diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..ef86260 --- /dev/null +++ b/.clang-format @@ -0,0 +1,74 @@ +--- +Language: Cpp +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BinPackParameters: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +ColumnLimit: 100 +CommentPragmas: '^ (IWYU pragma:|NOLINT)' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ForEachMacros: [] +IncludeCategories: + - Regex: '^<[Ww]indows\.h>$' + Priority: 1 + - Regex: '^<' + Priority: 2 + - Regex: '^"' + Priority: 3 +IndentCaseLabels: false +IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 4 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Left +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: c++17 +TabWidth: 4 +UseTab: Never +... diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..7058e79 --- /dev/null +++ b/.clangd @@ -0,0 +1,2 @@ +CompileFlags: + Add: [-std=c++20] \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5fd286 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +starlight_patch_100/** +build100/** +romfs stuff/** +.vscode/** +Crash Reports/** +.cache/** +Custom Stage Builds/** + +compile_commands.json diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9c8c846 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +# TODO (Khangaroo): Make this process a lot less hacky (no, export did not work) +# See MakefileNSO + +.PHONY: all clean starlight send + +SMOVER ?= 100 +BUILDVER ?= 99.37 +IP ?= 10.0.0.221 +DEBUGLOG ?= 0 # defaults to disable debug logger +SERVERIP ?= 0.0.0.0 # put debug logger server IP here + +PROJNAME ?= StarlightBase + +all: starlight + +starlight: + $(MAKE) all -f MakefileNSO SMOVER=$(SMOVER) BUILDVER=$(BUILDVER) DEBUGLOG=$(DEBUGLOG) SERVERIP=${SERVERIP} + $(MAKE) starlight_patch_$(SMOVER)/*.ips + + mkdir -p starlight_patch_$(SMOVER)/atmosphere/exefs_patches/$(PROJNAME)/ + mkdir -p starlight_patch_$(SMOVER)/atmosphere/contents/0100000000010000/exefs/ + + mv starlight_patch_$(SMOVER)/3CA12DFAAF9C82DA064D1698DF79CDA1.ips starlight_patch_$(SMOVER)/atmosphere/exefs_patches/$(PROJNAME)/3CA12DFAAF9C82DA064D1698DF79CDA1.ips + 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 + +starlight_patch_$(SMOVER)/*.ips: patches/*.slpatch patches/configs/$(SMOVER).config patches/maps/$(SMOVER)/*.map \ + build$(SMOVER)/$(shell basename $(CURDIR))$(SMOVER).map scripts/genPatch.py + @rm -f starlight_patch_$(SMOVER)/*.ips + python3 scripts/genPatch.py $(SMOVER) + +# builds project with the file structure used in the yuzu emulator +yuzu: + $(MAKE) all -f MakefileNSO SMOVER=$(SMOVER) BUILDVER=$(BUILDVER) + $(MAKE) starlight_patch_$(SMOVER)/*.ips + + mkdir -p starlight_patch_$(SMOVER)/yuzu/ + + mv starlight_patch_$(SMOVER)/3CA12DFAAF9C82DA064D1698DF79CDA1.ips starlight_patch_$(SMOVER)/yuzu/3CA12DFAAF9C82DA064D1698DF79CDA1.ips + mv $(shell basename $(CURDIR))$(SMOVER).elf starlight_patch_$(SMOVER)/subsdk1.elf + mv $(shell basename $(CURDIR))$(SMOVER).nso starlight_patch_$(SMOVER)/yuzu/subsdk1 +# builds and sends project to FTP server hosted on provided IP +send: all + python3.8 scripts/sendPatch.py $(IP) $(PROJNAME) + +log: all + python3.8 scripts/tcpServer.py $(SERVERIP) + +sendlog: all + python3.8 scripts/sendPatch.py $(IP) $(PROJNAME) $(USER) $(PASS) + python3.8 scripts/tcpServer.py $(SERVERIP) + +clean: + $(MAKE) clean -f MakefileNSO + @rm -fr starlight_patch_* \ No newline at end of file diff --git a/MakefileNSO b/MakefileNSO new file mode 100644 index 0000000..e37bcfe --- /dev/null +++ b/MakefileNSO @@ -0,0 +1,176 @@ +#--------------------------------------------------------------------------------- +# Starlight-specific +# SMOVER is the target version of Super Mario Odyssey, but without the decimal points +# This can be changed by compiling for a different version (e.g. make 100) +# (used for C defines, filenames, etc) +# (used for user-facing stuff) +# LINKERSCRIPTS is the directory where the function addresses for Super Mario Odyssey are +# stored +# Each script is stored as syms$(SMOVER).ld +# (used for mapping Super Mario Odyssey functions to the proper address) +#--------------------------------------------------------------------------------- + +LINKERSCRIPTS := linkerscripts + +#--------------------------------------------------------------------------------- +#.SUFFIXES: +#--------------------------------------------------------------------------------- + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") +endif + +TOPDIR ?= $(CURDIR) +include $(DEVKITPRO)/libnx/switch_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# DATA is a list of directories containing data files +# INCLUDES is a list of directories containing header files +#--------------------------------------------------------------------------------- +TARGET ?= $(notdir $(CURDIR))$(SMOVER) +BUILD ?= build$(SMOVER) +SOURCES := source/sead/time source/sead source/puppets source/server source/layouts source/states source/cameras source +DATA := data +INCLUDES := include include/sead + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec + +CFLAGS := -g -Wall -ffunction-sections \ + $(ARCH) $(DEFINES) + +CFLAGS += $(INCLUDE) -D__SWITCH__ -DSMOVER=$(SMOVER) -O3 -DNNSDK -DSWITCH -DBUILDVER=$(BUILDVER) -DDEBUGLOG=$(DEBUGLOG) -DSERVERIP=$(SERVERIP) + +CXXFLAGS := $(CFLAGS) -fno-rtti -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables -std=gnu++20 + +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 + +LIBS := -lnx + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(PORTLIBS) $(LIBNX) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) +export TOPDIR := $(CURDIR) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR ?= $(CURDIR)/$(BUILD) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) +#--------------------------------------------------------------------------------- + export LD := $(CC) +#--------------------------------------------------------------------------------- +else +#--------------------------------------------------------------------------------- + export LD := $(CXX) +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SRC) +export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) + +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +ifeq ($(strip $(ICON)),) + icons := $(wildcard *.jpg) + ifneq (,$(findstring $(TARGET).jpg,$(icons))) + export APP_ICON := $(TOPDIR)/$(TARGET).jpg + else + ifneq (,$(findstring icon.jpg,$(icons))) + export APP_ICON := $(TOPDIR)/icon.jpg + endif + endif +else + export APP_ICON := $(TOPDIR)/$(ICON) +endif + +ifeq ($(strip $(NO_ICON)),) + export NROFLAGS += --icon=$(APP_ICON) +endif + +ifeq ($(strip $(NO_NACP)),) + export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp +endif + +.PHONY: $(BUILD) clean all + +#--------------------------------------------------------------------------------- + +all: $(BUILD) + +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @cp $(LINKERSCRIPTS)/syms$(SMOVER).ld $(LINKERSCRIPTS)/symstemp.ld # This is required because you can't pass a variable to the .specs + $(MAKE) -C $(BUILD) -f $(CURDIR)/MakefileNSO + @rm -f $(LINKERSCRIPTS)/symstemp.ld + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr build* *.nso *.elf + + +#--------------------------------------------------------------------------------- +else +.PHONY: all + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +%.nso: %.elf + @elf2nso $< $@ + @echo built ... $(notdir $@) +#--------------------------------------------------------------------------------- +all : $(OUTPUT).nso + +$(OUTPUT).elf : $(OFILES) + + +$(OFILES_SRC) : $(HFILES_BIN) + +#--------------------------------------------------------------------------------- +# you need a rule like this for each extension you use as binary data +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------------- diff --git a/README.md b/README.md new file mode 100644 index 0000000..e332489 --- /dev/null +++ b/README.md @@ -0,0 +1,82 @@ +# Super Mario Odyssey - Online Multiplayer Mod + +Welcome to the official repository for the Super Mario Odyssey Online mod! Have fun exploring kingdoms with friends, playing gamemodes, or beating the game as fast as possible! This mod is still early in development, so expect bugs and un-refined aspects as we work hard to improve it and make the mod as polished as possible. + +## Features + +* Explore Kingdoms together with up to 10 People +* Almost every capture in the game is synced between players +* Full 2D and Costume models syncing +* Moon Collection is shared between all players +* Custom Configuration Menu (Accessible by holding ZL and selecting any option in the pause/start menu) +* Support for custom gamemodes (WIP) +### Available Gamemodes +* Hide and Seek + +## SMO Version Support + +* 1.0 + +## Installation Tutorial + +Before installing, Ensure that your switch is hacked. If not, follow [This Guide](https://switch.homebrew.guide/) to get your switch setup for modding. Make sure you set up a way to block Nintendo's servers as you will need to have your switch connected to the internet for this mod to work! + +1. Download the latest mod build from either [Gamebanana](https://gamebanana.com/games/6376) or from the [Releases](https://github.com/CraftyBoss/SuperMarioOdysseyOnline/releases) tab. (Alternatively, build from source) +2. Extract the downloaded zip onto the root of your Switch's SD card. +3. If you need to host an online server, head over to the [Super Mario Odyssey Online Server](https://github.com/Sanae6/SmoOnlineServer) repository and follow the instructions there to set up the server. +4. Launch the game! Upon first time bootup, the mod should ask for a server IP to save to the games common save file. This IP address will be the server you wish to connect to every time you launch the game with the mod installed. (Note: un-installing the mod and launching the game will remove the server IP from the common save file.) + +## Gamemode Info +### Hide and Seek +* Depending on Group size, select who will start as seekers at the beginning of each round and a kingdom to hide in. +* Each player has a timer on the top right of the screen that will increase while they are hiding during a round. +* When a seeker gets close enough to a player, the player will die and respawn as a seeker. +* During the round, hiders who die by other means will also become seekers upon respawning. +* If a hider loads into a new stage (via a pipe, door, etc.) the hider will get 5 seconds of tag invincibility to prevent spawn point camping. +* The player with the most time at the end of a round (or set of rounds) is considered the winner. +* While not a concrete rule, it's generally agreed upon that hiding should not be done out of bounds, inside objects that don't sync across games yet, and inside objects that completely conceal a player from others (such as trees). + +## Gamemode Controls +### Hide and Seek +- Left D-Pad: Decrease time +- Right D-Pad: Increase Time +- L + D-Pad Down: Reset Time +- D-Pad Up: Switch from Hider/Seeker + +## Building Prerequisites + +- [devkitPro](https://devkitpro.org/) +- Python 3 +- The [Keystone-Engine](https://www.keystone-engine.org/) Python Module + +## Building + +Build has only been tested on WSL2 running Ubuntu 20.04.1. + +Just run: +``` +DEVKITPRO={path_to_devkitpro} make +``` + +On Ubuntu (and other Debian-based systems), devkitPro will be installed to `/opt/devkitpro` by default: + +``` +DEVKITPRO=/opt/devkitpro/ make +``` + +## Installing (Atmosphère) + +After a successful build, simply transfer the `atmosphere` folder located inside `starlight_patch_100` to the root of your switch's SD card. + +--- + +# Contributors + +- [Sanae](https://github.com/sanae6) Wrote the majority of the server code +- [Shadow](https://github.com/shadowninja108) original author of starlight, the tool used to make this entire mod possible +- [GRAnimated](https://github.com/GRAnimated) + +# Credits +- [OdysseyDecomp](https://github.com/shibbo/OdysseyDecomp) +- [OdysseyReversed](https://github.com/shibbo/OdysseyReversed) +- [open-ead](https://github.com/open-ead/sead) sead Headers diff --git a/exported.txt b/exported.txt new file mode 100644 index 0000000..337b29e --- /dev/null +++ b/exported.txt @@ -0,0 +1,5 @@ +{ + global: + _Z14stageSceneHookv; + local: *; +}; diff --git a/include/Keyboard.hpp b/include/Keyboard.hpp new file mode 100644 index 0000000..003d339 --- /dev/null +++ b/include/Keyboard.hpp @@ -0,0 +1,49 @@ +#pragma once + +#include +#include "al/async/AsyncFunctorThread.h" +#include "al/async/FunctorV0M.hpp" + +#include "nn/swkbd/swkbd.h" + +#include "logger.hpp" +#include "sead/prim/seadSafeString.h" + +class Keyboard { + public: + Keyboard(ulong strSize); + void keyboardThread(); + + void openKeyboard(const char* initialText); + + const char* getResult() { + if (mThread->isDone()) { + return mResultString.cstr(); + } + return nullptr; + }; + + bool isThreadDone() { return mThread->isDone(); } + + void setHeaderText(const char16_t* text) { mHeaderText = text; } + void setSubText(const char16_t* text) { mSubText = text; } + + private: + + al::AsyncFunctorThread* mThread; + nn::swkbd::String mResultString; + + bool mIsDoneKeyboard; + + sead::FixedSafeString<0x10> mInitialText; + + const char16_t *mHeaderText = u"Enter Server IP Here!"; + const char16_t *mSubText = u"Must be a Valid Address."; + + char* mWorkBuf; + int mWorkBufSize; + char* mTextCheckBuf; + int mTextCheckSize; + char* mCustomizeDicBuf; + int mCustomizeDicSize; +}; \ No newline at end of file diff --git a/include/SocketBase.hpp b/include/SocketBase.hpp new file mode 100644 index 0000000..622b4c0 --- /dev/null +++ b/include/SocketBase.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include +#include +#include "types.h" +#include "nn.h" +#include "sead/basis/seadNew.h" + +class SocketBase { + + public: + SocketBase(const char *name); + + virtual nn::Result init(const char * ip, u16 port) = 0; + + const char *getStateChar(); + u8 getLogState(); + s32 getSocket(); + + void set_sock_flags(int flags); + + bool closeSocket(); + + void setName(const char *name) {strcpy(sockName, name);}; + + protected: + s32 socket_log(const char* str); + s32 socket_read_char(char *out); + + char sockName[0x10] = {}; + const char *sock_ip; + + u16 port; + u8 socket_log_state; + s32 socket_log_socket; + + int sock_flags; +}; + + + diff --git a/include/actors/PuppetActor.h b/include/actors/PuppetActor.h new file mode 100644 index 0000000..e6ed730 --- /dev/null +++ b/include/actors/PuppetActor.h @@ -0,0 +1,85 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "al/async/FunctorV0M.hpp" +#include "al/async/FunctorBase.h" +#include "al/util.hpp" +#include "al/string/StringTmp.h" +#include "al/layout/BalloonMessage.h" + +#include "game/Player/PlayerFunction.h" +#include "game/Player/PlayerJointControlPartsDynamics.h" +#include "game/Player/PlayerConst.h" +#include "game/Player/PlayerModelHolder.h" + +#include "actors/PuppetCapActor.h" +#include "actors/PuppetHackActor.h" +#include "layouts/NameTag.h" +#include "sead/math/seadVector.h" +#include "server/DeltaTime.hpp" + +#include "logger.hpp" +#include "puppets/PuppetInfo.h" +#include "puppets/HackModelHolder.hpp" +#include "helpers.hpp" +#include "algorithms/CaptureTypes.h" + +class PuppetActor : public al::LiveActor { + public: + PuppetActor(const char *name); + virtual void init(al::ActorInitInfo const &) override; + virtual void initAfterPlacement(void) override; + virtual void control(void) override; + virtual void movement(void) override; + virtual void makeActorAlive(void) override; + virtual void makeActorDead(void) override; + + void initOnline(PuppetInfo *pupInfo); + + void startAction(const char *actName); + void hairControl(); + + void setBlendWeight(int index, float weight) { al::setSklAnimBlendWeight(getCurrentModel(), weight, index); }; + + bool isNeedBlending(); + + bool isInCaptureList(const char *hackName); + + PuppetInfo* getInfo() { return mInfo; } + + const char *getPuppetName() { return mInfo->puppetName; } + + bool addCapture(PuppetHackActor *capture, const char *hackType); + + al::LiveActor* getCurrentModel(); + + int getMaxCaptures() {return mCaptures->getEntryCount(); }; + + void debugTeleportCaptures(const sead::Vector3f& pos); + + void debugTeleportCapture(const sead::Vector3f& pos, int index); + + bool mIsDebug = false; + + float mClosingSpeed = 0; + + NameTag *mNameTag = nullptr; // temp public + private: + void changeModel(const char* newModel); + + bool setCapture(const char* captureName); + + void syncPose(); + + PlayerCostumeInfo *mCostumeInfo = nullptr; + PuppetInfo *mInfo = nullptr; + PuppetCapActor *mPuppetCap = nullptr; + PlayerModelHolder *mModelHolder = nullptr; + HackModelHolder* mCaptures = nullptr; + + CaptureTypes::Type mCurCapture = CaptureTypes::Type::Unknown; + + bool mIs2DModel = false; + + bool mIsCaptureModel = false; +}; diff --git a/include/actors/PuppetCapActor.h b/include/actors/PuppetCapActor.h new file mode 100644 index 0000000..3e13e89 --- /dev/null +++ b/include/actors/PuppetCapActor.h @@ -0,0 +1,28 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "al/util.hpp" + +#include "game/Player/PlayerFunction.h" +#include "game/Player/HackCap/HackCapJointControlKeeper.h" + +#include "logger.hpp" +#include "puppets/PuppetInfo.h" +#include "helpers.hpp" + +class PuppetCapActor : public al::LiveActor { + public: + PuppetCapActor(const char *name); + virtual void init(al::ActorInitInfo const &) override; + virtual void initAfterPlacement() override; + virtual void control(void) override; + virtual void movement(void) override; + void initOnline(PuppetInfo *info); + + void startAction(const char *actName); + void update(); + + private: + HackCapJointControlKeeper *mJointKeeper; + PuppetInfo *mInfo; +}; diff --git a/include/actors/PuppetHackActor.h b/include/actors/PuppetHackActor.h new file mode 100644 index 0000000..6e32658 --- /dev/null +++ b/include/actors/PuppetHackActor.h @@ -0,0 +1,28 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "al/util.hpp" + +#include "logger.hpp" +#include "puppets/PuppetInfo.h" +#include "helpers.hpp" + +// TODO: Make this actor only created once per puppet, and use SubActorKeeper to create PartsModel actors for each capture + +class PuppetHackActor : public al::LiveActor { + public: + PuppetHackActor(const char *name); + virtual void init(al::ActorInitInfo const &) override; + virtual void initAfterPlacement() override; + virtual void control(void) override; + virtual void movement(void) override; + void initOnline(PuppetInfo *info, const char *hackType); + + void startAction(const char* actName); + + void startHackAnim(bool isOn); + + private: + PuppetInfo *mInfo; + sead::FixedSafeString<0x20> mHackType; +}; diff --git a/include/agl/DisplayList.h b/include/agl/DisplayList.h new file mode 100644 index 0000000..15b693c --- /dev/null +++ b/include/agl/DisplayList.h @@ -0,0 +1,52 @@ +/** + * @file DisplayList.h + * @brief Defines a display list for the GPU. + */ + +#pragma once + +#include "types.h" +#include "agl/gpu.h" +#include "sead/heap/seadHeap.h" + +namespace agl +{ + class DisplayList + { + public: + DisplayList(); + + virtual ~DisplayList(); + + void setControlMemeory(void *, s32); + void clear(); + void setBuffer(agl::GPUMemAddr, u64); + void setValidSize(u64 size); + void copyTo(agl::DisplayList *) const; + void beginDisplayList(); + void endDisplayList(); + bool beginDisplayListBuffer(agl::GPUMemAddr, u64, bool); + void endDisplayListBuffer(sead::Heap *); + void adjustValueSize(); + void invalidateCPUCache() const; + void dump() const; + bool suspend(void **); + void resume(void *, u64); + u64 calcRemainingSize(); + + u64 _8; + u64 _10; + u64 _18; + u32 mUsedSize; // _20 + u32 _24; + u32 mSize; // _28 + u32 _2C; + u64 _30; + u64 _38; + u8 _40[0x248-0x40]; // todo; what is here? + u32 _248; // init'd to 0x200 + u32 _24C; + u64 _250; + char* mDisplayName; // _258 + }; +}; \ No newline at end of file diff --git a/include/agl/DrawContext.h b/include/agl/DrawContext.h new file mode 100644 index 0000000..de47183 --- /dev/null +++ b/include/agl/DrawContext.h @@ -0,0 +1,41 @@ +/** + * @file DrawContext.h + * @brief Defines a draw context for textures in a GPU buffer. + */ + +#pragma once + +#include "types.h" +#include "DisplayList.h" + +#include +#include + +namespace agl +{ + class DrawContext : public sead::DrawContext + { + public: + DrawContext(); + virtual ~DrawContext(); + + void setCommandBuffer(agl::DisplayList *); + void flushCommandBuffer(); + void setBoundRenderBuffer(u64 *); + void barrierTexture(u32); + void barrierShader(u32); + bool isTextureDirty(u32, s32) const; + void setTextureDirty(s32); + void setCommandBufferTemporary(); + + agl::DisplayList* mDisplayList; // _F0 + u64* _F8; // agl::RenderBuffer* + u8 _100; + u8 _101; + u8 _102; + u8 _103; + u32 _104; + u32 _10C; + sead::CriticalSection mCriticalSection; // _110 + }; +}; \ No newline at end of file diff --git a/include/agl/RenderBuffer.h b/include/agl/RenderBuffer.h new file mode 100644 index 0000000..30c6759 --- /dev/null +++ b/include/agl/RenderBuffer.h @@ -0,0 +1,48 @@ +/** + * @file RenderBuffer.h + * @brief Defines classes that implement a render buffer. + */ + +#pragma once + +#include "RenderTargetColor.h" +#include "RenderTargetDepth.h" + +#include "sead/gfx/seadFrameBuffer.h" + +namespace agl +{ + class RenderBuffer : public sead::FrameBuffer + { + public: + RenderBuffer(); + RenderBuffer(sead::Vector2 const &, sead::BoundBox2 const &); + RenderBuffer(sead::Vector2 const &, f32, f32, f32, f32); + virtual ~RenderBuffer(); + + virtual void copyToDisplayBuffer(sead::DrawContext *, sead::DisplayBuffer const *); + virtual void clear(sead::DrawContext *, u32, sead::Color4f const &, f32, u32); + virtual void bindImpl_(sead::DrawContext *) const; + + void initialize_(); + void setRenderTargetColorNullAll(); + void adjustPhysicalAreaAndVirtualSizeFromColorTarget(u32); + void invalidateGPUCache(agl::DrawContext *) const; + void bind_(agl::DrawContext *, u16) const; + + u32 _8; + u32 C; + u64 _10; + u32 _18; + u32 _1C; + agl::RenderTargetColor* _20; + agl::RenderTargetColor* _28; + agl::RenderTargetColor* _30; + agl::RenderTargetColor* _38; + agl::RenderTargetColor* _40; + agl::RenderTargetColor* _48; + agl::RenderTargetColor* _50; + agl::RenderTargetColor* _58; + agl::RenderTargetDepth* _60; + }; +}; \ No newline at end of file diff --git a/include/agl/RenderTargetColor.h b/include/agl/RenderTargetColor.h new file mode 100644 index 0000000..37079c9 --- /dev/null +++ b/include/agl/RenderTargetColor.h @@ -0,0 +1,34 @@ +/** + * @file RenderTargetColor.h + * @brief Defines classes implement a rendering target color. + */ + +#pragma once + +#include "TextureData.h" + +namespace agl +{ + class RenderTargetColor : agl::TextureData + { + public: + RenderTargetColor(); + RenderTargetColor(agl::TextureData const &, u32, u32); + + void onApplyTextureData_(); + void initRegs_(u32) const; + + s32 _128; + u32 _12C; + u32 _130; + u32 _134; + u64 _138; + u64 _140; + u64 _148; + u64 _150; + u64 _158; + u64 _160; + u64 _168; + u64 _170; + }; +}; \ No newline at end of file diff --git a/include/agl/RenderTargetDepth.h b/include/agl/RenderTargetDepth.h new file mode 100644 index 0000000..427232e --- /dev/null +++ b/include/agl/RenderTargetDepth.h @@ -0,0 +1,29 @@ +/** + * @file RenderTargetDepth.h + * @brief Defines a class to represent a render target depth. + */ + +#pragma once + +#include "TextureData.h" + +namespace agl +{ + class RenderTargetDepth : public agl::TextureData + { + public: + RenderTargetDepth(); + RenderTargetDepth(agl::TextureData const &, u32, u32); + + void onApplyTextureData_(); + void initRegs_(u32) const; + + s32 _128; + u32 _12C; + u64 _130; + u64 _138; + u64 _140; + u64 _148; + u8 _150[0x178-0x150]; + }; +}; \ No newline at end of file diff --git a/include/agl/TextureData.h b/include/agl/TextureData.h new file mode 100644 index 0000000..9ee6358 --- /dev/null +++ b/include/agl/TextureData.h @@ -0,0 +1,63 @@ +/** + * @file TextureData.h + * @brief Defines a class that implements a texture compressor, and a texture data storage container. + */ + +#pragma once + +#include "detail/Surface.h" +#include "driver/NVNtexture.h" + +#include "sead/prim/seadSafeString.h" + +namespace agl +{ + class TextureData + { + public: + class CompressToWork + { + public: + CompressToWork(agl::TextureData const &); + + u64 _0; + u64 _8; + u64 _10; + u64 _18; + u32 _20; + u64 _28; + u64 _30; + u32 _38; + u64 _40; + agl::detail::Surface mSurface; // _48 + agl::driver::NVNtexture_ mTexture; // _70 + }; + + TextureData(); + + void setMipLevelNum_(s32, bool); + u16 getMinSlice_() const; + void getTextureFormatName() const; + u32 calcMipByteSize(u32) const; + bool isCompressedFormat() const; + bool isRenderTargetCompressAvailable() const; + bool isDepthFormat() const; + bool hasStencil() const; + void invalidateCPUCache(); + void flushCPUCache() const; + void setDebugLabel(sead::SafeStringBase const &); + void getDebugLabel() const; + + u64 _0; + u32 _8; + u32 C; + u64 _10; + u64 _18; + u64 _20; + u64 _28; + agl::detail::Surface mSurface; // _30 + agl::TextureFormat mTextureFormat; // _54 + u8 _58[0x120-0x58]; + char* _120; // "agl::TextureData string" + }; +}; \ No newline at end of file diff --git a/include/agl/detail/FileIOMgr.h b/include/agl/detail/FileIOMgr.h new file mode 100644 index 0000000..9bbc6de --- /dev/null +++ b/include/agl/detail/FileIOMgr.h @@ -0,0 +1,77 @@ +/** + * @file FileIOMgr.h + * @brief Defines classes that handle shader management I/O. + */ + +#pragma once + +#include "sead/heap.h" +#include "sead/hostio.h" +#include "sead/string.h" +#include "sead/xml.h" + +namespace agl +{ + namespace detail + { + class FileIOMgr : public sead::hostio::Node + { + public: + + class SingletonDisposer + { + public: + ~SingletonDisposer(); + }; + + class CreateArg + { + public: + CreateArg(); + + u32 mArg; // _0 + }; + + class DialogArg + { + public: + DialogArg(); + + u64* _0; + u64* _8; + u64 _10; + u64 _18; + u64 _20; + char* mMsg; // _28 + u64* _30; + u64* _38; + u64 _40; + u32 _48; // set to 0x20 + u8 _4C; + u8 _4D; + u8 _4E; + u8 _4F; + u32 _50; + }; + + FileIOMgr(); + + void initialize(agl::detail::FileIOMgr::CreateArg const &, sead::Heap *); + void setCheckoutCommandPath(sead::SafeStringBase const &); + void save(sead::XmlDocument const &, agl::detail::FileIOMgr::DialogArg const &, u32); + void showDialog(sead::hostio::FileInfo *, sead::SafeStringBase const &, sead::SafeStringBase const &, sead::SafeStringBase const &, sead::SafeStringBase const &) const; + void checkout_(sead::SafeStringBase const &) const; + void showErrorDialog_(sead::SafeStringBase const &) const; + void save(void const*, u32, agl::detail::FileIOMgr::DialogArg const &); + s32 load(agl::detail::FileIOMgr::DialogArg const &); + void close(s32); + void genMessage(sead::hostio::Context *); + void listenPropertyEvent(sead::hostio::PropertyEvent const *); + + static agl::detail::FileIOMgr* createInstance(sead::Heap *); + static void deleteInstance(); + + u64* _28; // sead::NinHostIOFileDevice * + }; + }; +}; \ No newline at end of file diff --git a/include/agl/detail/MemoryPool.h b/include/agl/detail/MemoryPool.h new file mode 100644 index 0000000..223994f --- /dev/null +++ b/include/agl/detail/MemoryPool.h @@ -0,0 +1,39 @@ +/** + * @file MemoryPool.h + * @brief Defines classes for memory pools for storage. + */ + +#pragma once + +#include "types.h" + +namespace agl +{ + typedef s32 MemoryAttribute; + + namespace detail + { + class MemoryPoolType + { + public: + static s32 convert(agl::MemoryAttribute); + + static u32 cInvalidPoolType; // 0 + static u32 cValidPoolType; // 0x80000000 + }; + + class MemoryPool + { + public: + MemoryPool(); + + void initialize(void *, u64, agl::detail::MemoryPoolType const &); + void initialize(void *, u64, agl::detail::MemoryPoolType const &, agl::detail::MemoryPool const &, s32); + + void finalize(); + + u8 _0[0x104]; // todo: where do the parent 0x100 bytes come from? + + }; + }; +}; \ No newline at end of file diff --git a/include/agl/detail/MemoryPoolHeap.h b/include/agl/detail/MemoryPoolHeap.h new file mode 100644 index 0000000..a5c6a3d --- /dev/null +++ b/include/agl/detail/MemoryPoolHeap.h @@ -0,0 +1,36 @@ +/** + * @file MemoryPoolHeap.h + * @brief Defines classes that manage heaps for memory pools. + */ + +#pragma once + +#include "types.h" +#include "MemoryPool.h" + +namespace agl +{ + class GPUMemBlockBase; + + namespace detail + { + class GPUMemBlockMgrHeapEx; + + class MemoryPoolHeap + { + public: + MemoryPoolHeap(void *, u64, u64, agl::detail::MemoryPoolType const &, void *, u64, agl::detail::GPUMemBlockMgrHeapEx *); + ~MemoryPoolHeap(); + + static agl::detail::MemoryPoolHeap* create(u64, s32, u64, s32, u64, u64, agl::detail::MemoryPoolType const &, agl::detail::GPUMemBlockMgrHeapEx *); + static void destroy(agl::detail::MemoryPoolHeap *); + + void pushBack(agl::GPUMemBlockBase *); + u64* allocFromMemoryPool(u64, s32); + void freeToHeap(agl::GPUMemBlockBase *); + bool isAllocatable(agl::detail::MemoryPoolType const &, u64, s32) const; + + agl::GPUMemBlockBase* _120; + }; + }; +}; \ No newline at end of file diff --git a/include/agl/detail/ShaderHolder.h b/include/agl/detail/ShaderHolder.h new file mode 100644 index 0000000..cbb260a --- /dev/null +++ b/include/agl/detail/ShaderHolder.h @@ -0,0 +1,32 @@ +/** + * @file ShaderHolder.h + * @brief Defines classes for shader storage. + */ + +#pragma once + +#include "sead/heap.h" + +namespace agl +{ + namespace detail + { + class ShaderHolder + { + public: + + class SingletonDisposer_ + { + public: + virtual ~SingletonDisposer_(); + + static SingletonDisposer_ sStaticDisposer; + }; + + ShaderHolder(); + + static agl::detail::ShaderHolder* createInstance(sead::Heap *); + static void deleteInstance(); + }; + }; +}; \ No newline at end of file diff --git a/include/agl/detail/Surface.h b/include/agl/detail/Surface.h new file mode 100644 index 0000000..f75c906 --- /dev/null +++ b/include/agl/detail/Surface.h @@ -0,0 +1,56 @@ +/** + * @file Surface.h + * @brief Defines classes to setup NVN textures on a surface. + */ + +#pragma once + +#include "types.h" +#include "agl/util.h" + +class NVNtextureBuilder; +class NVNtexture; + +namespace agl +{ + namespace detail + { + struct SurfaceBase; + + class Surface + { + public: + Surface(); + void initialize(agl::TextureType, agl::TextureFormat, u32, agl::TextureAttribute, agl::MultiSampleType); + void initializeSize(u32, u32, u32); + void copyFrom(agl::detail::SurfaceBase const &); + void calcSizeAndAlignment(); + void setupNVNtextureBuilder(NVNtextureBuilder *) const; + void printInfo() const; + void copyFrom(NVNtexture const &); + + u16 _0; + u16 _2; + u16 _4; + u16 _6; + u8 _8; + u8 _9; + u16 _A; + u8 C[0x1A-0xC]; + u8 _1A; + u8 _1B; + u32 _1C; + u8 _20; + u8 _21; + u8 _22; + u8 _23; + }; + + struct SurfaceBase + { + u64 _0; + u64 _8; + u64 _10; + }; + }; +}; \ No newline at end of file diff --git a/include/agl/driver/NVNimage.h b/include/agl/driver/NVNimage.h new file mode 100644 index 0000000..fe11da4 --- /dev/null +++ b/include/agl/driver/NVNimage.h @@ -0,0 +1,26 @@ +/** + * @file NVNimage.h + * @brief Defines a class for representing a NVN image. + */ + +#pragma once + +#include "types.h" + +namespace agl +{ + namespace driver + { + class NVNimage_ + { + public: + NVNimage_(); + NVNimage_(agl::driver::NVNimage_ const &); + ~NVNimage_(); + + void updateImageId(s32 id); + + u64 mImageId; // _0 + }; + }; +}; \ No newline at end of file diff --git a/include/agl/driver/NVNsampler.h b/include/agl/driver/NVNsampler.h new file mode 100644 index 0000000..815dd2d --- /dev/null +++ b/include/agl/driver/NVNsampler.h @@ -0,0 +1,31 @@ +/** + * @file NVNsampler.h + * @brief Defines a sampler for NVN images. + */ + +#pragma once + +#include "types.h" + +class NVNsampler; + +namespace agl +{ + namespace driver + { + class NVNsampler_ + { + public: + NVNsampler_(); + NVNsampler_(agl::driver::NVNsampler_ const &); + ~NVNsampler_(); + + void releaseSampler(); + bool registerSampler(NVNsampler const &, char const *); + void updateTextureId(s32); + + u64 _0; + s16 _8; + }; + }; +}; \ No newline at end of file diff --git a/include/agl/driver/NVNtexture.h b/include/agl/driver/NVNtexture.h new file mode 100644 index 0000000..3478f5b --- /dev/null +++ b/include/agl/driver/NVNtexture.h @@ -0,0 +1,39 @@ +/** + * @file device.h + * @brief Defines a class to represent a NVN texture. + */ + +#pragma once + +#include "types.h" + +class NVNtextureView; +class NVNtexture; + +namespace agl +{ + namespace driver + { + class NVNtexture_ + { + public: + NVNtexture_(); + NVNtexture_(agl::driver::NVNtexture_ const &); + ~NVNtexture_(); + + void releaseTexture(); + void updateTexId_(s32 newID); + //agl::driver:NVNtexture_ operator=(agl::driver::NVNtexture_ const &); + bool registerTexture(NVNtexture const *, NVNtextureView const *, char const *, bool); + + void setReference_() const; + + u8 _0[0xC0]; // NVNtexture + s32 mTextureID; // _C0 + u8 _C4; + u8 _C5; + u8 _C6; + u8 _C7; + }; + }; +}; \ No newline at end of file diff --git a/include/agl/g3d.h b/include/agl/g3d.h new file mode 100644 index 0000000..dab120a --- /dev/null +++ b/include/agl/g3d.h @@ -0,0 +1,3 @@ +#pragma once + +#include \ No newline at end of file diff --git a/include/agl/g3d/g3d_ResFile.h b/include/agl/g3d/g3d_ResFile.h new file mode 100644 index 0000000..7e94ac1 --- /dev/null +++ b/include/agl/g3d/g3d_ResFile.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +namespace agl +{ + namespace g3d + { + class ResFile + { + public: + static void BindTexture(nn::g3d::ResFile *, nn::g3d::ResFile *); + static void Cleanup(nn::g3d::ResFile *); + }; + }; +}; \ No newline at end of file diff --git a/include/agl/gpu.h b/include/agl/gpu.h new file mode 100644 index 0000000..884e3b2 --- /dev/null +++ b/include/agl/gpu.h @@ -0,0 +1,93 @@ +/** + * @file gpu.h + * @brief Defines classes that use the GPU, such as memory blocks, and address blocks. + */ + +#pragma once + +#include "types.h" +#include "agl/detail/MemoryPool.h" +#include "agl/detail/MemoryPoolHeap.h" +#include "nn/gfx/api.h" +#include "nn/gfx/memory.h" +#include "sead/heap/seadHeap.h" + +namespace agl +{ + typedef u64 GPUMemVoidAddr; + + class GPUMemBlockBase + { + public: + GPUMemBlockBase(); + + virtual ~GPUMemBlockBase(); + + void clear(); + void freeBuffer(); + void free(); + void allocBuffer_(u64, sead::Heap *, s32, agl::MemoryAttribute); + bool tryAllocBuffer_(u64, sead::Heap *, s32, agl::MemoryAttribute); + void setBuffer_(u64, void *, void *, agl::MemoryAttribute); + void setVirtual_(u64, sead::Heap *, agl::MemoryAttribute, agl::GPUMemVoidAddr, s32); + void initializeGfxMemoryPool(nn::gfx::TMemoryPool, nn::gfx::ApiVersion<8>>> *) const; + void addList(agl::GPUMemBlockBase*); + void setMemoryPool(void *, u64, agl::detail::MemoryPool *); + void setMemoryPoolHeap(void *, u64, agl::detail::MemoryPoolHeap *); + u64 getByteOffset() const; + u64 getMemoryPoolType() const; + + void* mMemBlockBuffer; // _8 + u64 mMemBlockBufferSize; // _10 + agl::detail::MemoryPool* mMemoryPool; // _18 + agl::detail::MemoryPoolHeap* mMemoryPoolHeap; // _20 + u8 _28; // this is some sort of bitflag + u8 _29; + u8 _2A; + u8 _2B; + u32 _2C; + u64 _30; + }; + + class GPUMemAddrBase + { + public: + GPUMemAddrBase(agl::GPUMemBlockBase const &, u64); + + u32 verify_() const; + void deleteGPUMemBlock() const; + void invalidate(); + u32 getAlignmentAddress() const; + void setByteOffsetByPtr(void *); + void roundUp(s32); + void flushCPUCache(u64); + void invalidateCPUCache(u64); + + agl::detail::MemoryPool* mMemoryPool; // _0 + u32 mAlignmentAddr; // _8 + u32 GPUMemAddrBase_C; // most likely padding bytes + agl::GPUMemBlockBase* mMemoryBlock; // _10 + }; + + template + class GPUMemBlock : public agl::GPUMemBlockBase + { + public: + virtual ~GPUMemBlock(); + }; + + template + class GPUMemBlockT : public agl::GPUMemBlockBase + { + public: + virtual ~GPUMemBlockT(); + }; + + template + class GPUMemAddr + { + public: + u64* mPtr; // _0 + u64 _8; + }; +}; \ No newline at end of file diff --git a/include/agl/shader/Shader.h b/include/agl/shader/Shader.h new file mode 100644 index 0000000..5ee6079 --- /dev/null +++ b/include/agl/shader/Shader.h @@ -0,0 +1,69 @@ +/** + * @file Shader.h + * @brief Defines a basic shader. + */ + +#pragma once + +#include "types.h" + +namespace agl +{ + enum ShaderType + { + ShaderType_Vertex = 0, + ShaderType_Fragment = 1, + ShaderType_Geometry = 2, + ShaderType_Compute = 3 + }; + + class Shader + { + public: + Shader(); + + virtual ~Shader(); + + virtual s32 getShaderType() const = 0; + virtual s32 getShaderMode() const; + virtual s32 getRingItemSize() const; + + void setBinary(void const *shaderBinary); + + void* mShaderBinary; // _8 + u64 _10; + u64 _18; + }; + + class VertexShader : public agl::Shader + { + public: + virtual ~VertexShader(); + + virtual s32 getShaderType() const; + }; + + class FragmentShader : public agl::Shader + { + public: + virtual ~FragmentShader(); + + virtual s32 getShaderType() const; + }; + + class GeometryShader : public agl::Shader + { + public: + virtual ~GeometryShader(); + + virtual s32 getShaderType() const; + }; + + class ComputeShader : public agl::Shader + { + public: + virtual ~ComputeShader(); + + virtual s32 getShaderType() const; + }; +}; \ No newline at end of file diff --git a/include/agl/shader/ShaderCompileInfo.h b/include/agl/shader/ShaderCompileInfo.h new file mode 100644 index 0000000..eb4ce8b --- /dev/null +++ b/include/agl/shader/ShaderCompileInfo.h @@ -0,0 +1,42 @@ +/** + * @file ShaderCompileInfo.h + * @brief Defines file devices and extensions. + */ + +#pragma once + +#include "sead/heap.h" +#include "sead/hostio.h" +#include "sead/array.h" +#include "Shader.h" +#include "types.h" + +namespace agl +{ + class ShaderCompileInfo : public sead::hostio::Node + { + // this value is used as an index to a table of version lists + // on 1.2.0, located at 0x7101E80B30 + typedef s32 Target; + + ShaderCompileInfo(); + + virtual ~ShaderCompileInfo(); + + void destroy(); + void create(s32, s32 bufferSize, sead::Heap *); + void clearVariation(); + void pushBackVariation(char const *, char const *); + void calcCompileSource(agl::ShaderType, sead::BufferedSafeStringBase *, agl::ShaderCompileInfo::Target, bool); + sead::SafeStringBase* getRegitserUniformBlockName(); // "RegisterUBO" + + u64 _8; + char* mName; // _10 + u64 _18; + u64 _20; + sead::PtrArrayImpl _28; + sead::PtrArrayImpl _38; + sead::PtrArrayImpl _48; + sead::PtrArrayImpl _58; + }; +}; \ No newline at end of file diff --git a/include/agl/shader/ShaderProgram.h b/include/agl/shader/ShaderProgram.h new file mode 100644 index 0000000..518db92 --- /dev/null +++ b/include/agl/shader/ShaderProgram.h @@ -0,0 +1,67 @@ +/** + * @file ShaderProgram.h + * @brief Defines a general shader program to compile raw shaders with macros. + */ + +#pragma once + +#include "agl/DisplayList.h" +#include "sead/heap.h" +#include "sead/string.h" +#include "Shader.h" + +namespace agl +{ + class ShaderProgram + { + public: + + class VariationBuffer + { + public: + void initialize(s32, sead::Heap *); + void createMacro(s32, sead::SafeStringBase const &, sead::SafeStringBase const &, s32, sead::Heap *); + void setMacroValue(s32, s32, sead::SafeStringBase const &); + void create(sead::Heap *); + }; + + ShaderProgram(); + + virtual ~ShaderProgram(); + + void cleanUp(); + void destroyLocationBuffers(); + void initializeVariation(sead::SafeStringBase const &, s32, sead::Heap *); + void createVariationMacro(s32, sead::SafeStringBase const &, sead::SafeStringBase const &, s32, sead::Heap *); + void setVariationMacroValue(s32, s32, sead::SafeStringBase const &); + void createVariation(sead::Heap *); + + u64* _8; + agl::DisplayList mShaderDisplayList; // _10 + u32 _278; + u32 _27C; + u64 _280; + u32 _288; + u32 _28C; + u64 _290; + u32 _298; + u32 _29C; + u64 _2A0; + u32 _2A8; + u32 _2AC; + u64 _2B0; + u32 _2B8; + u32 _2BC; + u64 _2C0; + u32 _2C8; + u32 _2CC; + u64 _2D0; + agl::VertexShader mVertexShader; // _2D8 + agl::FragmentShader mFragmentShader; // _2F8 + agl::GeometryShader mGeometryShader; // _318 + agl::ComputeShader mComputeShader; // _338 + u8 _358[0x418-0x358]; // todo; what is here? + u64 _418; + u32 _420; + }; +}; \ No newline at end of file diff --git a/include/agl/shader/ShaderProgramArchive.h b/include/agl/shader/ShaderProgramArchive.h new file mode 100644 index 0000000..6ddc40c --- /dev/null +++ b/include/agl/shader/ShaderProgramArchive.h @@ -0,0 +1,38 @@ +/** + * @file ShaderProgramArchive.h + * @brief Defines a class wrapper for SHARCB (Shader Binary) archives. + */ + +#pragma once + +#include "sead/disposer.h" +#include "sead/heap.h" +#include "sead/hostio.h" + +namespace agl +{ + class ResBinaryShaderArchive; + class ResShaderArchive; + class ResShaderProgram; + class ResShaderSource; + + class ShaderProgramArchive : public sead::IDisposer, public sead::hostio::Node + { + public: + ShaderProgramArchive(); + + virtual ~ShaderProgramArchive(); + + void destroy(); + void createWithOption(agl::ResBinaryShaderArchive, agl::ResShaderArchive, u32, sead::Heap *); + void destroyResFile_(); + void initialize(agl::ShaderProgramArchive *, s32, agl::ResShaderProgram, sead::Heap *); + void updateCompileInfo(); + void setUp(); + void setUp_(bool); + + u64 _20; + agl::ResBinaryShaderArchive* mBinaryShaderArchive; // _28 + agl::ResShaderArchive* mResShaderArchive; // _30 + }; +}; \ No newline at end of file diff --git a/include/agl/shtxt/Clause.h b/include/agl/shtxt/Clause.h new file mode 100644 index 0000000..40bcf42 --- /dev/null +++ b/include/agl/shtxt/Clause.h @@ -0,0 +1,56 @@ +/** + * @file Clause.h + * @brief Defines a clause for shader processing. + */ + +#pragma once + +#include "sead/string.h" +#include "types.h" + +namespace agl +{ + namespace shtxt + { + class Clause + { + public: + class TableChecker + { + public: + TableChecker(); + }; + + typedef u8 Type; + + Clause(); + Clause(agl::shtxt::Clause::Type, char const *, char const *); + ~Clause(); + + u64 findNumberBlock(agl::shtxt::Clause::Type *, char const *); + void appendTo(sead::BufferedSafeStringBase *) const; + void appendTo(sead::BufferedSafeStringBase *, u32) const; + void copyTo(sead::BufferedSafeStringBase *) const; + f64 toNumber() const; + f64 forceNumber() const; + u32 calcLineFeedCount() const; + bool compareImpl(agl::shtxt::Clause const &, u32, agl::shtxt::Clause const *, agl::shtxt::Clause const *) const; + bool compare(sead::SafeStringBase const &, u32) const; + bool compare(agl::shtxt::Clause const &, u32) const; + s32 calcHash(void const *, u32, u32) const; + + agl::shtxt::Clause* _0; + agl::shtxt::Clause* _8; + u8 mClauseType; // _10 + u8 _11; + u8 _12; + u8 _13; + u32 _14; + char* _18; + char* _20; + + static bool cTableChecked; + static u32* cHashTable; + }; + }; +}; \ No newline at end of file diff --git a/include/agl/shtxt/DefineLinker.h b/include/agl/shtxt/DefineLinker.h new file mode 100644 index 0000000..7645d99 --- /dev/null +++ b/include/agl/shtxt/DefineLinker.h @@ -0,0 +1,45 @@ +/** + * @file DefineLinker.h + * @brief Defines a linker for shader source compilation. + */ + +#pragma once + +#include "sead/heap.h" +#include "types.h" + +namespace agl +{ + namespace shtxt + { + class Clause; + + class DefineLinker + { + public: + DefineLinker(); + ~DefineLinker(); + + void clear(); + bool set(sead::Heap *, agl::shtxt::Clause const *, agl::shtxt::Clause const *); + bool setImpl(sead::Heap *, agl::shtxt::Clause const *, agl::shtxt::Clause const *, bool); + void setDirect(agl::shtxt::Clause *, u32, bool); + void updateHash(); + void replace(sead::Heap *, agl::shtxt::Clause const *, agl::shtxt::Clause const *, bool); + agl::shtxt::DefineLinker* clone(sead::Heap *, sead::Heap *) const; + agl::shtxt::DefineLinker* cloneAll(sead::Heap *, sead::Heap *) const; + + agl::shtxt::DefineLinker* _0; // seems to copy itself twice + agl::shtxt::DefineLinker* _8; + agl::shtxt::Clause* _10; + agl::shtxt::Clause* _18; // hash clause? + u64 _20; + agl::shtxt::Clause* _28; + u64 _30; + u64 _38; + s32 mHash; // _40 + s16 _44; // -1 + u16 _46; // 0x101 + }; + }; +}; \ No newline at end of file diff --git a/include/agl/shtxt/ExpressionEvaluator.h b/include/agl/shtxt/ExpressionEvaluator.h new file mode 100644 index 0000000..e92d5a1 --- /dev/null +++ b/include/agl/shtxt/ExpressionEvaluator.h @@ -0,0 +1,53 @@ +/** + * @file ExpressionEvaluator.h + * @brief Defines an evaluator for shader expressions. + */ + +#pragma once + +#include "sead/array.h" +#include "sead/delegate.h" +#include "sead/heap.h" + +namespace agl +{ + namespace shtxt + { + class Clause; + class SyntaxLeash; + + class ExpressionEvaluator + { + public: + ExpressionEvaluator(); + ExpressionEvaluator(sead::Heap *, sead::Heap *, sead::AnyDelegate1Const const *); + + void initialize(sead::Heap *, sead::Heap *, sead::AnyDelegate1Const const *); + u64 findSyntaxLeash(sead::ObjArray *, agl::shtxt::Clause const *) const; + u64* createBinaryOperatorSyntaxTree(sead::ObjArray *, agl::shtxt::Clause *); + u64* createTernaryOperatorSyntaxTree(sead::ObjArray *, agl::shtxt::Clause *); + u64* createTokenOperatorSyntaxTree(sead::ObjArray *, agl::shtxt::Clause *); + void resolveOperatorTokenConnect(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorUnary(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorMathHigh(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorMathLow(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorShift(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorCompareHigh(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorCompareLow(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorBitOpAnd(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorBitOpXor(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorBitOpOr(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorLogicalAnd(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorLogicalOr(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorTernary(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperatorAssignment(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveOperator(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolveParenthesis(sead::ObjArray *, agl::shtxt::Clause *, agl::shtxt::Clause *); + void resolve(agl::shtxt::Clause *, agl::shtxt::Clause *, bool); + + sead::Heap* _0; + sead::Heap* _8; + sead::AnyDelegate1Const* _10; + }; + }; +}; \ No newline at end of file diff --git a/include/agl/shtxt/Lexer.h b/include/agl/shtxt/Lexer.h new file mode 100644 index 0000000..5225409 --- /dev/null +++ b/include/agl/shtxt/Lexer.h @@ -0,0 +1,36 @@ +/** + * @file Lexer.h + * @brief Defines a lexer for parsing shader clauses. + */ + +#pragma once + +#include "sead/heap.h" + +namespace agl +{ + namespace shtxt + { + class Clause; + + class Lexer + { + public: + Lexer(); + ~Lexer(); + + void initialize(sead::Heap *, char const *, agl::shtxt::Clause *); + void setupCurrentRange(u64 range); + u32 findNumberBlock() const; + agl::shtxt::Clause* createClause(u32) const; + bool execute(bool); + + sead::Heap* _0; + agl::shtxt::Clause* _8; + char* mRefName; // _10 + u64 _18; + u64 _20; + u64 _28; + }; + }; +}; \ No newline at end of file diff --git a/include/agl/shtxt/Preprocessor.h b/include/agl/shtxt/Preprocessor.h new file mode 100644 index 0000000..3c8ca56 --- /dev/null +++ b/include/agl/shtxt/Preprocessor.h @@ -0,0 +1,63 @@ +/** + * @file Preprocessor.h + * @brief Defines a preprocessor for a collection of clauses and macros in a shader program. + */ + +#pragma once + +#include "sead/heap.h" +#include "sead/string.h" + +namespace agl +{ + namespace shtxt + { + class Clause; + class DefineLinker; + class MacroDeployInfo; + class MacroReplaceInfo; + + class Preprocessor + { + public: + Preprocessor(sead::Heap *, sead::Heap *); + ~Preprocessor(); + + void finalize(); + void initialize(char const *); + void removeClause(agl::shtxt::Clause *) const; + void removeClause(agl::shtxt::Clause *, agl::shtxt::Clause *, bool) const; + void removeClauseAll(); + void removeDefineLinkerAll(); + void setReplacedMacro(char const **, char const **, u32); + void setDeployMacro(char const**, u32); + void appendMacro(agl::shtxt::DefineLinker const *); + bool preprocess(u32, u64, u64); + void removeComment(); + void forceLF(); + void reduceSpace(); + void reduceLF(); + void format(bool); + bool construct(sead::BufferedSafeStringBase *dest) const; + u64 calcConstructLength() const; + + + u64 _0; + u64 _8; // some sort of size + u64 _10; + sead::ExpHeap* _18; + u64 _20; + agl::shtxt::Clause* _28; + agl::shtxt::DefineLinker* _30; + char* mRefName; // _38 + agl::shtxt::MacroReplaceInfo* _40; + u32 _48; // related to replace info + u32 _4C; + agl::shtxt::MacroDeployInfo* _50; + u32 _58; // related to deploy info + u32 _5C; + agl::shtxt::DefineLinker* _60; + u64 _68; + }; + }; +}; \ No newline at end of file diff --git a/include/agl/shtxt/SyntaxTree.h b/include/agl/shtxt/SyntaxTree.h new file mode 100644 index 0000000..16c076b --- /dev/null +++ b/include/agl/shtxt/SyntaxTree.h @@ -0,0 +1,39 @@ +/** + * @file SyntaxTree.h + * @brief Defines a syntax tree for shader compilation. + */ + +#pragma once + +#include "sead/delegate.h" +#include "types.h" + +namespace agl +{ + namespace shtxt + { + class Clause; + + class SyntaxTree + { + public: + SyntaxTree(agl::shtxt::Clause *); + ~SyntaxTree(); + + void removeClauseRecursive(sead::AnyDelegate1Const const *); + f64 checkAndGetValue(); + void checkAndEvaluate(agl::shtxt::SyntaxTree const *) const; + f64 evaluate(); + void constructRecursive(sead::Heap *,sead::Heap *); + u64* construct(sead::Heap *, sead::Heap *) const; + + agl::shtxt::SyntaxTree* _0; + agl::shtxt::SyntaxTree* _8; + agl::shtxt::SyntaxTree* _10; + u64 _18; + agl::shtxt::Clause* _20; + u64 _28; + u32 _30; + }; + }; +}; \ No newline at end of file diff --git a/include/agl/util.h b/include/agl/util.h new file mode 100644 index 0000000..fdc58b3 --- /dev/null +++ b/include/agl/util.h @@ -0,0 +1,109 @@ +/** + * @file util.h + * @brief Defines enumerators for texture types and formats. + */ + +#pragma once + +namespace agl +{ + enum TextureType + { + TYPELESS = 0, + UNORM = 1, + SNORM = 2, + UFLOAT = 3, + FLOAT = 4, + SINT = 5, + UINT = 6, + SRGB = 7, + }; + enum TextureFormat + { + INVALID, + R32_G32_B32_A32, + R32_G32_B32, + R16_G16_B16_A16, + R5_G5_B5_A1, + R32_G32, + R32_G8_X24, + D32_S8_X24, + R32_X8_X24, + X32_G8_X24, + R10_G10_B10_A2, + R11_G11_B10, + R8_G8_B8_A8, + R9_G9B9E5_SHAREDEXP, + R8_G8_B8_G8, + R8_G8_B8_X8, + R4_G4_B4_A4, + R16_G16, + R32, + D32, + R24_G8, + D24_S8, + R24_X8, + X24_G8, + R8G8, + R4_G4, + R16, + G8_R8_G8_B8, + D16, + D24, + D24S8, + D32S8, + R8, + A8, + R1, + B5_G6_R5, + A1_B5_G5_R5, + BC1, + BC2, + BC3, + BC4, + BC5, + BC6, + BC7, + AYUV, + Y410, + Y416, + NV12, + P010, + P016, + YUY2, + Y210, + Y216, + NV11, + AI44, + IA44, + P8, + A8P8, + P208, + V208, + V408, + ASTC4x4, + ASTC5x4, + ASTC5x5, + ASTC6x5, + ASTC6x6, + ASTC8x5, + ASTC8x6, + ASTC8x8, + ASTC10x5, + ASTC10x6, + ASTC10x8, + ASTC10x10, + ASTC12x10, + ASTC12x12 + }; + + enum TextureAttribute + { + + }; + + enum MultiSampleType + { + + }; +}; \ No newline at end of file diff --git a/include/agl/utl.h b/include/agl/utl.h new file mode 100644 index 0000000..8400d18 --- /dev/null +++ b/include/agl/utl.h @@ -0,0 +1,23 @@ +/** + * @file GameDataFile.h + * @brief Utilitis for agl namespace. + */ + +#pragma once + +#include "../types.h" +#include "DrawContext.h" +#include "sead/math/seadVector.h" +#include "sead/math/seadMatrix.h" +#include "sead/gfx/seadColor.h" + +namespace agl { + namespace utl { + class DevTools{ + public: + void static beginDrawImm(agl::DrawContext *,sead::Matrix34 const&,sead::Matrix44 const&); + void static drawTriangleImm(agl::DrawContext*, sead::Vector3 const&, sead::Vector3 const&, sead::Vector3 const&, sead::Color4f const&); + void static drawLineImm(agl::DrawContext*, sead::Vector3 const&, sead::Vector3 const&, sead::Color4f const&, float); + }; + }; +}; \ No newline at end of file diff --git a/include/al/HtmlViewer.h b/include/al/HtmlViewer.h new file mode 100644 index 0000000..5ea00ee --- /dev/null +++ b/include/al/HtmlViewer.h @@ -0,0 +1,12 @@ +#pragma once + +#include "sead/prim/seadSafeString.hpp" + +namespace al +{ + class HtmlViewer + { + public: + void call(const char *, sead::BufferedSafeStringBase *) const; + }; +}; \ No newline at end of file diff --git a/include/al/LiveActor/LiveActor.h b/include/al/LiveActor/LiveActor.h new file mode 100644 index 0000000..b27b0ca --- /dev/null +++ b/include/al/LiveActor/LiveActor.h @@ -0,0 +1,124 @@ +#pragma once + +#include "al/actor/ActorInitInfo.h" +#include "al/actor/ActorSceneInfo.h" +#include "al/actor/ActorActionKeeper.h" +#include "al/area/AreaObjDirector.h" +#include "al/audio/AudioKeeper.h" +#include "al/camera/CameraDirector.h" +#include "al/collision/CollisionDirector.h" +#include "al/effect/EffectKeeper.h" +#include "al/hio/HioNode.h" +#include "al/nerve/Nerve.h" +#include "al/nerve/NerveStateCtrl.h" +#include "al/pose/ActorPoseKeeper.h" +#include "al/rail/RailKeeper.h" +#include "al/rail/RailRider.h" +#include "al/scene/SceneObjHolder.h" +#include "al/screen/ScreenPointKeeper.h" +#include "al/sensor/HitSensorKeeper.h" +#include "al/switch/StageSwitchKeeper.h" +#include "al/actor/SubActorKeeper.h" + +// vtable for LiveActor: 1C4EB58 + +namespace al +{ + + class ActorPoseKeeperBase; + class ActorExecuteInfo; + class ActorItemKeeper; + class ActorScoreKeeper; + class Collider; + class CollisionParts; + class ModelKeeper; + class ShadowKeeper; + class ActorPrePassLightKeeper; + class ActorOcclusionKeeper; + class LiveActorFlag; + + class ActorInitInfo; + class HitSensor; + class SensorMsg; + class ScreenPointer; + class ScreenPointTarget; + + class LiveActor : public al::IUseNerve, public al::IUseEffectKeeper, public al::IUseAudioKeeper, public al::IUseStageSwitch, public al::IUseSceneObjHolder, public al::IUseAreaObj, public al::IUseCamera, public al::IUseCollision, public al::IUseRail, public al::IUseHioNode + { + public: + LiveActor(const char *); + + virtual al::NerveKeeper* getNerveKeeper() const; + + virtual void init(const ActorInitInfo &); + virtual void initAfterPlacement(); + virtual void appear(); + virtual void makeActorAlive(); + virtual void kill(); + virtual void makeActorDead(); + virtual void movement(); + virtual void calcAnim(); + virtual void draw() const; + virtual void startClipped(); + virtual void endClipped(); + virtual void attackSensor(HitSensor *, HitSensor *); + virtual bool receiveMsg(const SensorMsg *, HitSensor *, HitSensor *); + virtual bool receiveMsgScreenPoint(const SensorMsg *, ScreenPointer *, ScreenPointTarget *); + + virtual const char *getName() const { return this->mActorName; }; + + virtual sead::Matrix34f *getBaseMtx() const; + + virtual al::EffectKeeper *getEffectKeeper() const { return this->mEffectKeeper; }; + + virtual al::AudioKeeper *getAudioKeeper() const { return this->mAudioKeeper; }; + + virtual al::StageSwitchKeeper *getStageSwitchKeeper() const { return this->mStageSwitchKeeper; }; + + virtual al::RailRider *getRailRider() const + { + if (this->mRailKeeper) + return this->mRailKeeper->getRailRider(); + return nullptr; + }; + + virtual al::SceneObjHolder *getSceneObjHolder() const { return this->mSceneInfo->mSceneObjHolder; }; + + virtual al::CollisionDirector *getCollisionDirector() const { return this->mSceneInfo->mCollisionDirector; }; + + virtual al::AreaObjDirector *getAreaObjDirector() const { return this->mSceneInfo->mAreaObjDirector; }; + + virtual al::CameraDirector *getCameraDirector() const { return this->mSceneInfo->mCameraDirector; }; + + virtual void initStageSwitchKeeper() { this->mStageSwitchKeeper = new StageSwitchKeeper(); }; + + virtual void control(); + + virtual void updateCollider(); + + const char *mActorName; // 0x48 + al::ActorPoseKeeperBase *mPoseKeeper; // 0x50 + al::ActorExecuteInfo *mLayoutExecuteInfo; // 0x58 + al::ActorActionKeeper *mActorActionKeeper; // 0x60 + al::ActorItemKeeper *mActorItemKeeper; // 0x68 + al::ActorScoreKeeper *mActorScoreKeeper; // 0x70 + al::Collider *mCollider; // 0x78 + al::CollisionParts *mCollisionParts; // 0x80 + al::ModelKeeper *mModelKeeper; // 0x88 + al::NerveKeeper *mNerveKeeper; // 0x90 + al::HitSensorKeeper *mHitSensorKeeper; // 0x98 + al::ScreenPointKeeper *mScreenPointKeeper; // 0xA0 + al::EffectKeeper *mEffectKeeper; // 0xA8 + al::AudioKeeper *mAudioKeeper; // 0xB0 + void *gap_4; // 0xB8 + al::StageSwitchKeeper *mStageSwitchKeeper; // 0xC0 + al::RailKeeper *mRailKeeper; // 0xC8 + al::ShadowKeeper *mShadowKeeper; // 0xD0 + al::ActorPrePassLightKeeper *mActorPrePassLightKeeper; // 0xD8 + al::ActorOcclusionKeeper *mActorOcclusionKeeper; // 0xE0 + al::SubActorKeeper *mSubActorKeeper; // 0xE8 + void *gap_6; // 0xF0 + al::ActorSceneInfo *mSceneInfo; // 0xF8 + al::LiveActorFlag *mLiveActorFlag; // 0x100 + }; +}; \ No newline at end of file diff --git a/include/al/LiveActor/LiveActorGroup.h b/include/al/LiveActor/LiveActorGroup.h new file mode 100644 index 0000000..26be814 --- /dev/null +++ b/include/al/LiveActor/LiveActorGroup.h @@ -0,0 +1,21 @@ +#pragma once + +#include "al/hio/HioNode.h" + +namespace al +{ + class LiveActor; + + class LiveActorGroup : public al::HioNode + { + public: + LiveActorGroup(const char *, int); + + virtual void registerActor(al::LiveActor *); + + const char* mGroupName; // _8 + int mMaxActorCount; // _10 + int mActorCount; // _14 + al::LiveActor** mActors; // _18 + }; +}; \ No newline at end of file diff --git a/include/al/PlayerHolder/PlayerHolder.h b/include/al/PlayerHolder/PlayerHolder.h new file mode 100644 index 0000000..068bb93 --- /dev/null +++ b/include/al/PlayerHolder/PlayerHolder.h @@ -0,0 +1,30 @@ +#pragma once + +#include "sead/math/seadVector.h" +#include "al/scene/Scene.h" +#include "al/LiveActor/LiveActor.h" +#include "game/Player/PlayerActorHakoniwa.h" +#include "types.h" + +namespace al { + + class PadRumbleKeeper; + + class PlayerHolder { + public: + PlayerHolder(int bufSize); + void clear(void); + void registerPlayer(al::LiveActor *, al::PadRumbleKeeper *); + PlayerActorHakoniwa *getPlayer(int) const; + PlayerActorHakoniwa *tryGetPlayer(int) const; + int getPlayerNum() const; + int getBufferSize() const {return bufferSize;}; + bool isFull(void) const; + bool isExistPadRumbleKeeper(int) const; + al::PadRumbleKeeper *getPadRumbleKeeper(int) const; + + undefined unkPointer[0x8]; + int bufferSize; + }; + +} \ No newline at end of file diff --git a/include/al/Scene.hpp b/include/al/Scene.hpp new file mode 100644 index 0000000..aef5d7f --- /dev/null +++ b/include/al/Scene.hpp @@ -0,0 +1,9 @@ +#pragma once + +namespace al +{ + class Scene + { + + }; +} diff --git a/include/al/action/ActionEffectCtrl.h b/include/al/action/ActionEffectCtrl.h new file mode 100644 index 0000000..247d881 --- /dev/null +++ b/include/al/action/ActionEffectCtrl.h @@ -0,0 +1,11 @@ +#pragma once + +#include "al/effect/EffectKeeper.h" + +namespace al { + class ActionEffectCtrl { + public: + void startAction(char const *); + IUseEffectKeeper *mEffectKeeper; + }; +} \ No newline at end of file diff --git a/include/al/actor/ActorActionKeeper.h b/include/al/actor/ActorActionKeeper.h new file mode 100644 index 0000000..a8cbea5 --- /dev/null +++ b/include/al/actor/ActorActionKeeper.h @@ -0,0 +1,47 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "al/action/ActionEffectCtrl.h" + +#include "sead/math/seadVector.h" + +namespace al +{ + + class ActorResource; + class ActionAnimCtrl; + class NerveActionCtrl; + class ActionFlagCtrl; + class ActionSeCtrl; + class ActionBgmCtrl; + class ActionPadAndCameraCtrl { + public: + ActionPadAndCameraCtrl(LiveActor const *, al::ActorResource const *, sead::Vector3f const *, char const *); + unsigned char padding[0x18]; + int mRumbleCount; // 0x18 + }; + class ActionScreenEffectCtrl; + class ActorActionKeeper + { + public: + inline ActorActionKeeper(LiveActor *, char const*, ActionAnimCtrl *, NerveActionCtrl *, ActionFlagCtrl *, ActionEffectCtrl *, ActionSeCtrl *, ActionBgmCtrl *, ActionPadAndCameraCtrl *, ActionScreenEffectCtrl *); + void tryCreate(al::LiveActor *,al::ActorResource const*,char const*,char const*); + void startAction(char const*); + void tryStartActionNoAnim(char const*); + void updatePrev(void); + void updatePost(void); + void init(void); + + LiveActor *mParentActor; // 0x0 + const char *mActorName; // 0x8 + bool unkBool; // 0x10 + ActionAnimCtrl *mAnimCtrl; // 0x18 + NerveActionCtrl *mNrvActionCtrl; // 0x20 + ActionFlagCtrl *mFlagCtrl; // 0x28 + ActionEffectCtrl *mEffectCtrl; // 0x30 + ActionSeCtrl *mSeCtrl; // 0x38 + ActionScreenEffectCtrl *mScreenEffectCtrl; // 0x40 + ActionPadAndCameraCtrl *mPadAndCamCtrl; // 0x48 + ActionBgmCtrl *mBgmCtrl; // 0x50 + }; +} // namespace al diff --git a/include/al/actor/ActorCameraTarget.h b/include/al/actor/ActorCameraTarget.h new file mode 100644 index 0000000..b4e1322 --- /dev/null +++ b/include/al/actor/ActorCameraTarget.h @@ -0,0 +1,25 @@ +#pragma once + +#include "sead/math/seadVector.h" +#include "al/LiveActor/LiveActor.h" +#include "al/camera/CameraTargetBase.h" + +namespace al +{ + class ActorCameraTarget : public al::CameraTargetBase + { + public: + ActorCameraTarget(al::LiveActor const *, float, sead::Vector3f const *); + + void calcTrans(sead::Vector3f *) const; + void calcSide(sead::Vector3f *) const; + void calcUp(sead::Vector3f *) const; + void calcFront(sead::Vector3f *) const; + void calcGravity(sead::Vector3f *) const; + void calcVelocity(sead::Vector3f *) const; + + al::LiveActor *actor; // 0x10 + sead::Vector3f *pos; // 0x18 + float distance; // 0x20 + }; +}; \ No newline at end of file diff --git a/include/al/actor/ActorDimensionKeeper.h b/include/al/actor/ActorDimensionKeeper.h new file mode 100644 index 0000000..5fb34a2 --- /dev/null +++ b/include/al/actor/ActorDimensionKeeper.h @@ -0,0 +1,21 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" + +class ActorDimensionKeeper { + public: + ActorDimensionKeeper(al::LiveActor const *); + void validate(void); + void invalidate(void); + void forceChange2DKeep(void); + void forceEndChange2DKeep(void); + void update(void); + + al::LiveActor *curActor; // 0x0 + bool is2D; // 0x8 + bool is2DModel; // 0x9 + bool unk2; // 0x10 + bool unk3; // 0xA + bool unk4; // 0xB + struct In2DAreaMoveControl *mMoveControl; // 0x10 +}; \ No newline at end of file diff --git a/include/al/actor/ActorExecuteInfo.h b/include/al/actor/ActorExecuteInfo.h new file mode 100644 index 0000000..bf28726 --- /dev/null +++ b/include/al/actor/ActorExecuteInfo.h @@ -0,0 +1,12 @@ +#pragma once + +namespace al +{ + class ExecutorActorExecuteBase; + + class ActorExecuteInfo + { + public: + void addUpdater(al::ExecutorActorExecuteBase *); + }; +}; \ No newline at end of file diff --git a/include/al/actor/ActorInitInfo.h b/include/al/actor/ActorInitInfo.h new file mode 100644 index 0000000..75523f9 --- /dev/null +++ b/include/al/actor/ActorInitInfo.h @@ -0,0 +1,77 @@ +#pragma once + +#include "al/actor/Placement.h" +#include "al/actor/ActorSceneInfo.h" +#include "al/LiveActor/LiveActorGroup.h" +#include "al/execute/ExecuteDirector.h" +#include "al/audio/AudioDirector.h" +#include "al/effect/EffectSystemInfo.h" +#include "al/gamepad/util.h" +#include "al/rumble/PadRumbleDirector.h" +#include "al/scene/SceneObjHolder.h" +#include "game/GameData/GameDataHolderBase.h" + +namespace al +{ + + class ModelDrawBufferCounter; + class ActorResourceHolder; + class HitSensorDirector; + class ScreenPointDirector; + class StageSwitchDirector; + class ViewIdHolder; + class ActorFactory; + class ClippingDirector; + class DemoDirector; + class GravityHolder; + class ItemDirectorBase; + class NatureDirector; + class SceneMsgCtrl; + class SceneStopCtrl; + class ScreenCoverCtrl; + class ShadowDirector; + class ModelGroup; + class GraphicsSystemInfo; + class PlayerHolder; + + class ActorInitInfo + { + public: + ActorInitInfo(); + void initViewIdSelf(al::PlacementInfo const*,al::ActorInitInfo const&); + void initNew(al::PlacementInfo const* placementInfo, al::LayoutInitInfo const* lytInfo, + al::LiveActorGroup* actorGroup, al::ActorFactory const* factory, + al::ActorResourceHolder* resourceHolder, al::AreaObjDirector* areaDir, + al::AudioDirector* audioDir, al::CameraDirector* camDir, + al::ClippingDirector* clippingDir, al::CollisionDirector* collDir, + al::DemoDirector* demoDir, al::EffectSystemInfo* effectSys, + al::ExecuteDirector* executeDir, al::GameDataHolderBase* dataHolder, + al::GravityHolder* gravityHolder, al::HitSensorDirector* hitSensorDir, + al::ItemDirectorBase* itemDir, al::NatureDirector* natureDir, + al::GamePadSystem const* gamepad, al::PadRumbleDirector* padRumbleDir, + al::PlayerHolder* playerHolder, al::SceneObjHolder* sceneObjHolder, + al::SceneMsgCtrl* sceneMsgCtrl, al::SceneStopCtrl* sceneStopCtrl, + al::ScreenCoverCtrl* screenCoverCtrl, al::ScreenPointDirector* screenPointDir, + al::ShadowDirector* shadowDir, al::StageSwitchDirector* stageSwitchDir, + al::ModelGroup* modelGroup, al::GraphicsSystemInfo* gfxSysInfo, + al::ModelDrawBufferCounter* mdlDrawBuffCtr, + al::LiveActorGroup *otherActorGroup); + LiveActorGroup *mLiveActorGroup; // 0x0 + const al::PlacementInfo& mPlacementInfo; // 0x8 + LayoutInitInfo *mLayoutInitInfo; // 0x10 + ActorSceneInfo mActorSceneInfo; // 0x18-0xB0 + LiveActorGroup *mLiveActorGroup2; // 0xB8 + ActorFactory *mActorFactory; // 0xC0 + ActorResourceHolder *mResourceHolder; // 0xC8 + AudioDirector *mAudioDirector; // 0xD0 + EffectSystemInfo *mEffectSysInfo; // 0xD8 + ExecuteDirector *mExecuteDirector; // 0xE0 + HitSensorDirector *mHitSensorDirector; // 0xE8 + ScreenPointDirector *mScreenPointDirector; // 0xF0 + StageSwitchDirector *mStageSwitchDirector; // 0xF8 + ViewIdHolder *mViewIdHolder; // 0x100 + }; +}; + +// size not entirely known, guessing based off of ActorInitInfo::initNew +static_assert(sizeof(al::ActorInitInfo) == 0x108); \ No newline at end of file diff --git a/include/al/actor/ActorSceneInfo.h b/include/al/actor/ActorSceneInfo.h new file mode 100644 index 0000000..3ca0213 --- /dev/null +++ b/include/al/actor/ActorSceneInfo.h @@ -0,0 +1,53 @@ +#pragma once + +#include "al/area/AreaObjDirector.h" +#include "al/camera/CameraDirector.h" +#include "al/collision/CollisionDirector.h" +#include "al/scene/SceneObjHolder.h" +#include "al/layout/LayoutInitInfo.h" +#include "game/GameData/GameDataHolderBase.h" + +namespace al { + + struct ClippingDirector; + struct DemoDirector; + struct GravityHolder; + struct ItemDirectorBase; + struct NatureDirector; + struct SceneMsgCtrl; + struct SceneStopCtrl; + struct ScreenCoverCtrl; + struct ShadowDirector; + struct ModelGroup; + struct GraphicsSystemInfo; + struct PlayerHolder; + struct ModelDrawBufferCounter; + + class ActorSceneInfo + { + public: + ActorSceneInfo() = default; + AreaObjDirector *mAreaObjDirector; // 0x0 + CameraDirector *mCameraDirector; // 0x8 + ClippingDirector *mClippingDirector; // 0x10 + CollisionDirector *mCollisionDirector; // 0x18 + DemoDirector *mDemoDirector; // 0x20 + GameDataHolderBase *mGameDataHolder; // 0x28 + GravityHolder *mGravityHolder; // 0x30 + ItemDirectorBase *mItemDirector; // 0x38 + NatureDirector *mNatureDirector; // 0x40 + GamePadSystem *mGamePadSys; // 0x48 + PadRumbleDirector *mPadRumbleDirector; // 0x50 + PlayerHolder *mPlayerHolder; // 0x58 + SceneObjHolder *mSceneObjHolder; // 0x60 + SceneStopCtrl *mSceneStopCtrl; // 0x68 + SceneMsgCtrl *mSceneMsgCtrl; // 0x70 + ScreenCoverCtrl *mScreenCoverCtrl; // 0x78 + ShadowDirector *mShadowDirector; // 0x80 + ModelGroup *mModelGroup; // 0x88 + GraphicsSystemInfo *mGfxSysInfo; // 0x90 + ModelDrawBufferCounter *mDrawBuffCount; // 0x98 + }; +} // namespace al + +static_assert(sizeof(al::ActorSceneInfo) == 0xA0, "Actor Scene Info Size"); \ No newline at end of file diff --git a/include/al/actor/DemoActor.h b/include/al/actor/DemoActor.h new file mode 100644 index 0000000..d068312 --- /dev/null +++ b/include/al/actor/DemoActor.h @@ -0,0 +1,43 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" + +namespace al +{ + class DemoActor : public LiveActor { + public: + DemoActor(const char* name); + virtual void paddingFunc(); + virtual void init(ActorInitInfo const &); + virtual void control(void); + virtual void initDemoActor(al::ActorInitInfo const&, al::ActorInitInfo const&, + sead::Matrix34f const*, bool); + virtual void initDemoActorSerial(al::ActorInitInfo const&, al::ActorInitInfo const&, + sead::Matrix34f const*); + virtual void initAfterCreateFromFactory(al::ActorInitInfo const&, al::ActorInitInfo const&, + sead::Matrix34f const*, bool); + virtual void startAction(int); + virtual void resetDynamics(void); + + bool isExistAction(int) const; + const char* getDemoActionName(int) const; + void startActionByName(const char*); + void hideModelBySwitch(void); + void showModelBySwitch(void); + void endDemo(void); + + void exeDelay(void); + void exeAction(void); + + struct DemoActionList *mActList = nullptr; // 0x108 + sead::Matrix34f mPoseMtx = sead::Matrix34f::ident; // 0x110 (size 0x30) + int mActDelay = 0; // 0x140 + int mActionIndex = 0; // 0x144 + int mSubActorNum = 0xFFFFFFFF; // 0x148 + int mShowModelStartFrame = 0xFFFFFFFF; // 0x14C + int mShowModelEndFrame = 0; // 0x150 + bool unkBool1 = false; + bool unkBool2 = false; + struct JointSpringControllerHolder *mJointControllerHolder = nullptr; // 0x158 + }; +} // namespace al diff --git a/include/al/actor/IUseName.h b/include/al/actor/IUseName.h new file mode 100644 index 0000000..655d917 --- /dev/null +++ b/include/al/actor/IUseName.h @@ -0,0 +1,10 @@ +#pragma once + +namespace al +{ + class IUseName + { + public: + virtual const char* getName() const = 0; + }; +}; \ No newline at end of file diff --git a/include/al/actor/LiveActorKit.h b/include/al/actor/LiveActorKit.h new file mode 100644 index 0000000..00609e1 --- /dev/null +++ b/include/al/actor/LiveActorKit.h @@ -0,0 +1,9 @@ +#pragma once + +namespace al +{ + class LiveActorKit { + public: + + }; +} // namespace al diff --git a/include/al/actor/Placement.h b/include/al/actor/Placement.h new file mode 100644 index 0000000..537185b --- /dev/null +++ b/include/al/actor/Placement.h @@ -0,0 +1,36 @@ +#pragma once + +#include "al/byaml/ByamlIter.h" +#include "sead/prim/seadSafeString.hpp" + +namespace al +{ + class PlacementInfo + { + public: + PlacementInfo(); + + void set(const al::ByamlIter &, const al::ByamlIter &); + + al::ByamlIter _0; + al::ByamlIter mZoneIter; // _10 + }; + + class PlacementId + { + public: + PlacementId(); + PlacementId(const char *unitConifgName, const char *objId, const char *commonId); + + bool init(const al::PlacementInfo &); + bool isEqual(const al::PlacementId &) const; + static bool isEqual(const al::PlacementId &, const al::PlacementId &); + bool isValid() const; + bool makeString(sead::BufferedSafeStringBase *) const; + + const char* _0; + const char* mUnitConfigName; // _8 + const char* mID; // _10 + const char* mCommonID; // _18 + }; +} \ No newline at end of file diff --git a/include/al/actor/SubActorKeeper.h b/include/al/actor/SubActorKeeper.h new file mode 100644 index 0000000..c1e0a80 --- /dev/null +++ b/include/al/actor/SubActorKeeper.h @@ -0,0 +1,16 @@ +#pragma once + + +#include "container/seadPtrArray.h" +namespace al { + struct SubActorInfo { + struct LiveActor* mActor; + void* unkPtr; + int unkInt; + }; + + class SubActorKeeper { + al::LiveActor* mRootActor; + sead::PtrArray mArray; + }; +} \ No newline at end of file diff --git a/include/al/actor/alPlacementFunction.h b/include/al/actor/alPlacementFunction.h new file mode 100644 index 0000000..3e34cf8 --- /dev/null +++ b/include/al/actor/alPlacementFunction.h @@ -0,0 +1,11 @@ +#pragma once + +#include "al/actor/ActorInitInfo.h" + +namespace alPlacementFunction { + void getModelName(char const**,al::ActorInitInfo const&); + void getModelName(char const**,al::PlacementInfo const&); + bool tryGetModelName(char const**,al::PlacementInfo const&); + bool tryGetModelName(char const**, al::ActorInitInfo const&); + +} \ No newline at end of file diff --git a/include/al/actor/misc.h b/include/al/actor/misc.h new file mode 100644 index 0000000..ec0b7fb --- /dev/null +++ b/include/al/actor/misc.h @@ -0,0 +1,11 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" + +namespace al +{ + template + al::LiveActor *createActorFunction(const char *actorName); + +} // namespace al + diff --git a/include/al/area/AreaObjDirector.h b/include/al/area/AreaObjDirector.h new file mode 100644 index 0000000..233b5e5 --- /dev/null +++ b/include/al/area/AreaObjDirector.h @@ -0,0 +1,12 @@ +#pragma once + +namespace al +{ + class AreaObjDirector; + + class IUseAreaObj + { + public: + virtual al::AreaObjDirector* getAreaObjDirector() const = 0; + }; +}; \ No newline at end of file diff --git a/include/al/area/AreaObjGroup.h b/include/al/area/AreaObjGroup.h new file mode 100644 index 0000000..5070cdb --- /dev/null +++ b/include/al/area/AreaObjGroup.h @@ -0,0 +1,10 @@ +#pragma once + +namespace al +{ + class AreaObjGroup + { + public: + + }; +}; \ No newline at end of file diff --git a/include/al/area/ChangeStageInfo.h b/include/al/area/ChangeStageInfo.h new file mode 100644 index 0000000..a3d7628 --- /dev/null +++ b/include/al/area/ChangeStageInfo.h @@ -0,0 +1,41 @@ +#pragma once + +#include "al/actor/Placement.h" + +#include "game/GameData/GameDataHolder.h" + +#include +#include + +class ChangeStageInfo { + public: + enum SubScenarioType : unsigned int { + UNK, + UNK1, + UNK2, + UNK3, + UNK4 + }; + + ChangeStageInfo(const GameDataHolder *mHolder, const al::PlacementInfo &placementInfo); + ChangeStageInfo(const GameDataHolder *mHolder, const al::PlacementInfo &placementInfo, const char *unk1, const char *unk2, bool unk3, int unk4, SubScenarioType type); + ChangeStageInfo(const GameDataHolder *mHolder, const char *changeId, const char *stageName, bool isReturn, int scenarioNo, SubScenarioType type); + void init(const al::PlacementInfo &placement, const GameDataHolder *mHolder); + void init(void); + void copy(const ChangeStageInfo &other); + inline void findScenarioNoByList(const GameDataHolder *holder); + bool isSubScenarioTypeLifeRecover(void) const; + bool isSubScenarioTypeResetMiniGame(void) const; + void setWipeType(const char *type); + void calcTrans(sead::Vector3f *result, const al::PlacementInfo &info); + + sead::FixedSafeString<0x80> changeStageId; // 0x0 (Size: 0x98) + sead::FixedSafeString<0x80> changeStageName; // 0xA0 + sead::FixedSafeString<0x80> placementString; // 0x138 + bool isReturn; // 0x1C8 + int scenarioNo; // 0x1CC or 0x134 + SubScenarioType subType; // 0x1D0 + sead::FixedSafeString<0x80> wipeType; // 0x1D8 + int hintPriority; // 0x270 + +}; \ No newline at end of file diff --git a/include/al/async/AsyncFunctorThread.h b/include/al/async/AsyncFunctorThread.h new file mode 100644 index 0000000..29eac62 --- /dev/null +++ b/include/al/async/AsyncFunctorThread.h @@ -0,0 +1,28 @@ +#pragma once + +#include "types.h" +#include "sead/prim/seadSafeString.hpp" +#include "FunctorBase.h" +#include "sead/thread/seadDelegateThread.h" +#include "sead/thread/seadMessageQueue.h" +#include "sead/mc/seadCoreInfo.h" + +namespace al +{ + class AsyncFunctorThread { + public: + AsyncFunctorThread(sead::SafeStringBase const &functorName, al::FunctorBase const &functor, int blockType, int stackSize, sead::CoreId id); + // this function is whats passed into the delegate thread as the function to call when the thread becomes unblocked + void threadFunction(sead::Thread *, s64); // unused args + + bool isDone() const {return this->mIsDone;}; + void start(); + // private: + unsigned char padding_08[0x8]; + sead::DelegateThread *mDelegateThread; + al::FunctorBase functor; + bool mIsDone; + }; +} // namespace al + +static_assert(sizeof(al::AsyncFunctorThread) == 0x20); diff --git a/include/al/async/FunctorBase.h b/include/al/async/FunctorBase.h new file mode 100644 index 0000000..8f835a7 --- /dev/null +++ b/include/al/async/FunctorBase.h @@ -0,0 +1,13 @@ +#pragma once + +namespace al +{ + + class FunctorBase + { + public: + virtual void operator()(void) const {return;}; + virtual FunctorBase *clone(void) const {return {0};}; + virtual ~FunctorBase() {return;}; + }; +} // namespace al diff --git a/include/al/async/FunctorV0M.hpp b/include/al/async/FunctorV0M.hpp new file mode 100644 index 0000000..ad6a9bb --- /dev/null +++ b/include/al/async/FunctorV0M.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include "FunctorBase.h" +#include "sead/basis/seadNew.h" +#include "types.h" +#include "nn.h" + +namespace sead +{ + namespace system + { + void DeleteImpl(void* ptr); + } // namespace system +} // namespace sead + +namespace al +{ + template + class FunctorV0M : public al::FunctorBase { + + public: + inline FunctorV0M(T objPointer, F functPointer) : mFunctor(functPointer), mObjPointer(objPointer) { }; + + void operator()(void) const override { + (mObjPointer->*mFunctor)(); + }; + + FunctorV0M *clone(void) const override { + return new FunctorV0M(mObjPointer, mFunctor); + }; + + ~FunctorV0M() override { + sead::system::DeleteImpl(this); + }; + + protected: + // 0x0 = vtable + T mObjPointer; // 0x8 = object pointer + F mFunctor; // 0x10 = member function pointer + }; +} // namespace al diff --git a/include/al/audio/AudioDirector.h b/include/al/audio/AudioDirector.h new file mode 100644 index 0000000..4e93365 --- /dev/null +++ b/include/al/audio/AudioDirector.h @@ -0,0 +1,7 @@ +#pragma once + +namespace al +{ + class AudioDirector; + +}; \ No newline at end of file diff --git a/include/al/audio/AudioKeeper.h b/include/al/audio/AudioKeeper.h new file mode 100644 index 0000000..fec6f51 --- /dev/null +++ b/include/al/audio/AudioKeeper.h @@ -0,0 +1,18 @@ +#pragma once + +namespace al +{ + class AudioKeeper; + + class IUseAudioKeeper + { + public: + virtual al::AudioKeeper* getAudioKeeper() const = 0; + }; + + class AudioKeeper + { + public: + + }; +}; \ No newline at end of file diff --git a/include/al/byaml/ByamlContainerHeader.h b/include/al/byaml/ByamlContainerHeader.h new file mode 100644 index 0000000..959e115 --- /dev/null +++ b/include/al/byaml/ByamlContainerHeader.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +namespace al { +class ByamlContainerHeader { +public: + int getType() const; + int getCount(bool) const; + + u32 mType; // _0 +}; +}; // namespace al \ No newline at end of file diff --git a/include/al/byaml/ByamlData.h b/include/al/byaml/ByamlData.h new file mode 100644 index 0000000..ae5c8b4 --- /dev/null +++ b/include/al/byaml/ByamlData.h @@ -0,0 +1,34 @@ +#pragma once + +#include "al/byaml/ByamlHashPair.h" + +namespace al { +enum DataType : unsigned char { + TYPE_STRING = 0xA0, + TYPE_BINARY = 0xA1, + TYPE_ARRAY = 0xC0, + TYPE_HASH = 0xC1, + TYPE_STRING_TABLE = 0xC2, + TYPE_BOOL = 0xD0, + TYPE_INT = 0xD1, + TYPE_FLOAT = 0xD2, + TYPE_UINT = 0xD3, + TYPE_LONG = 0xD4, + TYPE_ULONG = 0xD5, + TYPE_DOUBLE = 0xD6, + TYPE_NULL = 0xFF +}; + +class ByamlData { +public: + ByamlData(); + + void set(const ByamlHashPair*, bool); + void set(unsigned char, unsigned int, bool); + unsigned char getType() const; + unsigned int getValue() const; + + unsigned int mValue; // _0 + unsigned char mType; // _4 +}; +}; // namespace al \ No newline at end of file diff --git a/include/al/byaml/ByamlHashPair.h b/include/al/byaml/ByamlHashPair.h new file mode 100644 index 0000000..32144dd --- /dev/null +++ b/include/al/byaml/ByamlHashPair.h @@ -0,0 +1,19 @@ +#pragma once + +namespace al { +class ByamlHashPair { +public: + int getKey(bool) const; + char getType() const; + int getValue(bool) const; + + union { + const int mData; + struct { + const char _0, _1, _2, mType; + }; + }; + + const int mValue; +}; +}; // namespace al \ No newline at end of file diff --git a/include/al/byaml/ByamlHeader.h b/include/al/byaml/ByamlHeader.h new file mode 100644 index 0000000..609b53b --- /dev/null +++ b/include/al/byaml/ByamlHeader.h @@ -0,0 +1,22 @@ +#pragma once + +namespace al { +class ByamlHeader { +public: + short getTag() const; + bool isInvertOrder() const; + short getVersion() const; + int getHashKeyTableOffset() const; + int getStringTableOffset() const; + int getDataOffset() const; + + union { + int _0; + unsigned short mTag, mVersion; + }; + + int mHashKeyOffset; // _4 + int mStringTableOffset; // _8 + int mDataOffset; // _C +}; +}; // namespace al \ No newline at end of file diff --git a/include/al/byaml/ByamlIter.h b/include/al/byaml/ByamlIter.h new file mode 100644 index 0000000..c53da78 --- /dev/null +++ b/include/al/byaml/ByamlIter.h @@ -0,0 +1,63 @@ +#pragma once + +#include "al/byaml/ByamlData.h" + +namespace al { +class ByamlIter { +public: + ByamlIter(); + ByamlIter(const char*); + ByamlIter(const char*, const char*); + + bool isValid() const; + bool isTypeHash() const; + bool isTypeArray() const; + bool isTypeContainer() const; + bool isExistKey(char const* key) const; + int getKeyIndex(char const* key) const; + bool isInvertOrder() const; + unsigned int getSize() const; + al::ByamlIter* getIterByIndex(int index) const; + bool getByamlDataByIndex(al::ByamlData*, int index) const; + al::ByamlIter* getIterByKey(char const*) const; + bool getByamlDataByKey(al::ByamlData*, char const*) const; + bool getByamlDataByKeyIndex(al::ByamlData*, int) const; + bool getByamlDataAndKeyName(al::ByamlData*, char const**, int) const; + bool getKeyName(char const**, int) const; + bool tryGetIterByIndex(al::ByamlIter*, int) const; + bool tryGetIterAndKeyNameByIndex(al::ByamlIter*, char const**, int) const; + bool tryGetIterByKey(al::ByamlIter*, char const*) const; + bool tryGetStringByKey(char const**, char const*) const; + bool tryConvertString(char const**, al::ByamlData const*) const; + bool tryGetBinaryByKey(char const**, int*, char const*) const; + bool tryGetBinary(char const**, int*, al::ByamlData const*) const; + bool tryGetBoolByKey(bool*, char const*) const; + bool tryConvertBool(bool*, al::ByamlData const*) const; + bool tryGetIntByKey(int*, char const*) const; + bool tryConvertInt32(int*, al::ByamlData const*) const; + bool tryGetUInt32ByKey(unsigned int*, char const*) const; + bool tryConvertUInt32(unsigned int*, al::ByamlData const*) const; + bool tryGetFloatByKey(float*, char const*) const; + bool tryConvertFloat(float*, al::ByamlData const*) const; + bool tryGetInt64ByKey(long*, char const*) const; + bool tryConvertInt64(long*, al::ByamlData const*) const; + bool tryGetUInt64ByKey(unsigned long*, char const*) const; + bool tryConvertUInt64(unsigned long*, al::ByamlData const*) const; + bool tryGetDoubleByKey(double*, char const*) const; + bool tryConvertDouble(double*, al::ByamlData const*) const; + bool tryGetStringByIndex(char const**, int) const; + bool tryGetBinaryByIndex(char const**, int*, int) const; + bool tryGetBoolByIndex(bool*, int) const; + bool tryGetInt32ByIndex(int*, int) const; + bool tryGetUInt32ByIndex(unsigned int*, int) const; + bool tryGetFloatByindex(float*, int) const; + bool tryGetInt64ByIndex(long*, int) const; + bool tryGetUInt64ByIndex(unsigned long*, int) const; + bool tryGetDoubleByIndex(double*, int) const; + bool tryConvertIter(al::ByamlIter*, al::ByamlData const*) const; + bool isEqualData(al::ByamlIter const&) const; + + unsigned char* mData; // _0 + unsigned long mDataOffset; // _8 +}; +}; // namespace al \ No newline at end of file diff --git a/include/al/byaml/ByamlStringTableIter.h b/include/al/byaml/ByamlStringTableIter.h new file mode 100644 index 0000000..d1472db --- /dev/null +++ b/include/al/byaml/ByamlStringTableIter.h @@ -0,0 +1,23 @@ +#pragma once + +#include + +namespace al { +class ByamlStringTableIter { +public: + ByamlStringTableIter(); + ByamlStringTableIter(const unsigned char*, bool); + + int getSize() const; + const u32* getAddressTable() const; + int getStringAddress(int) const; + int getEndAddress() const; + const char* getString(int) const; + int getStringSize(int) const; + int findStringIndex(const char*) const; + bool isValidate() const; + + const u8* mData; // _0 + bool mReversed; +}; +}; // namespace al \ No newline at end of file diff --git a/include/al/byaml/writer/ByamlWriter.h b/include/al/byaml/writer/ByamlWriter.h new file mode 100644 index 0000000..1dec688 --- /dev/null +++ b/include/al/byaml/writer/ByamlWriter.h @@ -0,0 +1,74 @@ +#pragma once + +#include + +namespace sead { +class Heap; +class WriteStream; +} // namespace sead + +namespace al { + +class ByamlWriterStringTable; +class ByamlWriterContainer; +class ByamlWriterBigDataList; + +class ByamlWriterArray; +class ByamlWriterHash; + +class ByamlIter; + +class ByamlWriter { +public: + ByamlWriter(sead::Heap*, bool); + virtual ~ByamlWriter(); + + void addBool(bool); + void addInt(int); + void addUInt(u32); + void addFloat(float); + void addInt64(long); + void addUInt64(u64); + void addDouble(double); + void addString(const char*); + void addNull(); + void addBool(const char*, bool); + void addInt(const char*, int); + void addUInt(const char*, u32); + void addFloat(const char*, float); + void addInt64(const char*, long); + void addUInt64(const char*, u64); + void addDouble(const char*, double); + void addString(const char*, char const*); + void addNull(const char*); + + ByamlWriterArray* getArrayCurrentContainer(); + ByamlWriterHash* getHashCurrentContainer(); + ByamlWriterContainer* getCurrentContainer(); + void pushHash(); + void pushContainer(ByamlWriterContainer*); + void pushArray(); + void pushArray(char const*); + void pushHash(char const*); + void pushIter(const ByamlIter&); + void pushIter(const char*, const ByamlIter&); + void pushLocalIter(const ByamlIter&, const char*); + void pop(); + u32 calcHeaderSize() const; + u32 calcPackSize() const; + void write(sead::WriteStream*); + void print() const; + +private: + sead::Heap* mHeap; + ByamlWriterStringTable* mStringTable1 = nullptr; + ByamlWriterStringTable* mStringTable2 = nullptr; + sead::TList mContainerList; + ByamlWriterBigDataList* mBigDataList = nullptr; + ByamlWriterContainer** mContainerStack = nullptr; + int mContainerStackSize = 64; + int mCurrentContainerIndex = -1; + bool _mAlwaysFalse; +}; + +} // namespace al diff --git a/include/al/byaml/writer/ByamlWriterBigDataList.h b/include/al/byaml/writer/ByamlWriterBigDataList.h new file mode 100644 index 0000000..72af3e4 --- /dev/null +++ b/include/al/byaml/writer/ByamlWriterBigDataList.h @@ -0,0 +1,27 @@ +#pragma once + +#include +#include + +namespace sead { +class WriteStream; +} + +namespace al { + +class ByamlWriterBigData; + +class ByamlWriterBigDataList { +public: + ByamlWriterBigDataList(); + virtual ~ByamlWriterBigDataList(); + u32 calcPackSize() const; + void addData(al::ByamlWriterBigData*); + int setOffset(int); + void write(sead::WriteStream*); + +private: + sead::TList mList; +}; + +} // namespace al diff --git a/include/al/byaml/writer/ByamlWriterData.h b/include/al/byaml/writer/ByamlWriterData.h new file mode 100644 index 0000000..b49dd82 --- /dev/null +++ b/include/al/byaml/writer/ByamlWriterData.h @@ -0,0 +1,268 @@ +#pragma once + +#include +#include + +namespace sead { +class WriteStream; +} + +namespace al { + +class ByamlWriterData { +public: + virtual ~ByamlWriterData(); + virtual void makeIndex(); + virtual u32 calcPackSize() const; + virtual u8 getTypeCode() const; + virtual bool isContainer() const; + virtual void write(sead::WriteStream*) const; + virtual void print(int) const; + void printIndent(int) const; +}; + +class ByamlWriterBool : public ByamlWriterData { +public: + ByamlWriterBool(bool); + u8 getTypeCode() const override; + void write(sead::WriteStream*) const override; + void print(int) const override; + +private: + bool mValue; +}; + +class ByamlWriterInt : public ByamlWriterData { +public: + ByamlWriterInt(int); + u8 getTypeCode() const override; + void write(sead::WriteStream*) const override; + void print(int) const override; + +private: + int mValue; +}; + +class ByamlWriterFloat : public ByamlWriterData { +public: + ByamlWriterFloat(float); + u8 getTypeCode() const override; + void write(sead::WriteStream*) const override; + void print(int) const override; + +private: + float mValue; +}; + +class ByamlWriterUInt : public ByamlWriterData { +public: + ByamlWriterUInt(u32); + u8 getTypeCode() const override; + void write(sead::WriteStream*) const override; + void print(int) const override; + +private: + u32 mValue; +}; + +class ByamlWriterNull : public ByamlWriterData { +public: + ByamlWriterNull(); + u8 getTypeCode() const override; + void write(sead::WriteStream*) const override; + void print(int) const override; +}; + +class ByamlWriterStringTable; +class ByamlWriterString : public ByamlWriterData { +public: + ByamlWriterString(const char*, ByamlWriterStringTable*); + u8 getTypeCode() const override; + void write(sead::WriteStream*) const override; + void print(int) const override; + +private: + const char* mString; + ByamlWriterStringTable* mStringTable; +}; + +class ByamlWriterBigDataList; + +class ByamlWriterBigData : public ByamlWriterData { +public: + ByamlWriterBigData(al::ByamlWriterBigDataList*); + ~ByamlWriterBigData(); + void write(sead::WriteStream*) const override; + virtual u32 calcBigDataSize() const; + virtual void writeBigData(sead::WriteStream*) const; + + void setOffset(int offset) { mOffset = offset; } + +private: + al::ByamlWriterBigDataList* mList; + int mOffset = 0; +}; + +class ByamlWriterInt64 : public ByamlWriterBigData { +public: + ByamlWriterInt64(long, ByamlWriterBigDataList*); + ~ByamlWriterInt64(); + u8 getTypeCode() const override; + void writeBigData(sead::WriteStream*) const override; + void print(int) const override; + +private: + long mValue; +}; + +class ByamlWriterUInt64 : public ByamlWriterBigData { +public: + ByamlWriterUInt64(u64, ByamlWriterBigDataList*); + ~ByamlWriterUInt64(); + u8 getTypeCode() const override; + void writeBigData(sead::WriteStream*) const override; + void print(int) const override; + +private: + u64 mValue; +}; + +class ByamlWriterDouble : public ByamlWriterBigData { +public: + ByamlWriterDouble(double, ByamlWriterBigDataList*); + ~ByamlWriterDouble(); + u8 getTypeCode() const override; + void writeBigData(sead::WriteStream*) const override; + void print(int) const override; + +private: + double mValue; +}; + +class ByamlWriterHash; +class ByamlWriterArray; +class ByamlWriterStringTable; + +class ByamlWriterContainer : public ByamlWriterData { +public: + bool isContainer() const override; + + virtual void addBool(const char*, bool); + virtual void addInt(const char*, s32); + virtual void addUInt(const char*, u32); + virtual void addFloat(const char*, float); + virtual void addInt64(const char*, s64, ByamlWriterBigDataList*); + virtual void addUInt64(const char*, u64, ByamlWriterBigDataList*); + virtual void addDouble(const char*, double, ByamlWriterBigDataList*); + virtual void addString(const char*, const char*); + virtual void addHash(const char*, ByamlWriterHash*); + virtual void addArray(const char*, ByamlWriterArray*); + virtual void addNull(const char*); + + virtual void addBool(bool); + virtual void addInt(s32); + virtual void addUInt(u32); + virtual void addFloat(float); + virtual void addInt64(s64, ByamlWriterBigDataList*); + virtual void addUInt64(u64, ByamlWriterBigDataList*); + virtual void addDouble(double, ByamlWriterBigDataList*); + virtual void addString(const char*); + virtual void addHash(ByamlWriterHash*); + virtual void addArray(ByamlWriterArray*); + virtual void addNull(); + + virtual void writeContainer(sead::WriteStream*) const; + virtual bool isHash() const; + virtual bool isArray() const; + virtual void deleteData(); + + int getOffset() const { return mOffset; } + void setOffset(int offset) { mOffset = offset; } + +private: + int mOffset = 0; // FIXME shouldn't be public +}; + +class ByamlWriterArray : public ByamlWriterContainer { +public: + ByamlWriterArray(ByamlWriterStringTable*); + ~ByamlWriterArray(); + + void deleteData() override; + u32 calcPackSize() const override; + + void addData(al::ByamlWriterData*); + void addBool(bool) override; + void addInt(s32) override; + void addUInt(u32) override; + void addFloat(float) override; + void addInt64(s64, ByamlWriterBigDataList*) override; + void addUInt64(u64, ByamlWriterBigDataList*) override; + void addDouble(double, ByamlWriterBigDataList*) override; + void addString(const char*) override; + void addHash(ByamlWriterHash*) override; + void addArray(ByamlWriterArray*) override; + void addNull() override; + + u8 getTypeCode() const override; + void writeContainer(sead::WriteStream*) const override; + void write(sead::WriteStream*) const override; + void print(int) const override; + bool isArray() const override; + +private: + sead::TList mList; + al::ByamlWriterStringTable* mStringTable; +}; +static_assert(sizeof(ByamlWriterArray) == 0x30); + +class ByamlWriterHashPair : public sead::ListNode { +public: + ByamlWriterHashPair(const char*, ByamlWriterData*); + + const char* getKey() { return mKey; } + al::ByamlWriterData* getValue() { return mValue; } + +private: + void* selfReference = this; + void* test2 = nullptr; + const char* mKey; + al::ByamlWriterData* mValue; +}; +static_assert(sizeof(ByamlWriterHashPair) == 0x30); + +class ByamlWriterHash : public ByamlWriterContainer { +public: + ByamlWriterHash(ByamlWriterStringTable*, ByamlWriterStringTable*); + ~ByamlWriterHash(); + + void deleteData() override; // TODO implementation missing + u32 calcPackSize() const override; + + void addData(const char*, al::ByamlWriterData*); // TODO implementation missing + void addBool(const char*, bool) override; + void addInt(const char*, s32) override; + void addUInt(const char*, u32) override; + void addFloat(const char*, float) override; + void addInt64(const char*, s64, ByamlWriterBigDataList*) override; + void addUInt64(const char*, u64, ByamlWriterBigDataList*) override; + void addDouble(const char*, double, ByamlWriterBigDataList*) override; + void addString(const char*, const char*) override; + void addHash(const char*, ByamlWriterHash*) override; + void addArray(const char*, ByamlWriterArray*) override; + void addNull(const char*) override; + + u8 getTypeCode() const override; + void writeContainer(sead::WriteStream*) const override; // TODO implementation missing + void write(sead::WriteStream*) const override; + void print(int) const override; // TODO implementation missing + bool isHash() const override; + +private: + sead::TList mList; // TODO not really... it's something different here. + al::ByamlWriterStringTable* mStringTable1; + al::ByamlWriterStringTable* mStringTable2; +}; +static_assert(sizeof(ByamlWriterHash) == 0x38); + +} // namespace al diff --git a/include/al/byaml/writer/ByamlWriterStringTable.h b/include/al/byaml/writer/ByamlWriterStringTable.h new file mode 100644 index 0000000..bdf8c9d --- /dev/null +++ b/include/al/byaml/writer/ByamlWriterStringTable.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include + +namespace sead { +class WriteStream; +} + +namespace al { + +class ByamlWriterStringTable { +public: + ByamlWriterStringTable(); + virtual ~ByamlWriterStringTable(); + const char* tryAdd(const char*); + u32 calcHeaderSize() const; + u32 calcContentSize() const; + u32 calcPackSize() const; + bool isEmpty() const; + u32 calcIndex(const char*) const; + void write(sead::WriteStream*) const; + void print() const; + +private: + sead::TList mList; +}; + +} // namespace al diff --git a/include/al/camera/CameraAngleCtrlInfo.h b/include/al/camera/CameraAngleCtrlInfo.h new file mode 100644 index 0000000..1b96e5f --- /dev/null +++ b/include/al/camera/CameraAngleCtrlInfo.h @@ -0,0 +1,9 @@ +#pragma once + +namespace al +{ + class CameraAngleCtrlInfo { + public: + + }; +}; \ No newline at end of file diff --git a/include/al/camera/CameraAngleSwingInfo.h b/include/al/camera/CameraAngleSwingInfo.h new file mode 100644 index 0000000..a636f35 --- /dev/null +++ b/include/al/camera/CameraAngleSwingInfo.h @@ -0,0 +1,9 @@ +#pragma once + +namespace al +{ + class CameraAngleSwingInfo { + public: + + }; +}; \ No newline at end of file diff --git a/include/al/camera/CameraArrowCollider.h b/include/al/camera/CameraArrowCollider.h new file mode 100644 index 0000000..8281a70 --- /dev/null +++ b/include/al/camera/CameraArrowCollider.h @@ -0,0 +1,11 @@ +#pragma once + +#include "sead/math/seadVector.h" + +namespace al +{ + class CameraArrowCollider { + public: + void update(sead::Vector3f const &,sead::Vector3f const &,sead::Vector3f const &); + }; +}; \ No newline at end of file diff --git a/include/al/camera/CameraDirector.h b/include/al/camera/CameraDirector.h new file mode 100644 index 0000000..c899f85 --- /dev/null +++ b/include/al/camera/CameraDirector.h @@ -0,0 +1,66 @@ +#pragma once + +#include "CameraPoseUpdater.h" +#include "CameraPoserSceneInfo.h" +#include "al/camera/CameraPoser.h" +#include "al/camera/CameraTicket.h" +#include "al/hio/HioNode.h" +#include "al/execute/IUseExecutor.h" + +namespace al { + + class CameraResourceHolder; + class CameraRailHolder; + class CameraPoserFactory; + class PlayerHolder; + class ICameraInput; + class NameToCameraParamTransferFunc; + + class CameraDirector : public al::HioNode, public al::IUseExecutor { + public: + + void init(al::CameraPoserSceneInfo *,al::CameraPoserFactory const*); + al::CameraPoseUpdater *getPoseUpdater(int) const; + void endInit(al::PlayerHolder const*); + al::CameraTicket *createCameraFromFactory(char const *creatorName, al::PlacementId const*,char const*, int priority, sead::Matrix34f const&); + void createCamera(al::CameraPoser *,al::PlacementId const*,char const*,int,sead::Matrix34f const&,bool); + void execute(void) override; + void update(void); + void createObjectCamera(al::PlacementId const*,char const*,char const*,int,sead::Matrix34f const&); + void createObjectEntranceCamera(al::PlacementId const*,char const*,sead::Matrix34f const&); + void createMirrorObjectCamera(al::PlacementId const*,char const*,int,sead::Matrix34f const&); + void initAreaCameraSwitcherMultiForPrototype(al::AreaObjDirector *); + al::ICameraInput *getCameraInput(int); + void setCameraInput(al::ICameraInput const*); + void setViewCameraInput(al::ICameraInput const*,int); + void initAreaCameraSwitcherSingle(void); + void initResourceHolder(al::CameraResourceHolder const*); + void registerCameraRailHolder(al::CameraRailHolder *); + void initSceneFovyDegree(float); + void setCameraParamTransferFuncTable(al::NameToCameraParamTransferFunc const*,int); + void initSettingCloudSea(float); + void initSnapShotCameraAudioKeeper(al::IUseAudioKeeper *); + void initAndCreatePauseCameraCtrl(float); + float getSceneFovyDegree(void) const; + void validateCameraArea2D(void); + void invalidateCameraArea2D(void); + void stopByDeathPlayer(void); + void restartByDeathPlayer(void); + void startInvalidStopJudgeByDemo(void); + void endInvalidStopJudgeByDemo(void); + void startSnapShotMode(bool); + void endSnapShotMode(void); + + unsigned char padding[0x20]; + al::CameraPoserFactory *mFactory; // 0x28 + al::CameraPoserSceneInfo *mSceneInfo; // 0x30 + // 0xBC float farClipDistance + // 0xB8 float nearClipDistance + }; + + class IUseCamera + { + public: + virtual al::CameraDirector* getCameraDirector() const = 0; + }; +}; \ No newline at end of file diff --git a/include/al/camera/CameraObjectRequestInfo.h b/include/al/camera/CameraObjectRequestInfo.h new file mode 100644 index 0000000..106f510 --- /dev/null +++ b/include/al/camera/CameraObjectRequestInfo.h @@ -0,0 +1,7 @@ +#pragma once + +namespace al { + class CameraObjectRequestInfo { + + }; +} \ No newline at end of file diff --git a/include/al/camera/CameraPoseUpdater.h b/include/al/camera/CameraPoseUpdater.h new file mode 100644 index 0000000..ec5d652 --- /dev/null +++ b/include/al/camera/CameraPoseUpdater.h @@ -0,0 +1,9 @@ +#pragma once + +namespace al +{ + class CameraPoseUpdater { + public: + + }; +}; \ No newline at end of file diff --git a/include/al/camera/CameraPoser.h b/include/al/camera/CameraPoser.h new file mode 100644 index 0000000..1985c74 --- /dev/null +++ b/include/al/camera/CameraPoser.h @@ -0,0 +1,132 @@ +#pragma once + +#include "al/actor/Placement.h" +#include "al/byaml/ByamlIter.h" +#include "al/hio/HioNode.h" +#include "al/area/AreaObjDirector.h" +#include "al/audio/AudioKeeper.h" +#include "al/collision/CollisionDirector.h" +#include "al/actor/IUseName.h" +#include "al/nerve/Nerve.h" +#include "al/nerve/NerveKeeper.h" +#include "al/rail/RailKeeper.h" + +#include "CameraPoserFlag.h" +#include "CameraStartInfo.h" +#include "CameraTurnInfo.h" +#include "CameraObjectRequestInfo.h" +#include "al/rail/RailRider.h" + +#include "sead/math/seadQuat.h" +#include "sead/gfx/seadCamera.h" +#include "sead/math/seadVector.h" +#include "sead/math/seadMatrix.h" + +// size is 0x140/320 bytes +namespace al { + + class CameraVerticalAbsorber; + class CameraAngleCtrlInfo; + class CameraAngleSwingInfo; + class CameraArrowCollider; + class CameraOffsetCtrlPreset; + class CameraParamMoveLimit; + class GyroCameraCtrl; + class SnapShotCameraCtrl; + class CameraViewInfo; + + class CameraPoser : public al::HioNode, public al::IUseAreaObj, public al::IUseAudioKeeper, public al::IUseCollision, public al::IUseName, public al::IUseNerve, public al::IUseRail { + public: + CameraPoser(char const* poserName); + + virtual AreaObjDirector* getAreaObjDirector() const override; + virtual void init(); + virtual void initByPlacementObj(al::PlacementInfo const&); + virtual void endInit(); + virtual void start(CameraStartInfo const &); + virtual void update(); + virtual void end(); + virtual void loadParam(ByamlIter const &); + virtual void makeLookAtCamera(sead::LookAtCamera*) const; + virtual void receiveRequestFromObject(CameraObjectRequestInfo const&); + virtual bool isZooming(void) const; + virtual bool isEnableRotateByPad(void) const; + virtual void startSnapShotMode(void); + virtual void endSnapShotMode(void); + + virtual const char *getName(void) const override; + virtual CollisionDirector *getCollisionDirector(void) const override; + virtual NerveKeeper *getNerveKeeper(void) const override; + virtual AudioKeeper *getAudioKeeper(void) const override; + virtual RailRider* getRailRider(void) const override; + + virtual void load(ByamlIter const&); + virtual void movement(void); + virtual void calcCameraPose(sead::LookAtCamera *) const; + virtual void requestTurnToDirection(al::CameraTurnInfo const *); + + bool isInterpoleByCameraDistance(void) const; + bool isInterpoleEaseOut(void) const; + bool isEndInterpoleByStep(void) const; + bool isFirstCalc(void) const; + + void initNerve(al::Nerve const*,int); + void initArrowCollider(al::CameraArrowCollider *); + void initAudioKeeper(char const*); + void initRail(al::PlacementInfo const&); + void initLocalInterpole(void); + void initLookAtInterpole(float); + void initOrthoProjectionParam(void); + void tryInitAreaLimitter(al::PlacementInfo const&); + + void makeLookAtCameraPrev(sead::LookAtCamera *) const; + void makeLookAtCameraPost(sead::LookAtCamera *) const; + void makeLookAtCameraLast(sead::LookAtCamera *) const; + void makeLookAtCameraCollide(sead::LookAtCamera*) const; + + void getInterpoleStep(void); + void setInterpoleStep(int); + void resetInterpoleStep(void); + void setInterpoleEaseOut(void); + void getEndInterpoleStep(void); + + void appear(al::CameraStartInfo const&); + void calcCameraPose(sead::LookAtCamera *); + void receiveRequestFromObjectCore(al::CameraObjectRequestInfo const&); + + void startSnapShotModeCore(void); + void endSnapShotModeCore(void); + + const char *mPoserName; // 0x30 + float unkFloat1; // 0x38 + sead::Vector3f mPosition; // 0x3C + sead::Vector3f mTargetTrans = sead::Vector3f::ex; // 0x48 + sead::Vector3f mCameraUp = sead::Vector3f::ey; // 0x54 + float mFovyDegree = 35.0f; // 0x60 + float unkFloat; // 0x64 + sead::Matrix34f mViewMtx = sead::Matrix34f::ident; // 0x68 + bool unkBool1 = false; // 0x98 + CameraViewInfo *mViewInfo; // 0xA0 + al::AreaObjDirector *mAreaDirector; // 0xA8 + CameraPoserFlag *mPoserFlags; // 0xB0 + CameraVerticalAbsorber *mVerticalAbsorber; // 0xB8 + CameraAngleCtrlInfo *mAngleCtrlInfo; // 0xC0 + CameraAngleSwingInfo *mAngleSwingInfo; // 0xC8 + CameraArrowCollider *mArrowCollider; // 0xD0 + CameraOffsetCtrlPreset *mOffsetCtrlPreset; // 0xD8 + float *mLocalInterpole; // 0xE0 (size = 0x20) + float *mLookAtInterpole; // 0xE8 (size = 0x10) + CameraParamMoveLimit *mParamMoveLimit; // 0xF0 + void *unkPtr4; // 0xF8 + GyroCameraCtrl *mGyroCtrl; // 0x100 + SnapShotCameraCtrl *mSnapshotCtrl; // 0x108 + AudioKeeper *mAudioKeeper; // 0x110 + NerveKeeper *mNerveKeeper; // 0x118 + RailKeeper *mRailKeeper; // 0x120 + int *unkPtr5; // 0x128 (size = 0xC) interpolesteptype? + int *unkPtr6; // 0x130 (size - 0x8) + sead::Vector3f *mOrthoProjectionParam; // 0x138 (gets init'd with new of size 0xC) + }; + + static_assert(sizeof(CameraPoser) == 0x140, "Camera Poser Size"); +}; diff --git a/include/al/camera/CameraPoserFlag.h b/include/al/camera/CameraPoserFlag.h new file mode 100644 index 0000000..47e9214 --- /dev/null +++ b/include/al/camera/CameraPoserFlag.h @@ -0,0 +1,25 @@ +#pragma once + +namespace al +{ + class CameraPoserFlag { + public: + CameraPoserFlag(void); + bool mFirstCalc = true; + bool mOffVerticalAbsorb = true; + bool mInvalidCollider = false; + bool unkBool4 = false; + bool mValidKeepPreSelfPoseNextCameraByParam = false; + bool unkBool6 = false; + bool mInvalidKeepPreSelfPoseNextCameraOverWriteProgram = false; + bool mInvalidKeepDistanceNextCamera = false; + bool unkBool9 = false; + bool unkBool10 = false; + bool mInvalidChangeSubjective = false; + bool unkBool12 = false; + bool unkBool13 = false; + bool mInvalidPreCameraEndAfterInterpole = false; + bool mStopUpdateGyro = false; // 0xE + // might be better to use a bool array? + }; +}; \ No newline at end of file diff --git a/include/al/camera/CameraPoserFollowLimit.h b/include/al/camera/CameraPoserFollowLimit.h new file mode 100644 index 0000000..e0f9d5e --- /dev/null +++ b/include/al/camera/CameraPoserFollowLimit.h @@ -0,0 +1,9 @@ +#pragma once + + +class CameraPoserFollowLimit { + public: + unsigned char massive[0x200]; + + //sead::Vector3f lookAtPos; // 0x1F4 +}; \ No newline at end of file diff --git a/include/al/camera/CameraPoserSceneInfo.h b/include/al/camera/CameraPoserSceneInfo.h new file mode 100644 index 0000000..0def809 --- /dev/null +++ b/include/al/camera/CameraPoserSceneInfo.h @@ -0,0 +1,7 @@ +#pragma once + +namespace al { +struct CameraPoserSceneInfo { + float mSceneFovyDegree; +}; +} \ No newline at end of file diff --git a/include/al/camera/CameraStartInfo.h b/include/al/camera/CameraStartInfo.h new file mode 100644 index 0000000..24e89f6 --- /dev/null +++ b/include/al/camera/CameraStartInfo.h @@ -0,0 +1,7 @@ +#pragma once + +namespace al { + class CameraStartInfo { + + }; +} \ No newline at end of file diff --git a/include/al/camera/CameraTargetBase.h b/include/al/camera/CameraTargetBase.h new file mode 100644 index 0000000..46357c3 --- /dev/null +++ b/include/al/camera/CameraTargetBase.h @@ -0,0 +1,31 @@ +#pragma once + +#include "sead/math/seadVector.h" + +namespace al { + + struct CameraSubTargetBase; + + class CameraTargetBase { + public: + CameraTargetBase(); + + virtual void calcSide(sead::Vector3f *) const {return;}; + virtual void calcUp(sead::Vector3f *) const {return;}; + virtual void calcFront(sead::Vector3f *) const {return;}; + virtual void calcGravity(sead::Vector3f *input) const {input->x = -1.f; input->y = 0.f; input->z = 0.f; return;}; + virtual void calcVelocity(sead::Vector3f *) const {return;}; + virtual bool isCollideGround(void) const {return false;}; + virtual bool isInWater(void) const {return false;}; + virtual bool isInMooonGravity(void) const {return false;}; + virtual bool isClimbPole(void) const {return false;}; + virtual bool isGrabCeil(void) const {return false;}; + virtual bool isWallWatch(void) const {return false;}; + virtual bool isInvalidMoveByInput(void) const {return false;}; + virtual bool isEnableEndAfterInterpole(void) const {return false;}; + virtual void update(void) const {return;}; + virtual float getRequestDistance(void) const {return -1.f;}; + + bool isActiveTarget; // 0x8 + }; +} \ No newline at end of file diff --git a/include/al/camera/CameraTargetHolder.h b/include/al/camera/CameraTargetHolder.h new file mode 100644 index 0000000..ad1a5ca --- /dev/null +++ b/include/al/camera/CameraTargetHolder.h @@ -0,0 +1,10 @@ +#pragma once + +#include "al/actor/ActorCameraTarget.h" + +namespace al { + class CameraTargetHolder { + public: + al::ActorCameraTarget *tryGetViewTarget(int) const; + }; +} \ No newline at end of file diff --git a/include/al/camera/CameraTicket.h b/include/al/camera/CameraTicket.h new file mode 100644 index 0000000..c9def40 --- /dev/null +++ b/include/al/camera/CameraTicket.h @@ -0,0 +1,32 @@ +#pragma once + +#include "al/actor/Placement.h" +#include "al/camera/CameraPoser.h" + +namespace al { + + class CameraTicketId { + public: + CameraTicketId(al::PlacementId const*,char const*); + void isEqual(al::CameraTicketId const&); + void isEqual(al::CameraTicketId const&,al::CameraTicketId const&); + void isEqual(al::ByamlIter const&); + void tryGetObjId(void); + void getObjId(void); + + al::PlacementId *mPlacement; + const char *mTicketName; + + }; + + class CameraTicket { + public: + CameraTicket(CameraPoser *poser, CameraTicketId const *ticketID, int priority); + void setPriority(int); + + CameraPoser *mPoser; + CameraTicketId *mTicketID; + int mPriority; + bool mIsActive; + }; +} \ No newline at end of file diff --git a/include/al/camera/CameraTurnInfo.h b/include/al/camera/CameraTurnInfo.h new file mode 100644 index 0000000..0d7ca14 --- /dev/null +++ b/include/al/camera/CameraTurnInfo.h @@ -0,0 +1,7 @@ +#pragma once + +namespace al { + class CameraTurnInfo { + + }; +} \ No newline at end of file diff --git a/include/al/camera/CameraVerticalAbsorber.h b/include/al/camera/CameraVerticalAbsorber.h new file mode 100644 index 0000000..d30c586 --- /dev/null +++ b/include/al/camera/CameraVerticalAbsorber.h @@ -0,0 +1,10 @@ +#pragma once + +namespace al +{ + class CameraVerticalAbsorber { + public: + bool isValid(void); + + }; +}; \ No newline at end of file diff --git a/include/al/camera/GyroCameraCtrl.h b/include/al/camera/GyroCameraCtrl.h new file mode 100644 index 0000000..fc47a82 --- /dev/null +++ b/include/al/camera/GyroCameraCtrl.h @@ -0,0 +1,9 @@ +#pragma once + +namespace al +{ + class GyroCameraCtrl { + public: + + }; +}; \ No newline at end of file diff --git a/include/al/camera/Projection.h b/include/al/camera/Projection.h new file mode 100644 index 0000000..9851e65 --- /dev/null +++ b/include/al/camera/Projection.h @@ -0,0 +1,10 @@ +#pragma once + +namespace al +{ + class Projection { + public: + float getFovy(void) const; + void setFovy(float); + }; +}; \ No newline at end of file diff --git a/include/al/camera/SnapshotCameraCtrl.h b/include/al/camera/SnapshotCameraCtrl.h new file mode 100644 index 0000000..5c3d312 --- /dev/null +++ b/include/al/camera/SnapshotCameraCtrl.h @@ -0,0 +1,9 @@ +#pragma once + +namespace al +{ + class SnapShotCameraCtrl { + public: + + }; +}; \ No newline at end of file diff --git a/include/al/camera/alCameraPoserFunction.h b/include/al/camera/alCameraPoserFunction.h new file mode 100644 index 0000000..062882d --- /dev/null +++ b/include/al/camera/alCameraPoserFunction.h @@ -0,0 +1,228 @@ +#pragma once + +#include "CameraPoser.h" +#include "al/actor/Placement.h" +#include "sead/math/seadVector.h" + +namespace alCameraPoserFunction { + + struct CameraCollisionHitResult; + + void initCameraArrowCollider(al::CameraPoser *); + void calcCameraPose(sead::Quat *,al::CameraPoser const*); + void calcLookDir(sead::Vector3 *,al::CameraPoser const*); + void calcCameraDir(sead::Vector3 *,al::CameraPoser const*); + void calcCameraDirH(sead::Vector3 *,al::CameraPoser const*); + void calcLookDirH(sead::Vector3 *,al::CameraPoser const*); + void calcSideDir(sead::Vector3 *,al::CameraPoser const*); + void calcPreCameraDir(sead::Vector3 *,al::CameraPoser const*); + void calcPreCameraDirH(sead::Vector3 *,al::CameraPoser const*); + void calcPreLookDir(sead::Vector3 *,al::CameraPoser const*); + void calcPreLookDirH(sead::Vector3 *,al::CameraPoser const*); + float calcPreCameraAngleH(al::CameraPoser const*); + float calcPreCameraAngleV(al::CameraPoser const*); + void setLookAtPosToTarget(al::CameraPoser *); + void calcTargetTrans(sead::Vector3 *,al::CameraPoser const*); + void setLookAtPosToTargetAddOffset(al::CameraPoser *,sead::Vector3 const&); + void setCameraPosToTarget(al::CameraPoser *); + void setCameraPosToTargetAddOffset(al::CameraPoser *,sead::Vector3 const&); + void calcTargetTransWithOffset(sead::Vector3 *,al::CameraPoser const*); + void calcTargetVelocity(sead::Vector3 *,al::CameraPoser const*); + void calcTargetVelocityH(sead::Vector3 *,al::CameraPoser const*); + void calcTargetUp(sead::Vector3 *,al::CameraPoser const*); + void calcTargetSpeedV(al::CameraPoser const*); + void calcTargetPose(sead::Quat *,al::CameraPoser const*); + void calcTargetFront(sead::Vector3 *,al::CameraPoser const*); + void calcTargetSide(sead::Vector3 *,al::CameraPoser const*); + void calcTargetGravity(sead::Vector3 *,al::CameraPoser const*); + void calcTargetSpeedH(al::CameraPoser const*); + void calcTargetJumpSpeed(al::CameraPoser const*); + void calcTargetFallSpeed(al::CameraPoser const*); + void tryGetTargetRequestDistance(float *,al::CameraPoser const*); + void tryGetBossDistanceCurve(al::CameraPoser const*); + void tryGetEquipmentDistanceCurve(al::CameraPoser const*); + void tryCalcSlopeCollisionDownFrontDirH(sead::Vector3 *,al::CameraPoser const*); + void checkValidTurnToSubTarget(al::CameraPoser const*); + void calcSubTargetBack(sead::Vector3 *,al::CameraPoser const*); + void calcSubTargetTrans(sead::Vector3 *,al::CameraPoser const*); + void calcSubTargetFront(sead::Vector3 *,al::CameraPoser const*); + void tryCalcSubTargetTurnBrakeDistanceRate(float *,al::CameraPoser const*); + void clampAngleSubTargetTurnRangeV(float *,al::CameraPoser const*); + void initCameraVerticalAbsorber(al::CameraPoser *); + void initCameraVerticalAbsorberNoCameraPosAbsorb(al::CameraPoser *); + void liberateVerticalAbsorb(al::CameraPoser *); + void stopUpdateVerticalAbsorb(al::CameraPoser *); + void stopUpdateVerticalAbsorbForSnapShotMode(al::CameraPoser *,sead::Vector3 const&); + void restartUpdateVerticalAbsorb(al::CameraPoser *); + void validateVerticalAbsorbKeepInFrame(al::CameraPoser *); + void invalidateVerticalAbsorbKeepInFrame(al::CameraPoser *); + void setVerticalAbsorbKeepInFrameScreenOffsetUp(al::CameraPoser *,float); + void setVerticalAbsorbKeepInFrameScreenOffsetDown(al::CameraPoser *,float); + void initCameraArrowCollider(al::CameraPoser *); + void initCameraArrowColliderWithoutThroughPassCollision(al::CameraPoser *); + void initCameraMoveLimit(al::CameraPoser *); + void initCameraAngleCtrl(al::CameraPoser *); + void initCameraAngleCtrlWithRelativeH(al::CameraPoser *); + void initCameraDefaultAngleRangeV(al::CameraPoser *,float,float); + void setCameraStartAngleV(al::CameraPoser *,float); + void setCameraAngleV(al::CameraPoser *,float); + void initAngleSwing(al::CameraPoser *); + void initCameraOffsetCtrlPreset(al::CameraPoser *); + void initGyroCameraCtrl(al::CameraPoser *); + void resetGyro(al::CameraPoser *); + void calcCameraGyroPose(al::CameraPoser const*,sead::Vector3 *,sead::Vector3 *,sead::Vector3 *); + void setGyroLimitAngleV(al::CameraPoser *,float,float); + void setGyroSensitivity(al::CameraPoser *,float,float); + void reduceGyroSencitivity(al::CameraPoser *); + void stopUpdateGyro(al::CameraPoser *); + void restartUpdateGyro(al::CameraPoser *); + void initSnapShotCameraCtrl(al::CameraPoser *); + void initSnapShotCameraCtrlZoomAutoReset(al::CameraPoser *); + void initSnapShotCameraCtrlZoomRollMove(al::CameraPoser *); + void validateSnapShotCameraLookAtOffset(al::CameraPoser *); + void validateSnapShotCameraZoomFovy(al::CameraPoser *); + void validateSnapShotCameraRoll(al::CameraPoser *); + void updateSnapShotCameraCtrl(al::CameraPoser *); + void startResetSnapShotCameraCtrl(al::CameraPoser *,int); + void setSnapShotMaxZoomOutFovyDegree(al::CameraPoser *,float); + void onVerticalAbsorb(al::CameraPoser *); + void offVerticalAbsorb(al::CameraPoser *); + void invalidateCameraBlur(al::CameraPoser *); + void validateCollider(al::CameraPoser *); + void invalidateCollider(al::CameraPoser *); + void validateCtrlSubjective(al::CameraPoser *); + void invalidateChangeSubjective(al::CameraPoser *); + void invalidateKeepDistanceNextCamera(al::CameraPoser *); + void invalidateKeepDistanceNextCameraIfNoCollide(al::CameraPoser *); + void invalidatePreCameraEndAfterInterpole(al::CameraPoser *); + void checkFirstCameraCollisionArrow(sead::Vector3 *,sead::Vector3 *,al::IUseCollision const*,sead::Vector3 const&,sead::Vector3 const&); + void checkFirstCameraCollisionArrow(alCameraPoserFunction::CameraCollisionHitResult *,al::IUseCollision const*,sead::Vector3 const&,sead::Vector3 const&); + void checkFirstCameraCollisionArrowOnlyCeiling(sead::Vector3 *,sead::Vector3 *,al::IUseCollision const*,sead::Vector3 const&,sead::Vector3 const&); + void checkCameraCollisionMoveSphere(sead::Vector3 *,al::IUseCollision const*,sead::Vector3 const&,sead::Vector3 const&,float); + void calcZoneRotateAngleH(float,al::CameraPoser const*); + void calcZoneRotateAngleH(float,sead::Matrix34 const&); + void calcZoneInvRotateAngleH(float,sead::Matrix34 const&); + void multVecZone(sead::Vector3 *,sead::Vector3 const&,al::CameraPoser const*); + void multVecInvZone(sead::Vector3 *,sead::Vector3 const&,al::CameraPoser const*); + void rotateVecZone(sead::Vector3 *,sead::Vector3 const&,al::CameraPoser const*); + void calcOffsetCameraKeepInFrameV(sead::Vector3 *,sead::LookAtCamera *,sead::Vector3 const&,al::CameraPoser const*,float,float); + void makeCameraKeepInFrameV(sead::LookAtCamera *,sead::Vector3 const&,al::CameraPoser const*,float,float); + void initCameraRail(al::CameraPoser *,al::PlacementInfo const&,char const*); + void tryGetCameraRailArg(float *,al::PlacementInfo const&,char const*,char const*); + void tryFindNearestLimitRailKeeper(al::CameraPoser const*,sead::Vector3 const&); + void calcCameraRotateStick(sead::Vector2 *,al::CameraPoser const*); + float calcCameraRotateStickH(al::CameraPoser const*); + float calcCameraRotateStickV(al::CameraPoser const*); + float calcCameraRotateStickPower(al::CameraPoser const*); + void tryCalcCameraSnapShotMoveStick(sead::Vector2*, al::CameraPoser const*); + + void getViewIndex(al::CameraPoser const*); + sead::LookAtCamera* getLookAtCamera(al::CameraPoser const*); + void getProjectionSead(al::CameraPoser const*); + void getProjection(al::CameraPoser const*); + void getProjectionMtx(al::CameraPoser const*); + void getNear(al::CameraPoser const*); + void getFar(al::CameraPoser const*); + void getAspect(al::CameraPoser const*); + void getPreCameraPos(al::CameraPoser const*); + sead::Vector3f *getPreLookAtPos(al::CameraPoser const*); + void getPreUpDir(al::CameraPoser const*); + void getPreFovyDegree(al::CameraPoser const*); + void getPreFovyRadian(al::CameraPoser const*); + void getPreCameraSwingAngleH(al::CameraStartInfo const&); + void getPreCameraSwingAngleV(al::CameraStartInfo const&); + void getPreCameraMaxSwingAngleH(al::CameraStartInfo const&); + void getPreCameraMaxSwingAngleV(al::CameraStartInfo const&); + void getAreaAngleH(al::CameraStartInfo const&); + void getAreaAngleV(al::CameraStartInfo const&); + void getNextAngleHByPreCamera(al::CameraStartInfo const&); + void getNextAngleVByPreCamera(al::CameraStartInfo const&); + void getUnderTargetCollisionPos(al::CameraPoser const*); + void getUnderTargetCollisionNormal(al::CameraPoser const*); + void getSlopeCollisionUpSpeed(al::CameraPoser const*); + void getSlopeCollisionDownSpeed(al::CameraPoser const*); + void getSubTargetRequestDistance(al::CameraPoser const*); + void getSubTargetTurnSpeedRate1(al::CameraPoser const*); + void getSubTargetTurnSpeedRate2(al::CameraPoser const*); + void getSubTargetTurnRestartStep(al::CameraPoser const*); + void getCameraVerticalAbsorbPosUp(al::CameraPoser const*); + void getCameraVerticalAbsorbPosDown(al::CameraPoser const*); + float getCameraAngleH(al::CameraPoser const*); + float getCameraAngleV(al::CameraPoser const*); + float getOffset(al::CameraPoser const*); + void getGyroFront(al::CameraPoser *); + float getGyroAngleV(al::CameraPoser *); + float getGyroAngleH(al::CameraPoser *); + void getSnapShotRollDegree(al::CameraPoser const*); + void getSnapShotLookAtOffset(al::CameraPoser const*); + void getRequestTargetAngleV(al::CameraObjectRequestInfo const&); + float getRequestAngleSpeed(al::CameraObjectRequestInfo const&); + float getRequestAngleV(al::CameraObjectRequestInfo const&); + void getCameraRailPointObjId(al::CameraPoser const*,int); + float getStickSensitivityLevel(al::CameraPoser const*); + float getStickSensitivityScale(al::CameraPoser const*); + void getGyroSensitivityLevel(al::CameraPoser const*); + void getGyroSensitivityScale(al::CameraPoser const*); + + bool isPrePriorityDemo(al::CameraStartInfo const&); + bool isPrePriorityDemo2(al::CameraStartInfo const&); + bool isPrePriorityDemoTalk(al::CameraStartInfo const&); + bool isPrePriorityDemoAll(al::CameraStartInfo const&); + bool isPrePriorityEntranceAll(al::CameraStartInfo const&); + bool isPrePriorityPlayer(al::CameraStartInfo const&); + bool isEqualPreCameraName(al::CameraStartInfo const&,char const*); + bool isPreCameraFixAbsolute(al::CameraStartInfo const&); + bool isInvalidCollidePreCamera(al::CameraStartInfo const&); + bool isInvalidKeepPreCameraDistance(al::CameraStartInfo const&); + bool isInvalidKeepPreCameraDistanceIfNoCollide(al::CameraStartInfo const&); + bool isValidResetPreCameraPose(al::CameraStartInfo const&); + bool isValidKeepPreSelfCameraPose(al::CameraStartInfo const&); + bool isExistAreaAngleH(al::CameraStartInfo const&); + bool isExistAreaAngleV(al::CameraStartInfo const&); + bool isExistNextPoseByPreCamera(al::CameraStartInfo const&); + bool isChangeTarget(al::CameraPoser const*); + bool isExistCollisionUnderTarget(al::CameraPoser const*); + bool isExistSlopeCollisionUnderTarget(al::CameraPoser const*); + bool isExistWallCollisionUnderTarget(al::CameraPoser const*); + bool isExistSubTarget(al::CameraPoser const*); + bool isChangeSubTarget(al::CameraPoser const*); + bool isValidSubTargetTurnV(al::CameraPoser const*); + bool isValidSubTargetResetAfterTurnV(al::CameraPoser const*); + bool isValidAngleSwing(al::CameraPoser const*); + bool isStopUpdateGyro(al::CameraPoser const*); + bool isTargetCollideGround(al::CameraPoser const*); + bool isTargetInWater(al::CameraPoser const*); + bool isTargetInMoonGravity(al::CameraPoser const*); + bool isTargetClimbPole(al::CameraPoser const*); + bool isTargetGrabCeil(al::CameraPoser const*); + bool isTargetInvalidMoveByInput(al::CameraPoser const*); + bool isTargetEnableEndAfterInterpole(al::CameraPoser const*); + bool isTargetWallCatch(al::CameraPoser const*); + bool isSnapShotMode(al::CameraPoser const*); + bool isOffVerticalAbsorb(al::CameraPoser const*); + bool isRequestStopVerticalAbsorb(al::CameraObjectRequestInfo const&); + bool isRequestResetPosition(al::CameraObjectRequestInfo const&); + bool isRequestResetAngleV(al::CameraObjectRequestInfo const&); + bool isRequestDownToDefaultAngleBySpeed(al::CameraObjectRequestInfo const&); + bool isRequestUpToTargetAngleBySpeed(al::CameraObjectRequestInfo const&); + bool isRequestMoveDownAngleV(al::CameraObjectRequestInfo const&); + bool isRequestSetAngleV(al::CameraObjectRequestInfo const&); + bool isInvalidCollider(al::CameraPoser const*); + bool isInvalidPreCameraEndAfterInterpole(al::CameraPoser const*); + bool isSceneCameraFirstCalc(al::CameraPoser const*); + bool isActiveInterpole(al::CameraPoser const*); + bool isInvalidEndEntranceCamera(al::CameraPoser const*); + bool isPause(al::CameraPoser const*); + bool isValidGyro(al::CameraPoser const*); + bool isTriggerCameraResetRotate(al::CameraPoser const*); + bool isHoldCameraZoom(al::CameraPoser const*); + bool isHoldCameraSnapShotZoomIn(al::CameraPoser const*); + bool isHoldCameraSnapShotZoomOut(al::CameraPoser const*); + bool isHoldCameraSnapShotRollLeft(al::CameraPoser const*); + bool isHoldCameraSnapShotRollRight(al::CameraPoser const*); + bool isPlayerTypeFlyer(al::CameraPoser const*); + bool isPlayerTypeHighSpeedMove(al::CameraPoser const*); + bool isPlayerTypeHighJump(al::CameraPoser const*); + bool isPlayerTypeNotTouchGround(al::CameraPoser const*); + bool isOnRideObj(al::CameraPoser const*); +} \ No newline at end of file diff --git a/include/al/collision/Collider.h b/include/al/collision/Collider.h new file mode 100644 index 0000000..d52f80f --- /dev/null +++ b/include/al/collision/Collider.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include + +#include "al/hio/HioNode.h" +#include "CollisionDirector.h" + +typedef unsigned int uint; + +namespace al +{ +struct SphereInterpolator; +struct SphereHitInfo; +struct CollisionPartsFilterBase; +struct TriangleFilterBase; + +class Collider : public al::HioNode, public IUseCollision { +public: + Collider(al::CollisionDirector*, sead::Matrix34f const*, sead::Vector3f const*, + sead::Vector3f const*, float, float, uint); + void calcCheckPos(sead::Vector3f*); + void calcMovePowerByContact(sead::Vector3f*, sead::Vector3f const&); + void clear(); + void clearContactPlane(); + void clearStoredPlaneNum(); + sead::Vector3f collide(sead::Vector3f const&); + void findCollidePos(int*, al::SphereInterpolator*, al::SphereHitInfo*, uint); + void getCollisionDirector(); + void getPlane(int); + void getRecentOnGroundNormal(uint); + void obtainMomentFixReaction(al::SphereHitInfo*, sead::Vector3f*, + sead::Vector3f*, bool, uint); + void onInvalidate(); + void preCollide(al::SphereInterpolator*, sead::Vector3f*, float*, sead::Vector3f const&, + al::SphereHitInfo*, uint); + void setCollisionPartsFilter(al::CollisionPartsFilterBase const*); + void setTriangleFilter(al::TriangleFilterBase const *); + void storeContactPlane(al::SphereHitInfo *); + void storeCurrentHitInfo(al::SphereHitInfo *, uint); + void updateRecentOnGroundInfo(); +}; +} // namespace al diff --git a/include/al/collision/CollisionDirector.h b/include/al/collision/CollisionDirector.h new file mode 100644 index 0000000..ae8474d --- /dev/null +++ b/include/al/collision/CollisionDirector.h @@ -0,0 +1,12 @@ +#pragma once + +namespace al +{ + class CollisionDirector; + + class IUseCollision + { + public: + virtual al::CollisionDirector* getCollisionDirector() const = 0; + }; +}; \ No newline at end of file diff --git a/include/al/debug/GpuPerf.h b/include/al/debug/GpuPerf.h new file mode 100644 index 0000000..503ca86 --- /dev/null +++ b/include/al/debug/GpuPerf.h @@ -0,0 +1,19 @@ +#pragma once + +#include "agl/DrawContext.h" +#include "sead/gfx/seadFrameBuffer.h" + +// seems to be a static class for managing agl::fctr::GPUStressChecker +namespace al +{ + class GpuPerf { + public: + GpuPerf(void); + void beginPerf(agl::DrawContext *); + void endPerf(agl::DrawContext *); + void update(void); + void drawResult(agl::DrawContext *,sead::FrameBuffer const*) const; + + // this class has no members + }; +} // namespace al diff --git a/include/al/effect/Effect.h b/include/al/effect/Effect.h new file mode 100644 index 0000000..88a3657 --- /dev/null +++ b/include/al/effect/Effect.h @@ -0,0 +1,9 @@ +#pragma once + +namespace al +{ + class Effect + { + + }; +}; \ No newline at end of file diff --git a/include/al/effect/EffectInfo.h b/include/al/effect/EffectInfo.h new file mode 100644 index 0000000..f126bca --- /dev/null +++ b/include/al/effect/EffectInfo.h @@ -0,0 +1,10 @@ +#pragma once + +namespace al +{ + class EffectInfo + { + public: + + }; +} \ No newline at end of file diff --git a/include/al/effect/EffectKeeper.h b/include/al/effect/EffectKeeper.h new file mode 100644 index 0000000..638a630 --- /dev/null +++ b/include/al/effect/EffectKeeper.h @@ -0,0 +1,17 @@ +#pragma once + +namespace al +{ + class EffectKeeper; + + class IUseEffectKeeper + { + public: + virtual al::EffectKeeper* getEffectKeeper() const = 0; + }; + + class EffectKeeper + { + + }; +} \ No newline at end of file diff --git a/include/al/effect/EffectSystemInfo.h b/include/al/effect/EffectSystemInfo.h new file mode 100644 index 0000000..b6243cf --- /dev/null +++ b/include/al/effect/EffectSystemInfo.h @@ -0,0 +1,8 @@ +#pragma once + +namespace al { + class EffectSystemInfo { + public: + + }; +} \ No newline at end of file diff --git a/include/al/effect/EffectUserInfo.h b/include/al/effect/EffectUserInfo.h new file mode 100644 index 0000000..f4735f2 --- /dev/null +++ b/include/al/effect/EffectUserInfo.h @@ -0,0 +1,19 @@ +#pragma once + +namespace al +{ + class EffectUserInfo + { + public: + EffectUserInfo(); + + unsigned long _0; + int _8; + int _C; + unsigned long _10; + int _18; + int _1C; + unsigned long _20; + unsigned long _28; + }; +}; \ No newline at end of file diff --git a/include/al/event/IEventFlowEventReceiver.h b/include/al/event/IEventFlowEventReceiver.h new file mode 100644 index 0000000..a374c13 --- /dev/null +++ b/include/al/event/IEventFlowEventReceiver.h @@ -0,0 +1,8 @@ +#pragma once + +namespace al +{ + class IEventFlowEventReceiver { + + }; +} // namespace al diff --git a/include/al/execute/ExecuteDirector.h b/include/al/execute/ExecuteDirector.h new file mode 100644 index 0000000..90ca68a --- /dev/null +++ b/include/al/execute/ExecuteDirector.h @@ -0,0 +1,8 @@ +#pragma once + +namespace al +{ + class ExecuteDirector { + public: + }; +} // namespace al diff --git a/include/al/execute/IUseExecutor.h b/include/al/execute/IUseExecutor.h new file mode 100644 index 0000000..a60ae00 --- /dev/null +++ b/include/al/execute/IUseExecutor.h @@ -0,0 +1,9 @@ +#pragma once + +namespace al { +class IUseExecutor { +public: + virtual void execute() = 0; + virtual void draw() = 0; +}; +} \ No newline at end of file diff --git a/include/al/factory/ActorFactory.h b/include/al/factory/ActorFactory.h new file mode 100644 index 0000000..3e6e22d --- /dev/null +++ b/include/al/factory/ActorFactory.h @@ -0,0 +1,29 @@ +#pragma once + +#include "Factory.h" +#include "logger.hpp" + +namespace al { + + template + LiveActor* createActorFunction(const char *name); + + template + LiveActor *createCustomActor(const char *name) + { + return new T(name); + }; + + class LiveActor; + + typedef LiveActor* (*createActor)(const char* name); + + class ActorFactory : public Factory { + public: + ActorFactory(const char *fName) { + this->factoryName = fName; + this->actorTable = nullptr; + this->factoryCount = 0; + }; + }; +} \ No newline at end of file diff --git a/include/al/factory/ActorFactoryEntries100.h b/include/al/factory/ActorFactoryEntries100.h new file mode 100644 index 0000000..99e0685 --- /dev/null +++ b/include/al/factory/ActorFactoryEntries100.h @@ -0,0 +1,645 @@ +#pragma once + +#include "ActorFactory.h" + +#include "actors/PuppetActor.h" +#include "actors/PuppetHackActor.h" + +namespace al +{ + class AllDeadWatcher; + class BgmPlayObj; + class CameraRailHolder; + class CameraWatchPoint; + class RippleFixMapParts; + class EffectObj; + class EffectObj; + class EffectObjCameraEmit; + class EffectObjFollowCamera; + class EffectObjFollowCameraLimit; + class EffectObjInterval; + class EntranceCameraStartObj; + class FogRequester; + class GraphicsObjShadowMaskSphere; + class KeyMoveCameraObj; + class LightningController; + class OccludedEffectRequester; + class OneMeshFixMapParts; + class PrePassLineLight; + class PrePassPointLight; + class PrePassProjLight; + class PrePassProjOrthoLight; + class PrePassSpotLight; + class RippleGeneratePoint; + class RippleGeneratePoint; + class SeBarrierObj; + class SePlayObj; + class SePlayRail; + class Sky; + class SwitchKeyMoveMapParts; + class ThunderRenderRequester; + class WaterAreaMoveModel; + class AtmosScatterRequester; + class BackHideParts; + class ClockMapParts; + class ConveyerMapParts; + class FallMapParts; + class FixMapParts; + class FloaterMapParts; + class FlowMapParts; + class GateMapParts; + class KeyMoveMapParts; + class KeyMoveMapPartsGenerator; + class RailMoveMapParts; + class RollingCubeMapParts; + class RippleFixMapParts; + class RotateMapParts; + class SeesawMapParts; + class SlideMapParts; + class SubActorLodMapParts; + class SurfMapParts; + class SwingMapParts; + class SwitchDitherMapParts; + class SwitchKeepOnWatcher; + class SwitchOpenMapParts; + class VisibleSwitchMapParts; + class WheelMapParts; + class WobbleMapParts; +} // namespace al + +__attribute((used)) static al::NameToCreator actorEntries[] = { + // CUSTOM ACTOR ENTRIES HERE + {"PuppetActor", &al::createCustomActor}, + {"PuppetHackActor", &al::createCustomActor}, + // VANILLA ACTOR ENTRIES + {"AchievementNpc", &al::createActorFunction}, + {"AirBubble", &al::createActorFunction}, + {"AirBubbleGenerator", &al::createActorFunction}, + {"AirCurrent", &al::createActorFunction}, + {"AllDeadWatcher", &al::createActorFunction}, + {"AllDeadWatcherWithShine", &al::createActorFunction}, + {"AmiiboHelpNpc", &al::createActorFunction}, + {"AmiiboNpc", &al::createActorFunction}, + {"AnagramAlphabet", &al::createActorFunction}, + {"Barrel2D", &al::createActorFunction}, + {"BarrelGenerator2D", &al::createActorFunction}, + {"BarrierField", &al::createActorFunction}, + {"BazookaElectric", &al::createActorFunction}, + {"BendLeafTree", &al::createActorFunction}, + {"BgmPlayObj", &al::createActorFunction}, + {"Bird", &al::createActorFunction}, + {"BirdCarryMeat", &al::createActorFunction}, + {"BirdPlayerGlideCtrl", &al::createActorFunction}, + {"BlockBrick", &al::createActorFunction}, + {"BlockBrick2D", &al::createActorFunction}, + {"BlockBrickBig2D", &al::createActorFunction}, + {"BlockEmpty", &al::createActorFunction}, + {"BlockEmpty2D", &al::createActorFunction}, + {"BlockHard", &al::createActorFunction}, + {"ClashWorldBlockHard", &al::createActorFunction}, + {"BlockQuestion", &al::createActorFunction}, + {"CityBlockQuestion", &al::createActorFunction}, + {"BlockQuestion2D", &al::createActorFunction}, + {"BlockTransparent", &al::createActorFunction}, + {"BlockTransparent2D", &al::createActorFunction}, + {"BlowObjBeans", &al::createActorFunction}, + {"BlowObjCan", &al::createActorFunction}, + {"BlowObjGarbageBag", &al::createActorFunction}, + {"BlowObjMushroom", &al::createActorFunction}, + {"BlowObj", &al::createActorFunction}, + {"BombTail", &al::createActorFunction}, + {"BossForest", &al::createActorFunction}, + {"BossForestBlock", &al::createActorFunction}, + {"BossForestWander", &al::createActorFunction}, + {"BossKnuckle", &al::createActorFunction}, + {"BossKnuckleCounterGround", &al::createActorFunction}, + {"BossKnuckleFix", &al::createActorFunction}, + {"BossMagma", &al::createActorFunction}, + {"BossRaid", &al::createActorFunction}, + {"BossRaidNpc", &al::createActorFunction}, + {"BossRaidRivet", &al::createActorFunction}, + {"BreakablePole", &al::createActorFunction}, + {"Breeda", &al::createActorFunction}, + {"Bubble", &al::createActorFunction}, + {"Bubble2D", &al::createActorFunction}, + {"BubbleLauncher", &al::createActorFunction}, + {"Bull", &al::createActorFunction}, + {"Byugo", &al::createActorFunction}, + {"Cactus", &al::createActorFunction}, + {"CactusMini", &al::createActorFunction}, + {"CageShine", &al::createActorFunction}, + {"CageSaveSwitch", &al::createActorFunction}, + {"CageStageSwitch", &al::createActorFunction}, + {"CageBreakable", &al::createActorFunction}, + {"CameraDemoGateMapParts", &al::createActorFunction}, + {"CameraDemoKeyMoveMapParts", &al::createActorFunction}, + {"CameraRailHolder", &al::createActorFunction}, + {"CameraSub", &al::createActorFunction}, + {"CameraWatchPoint", &al::createActorFunction}, + {"Candlestand", &al::createActorFunction}, + {"CandlestandFire", &al::createActorFunction}, + {"CandlestandInitializer", &al::createActorFunction}, + {"CandlestandBgmDirector", &al::createActorFunction}, + {"CandlestandSaveWatcher", &al::createActorFunction}, + {"CandlestandWatcher", &al::createActorFunction}, + {"CapAccelerator", &al::createActorFunction}, + {"CapAcceleratorKeyMoveMapParts", &al::createActorFunction}, + {"CapAppearMapParts", &al::createActorFunction}, + {"CapBeamer", &al::createActorFunction}, + {"CapBomb", &al::createActorFunction}, + {"CapCatapult", &al::createActorFunction}, + {"CapFlower", &al::createActorFunction}, + {"CapFlowerGroup", &al::createActorFunction}, + {"CapHanger", &al::createActorFunction}, + {"CapMessageAfterInformation", &al::createActorFunction}, + {"CapRack", &al::createActorFunction}, + {"CapRackTimer", &al::createActorFunction}, + {"CapRailMover", &al::createActorFunction}, + {"CapSlotBase", &al::createActorFunction}, + {"CapSwitch", &al::createActorFunction}, + {"CapSwitchSave", &al::createActorFunction}, + {"CapSwitchTimer", &al::createActorFunction}, + {"CapThrower", &al::createActorFunction}, + {"CapTrampoline", &al::createActorFunction}, + {"Car", &al::createActorFunction}, + {"CarSandWorld", &al::createActorFunction}, + {"CarWatcher", &al::createActorFunction}, + {"CardboardBox", &al::createActorFunction}, + {"CatchBomb", &al::createActorFunction}, + {"Chair", &al::createActorFunction}, + {"CheckpointFlag", &al::createActorFunction}, + {"ChorobonHolder", &al::createActorFunction}, + {"ChurchDoor", &al::createActorFunction}, + {"CityBuilding", &al::createActorFunction}, + {"CityStreetlight", &al::createActorFunction}, + {"CityWorldSign", &al::createActorFunction}, + {"CityWorldUndergroundMachine", &al::createActorFunction}, + {"CitySign", &al::createActorFunction}, + {"CitySignal", &al::createActorFunction}, + {"CityWorldTable", &al::createActorFunction}, + {"Closet", &al::createActorFunction}, + {"CloudStep", &al::createActorFunction}, + {"CollapseSandHill", &al::createActorFunction}, + {"CollectAnimalWatcher", &al::createActorFunction}, + {"CollectBgmSpeaker", &al::createActorFunction}, + {"CollectionList", &al::createActorFunction}, + {"Coin", &al::createActorFunction}, + {"Coin2D", &al::createActorFunction}, + {"Coin2DCityDirector", &al::createActorFunction}, + {"CoinBlow", &al::createActorFunction}, + {"CoinChameleon", &al::createActorFunction}, + {"CoinCirclePlacement", &al::createActorFunction}, + {"CoinCollect", &al::createActorFunction}, + {"CoinCollectHintObj", &al::createActorFunction}, + {"CoinCollect2D", &al::createActorFunction}, + {"CoinLead", &al::createActorFunction}, + {"CoinRail", &al::createActorFunction}, + {"CoinRing", &al::createActorFunction}, + {"CoinStackGroup", &al::createActorFunction}, + {"CrystalBreakable", &al::createActorFunction}, + {"DamageBallGenerator", &al::createActorFunction}, + {"DelaySwitch", &al::createActorFunction}, + {"DemoActorCapManHero", &al::createActorFunction}, + {"DemoActorCapManHeroine", &al::createActorFunction}, + {"DemoActorKoopaShip", &al::createActorFunction}, + {"DemoActorHack", &al::createActorFunction}, + {"DemoActorPeach", &al::createActorFunction}, + {"DemoActorShineTower", &al::createActorFunction}, + {"DemoPeachWorldHomeWater001", &al::createActorFunction}, + {"DemoChangeEffectObj", &al::createActorFunction}, + {"DemoWorldMoveHomeBackGround", &al::createActorFunction}, + {"DemoPeachWedding", &al::createActorFunction}, + {"DemoPlayer", &al::createActorFunction}, + {"DemoPlayerCap", &al::createActorFunction}, + {"DigPoint", &al::createActorFunction}, + {"DigPointHintPhoto", &al::createActorFunction}, + {"DigPointWater", &al::createActorFunction}, + {"DirectionFixedBillboard", &al::createActorFunction}, + {"Dokan", &al::createActorFunction}, + {"DokanKoopa", &al::createActorFunction}, + {"DokanMaze", &al::createActorFunction}, + {"DokanMazeDirector", &al::createActorFunction}, + {"DokanStageChange", &al::createActorFunction}, + {"DonkeyKong2D", &al::createActorFunction}, + {"Donsuke", &al::createActorFunction}, + {"Doshi", &al::createActorFunction}, + {"DoorAreaChange", &al::createActorFunction}, + {"DoorAreaChangeCap", &al::createActorFunction}, + {"DoorCity", &al::createActorFunction}, + {"DoorSnow", &al::createActorFunction}, + {"DoorWarp", &al::createActorFunction}, + {"DoorWarpStageChange", &al::createActorFunction}, + {"EchoBlockMapParts", &al::createActorFunction}, + {"EffectObj", &al::createActorFunction}, + {"EffectObjScale", &al::createActorFunction}, + {"EffectObjAlpha", &al::createActorFunction}, + {"EffectObjCameraEmit", &al::createActorFunction}, + {"EffectObjFollowCamera", &al::createActorFunction}, + {"EffectObjFollowCameraLimit", &al::createActorFunction}, + {"EffectObjInterval", &al::createActorFunction}, + {"EffectObjNpcManFar", &al::createActorFunction}, + {"EffectObjQualityChange", &al::createActorFunction}, + {"ElectricWire", &al::createActorFunction}, + {"ElectricWireKoopa", &al::createActorFunction}, + {"EntranceCameraStartObj", &al::createActorFunction}, + {"EventKeyMoveCameraObjNoDemo", &al::createActorFunction}, + {"EventKeyMoveCameraObjWithDemo", &al::createActorFunction}, + {"FigureWalkingNpc", &al::createActorFunction}, + {"FireBlower", &al::createActorFunction}, + {"FireBrosPossessed", &al::createActorFunction}, + {"FireSwitch", &al::createActorFunction}, + {"FireHydrant", &al::createActorFunction}, + {"FireDrum2D", &al::createActorFunction}, + {"FishingFish", &al::createActorFunction}, + {"FixMapParts2D", &al::createActorFunction}, + {"FixMapPartsAppearKillAsync", &al::createActorFunction}, + {"FixMapPartsBgmChangeAction", &al::createActorFunction}, + {"FixMapPartsCapHanger", &al::createActorFunction}, + {"FixMapPartsDitherAppear", &al::createActorFunction}, + {"FixMapPartsForceSafetyPoint", &al::createActorFunction}, + {"FixMapPartsFukankunZoomCapMessage", &al::createActorFunction}, + {"FixMapPartsScenarioAction", &al::createActorFunction}, + {"FlyObject", &al::createActorFunction}, + {"ForestManSeed", &al::createActorFunction}, + {"ForestWorldHomeBreakParts000", &al::createActorFunction}, + {"FogRequester", &al::createActorFunction}, + {"FrailBox", &al::createActorFunction}, + {"Frog", &al::createActorFunction}, + {"Fukankun", &al::createActorFunction}, + {"FukankunZoomCapMessageSun", &al::createActorFunction}, + {"FukuwaraiWatcher", &al::createActorFunction}, + {"ForestWorldEnergyStand", &al::createActorFunction}, + {"ForestWorldFlowerCtrl", &al::createActorFunction}, + {"GabuZou", &al::createActorFunction}, + {"GabuZouGroup", &al::createActorFunction}, + {"Gamane", &al::createActorFunction}, + {"GiantWanderBoss", &al::createActorFunction}, + {"GoalMark", &al::createActorFunction}, + {"GolemClimb", &al::createActorFunction}, + {"Gotogoton", &al::createActorFunction}, + {"GotogotonGoal", &al::createActorFunction}, + {"GraphicsObjShadowMaskCube", &al::createActorFunction}, + {"GraphicsObjShadowMaskSphere", &al::createActorFunction}, + {"GrowerBug", &al::createActorFunction}, + {"GrowerWorm", &al::createActorFunction}, + {"GrowFlowerCoin", &al::createActorFunction}, + {"GrowFlowerWatcher", &al::createActorFunction}, + {"GrowPlantGrowPlace", &al::createActorFunction}, + {"GrowPlantSeed", &al::createActorFunction}, + {"GrowPlantStartStage", &al::createActorFunction}, + {"GrowPlantWatcher", &al::createActorFunction}, + {"Gunetter", &al::createActorFunction}, + {"GunetterMove", &al::createActorFunction}, + {"HackCar", &al::createActorFunction}, + {"HackFork", &al::createActorFunction}, + {"HammerBrosPossessed", &al::createActorFunction}, + {"HammerBros2D", &al::createActorFunction}, + {"HelpNpc", &al::createActorFunction}, + {"HintNpc", &al::createActorFunction}, + {"HintPhoto", &al::createActorFunction}, + {"HintRouteGuidePoint", &al::createActorFunction}, + {"HipDropSwitch", &al::createActorFunction}, + {"HipDropSwitchSave", &al::createActorFunction}, + {"HipDropSwitchTimer", &al::createActorFunction}, + {"HipDropTile", &al::createActorFunction}, + {"HipDropMoveLift", &al::createActorFunction}, + {"HipDropRepairParts", &al::createActorFunction}, + {"HipDropTransformPartsWatcher", &al::createActorFunction}, + {"HomeBed", &al::createActorFunction}, + {"HomeChair", &al::createActorFunction}, + {"HomeInside", &al::createActorFunction}, + {"HomeShip", &al::createActorFunction}, + {"Hosui", &al::createActorFunction}, + {"IcicleFall", &al::createActorFunction}, + {"Imomu", &al::createActorFunction}, + {"IndicatorDirector", &al::createActorFunction}, + {"Jango", &al::createActorFunction}, + {"Joku", &al::createActorFunction}, + {"JugemFishing", &al::createActorFunction}, + {"JumpingRopeNpc", &al::createActorFunction}, + {"Kakku", &al::createActorFunction}, + {"KaronWing", &al::createActorFunction}, + {"KeyMoveCameraFix", &al::createActorFunction}, + {"KickStone", &al::createActorFunction}, + {"KillerLauncher", &al::createActorFunction}, + {"KillerLauncherDot", &al::createActorFunction}, + {"KinokoUfo", &al::createActorFunction}, + {"Koopa", &al::createActorFunction}, + {"KoopaCapPlayer", &al::createActorFunction}, + {"KoopaChurch", &al::createActorFunction}, + {"KoopaLv1", &al::createActorFunction}, + {"KoopaLv2", &al::createActorFunction}, + {"KoopaLv3", &al::createActorFunction}, + {"KoopaShip", &al::createActorFunction}, + {"Kuribo2D3D", &al::createActorFunction}, + {"KuriboGenerator2D3D", &al::createActorFunction}, + {"KuriboGirl", &al::createActorFunction}, + {"KuriboPossessed", &al::createActorFunction}, + {"KuriboMini", &al::createActorFunction}, + {"KuriboTowerSwitch", &al::createActorFunction}, + {"KuriboWing", &al::createActorFunction}, + {"LavaFryingPan", &al::createActorFunction}, + {"LavaStewVeget", &al::createActorFunction}, + {"LavaPan", &al::createActorFunction}, + {"LavaWave", &al::createActorFunction}, + {"LifeMaxUpItem", &al::createActorFunction}, + {"LifeMaxUpItem2D", &al::createActorFunction}, + {"LifeUpItem", &al::createActorFunction}, + {"LifeUpItem2D", &al::createActorFunction}, + {"LightningController", &al::createActorFunction}, + {"LongGenerator", &al::createActorFunction}, + {"MarchingCubeBlock", &al::createActorFunction}, + {"MapPartsRoulette", &al::createActorFunction}, + {"Megane", &al::createActorFunction}, + {"MeganeLiftExLift", &al::createActorFunction}, + {"MeganeKeyMoveMapParts", &al::createActorFunction}, + {"MeganeMapParts", &al::createActorFunction}, + {"Mirror", &al::createActorFunction}, + {"MoonBasementBreakParts", &al::createActorFunction}, + {"MoonBasementClimaxWatcher", &al::createActorFunction}, + {"MoonBasementFallObj", &al::createActorFunction}, + {"MoonBasementFinalGate", &al::createActorFunction}, + {"MoonBasementFallObjDecoration", &al::createActorFunction}, + {"MoonBasementFloor", &al::createActorFunction}, + {"MoonBasementGate", &al::createActorFunction}, + {"MoonBasementMeteorAreaObj", &al::createActorFunction}, + {"MoonBasementPillar", &al::createActorFunction}, + {"MoonBasementRock", &al::createActorFunction}, + {"MoonBasementSlideObj", &al::createActorFunction}, + {"MoonRock", &al::createActorFunction}, + {"MoonWorldBell", &al::createActorFunction}, + {"MoonWorldCaptureParadeLift", &al::createActorFunction}, + {"Mofumofu", &al::createActorFunction}, + {"MofumofuLv2", &al::createActorFunction}, + {"MofumofuScrap", &al::createActorFunction}, + {"Motorcycle", &al::createActorFunction}, + {"MotorcycleParkingLot", &al::createActorFunction}, + {"MoveHomeNpc", &al::createActorFunction}, + {"MoviePlayerMapParts", &al::createActorFunction}, + {"MultiGateKeeperBonfire", &al::createActorFunction}, + {"MultiGateKeeperWatcher", &al::createActorFunction}, + {"Mummy", &al::createActorFunction}, + {"MummyGenerator", &al::createActorFunction}, + {"NeedleTrap", &al::createActorFunction}, + {"Nokonoko2D", &al::createActorFunction}, + {"NoteObjFirst", &al::createActorFunction}, + {"NoteObjFirst2D", &al::createActorFunction}, + {"NoteObjDirector", &al::createActorFunction}, + {"Objex", &al::createActorFunction}, + {"OccludedEffectRequester", &al::createActorFunction}, + {"OceanWave", &al::createActorFunction}, + {"CloudOcean", &al::createActorFunction}, + {"DemoCloudOcean", &al::createActorFunction}, + {"OneMeshFixMapParts", &al::createActorFunction}, + {"OpeningStageStartDemo", &al::createActorFunction}, + {"PackunFire", &al::createActorFunction}, + {"PadRumblePoint", &al::createActorFunction}, + {"PaintObj", &al::createActorFunction}, + {"PaulineAtCeremony", &al::createActorFunction}, + {"PaulineAudience", &al::createActorFunction}, + {"PeachWorldHomeCastleCap", &al::createActorFunction}, + {"PeachWorldGate", &al::createActorFunction}, + {"PeachWorldMoatWater", &al::createActorFunction}, + {"PeachWorldTree", &al::createActorFunction}, + {"Pecho", &al::createActorFunction}, + {"Pen", &al::createActorFunction}, + {"PictureStageChange", &al::createActorFunction}, + {"PillarKeyMoveParts", &al::createActorFunction}, + {"PillarSwitchOpenMapParts", &al::createActorFunction}, + {"PlayerMotionObserver", &al::createActorFunction}, + {"PlayerStartObj", &al::createActorFunction}, + {"PlayerSubjectiveWatchCheckObj", &al::createActorFunction}, + {"PlayGuideBoard", &al::createActorFunction}, + {"PlayRecorder", &al::createActorFunction}, + {"PlayerStartObjNoLink", &al::createActorFunction}, + {"PochiHintPhoto", &al::createActorFunction}, + {"Poetter", &al::createActorFunction}, + {"PoleClimbParts", &al::createActorFunction}, + {"PoleClimbPartsBreak", &al::createActorFunction}, + {"PoleGrabCeil", &al::createActorFunction}, + {"PoleGrabCeilKeyMoveParts", &al::createActorFunction}, + {"PopnGenerator", &al::createActorFunction}, + {"LavaWorldPoster", &al::createActorFunction}, + {"PosterCeremony", &al::createActorFunction}, + {"PosterWedding", &al::createActorFunction}, + {"ReactionObjectSkyRhythm", &al::createActorFunction}, + {"PosterWatcher", &al::createActorFunction}, + {"PrePassCausticsLight", &al::createActorFunction}, + {"PrePassLineLight", &al::createActorFunction}, + {"PrePassPointLight", &al::createActorFunction}, + {"PrePassProjLight", &al::createActorFunction}, + {"PrePassProjOrthoLight", &al::createActorFunction}, + {"PrePassSpotLight", &al::createActorFunction}, + {"ProjectRaceCheckPoint", &al::createActorFunction}, + {"Pyramid", &al::createActorFunction}, + {"QuestObj", &al::createActorFunction}, + {"RabbitGraph", &al::createActorFunction}, + {"RaceAudienceNpc", &al::createActorFunction}, + {"RaceManGoal", &al::createActorFunction}, + {"RaceManRace", &al::createActorFunction}, + {"RaceManStart", &al::createActorFunction}, + {"RaceWatcher", &al::createActorFunction}, + {"RadiConRaceWatcher", &al::createActorFunction}, + {"RadioCassette", &al::createActorFunction}, + {"RadiconNpc", &al::createActorFunction}, + {"Radish", &al::createActorFunction}, + {"RadishGold", &al::createActorFunction}, + {"RailDrawer", &al::createActorFunction}, + {"RankingNpc", &al::createActorFunction}, + {"ReactionObject", &al::createActorFunction}, + {"CarBreakable", &al::createActorFunction}, + {"ReactionObjectDotCharacter", &al::createActorFunction}, + {"ReflectBombGenerator", &al::createActorFunction}, + {"RhythmSpotlight", &al::createActorFunction}, + {"RippleGeneratePoint", &al::createActorFunction}, + {"RippleGenerateSquare", &al::createActorFunction}, + {"RotateTarget", &al::createActorFunction}, + {"RouletteSwitch", &al::createActorFunction}, + {"RouteGuideArrow", &al::createActorFunction}, + {"RouteGuideRail", &al::createActorFunction}, + {"RunAwayNpc", &al::createActorFunction}, + {"SandGeyser", &al::createActorFunction}, + {"SandWorldHomeLift", &al::createActorFunction}, + {"SaucePan", &al::createActorFunction}, + {"SaveFlagCheckObj", &al::createActorFunction}, + {"ScenarioStartCameraAnim", &al::createActorFunction}, + {"ScenarioStartCameraSimpleZoom", &al::createActorFunction}, + {"ScenarioStartCameraRailMove", &al::createActorFunction}, + {"Senobi", &al::createActorFunction}, + {"SenobiGeneratePoint", &al::createActorFunction}, + {"SenobiMoveMapParts", &al::createActorFunction}, + {"SenobiMoveMapPartsConnector", &al::createActorFunction}, + {"SeBarrierObj", &al::createActorFunction}, + {"SePlayObj", &al::createActorFunction}, + {"SePlayObjWithSave", &al::createActorFunction}, + {"SePlayRail", &al::createActorFunction}, + {"SequentialSwitch", &al::createActorFunction}, + {"SessionBgmCtrlObj", &al::createActorFunction}, + {"SessionMayorNpc", &al::createActorFunction}, + {"SessionMusicianNpc", &al::createActorFunction}, + {"Shibaken", &al::createActorFunction}, + {"ShibakenHomeShipInside", &al::createActorFunction}, + {"Shine", &al::createActorFunction}, + {"ShineWithAppearCamera", &al::createActorFunction}, + {"ShineChipWatcher", &al::createActorFunction}, + {"ShineDot", &al::createActorFunction}, + {"ShineFukankunWatchObj", &al::createActorFunction}, + {"ShineTowerRocket", &al::createActorFunction}, + {"ShopBgmPlayer", &al::createActorFunction}, + {"ShopMark", &al::createActorFunction}, + {"ShoppingWatcher", &al::createActorFunction}, + {"SignBoardDanger", &al::createActorFunction}, + {"SignBoardLayoutTexture", &al::createActorFunction}, + {"SkyFukankunZoomCapMessage", &al::createActorFunction}, + {"SkyWorldCloud", &al::createActorFunction}, + {"SkyWorldKoopaFire", &al::createActorFunction}, + {"SkyWorldKoopaFrame", &al::createActorFunction}, + {"SkyWorldMiddleViewCloud", &al::createActorFunction}, + {"SignBoard", &al::createActorFunction}, + {"SnowWorldBigIcicle", &al::createActorFunction}, + {"SnowWorldSequenceFlagCheckObj", &al::createActorFunction}, + {"Sky", &al::createActorFunction}, + {"SmallWanderBoss", &al::createActorFunction}, + {"SneakingMan", &al::createActorFunction}, + {"SnowManRaceNpc", &al::createActorFunction}, + {"SnowVolume", &al::createActorFunction}, + {"SnowVolumeEraser", &al::createActorFunction}, + {"Souvenir", &al::createActorFunction}, + {"SouvenirDirector", &al::createActorFunction}, + {"Special2KeyMoveLift", &al::createActorFunction}, + {"Special2KeyMoveParts", &al::createActorFunction}, + {"SphinxQuiz", &al::createActorFunction}, + {"SphinxRide", &al::createActorFunction}, + {"SphinxTaxiWatcher", &al::createActorFunction}, + {"Squirrel", &al::createActorFunction}, + {"Stacker", &al::createActorFunction}, + {"StackerCapWorldCtrl", &al::createActorFunction}, + {"StageEventDemo", &al::createActorFunction}, + {"StageSwitchSelector", &al::createActorFunction}, + {"StageTalkDemoNpcCap", &al::createActorFunction}, + {"StageTalkDemoNpcCapMoonRock", &al::createActorFunction}, + {"Stake", &al::createActorFunction}, + {"Statue", &al::createActorFunction}, + {"StatueSnapMark", &al::createActorFunction}, + {"SubActorLodFixPartsScenarioAction", &al::createActorFunction}, + {"SwitchAnd", &al::createActorFunction}, + {"SwitchKeyMoveMapParts", &al::createActorFunction}, + {"TalkMessageInfoPoint", &al::createActorFunction}, + {"TalkMessageInfoPointSaveObj", &al::createActorFunction}, + {"TalkNpc", &al::createActorFunction}, + {"TalkNpcFreeze", &al::createActorFunction}, + {"TalkNpcCapMan", &al::createActorFunction}, + {"TalkNpcCapManHero", &al::createActorFunction}, + {"TalkNpcCityMan", &al::createActorFunction}, + {"TalkNpcCityManLow", &al::createActorFunction}, + {"TalkNpcCityManSit", &al::createActorFunction}, + {"TalkNpcCityMayor", &al::createActorFunction}, + {"TalkNpcCollectBgm", &al::createActorFunction}, + {"TalkNpcDesertMan", &al::createActorFunction}, + {"TalkNpcForestMan", &al::createActorFunction}, + {"TalkNpcForestManScrap", &al::createActorFunction}, + {"TalkNpcKinopio", &al::createActorFunction}, + {"TalkNpcKinopioBrigade", &al::createActorFunction}, + {"TalkNpcKinopioMember", &al::createActorFunction}, + {"TalkNpcLakeMan", &al::createActorFunction}, + {"TalkNpcLavaMan", &al::createActorFunction}, + {"TalkNpcLavaManCook", &al::createActorFunction}, + {"TalkNpcLifeUpItemSeller", &al::createActorFunction}, + {"TalkNpcRabbit", &al::createActorFunction}, + {"TalkNpcSeaMan", &al::createActorFunction}, + {"TalkNpcSnowMan", &al::createActorFunction}, + {"TalkNpcSnowManLeader", &al::createActorFunction}, + {"TalkNpcSnowManRacer", &al::createActorFunction}, + {"TalkPoint", &al::createActorFunction}, + {"Tank", &al::createActorFunction}, + {"TankReviveCtrl", &al::createActorFunction}, + {"TaxiStop", &al::createActorFunction}, + {"TextureReplaceScreen", &al::createActorFunction}, + {"ThunderRenderRequester", &al::createActorFunction}, + {"Togezo", &al::createActorFunction}, + {"Togezo2D", &al::createActorFunction}, + {"TokimekiMayorNpc", &al::createActorFunction}, + {"TrampleBush", &al::createActorFunction}, + {"TrampleSwitch", &al::createActorFunction}, + {"TrampleSwitchSave", &al::createActorFunction}, + {"TrampleSwitchTimer", &al::createActorFunction}, + {"TransparentWall", &al::createActorFunction}, + {"TreasureBox", &al::createActorFunction}, + {"TreasureBoxKey", &al::createActorFunction}, + {"TreasureBoxSequentialDirector", &al::createActorFunction}, + {"TRex", &al::createActorFunction}, + {"TRexForceScroll", &al::createActorFunction}, + {"TRexPatrol", &al::createActorFunction}, + {"TRexSleep", &al::createActorFunction}, + {"TRexScrollBreakMapParts", &al::createActorFunction}, + {"Tsukkun", &al::createActorFunction}, + {"TsukkunHole", &al::createActorFunction}, + {"TwistChainList", &al::createActorFunction}, + {"Utsubo", &al::createActorFunction}, + {"UtsuboWatcher", &al::createActorFunction}, + {"VocalMike", &al::createActorFunction}, + {"VolleyballBase", &al::createActorFunction}, + {"VolleyballNet", &al::createActorFunction}, + {"VolleyballNpc", &al::createActorFunction}, + {"Wanwan", &al::createActorFunction}, + {"WanwanHole", &al::createActorFunction}, + {"WaterAreaMoveModel", &al::createActorFunction}, + {"WaterfallWorldBigBreakableWall", &al::createActorFunction}, + {"WaterfallWorldFallDownBridge", &al::createActorFunction}, + {"WaterfallWorldHomeCage", &al::createActorFunction}, + {"WaterfallWorldWaterfall", &al::createActorFunction}, + {"WaterRoad", &al::createActorFunction}, + {"WeightSwitch", &al::createActorFunction}, + {"WheelWaveSurfParts", &al::createActorFunction}, + {"WindBlowPuzzle", &al::createActorFunction}, + {"WorldMapEarth", &al::createActorFunction}, + {"WorldTravelingNpc", &al::createActorFunction}, + {"WorldTravelingPeach", &al::createActorFunction}, + {"WorldWarpHole", &al::createActorFunction}, + {"Fastener", &al::createActorFunction}, + {"FastenerObj", &al::createActorFunction}, + {"AtmosScatterRequester", &al::createActorFunction}, + {"BackHideParts", &al::createActorFunction}, + {"BreakMapParts", &al::createActorFunction}, + {"CapRotateMapParts", &al::createActorFunction}, + {"ClockMapParts", &al::createActorFunction}, + {"ConveyerMapParts", &al::createActorFunction}, + {"FallMapParts", &al::createActorFunction}, + {"FixMapParts", &al::createActorFunction}, + {"FloaterMapParts", &al::createActorFunction}, + {"FlowMapParts", &al::createActorFunction}, + {"GateMapParts", &al::createActorFunction}, + {"KeyMoveMapParts", &al::createActorFunction}, + {"KeyMoveMapPartsGenerator", &al::createActorFunction}, + {"PossessedMapParts", &al::createActorFunction}, + {"Pukupuku", &al::createActorFunction}, + {"PulseSwitch", &al::createActorFunction}, + {"RailCollision", &al::createActorFunction}, + {"RailMoveMapParts", &al::createActorFunction}, + {"RiseMapParts", &al::createActorFunction}, + {"ReactionMapParts", &al::createActorFunction}, + {"RiseMapPartsHolder", &al::createActorFunction}, + {"RocketFlower", &al::createActorFunction}, + {"RollingCubeMapParts", &al::createActorFunction}, + {"RippleFixMapParts", &al::createActorFunction}, + {"RotateMapParts", &al::createActorFunction}, + {"SeesawMapParts", &al::createActorFunction}, + {"SlideMapParts", &al::createActorFunction}, + {"SubActorLodMapParts", &al::createActorFunction}, + {"SurfMapParts", &al::createActorFunction}, + {"SwingMapParts", &al::createActorFunction}, + {"SwitchDitherMapParts", &al::createActorFunction}, + {"SwitchKeepOnWatcher", &al::createActorFunction}, + {"SwitchOpenMapParts", &al::createActorFunction}, + {"VisibleSwitchMapParts", &al::createActorFunction}, + {"WaveSurfMapParts", &al::createActorFunction}, + {"WheelMapParts", &al::createActorFunction}, + {"WobbleMapParts", &al::createActorFunction}, + {"WindBlowMapParts", &al::createActorFunction}, + {"Yoshi", &al::createActorFunction}, + {"YoshiFruit", &al::createActorFunction}, + {"YoshiFruitShineHolder", &al::createActorFunction}, + {"Yukimaru", &al::createActorFunction}, + {"YukimaruRacer", &al::createActorFunction}, + {"YukimaruRacerTiago", &al::createActorFunction} +}; \ No newline at end of file diff --git a/include/al/factory/CameraPoserFactory.h b/include/al/factory/CameraPoserFactory.h new file mode 100644 index 0000000..a6e68c5 --- /dev/null +++ b/include/al/factory/CameraPoserFactory.h @@ -0,0 +1,41 @@ +#pragma once + +#include "Factory.h" + +namespace al { + + class CameraPoser; + + template + CameraPoser* createCameraPoserFunction(const char *name); + + typedef CameraPoser* (*createCameraPoser)(const char* name); + + class CameraPoserFactory : public Factory { + public: + CameraPoserFactory(const char *fName) __attribute__((noinline)) { + this->factoryName = fName; + this->actorTable = nullptr; + this->factoryCount = 0; + }; + + virtual CameraPoser *createEntranceCameraPoser(void) const; + // return new al::CameraPoserEntrance(スタート); + + int mLastUsedIndex = 0; + }; +} + +namespace alCameraPoserFactoryFunction { + void initAndCreateTableFromOtherTable2(al::CameraPoserFactory *,al::NameToCreator const*,int,al::NameToCreator const*,int); + void initAndCreateTableWithAnotherFactory(al::CameraPoserFactory *,al::CameraPoserFactory const*,al::NameToCreator const*,int); + void initAndCreateTableWithPresetPosers(al::CameraPoserFactory *,al::NameToCreator const*,int); +} + +namespace cc { + template + al::CameraPoser *createCustomCameraPoser(const char *name) + { + return new T(name); + }; +} \ No newline at end of file diff --git a/include/al/factory/CameraPoserFactoryEntries100.h b/include/al/factory/CameraPoserFactoryEntries100.h new file mode 100644 index 0000000..b0368ca --- /dev/null +++ b/include/al/factory/CameraPoserFactoryEntries100.h @@ -0,0 +1,70 @@ +#pragma once + +#include "CameraPoserFactory.h" +#include "al/factory/Factory.h" + +#include "cameras/CameraPoserCustom.h" + +class CameraPoserFollowLimit; +class ScenarioStartCameraPoserSimpleZoom; +class ScenarioStartCameraPoserRailMove; + +namespace al { + class CameraPoserFix; + class CameraPoserFixPoint; + class CameraPoserRace; + class CameraPoserRailMoveLookAt; + class CameraPoserKinopioBrigade; + class CameraPoserTalk; + class CameraPoserRailMoveMovie; + class CameraPoserBossBattle; + class CameraPoserEntrance; + class CameraPoserLookBoard; + class CameraPoserLookDown; + class CameraPoserSubjective; + class CameraPoserTower; + class KeyMoveCameraFix; + class KeyMoveCameraRailMove; + class KeyMoveCameraZoom; + class CameraPoserFix; + class CameraPoserFix; + class CameraPoserFix; + class CameraPoserFix; + class CameraPoserFix; + class CameraPoserFix; + class CameraPoserFix; +} +// 0xE in size +static al::NameToCreator poserEntries[] = { + {"制限付きフォロー", &al::createCameraPoserFunction}, + {"制限付き平行", &al::createCameraPoserFunction}, + {"2D平行", &al::createCameraPoserFunction}, + {"固定", &al::createCameraPoserFunction}, + {"完全固定", &al::createCameraPoserFunction}, + {"出入口専用固定", &al::createCameraPoserFunction}, + {"定点", &al::createCameraPoserFunction}, + {"その場定点", &al::createCameraPoserFunction}, + {"完全追従定点", &al::createCameraPoserFunction}, + {"レース", &al::createCameraPoserFunction}, + {"レール移動", &al::createCameraPoserFunction}, + {"キノピオ探検隊", &al::createCameraPoserFunction}, + {"会話用2点間", &al::createCameraPoserFunction}, + {"映像撮影レール", &al::createCameraPoserFunction}, + // Custom Posers + {"CameraPoserCustom", &cc::createCustomCameraPoser} // al::CameraPoserFollowSimple +}; + +// 0xB in size +static al::NameToCreator poserEntries2[] = { + {"ボス戦カメラ", &al::createCameraPoserFunction}, + {"スタート", &al::createCameraPoserFunction}, + {"看板用2点間", &al::createCameraPoserFunction}, + {"見下ろし", &al::createCameraPoserFunction}, + {"主観", &al::createCameraPoserFunction}, + {"塔", &al::createCameraPoserFunction}, + {"キー移動固定", &al::createCameraPoserFunction}, + {"キー移動レール移動", &al::createCameraPoserFunction}, + {"キー移動ズーム", &al::createCameraPoserFunction}, + {"シナリオ紹介シンプルズームカメラ", &al::createCameraPoserFunction}, + {"シナリオ紹介レール移動カメラ", &al::createCameraPoserFunction}, +}; \ No newline at end of file diff --git a/include/al/factory/Factory.h b/include/al/factory/Factory.h new file mode 100644 index 0000000..40c91e8 --- /dev/null +++ b/include/al/factory/Factory.h @@ -0,0 +1,42 @@ +#pragma once + +#include "types.h" +#include "al/util.hpp" +#include "logger.hpp" + +namespace al +{ + template + struct NameToCreator + { + const char* creatorName; + T createActorFunction; + }; + + template + class Factory { + public: + inline Factory() {}; + + virtual const char * convertName(char const *name) const { + return name; + }; + + inline T getCreator(const char *name) { + for (size_t i = 0; i < this->factoryCount; i++) + { + if(isEqualString(this->actorTable[i].creatorName, name)) { + return this->actorTable[i].createActorFunction; + } + } + return nullptr; + }; + + protected: + // 0x0 is vtable + const char *factoryName; // 0x8 + const al::NameToCreator *actorTable; // 0x10 + int factoryCount; // 0x18 + }; + +} // namespace al diff --git a/include/al/factory/ProjectActorFactory.h b/include/al/factory/ProjectActorFactory.h new file mode 100644 index 0000000..dacf869 --- /dev/null +++ b/include/al/factory/ProjectActorFactory.h @@ -0,0 +1,9 @@ +#pragma once + +#include "ActorFactory.h" +#include "ActorFactoryEntries100.h" + +class ProjectActorFactory : public al::ActorFactory { + public: + ProjectActorFactory(); +}; diff --git a/include/al/factory/ProjectCameraPoserFactory.h b/include/al/factory/ProjectCameraPoserFactory.h new file mode 100644 index 0000000..e2f39aa --- /dev/null +++ b/include/al/factory/ProjectCameraPoserFactory.h @@ -0,0 +1,9 @@ +#pragma once + +#include "CameraPoserFactoryEntries100.h" +#include "CameraPoserFactory.h" + +class ProjectCameraPoserFactory : public al::CameraPoserFactory { + public: + ProjectCameraPoserFactory(); +}; diff --git a/include/al/gamepad/util.h b/include/al/gamepad/util.h new file mode 100644 index 0000000..a0c62aa --- /dev/null +++ b/include/al/gamepad/util.h @@ -0,0 +1,9 @@ +#pragma once + +namespace al { + class GamePadSystem { + public: + void changeSinglePlayMode(void); + void changeMultiPlayMode(int, int); + }; +} \ No newline at end of file diff --git a/include/al/hio/HioNode.h b/include/al/hio/HioNode.h new file mode 100644 index 0000000..dbd2452 --- /dev/null +++ b/include/al/hio/HioNode.h @@ -0,0 +1,16 @@ +#pragma once + +namespace al +{ + class IUseHioNode + { + public: + // ?? + }; + + class HioNode : public IUseHioNode + { + public: + // ?? + }; +}; \ No newline at end of file diff --git a/include/al/layout/BalloonMessage.h b/include/al/layout/BalloonMessage.h new file mode 100644 index 0000000..cbcad40 --- /dev/null +++ b/include/al/layout/BalloonMessage.h @@ -0,0 +1,68 @@ +#pragma once + +#include "LayoutActor.h" +#include "TalkMessageVoicePlayer.h" + +namespace al { + + struct BalloonMessageInitParam { + const char *mActorName; // 0x0 + const char *mLayoutName; // 0x8 + const char *mPaneName; // 0x10 + const char *mMessage; // 0x18 + float mStartDist; // 0x20 + float mEndDist; // 0x24 + const char *mGroupName; // 0x28 + float mActorOffset; // 0x30 + int mPlayerIndex; // 0x34 + int mIsUseSub; // 0x38 + bool mIsHideIfNotVis; // 0x3C + }; + + class BalloonMessage : public LayoutActor { + public: + BalloonMessage(const al::LiveActor*, const al::LayoutInitInfo&, + const al::BalloonMessageInitParam&, bool isUseDistance); + + void appear(void) override; + void control(void) override; + void updateTrans(void); + void hidePushA(void); + void appearWithPushA(void); + void showPushA(void); + void update(void); + void end(void); + void setText(char const*); + void setTextW(char16_t const*); + + bool isEnableAppear(void) const; + bool isWait(void) const; + bool isVoicePlayerPlaying(void) const; + bool isShowPushA(void) const; + bool isEnableEnd(void) const; + bool isNearPlayerActor(float) const; + + void exeAppear(void); + void exeWait(void); + void exeEnd(void); + void exeHide(void); + + const LiveActor *mTargetActor; // 0x130 + const char *mPaneName; // 0x138 + float mMinDist; // 0x140 + float mMaxDist; // 0x144 + sead::Vector3f mTargetOffset = sead::Vector3f::zero; // 0x148 + int mPlayerIndex; // 0x154 + int mIsUseSub; // 0x158 + bool mIsUseDistance; // 0x15C + bool mIsHideIfNotVis; // 0x15D + bool mIsUseVoice; // 0x15E + TalkMessageVoicePlayer* mTalkVoicePlayer = nullptr; // 0x160 + sead::FixedSafeString<0x40> mTalkMsgSe; // 0x168 + }; + + BalloonMessage *createBalloonMessage(al::LiveActor const*,al::ActorInitInfo const&); + BalloonMessage *createBalloonMessage(al::LiveActor const*,al::ActorInitInfo const&, char const*); + BalloonMessage *createBalloonMessage(al::LiveActor const*,al::ActorInitInfo const&,al::BalloonMessageInitParam const&); + BalloonMessage *createBalloonMessageNoAutoUpdate(al::LiveActor const*,al::ActorInitInfo const&,al::BalloonMessageInitParam const&); +} \ No newline at end of file diff --git a/include/al/layout/CoinCounter.h b/include/al/layout/CoinCounter.h new file mode 100644 index 0000000..003b4d4 --- /dev/null +++ b/include/al/layout/CoinCounter.h @@ -0,0 +1,9 @@ +#pragma once + +/* + * VTable Loc: 1CC3170 + */ + +#include "al/layout/LayoutActor.h" + +class CoinCounter : public al::LayoutActor {}; \ No newline at end of file diff --git a/include/al/layout/HtmlViewer.h b/include/al/layout/HtmlViewer.h new file mode 100644 index 0000000..7a976bb --- /dev/null +++ b/include/al/layout/HtmlViewer.h @@ -0,0 +1,10 @@ +#pragma once + +#include + +namespace al { +class HtmlViewer { +public: + void call(const char*, sead::BufferedSafeStringBase*) const; +}; +}; // namespace al \ No newline at end of file diff --git a/include/al/layout/IUseLayout.h b/include/al/layout/IUseLayout.h new file mode 100644 index 0000000..9e609d5 --- /dev/null +++ b/include/al/layout/IUseLayout.h @@ -0,0 +1,18 @@ +/** + * @file IUseLayout.h + * @brief Interface for classes that are layouts. + */ + +#pragma once + +#include "al/actor/IUseName.h" + +namespace al { + +struct LayoutKeeper; + +class IUseLayout : virtual public al::IUseName { + public: + virtual al::LayoutKeeper* getLayoutKeeper(void) const = 0; +}; +} // namespace al \ No newline at end of file diff --git a/include/al/layout/KeyRepeatCtrl.h b/include/al/layout/KeyRepeatCtrl.h new file mode 100644 index 0000000..05da84b --- /dev/null +++ b/include/al/layout/KeyRepeatCtrl.h @@ -0,0 +1,17 @@ +#pragma once + +namespace al +{ + struct KeyRepeatCtrl { + KeyRepeatCtrl(void); + void init(int, int); + void update(bool isUp, bool isDown); + void reset(void); + bool isUp(void) const; + bool isDown(void) const; + + int maxIndex = 0; + int frameTime = 0; + bool isNoMove = true; + }; +} // namespace al diff --git a/include/al/layout/LayoutActor.h b/include/al/layout/LayoutActor.h new file mode 100644 index 0000000..90fe054 --- /dev/null +++ b/include/al/layout/LayoutActor.h @@ -0,0 +1,87 @@ +#pragma once + +#include "al/actor/IUseName.h" +#include "al/audio/AudioKeeper.h" +#include "al/camera/CameraDirector.h" +#include "al/effect/EffectKeeper.h" +#include "al/hio/HioNode.h" +#include "al/layout/IUseLayout.h" +#include "al/message/IUseMessageSystem.h" +#include "al/nerve/Nerve.h" +#include "al/nerve/NerveKeeper.h" +#include "al/scene/SceneObjHolder.h" +#include "sead/prim/seadSafeString.h" +#include "LayoutSceneInfo.h" + +#include "al/LiveActor/LiveActor.h" + +namespace al { + +class LayoutActionKeeper; + +class IUseLayoutAction : virtual public IUseName { + public: + virtual al::LayoutActionKeeper* getLayoutActionKeeper() const = 0; +}; + +class LayoutTextPaneAnimator {}; + +class LayoutExecuteInfo {}; + +class HitReactionKeeper {}; + //: public al::IUseNerve, public al::IUseEffectKeeper, public al::IUseAudioKeeper, public al::IUseStageSwitch, public al::IUseSceneObjHolder, public al::IUseAreaObj, public al::IUseCamera, public al::IUseCollision, public al::IUseRail, public al::IUseHioNode + //: public al::IUseStageSwitch, public al::IUseAreaObj, public al::IUseCollision, public al::IUseRail, +class LayoutActor : public al::IUseHioNode, public al::IUseNerve, public al::IUseLayout, public al::IUseLayoutAction, public al::IUseMessageSystem, public al::IUseCamera, public al::IUseAudioKeeper, public al::IUseEffectKeeper, public al::IUseSceneObjHolder +{ + public: + LayoutActor(char const*); + + virtual al::NerveKeeper* getNerveKeeper(void) const {return mNerveKeeper;} + + virtual void appear(); + virtual void kill(); + virtual void movement(); + virtual void calcAnim(bool); + + virtual const char *getName(void) const {return mName.cstr();} + virtual al::EffectKeeper *getEffectKeeper(void) const {return mEffectKeeper;} + virtual al::AudioKeeper *getAudioKeeper(void) const {return mAudioKeeper;} + virtual al::LayoutActionKeeper *getLayoutActionKeeper(void) const {return mLytActionKeeper;} + virtual al::LayoutKeeper* getLayoutKeeper(void) const {return mLytKeeper;} + + void initLayoutKeeper(al::LayoutKeeper *); + void initActionKeeper(void); + void initTextPaneAnimator(al::LayoutTextPaneAnimator *); + void initExecuteInfo(al::LayoutExecuteInfo *); + void initHitReactionKeeper(al::HitReactionKeeper *); + void initSceneInfo(al::LayoutSceneInfo *); + void initLayoutPartsActorKeeper(int); + void initEffectKeeper(al::EffectKeeper *); + void initAudioKeeper(al::AudioKeeper *); + void initNerve(al::Nerve const*, int); + void setMainGroupName(char const*); + void syncAction(); + + virtual al::CameraDirector *getCameraDirector(void) const {return mLytSceneInfo->mCameraDirector;} + virtual al::SceneObjHolder *getSceneObjHolder(void) const {return mLytSceneInfo->mSceneObjHolder;} + virtual al::MessageSystem* getMessageSystem(void) const {return mLytSceneInfo->mMessageSystem;} + + virtual void control(); + + sead::FixedSafeString<0x80> mName; // 0x40 + NerveKeeper *mNerveKeeper; // 0xD8 + LayoutKeeper *mLytKeeper; // 0xE0 + LayoutActionKeeper *mLytActionKeeper; // 0xE8 + LayoutTextPaneAnimator *mTextPaneAnimator; // 0xF0 + EffectKeeper *mEffectKeeper; // 0xF8 + AudioKeeper *mAudioKeeper; // 0x100 + LayoutExecuteInfo *mExecuteInfo; // 0x108 + HitReactionKeeper *mHitReactionKeeper; // 0x110 + LayoutSceneInfo *mLytSceneInfo; // 0x118 + struct LayoutPartsActorKeeper *mLytPartsActorKeeper; // 0x120 + bool mIsAlive; // 0x128 +}; +} // namespace al + +static_assert(sizeof(al::LayoutActor) == 0x130); + diff --git a/include/al/layout/LayoutInitInfo.h b/include/al/layout/LayoutInitInfo.h new file mode 100644 index 0000000..319f0b7 --- /dev/null +++ b/include/al/layout/LayoutInitInfo.h @@ -0,0 +1,34 @@ +#pragma once + +#include "al/audio/AudioDirector.h" +#include "al/layout/LayoutSceneInfo.h" +#include "al/message/MessageSystem.h" +#include "al/rumble/PadRumbleDirector.h" +#include "al/camera/CameraDirector.h" +#include "al/execute/ExecuteDirector.h" +#include "al/layout/LayoutKit.h" +#include "game/System/GameSystemInfo.h" +#include "al/effect/EffectSystemInfo.h" +#include "al/scene/Scene.h" + +namespace al { + + class LayoutInitInfo : public LayoutSceneInfo { + public: + void init(al::ExecuteDirector*, al::EffectSystemInfo const*, al::SceneObjHolder*, + al::AudioDirector const*, al::CameraDirector*, al::LayoutSystem const*, + al::MessageSystem const*, al::GamePadSystem const*, al::PadRumbleDirector*); + + al::MessageSystem *getMessageSystem(void) const; + + void *qword30; + void *qword38; + void *qword40; + al::ExecuteDirector *mExecuteDirector; + al::EffectSystemInfo *mEffectSysInfo; + al::AudioDirector *mAudioDirector; + al::LayoutSystem *mLayoutSystem; + }; + void initLayoutInitInfo(al::LayoutInitInfo *,al::Scene const*,al::SceneInitInfo const&); + void initLayoutInitInfo(al::LayoutInitInfo *,al::LayoutKit const*,al::SceneObjHolder *,al::AudioDirector const*,al::LayoutSystem const*,al::MessageSystem const*,al::GamePadSystem const*); +} // namespace al diff --git a/include/al/layout/LayoutKit.h b/include/al/layout/LayoutKit.h new file mode 100644 index 0000000..4cda4f6 --- /dev/null +++ b/include/al/layout/LayoutKit.h @@ -0,0 +1,13 @@ +/** + * @file IUseLayout.h + * @brief Interface for classes that are layouts. + */ + +#pragma once + +namespace al { + class LayoutKit { + public: + + }; +} \ No newline at end of file diff --git a/include/al/layout/LayoutSceneInfo.h b/include/al/layout/LayoutSceneInfo.h new file mode 100644 index 0000000..61dc518 --- /dev/null +++ b/include/al/layout/LayoutSceneInfo.h @@ -0,0 +1,19 @@ +#pragma once + +#include "al/camera/CameraDirector.h" +#include "al/message/IUseMessageSystem.h" +#include "al/rumble/PadRumbleDirector.h" +#include "al/scene/SceneObjHolder.h" +#include "game/System/GameSystemInfo.h" + +namespace al { +class LayoutSceneInfo { + public: + void* gap; + al::CameraDirector *mCameraDirector; + al::PadRumbleDirector *mPadRumbleDirector; + al::SceneObjHolder *mSceneObjHolder; + al::MessageSystem* mMessageSystem; + al::GamePadSystem *mGamepadSystem; + }; +} diff --git a/include/al/layout/MenuSelectParts.h b/include/al/layout/MenuSelectParts.h new file mode 100644 index 0000000..c186b2d --- /dev/null +++ b/include/al/layout/MenuSelectParts.h @@ -0,0 +1,89 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "al/layout/LayoutActor.h" +#include "al/layout/LayoutInitInfo.h" +#include "al/nerve/NerveExecutor.h" +#include "al/layout/KeyRepeatCtrl.h" +#include "al/util/LiveActorUtil.h" +#include "al/string/StringTmp.h" +#include "al/rumble/alPadRumbleFunction.h" +#include "al/rumble/PadRumbleParam.h" + +#include "al/util/NerveUtil.h" +#include "al/util/LayoutUtil.h" +#include "al/util/MathUtil.h" + +#include "game/GameData/GameDataHolderAccessor.h" + +#include "rs/util/SceneUtil.h" +#include "rs/util/UIUtil.h" + +#include + +/* +0 Continue +1 SeparatePlay +2 NewGame +3 Help +4 Save +5 Setting +*/ + +class MenuSelectParts : public al::NerveExecutor { + public: + MenuSelectParts(char const*,al::LayoutActor *,al::LiveActor *,al::LayoutInitInfo const&,int); + void update(void); + void appear(int); + void startActionPartsIllustSelectIndex(void); + void appearWait(void); + void setSelectMessage(int,char16_t const*); + bool isDecideContinue(void) const; + bool isDecideEnd(void) const; + bool isSelectContinue(void) const; + bool isDecideSetting(void) const; + bool isSelectSetting(void) const; + bool isDecideSave(void) const; + bool isSelectSave(void) const; + bool isDecideSeparatePlay(void) const; + bool isSelectSeparatePlay(void) const; + bool isDecideHelp(void) const; + bool isSelectHelp(void) const; + bool isDecideNewGame(void) const; + bool isSelectNewGame(void) const; + int calcPartsIndex(int) const; + void exeHide(void); + void exeAppear(void); + void startActionMarioSelectIndex(void); + void exeSelect(void); + void startActionMario(al::LiveActor *, const char *); + void exeDecideParts(void); + bool isInvalidSelect(void) const; + void exeDecideInterval(void); + void exeDecideEnd(void); + ~MenuSelectParts(); + + // void *vtable; + // void *unk1; // 0x08 + al::LayoutActor *mRootLayout; // 0x10 + int mMaxSelectParts; // 0x18 + int mCursorItemIdx; // 0x1C + sead::PtrArray mSelectParts; // 0x20-0x28 + al::LayoutActor *mCursorActor; // 0x30 + void *unk3; // 0x38 + al::LiveActor *mMarioHigh; // 0x40 + al::LiveActor *mCapEyes; // 0x48 + al::KeyRepeatCtrl *mKeyRepeatCtrl; // 0x50 + bool isMenuMain; // 0x58 +}; + +namespace +{ + NERVE_HEADER(MenuSelectParts, Hide) + NERVE_HEADER(MenuSelectParts, Appear) + NERVE_HEADER(MenuSelectParts, Select) + NERVE_HEADER(MenuSelectParts, DecideEnd) + NERVE_HEADER(MenuSelectParts, DecideParts) + NERVE_HEADER(MenuSelectParts, SelectSecond) + NERVE_HEADER(MenuSelectParts, DecideInterval) +} // namespace diff --git a/include/al/layout/SimpleLayoutAppearWaitEnd.h b/include/al/layout/SimpleLayoutAppearWaitEnd.h new file mode 100644 index 0000000..fc84300 --- /dev/null +++ b/include/al/layout/SimpleLayoutAppearWaitEnd.h @@ -0,0 +1,24 @@ +#pragma once + +#include "al/layout/LayoutActor.h" +namespace al { +class SimpleLayoutAppearWaitEnd : public al::LayoutActor { +public: + SimpleLayoutAppearWaitEnd(char const*, char const*, al::LayoutInitInfo const&, char const*, + bool); + + SimpleLayoutAppearWaitEnd(al::LayoutActor*, char const*, char const*, al::LayoutInitInfo const&, + char const*); + + void appear(void); + void end(void); + void startWait(void); + + void exeAppear(void); + void exeWait(void); + void exeEnd(void); + bool isWait(void) const; + bool isAppearOrWait(void) const; + +}; +} \ No newline at end of file diff --git a/include/al/layout/TalkMessageVoicePlayer.h b/include/al/layout/TalkMessageVoicePlayer.h new file mode 100644 index 0000000..db07e5e --- /dev/null +++ b/include/al/layout/TalkMessageVoicePlayer.h @@ -0,0 +1,19 @@ +#pragma once + +#include "al/audio/AudioKeeper.h" +#include "al/message/IUseMessageSystem.h" + +namespace al { +class TalkMessageVoicePlayer { +public: + TalkMessageVoicePlayer(); + + void start(al::IUseMessageSystem const*, al::IUseAudioKeeper const*, char16_t const*, int); + void stop(void); + void update(void); + void calcVoicePitch(int); + bool isPlaying(void) const; + + char size[0x440]; +}; +} \ No newline at end of file diff --git a/include/al/layout/WindowConfirm.h b/include/al/layout/WindowConfirm.h new file mode 100644 index 0000000..9e9f2cc --- /dev/null +++ b/include/al/layout/WindowConfirm.h @@ -0,0 +1,38 @@ +#pragma once + +#include "al/layout/LayoutActor.h" + +namespace al { +class WindowConfirm : public al::LayoutActor { +public: + + WindowConfirm(al::LayoutInitInfo const&, char const*, char const*); + + void appear(void); + void appearWithChoicingCancel(void); + void exeAppear(void); + void exeDecide(void); + void exeDecideAfter(void); + void exeEnd(void); + void exeHide(void); + void exeWait(void); + void isEnableInput(void); + void isNerveEnd(void); + void setCancelIdx(int); + void setCursorToPane(void); + void setListNum(int); + void setTxtList(int,char16_t const*); + void setTxtMessage(char16_t const*); + void tryCancel(void); + void tryCancelWithoutEnd(void); + void tryDecide(void); + void tryDecideWithoutEnd(void); + void tryDown(void); + void tryEnd(void); + void tryUp(void); + + char size[0x38]; + + +}; +} \ No newline at end of file diff --git a/include/al/layout/WindowConfirmWait.h b/include/al/layout/WindowConfirmWait.h new file mode 100644 index 0000000..7aa59ab --- /dev/null +++ b/include/al/layout/WindowConfirmWait.h @@ -0,0 +1,56 @@ +#pragma once + +#include "al/layout/LayoutActor.h" +#include "al/layout/LayoutInitInfo.h" +#include "al/util/NerveUtil.h" + +namespace al { + +class WindowConfirmWait : public al::LayoutActor { + public: + WindowConfirmWait(char const*, char const*, al::LayoutInitInfo const&); + + void setTxtMessage(char16_t const*); + void setTxtMessageConfirm(char16_t const*); + + void appear(void); + bool tryEnd(void); + bool tryEndForce(void); + void playLoop(void); + void endLoop(void); + void tryPageIn(void); + void tryPageOut(void); + void showPaneConfirm(void); + void tryConfirmDecide(void); + void updateHardKey(void); + + void exeHide(void); + void exeAppear(void); + void exeKeepWait(void); + void exeWait(void); + void exeWaitEnd(void); + void exeEnd(void); + void exePageIn(void); + void exePageOut(void); + void exePageOutEnd(void); + void exeConfirmDecide(void); + + al::LayoutActor *mPartsHardKey; + + }; +} // namespace al + +namespace { + NERVE_HEADER(WindowConfirmWait, Hide) + NERVE_HEADER(WindowConfirmWait, Appear) + NERVE_HEADER(WindowConfirmWait, KeepWait) + NERVE_HEADER(WindowConfirmWait, Wait) + NERVE_HEADER(WindowConfirmWait, WaitEnd) + NERVE_HEADER(WindowConfirmWait, End) + NERVE_HEADER(WindowConfirmWait, PageIn) + NERVE_HEADER(WindowConfirmWait, PageOut) + NERVE_HEADER(WindowConfirmWait, PageOutEnd) + NERVE_HEADER(WindowConfirmWait, ConfirmDecide) +} // namespace + +static_assert(sizeof(al::WindowConfirmWait) == 0x138, "Size of WindowConfirmWait"); \ No newline at end of file diff --git a/include/al/message/IUseMessageSystem.h b/include/al/message/IUseMessageSystem.h new file mode 100644 index 0000000..6d38ae0 --- /dev/null +++ b/include/al/message/IUseMessageSystem.h @@ -0,0 +1,10 @@ +#pragma once + +#include "MessageSystem.h" + +namespace al { + class IUseMessageSystem { + public: + virtual al::MessageSystem *getMessageSystem() const = 0; + }; +} \ No newline at end of file diff --git a/include/al/message/MessageSystem.h b/include/al/message/MessageSystem.h new file mode 100644 index 0000000..50a1972 --- /dev/null +++ b/include/al/message/MessageSystem.h @@ -0,0 +1,7 @@ +#pragma once + +namespace al { + class MessageSystem { + + }; +} \ No newline at end of file diff --git a/include/al/nerve/ActorStateBase.h b/include/al/nerve/ActorStateBase.h new file mode 100644 index 0000000..149860f --- /dev/null +++ b/include/al/nerve/ActorStateBase.h @@ -0,0 +1,14 @@ +#pragma once + +#include "NerveStateBase.h" +#include "al/LiveActor/LiveActor.h" + +namespace al { + class ActorStateBase : public al::NerveStateBase { + public: + ActorStateBase(const char*, al::LiveActor*); + + protected: + LiveActor* mLiveActor; + }; +} \ No newline at end of file diff --git a/include/al/nerve/HostStateBase.h b/include/al/nerve/HostStateBase.h new file mode 100644 index 0000000..0b1a772 --- /dev/null +++ b/include/al/nerve/HostStateBase.h @@ -0,0 +1,13 @@ +#pragma once + +#include "NerveStateBase.h" + +namespace al +{ + template + class HostStateBase : public NerveStateBase { + public: + HostStateBase(const char* name, T *host) : NerveStateBase(name), mHost(host){}; + T *mHost; + }; +} // namespace al diff --git a/include/al/nerve/Nerve.h b/include/al/nerve/Nerve.h new file mode 100644 index 0000000..73c228d --- /dev/null +++ b/include/al/nerve/Nerve.h @@ -0,0 +1,25 @@ +#pragma once + +namespace al +{ + class NerveKeeper; + + class IUseNerve + { + public: + + inline IUseNerve() + { + + } + + virtual NerveKeeper* getNerveKeeper() const = 0; + }; + + class Nerve + { + public: + virtual void execute(NerveKeeper *) = 0; + virtual void executeOnEnd(NerveKeeper *) const; + }; +}; \ No newline at end of file diff --git a/include/al/nerve/NerveAction.h b/include/al/nerve/NerveAction.h new file mode 100644 index 0000000..b2eaa0b --- /dev/null +++ b/include/al/nerve/NerveAction.h @@ -0,0 +1,34 @@ +#pragma once + +#include "Nerve.h" + +namespace al +{ + class NerveAction : public al::Nerve + { + public: + NerveAction(); + + virtual const char* getActionName() const = 0; + + al::NerveAction* _8; + }; +}; + +namespace alNerveFunction +{ + class NerveActionCollector + { + public: + NerveActionCollector(); + + void addNerve(al::NerveAction *); + + int mActionCount; // _0 + int _4; + al::NerveAction* _8; + al::NerveAction* _10; + + static alNerveFunction::NerveActionCollector* sCurrentCollector; + }; +}; \ No newline at end of file diff --git a/include/al/nerve/NerveExecutor.h b/include/al/nerve/NerveExecutor.h new file mode 100644 index 0000000..f3e9057 --- /dev/null +++ b/include/al/nerve/NerveExecutor.h @@ -0,0 +1,21 @@ +#pragma once + +#include "Nerve.h" +#include "NerveKeeper.h" + +namespace al +{ + class NerveExecutor : public IUseNerve + { + public: + NerveExecutor(const char *); + + virtual NerveKeeper* getNerveKeeper() const; + virtual ~NerveExecutor(); + + void initNerve(const al::Nerve *, int stateCount); + void updateNerve(); + + al::NerveKeeper* mKeeper; // _8 + }; +}; \ No newline at end of file diff --git a/include/al/nerve/NerveKeeper.h b/include/al/nerve/NerveKeeper.h new file mode 100644 index 0000000..be2efa8 --- /dev/null +++ b/include/al/nerve/NerveKeeper.h @@ -0,0 +1,28 @@ +#pragma once + +#include "Nerve.h" + +namespace al +{ + class NerveStateCtrl; + + class NerveKeeper + { + public: + NerveKeeper(al::IUseNerve *, const al::Nerve *, int); + + void update(); + + void tryChangeNerve(); + void setNerve(const al::Nerve *); + const al::Nerve* getCurrentNerve() const; + + al::IUseNerve* mParent; // _0 + const al::Nerve* _8; + const al::Nerve* mNerve; // _10 + int mStep; // _18 + int _1C; + al::NerveStateCtrl* mStateCtrl; // _20 + unsigned long _28; + }; +}; \ No newline at end of file diff --git a/include/al/nerve/NerveStateBase.h b/include/al/nerve/NerveStateBase.h new file mode 100644 index 0000000..be04a9d --- /dev/null +++ b/include/al/nerve/NerveStateBase.h @@ -0,0 +1,21 @@ +#pragma once + +#include "NerveExecutor.h" + +namespace al +{ + class NerveStateBase : public NerveExecutor + { + public: + NerveStateBase(const char *); + + virtual ~NerveStateBase(); + virtual void init(); + virtual void appear(); + virtual void kill(); + virtual bool update(); + virtual void control(); + + bool mIsDead; // _10 + }; +}; \ No newline at end of file diff --git a/include/al/nerve/NerveStateCtrl.h b/include/al/nerve/NerveStateCtrl.h new file mode 100644 index 0000000..a448471 --- /dev/null +++ b/include/al/nerve/NerveStateCtrl.h @@ -0,0 +1,34 @@ +#pragma once + +#include "Nerve.h" +#include "NerveStateBase.h" + +namespace al +{ + struct State + { + al::NerveStateBase* mStateBase; // _0 + const al::Nerve* mNerve; // _8 + const char* mName; // _10 + }; + + class NerveStateCtrl + { + public: + NerveStateCtrl(int); + + void addState(al::NerveStateBase *, const al::Nerve *, const char *); + bool updateCurrentState(); + void startState(const al::Nerve *); + void update(); + + State* findStateInfo(const al::Nerve *); + bool isCurrentStateEnd() const; + void tryEndCurrentState(); + + int _0; + int mStateCount; // _4 + State* mStates; // _8 + State* mCurrentState; // _10 + }; +}; \ No newline at end of file diff --git a/include/al/pose/ActorPoseKeeper.h b/include/al/pose/ActorPoseKeeper.h new file mode 100644 index 0000000..1d268e2 --- /dev/null +++ b/include/al/pose/ActorPoseKeeper.h @@ -0,0 +1,64 @@ +#pragma once + +#include "sead/math/seadMatrix.h" +#include "sead/math/seadQuat.h" +#include "sead/math/seadVector.h" + +namespace al +{ + class ActorPoseKeeperBase + { + public: + ActorPoseKeeperBase(); + + virtual const sead::Vector3& getRotate() const; + virtual const sead::Vector3& getScale() const; + virtual const sead::Vector3& getVelocity() const; + virtual const sead::Vector3& getFront() const; + virtual const sead::Vector3& getUp() const; + virtual const sead::Quat& getQuat() const; + virtual const sead::Vector3& getGravity() const; + virtual const sead::Matrix34& getMtx() const; + virtual sead::Vector3* getRotatePtr(); + virtual sead::Vector3* getScalePtr(); + virtual sead::Vector3* getVelocityPtr(); + virtual sead::Vector3* getFrontPtr(); + virtual sead::Vector3* getUpPtr(); + virtual sead::Quat* getQuatPtr(); + virtual sead::Vector3* getGravityPtr(); + virtual sead::Matrix34* getMtxPtr(); + virtual void updatePoseTrans(const sead::Vector3 &) = 0; + virtual void updatePoseRotate(const sead::Vector3 &) = 0; + virtual void updatePoseQuat(const sead::Quat &) = 0; + virtual void updatePoseMtx(const sead::Matrix34 *) = 0; + virtual void copyPose(const al::ActorPoseKeeperBase *); + virtual void calcBaseMtx(sead::Matrix34 *) = 0; + + sead::Vector3 mTranslation; // _8 + + static const sead::Vector3 sDefaultVelocity; + }; + + class ActorPoseKeeperTRSV : public ActorPoseKeeperBase + { + public: + virtual const sead::Vector3& getRotate() const; + virtual const sead::Vector3& getScale() const; + virtual const sead::Vector3& getVelocity() const; + + virtual sead::Vector3* getRotatePtr(); + virtual sead::Vector3* getScalePtr(); + virtual sead::Vector3* getVelocityPtr(); + + virtual void updatePoseTrans(const sead::Vector3 &); + virtual void updatePoseRotate(const sead::Vector3 &); + virtual void updatePoseQuat(const sead::Quat &); + virtual void updatePoseMtx(const sead::Matrix34 *); + + virtual void calcBaseMtx(sead::Matrix34 *); + + sead::Vector3 mRotation; // _14 + sead::Vector3 mScale; // _20 + sead::Vector3 mVelocity; // _2C + }; +}; \ No newline at end of file diff --git a/include/al/rail/RailKeeper.h b/include/al/rail/RailKeeper.h new file mode 100644 index 0000000..7d5d86b --- /dev/null +++ b/include/al/rail/RailKeeper.h @@ -0,0 +1,14 @@ +#pragma once + +#include "al/rail/RailRider.h" + +namespace al +{ + class RailKeeper + { + public: + virtual al::RailRider* getRailRider() const; + + al::RailRider* mRailRider; // _8 + }; +}; \ No newline at end of file diff --git a/include/al/rail/RailRider.h b/include/al/rail/RailRider.h new file mode 100644 index 0000000..150d17a --- /dev/null +++ b/include/al/rail/RailRider.h @@ -0,0 +1,12 @@ +#pragma once + +namespace al +{ + class RailRider; + + class IUseRail + { + public: + virtual al::RailRider* getRailRider() const = 0; + }; +}; \ No newline at end of file diff --git a/include/al/rumble/PadRumbleDirector.h b/include/al/rumble/PadRumbleDirector.h new file mode 100644 index 0000000..a45fc00 --- /dev/null +++ b/include/al/rumble/PadRumbleDirector.h @@ -0,0 +1,7 @@ +#pragma once + +namespace al { + class PadRumbleDirector { + public: + }; +} \ No newline at end of file diff --git a/include/al/rumble/PadRumbleParam.h b/include/al/rumble/PadRumbleParam.h new file mode 100644 index 0000000..51a1797 --- /dev/null +++ b/include/al/rumble/PadRumbleParam.h @@ -0,0 +1,15 @@ +#pragma once + +namespace al { + struct PadRumbleParam { + inline PadRumbleParam() = default; + float mRumbleNear = 0.0f; + float mRumbleFar = 3000.0f; + float mRumbleVolume = 1.0f; + float mRumblePitchVol = 1.0f; + float mRumblePitchLeft = 1.0f; + float mRumblePitchRight = 1.0f; + int unk = 0; + bool isUseController = false; + }; + } // namespace al \ No newline at end of file diff --git a/include/al/rumble/alPadRumbleFunction.h b/include/al/rumble/alPadRumbleFunction.h new file mode 100644 index 0000000..00d69e1 --- /dev/null +++ b/include/al/rumble/alPadRumbleFunction.h @@ -0,0 +1,52 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "al/layout/LayoutActor.h" +#include "PadRumbleParam.h" + +namespace al { + class PadRumbleDirector; +} + +namespace alPadRumbleFunction { + al::PadRumbleDirector *getPadRumbleDirector(al::LiveActor const*); + al::PadRumbleDirector *getPadRumbleDirector(al::LayoutActor const*); + void startPadRumble(al::PadRumbleDirector *,sead::Vector3 const&,char const*,float,float,int); + void startPadRumbleWithParam(al::PadRumbleDirector *,sead::Vector3 const&,char const*,al::PadRumbleParam const&,int); + void startPadRumble(al::LiveActor const*,char const*,float,float,int); + void startPadRumblePos(al::LiveActor const*,sead::Vector3 const&,char const*,float,float,int); + void startPadRumbleWithParam(al::LiveActor const*,sead::Vector3 const&,char const*,al::PadRumbleParam const&,int); + void startPadRumbleNo3D(al::PadRumbleDirector *,char const*,int); + void startPadRumbleNo3DWithParam(al::PadRumbleDirector *,char const*,al::PadRumbleParam const&,int); + void startPadRumbleNo3DWithParam(al::PadRumbleDirector *,char const*,float,float,float,float,int); + void startPadRumbleNo3D(al::LiveActor const*,char const*,int); + void startPadRumbleNo3DWithParam(al::LiveActor const*,char const*,al::PadRumbleParam const&,int); + void startPadRumbleNo3DWithParam(al::LiveActor const*,char const*,float,float,float,float,int); + void stopPadRumbleOneTime(al::PadRumbleDirector *,char const*,int); + void stopPadRumbleOneTime(al::LiveActor const*,char const*,int); + void startPadRumbleLoop(al::PadRumbleDirector *,char const*,sead::Vector3 const*,float,float,int); + void startPadRumbleLoopWithParam(al::PadRumbleDirector *,char const*,sead::Vector3 const*,al::PadRumbleParam const&,int); + void startPadRumbleLoop(al::LiveActor const*,char const*,sead::Vector3 const*,float,float,int); + void startPadRumbleLoopWithParam(al::LiveActor const*,char const*,sead::Vector3 const*,al::PadRumbleParam const&,int); + void startPadRumbleLoopNo3D(al::PadRumbleDirector *,char const*,sead::Vector3 const*,int); + void startPadRumbleLoopNo3DWithParam(al::PadRumbleDirector *,char const*,sead::Vector3 const*,al::PadRumbleParam const&,int); + void startPadRumbleLoopNo3D(al::LiveActor const*,char const*,sead::Vector3 const*,int); + void startPadRumbleLoopNo3DWithParam(al::LiveActor const*,char const*,sead::Vector3 const*,al::PadRumbleParam const&,int); + void stopPadRumbleLoop(al::PadRumbleDirector *,char const*,sead::Vector3 const*,int); + void stopPadRumbleLoop(al::LiveActor const*,char const*,sead::Vector3 const*,int); + void checkIsAlivePadRumbleLoop(al::PadRumbleDirector *,char const*,sead::Vector3 const*,int); + void checkIsAlivePadRumbleLoop(al::LiveActor const*,char const*,sead::Vector3 const*,int); + void startPadRumbleLoopControlable(al::LiveActor const*,char const*,sead::Vector3 const*,int); + void changePadRumbleLoopVolmue(al::LiveActor const*,char const*,sead::Vector3 const*,float,float,int); + void changePadRumbleLoopVolmueEaseInRange(al::LiveActor const*,char const*,sead::Vector3 const*,float,float,float,float,float,int); + void changePadRumbleLoopPitch(al::LiveActor const*,char const*,sead::Vector3 const*,float,float,int); + void startPadRumbleDirectValue(al::LiveActor const*,float,float,float,float,float,float,int); + void stopPadRumbleDirectValue(al::LiveActor const*,int); + void startPadRumbleWithVolume(al::LiveActor const*,char const*,float,float,int); + void startPadRumbleWithVolume(al::PadRumbleDirector *,char const*,float,float,int); + void makePadRumbleParamNearFarVolume(al::PadRumbleParam *,float,float,float); + void makePadRumbleParamNearFarVolumeLR(al::PadRumbleParam *,float,float,float,float); + void makePadRumbleParamNearFarVolumePitch(al::PadRumbleParam *,float,float,float,float); + void makePadRumbleParamNearFarVolumePitchLR(al::PadRumbleParam *,float,float,float,float,float,float); + +}; \ No newline at end of file diff --git a/include/al/scene/ISceneObj.h b/include/al/scene/ISceneObj.h new file mode 100644 index 0000000..240fc44 --- /dev/null +++ b/include/al/scene/ISceneObj.h @@ -0,0 +1,12 @@ +#pragma once + + +namespace al { + class ISceneObj { + public: + virtual const char* getSceneObjName(void) = 0; + virtual ~ISceneObj(); + virtual void initAfterPlacementSceneObj(struct ActorInitInfo const&) = 0; + virtual void initSceneObj(void) = 0; + }; +} \ No newline at end of file diff --git a/include/al/scene/Scene.h b/include/al/scene/Scene.h new file mode 100644 index 0000000..78bdb24 --- /dev/null +++ b/include/al/scene/Scene.h @@ -0,0 +1,37 @@ +#pragma once + +#include "SceneInitInfo.h" +#include +#include "al/audio/AudioKeeper.h" +#include "al/camera/CameraDirector.h" +#include "al/scene/SceneObjHolder.h" + +namespace al +{ + + class GraphicsInitArg; + + class Scene : public al::NerveExecutor, public al::IUseAudioKeeper, public al::IUseCamera, public al::IUseSceneObjHolder + { + public: + Scene(const char *); + + virtual ~Scene(); + virtual void init(const al::SceneInitInfo &); + virtual void appear(); + virtual void kill(); + virtual void movement(); + virtual void control(); + virtual void drawMain(); + virtual void drawSub(); + virtual al::AudioKeeper* getAudioKeeper(); + virtual al::SceneObjHolder* getSceneObjHolder(); + virtual al::CameraDirector* getCameraDirector(); + + void initDrawSystemInfo(al::SceneInitInfo const&); + + void initLiveActorKitWithGraphics(al::GraphicsInitArg const &, al::SceneInitInfo const &, int, int, int); + + unsigned char _28[0xD8-0x28]; + }; +}; \ No newline at end of file diff --git a/include/al/scene/SceneCreator.h b/include/al/scene/SceneCreator.h new file mode 100644 index 0000000..dc7d41d --- /dev/null +++ b/include/al/scene/SceneCreator.h @@ -0,0 +1,13 @@ +#pragma once + +namespace al +{ + class SceneCreator; + + class IUseSceneCreator + { + public: + virtual al::SceneCreator* getSceneCreator() const = 0; + virtual al::SceneCreator* setSceneCreator() const = 0; + }; +}; \ No newline at end of file diff --git a/include/al/scene/SceneInitInfo.h b/include/al/scene/SceneInitInfo.h new file mode 100644 index 0000000..16a6976 --- /dev/null +++ b/include/al/scene/SceneInitInfo.h @@ -0,0 +1,15 @@ +#pragma once + +#include "game/GameData/GameDataHolderAccessor.h" +#include "game/System/GameSystemInfo.h" +#include "types.h" + +namespace al { + struct SceneInitInfo { + al::GameSystemInfo * gameSysInfo; + GameDataHolderAccessor gameDataHolder; + undefined field_0x10[8]; + char *initStageName; + u32 scenarioNo; + }; +} diff --git a/include/al/scene/SceneObjHolder.h b/include/al/scene/SceneObjHolder.h new file mode 100644 index 0000000..ddf5afd --- /dev/null +++ b/include/al/scene/SceneObjHolder.h @@ -0,0 +1,27 @@ +#pragma once + +#include "ISceneObj.h" + +namespace al { + + class SceneObjHolder { + public: + SceneObjHolder(al::ISceneObj* (*)(int), int); + + ISceneObj *tryGetObj(int) const; // unsafe get still + void setSceneObj(al::ISceneObj *,int); + bool isExist(int) const; + void initAfterPlacementSceneObj(struct ActorInitInfo const&); + ISceneObj *getObj(int) const; + void create(int); + + }; + + class IUseSceneObjHolder + { + public: + virtual al::SceneObjHolder* getSceneObjHolder() const = 0; + + static const char* sSceneObjName; + }; +}; \ No newline at end of file diff --git a/include/al/screen/ScreenPointKeeper.h b/include/al/screen/ScreenPointKeeper.h new file mode 100644 index 0000000..f4e9fe2 --- /dev/null +++ b/include/al/screen/ScreenPointKeeper.h @@ -0,0 +1,10 @@ +#pragma once + +namespace al +{ + class ScreenPointKeeper + { + public: + + }; +}; \ No newline at end of file diff --git a/include/al/sensor/HitSensor.h b/include/al/sensor/HitSensor.h new file mode 100644 index 0000000..2ffa19a --- /dev/null +++ b/include/al/sensor/HitSensor.h @@ -0,0 +1,44 @@ +#pragma once + +#include "al/sensor/SensorHitGroup.h" +#include "sead/math/seadVector.h" +#include "sead/math/seadMatrix.h" + +namespace al +{ + + class LiveActor; + + class HitSensor + { + public: + HitSensor(al::LiveActor *, const char *, unsigned int, float, unsigned short, const sead::Vector3 *, const sead::Matrix34 *, const sead::Vector3 &); + + bool trySensorSort(); + void setFollowPosPtr(const sead::Vector3 *); + void setFollowMtxPtr(const sead::Matrix34 *); + void validate(); + void invalidate(); + void validateBySystem(); + void invalidateBySystem(); + void update(); + void addHitSensor(al::HitSensor *); + + const char* mName; // _0 + int _8; + float _unkC; + float _10; + float _14; + float _18; + unsigned short mMaxSensorCount; // _1C + unsigned short mSensorCount; // _1E + al::HitSensor** mSensors; // _20 + unsigned long _28; + al::SensorHitGroup* mHitGroup; // _30 + bool mIsValidBySystem; // _38 + bool mIsValid; // _39 + al::LiveActor* mParentActor; // _40 + const sead::Vector3* mFollowPos; // _48 + const sead::Matrix34* mFollowMtx; // _50 + }; +}; \ No newline at end of file diff --git a/include/al/sensor/HitSensorKeeper.h b/include/al/sensor/HitSensorKeeper.h new file mode 100644 index 0000000..03edf6d --- /dev/null +++ b/include/al/sensor/HitSensorKeeper.h @@ -0,0 +1,27 @@ +#pragma once + +#include "types.h" +#include "al/LiveActor/LiveActor.h" +#include "al/sensor/SensorHitGroup.h" +#include "sead/math/seadVector.h" +#include "sead/math/seadMatrix.h" +#include "HitSensor.h" + +namespace al +{ + class HitSensorKeeper + { + public: + HitSensorKeeper(int); + bool addSensor(al::LiveActor *sensorHost, char const *sensorName, u32 typeEnum, float radius, ushort maxCount, const sead::Vector3f *position, const sead::Matrix34f *matrix, const sead::Vector3f &scale); + void update(void); + int getSensorNum(void) const; + al::HitSensor *getSensor(int) const; + void clear(void); + void validate(void); + void invalidate(void); + void validateBySystem(void); + void invalidateBySystem(void); + al::HitSensor *getSensor(char const *sensorName) const; + }; +}; \ No newline at end of file diff --git a/include/al/sensor/SensorHitGroup.h b/include/al/sensor/SensorHitGroup.h new file mode 100644 index 0000000..4007652 --- /dev/null +++ b/include/al/sensor/SensorHitGroup.h @@ -0,0 +1,20 @@ +#pragma once + +namespace al +{ + class HitSensor; + + class SensorHitGroup + { + public: + SensorHitGroup(int, const char *); + + void add(al::HitSensor *); + void remove(al::HitSensor *); + al::HitSensor* getSensor(int) const; + + int _0; + int mSensorCount; // _4 + al::HitSensor** mSensors; // _8 + }; +}; \ No newline at end of file diff --git a/include/al/sensor/SensorMsg.h b/include/al/sensor/SensorMsg.h new file mode 100644 index 0000000..b092204 --- /dev/null +++ b/include/al/sensor/SensorMsg.h @@ -0,0 +1,8 @@ +#pragma once + +namespace al +{ + class SensorMsg { + + }; +} // namespace al diff --git a/include/al/sequence/Sequence.h b/include/al/sequence/Sequence.h new file mode 100644 index 0000000..f140ce0 --- /dev/null +++ b/include/al/sequence/Sequence.h @@ -0,0 +1,12 @@ +#pragma once + +#include "al/nerve/NerveExecutor.h" +#include "al/audio/AudioKeeper.h" +#include "al/scene/SceneCreator.h" + +namespace al { + class Sequence : public al::NerveExecutor, public al::IUseAudioKeeper, public al::IUseSceneCreator { + public: + Sequence(const char *seqName); + }; +} \ No newline at end of file diff --git a/include/al/sequence/SequenceInitInfo.h b/include/al/sequence/SequenceInitInfo.h new file mode 100644 index 0000000..c8db4e1 --- /dev/null +++ b/include/al/sequence/SequenceInitInfo.h @@ -0,0 +1,11 @@ +#pragma once + +#include "game/System/GameSystemInfo.h" + +namespace al { + class SequenceInitInfo { + public: + SequenceInitInfo(al::GameSystemInfo const *sysInf) : mSystemInfo(sysInf) {} + const GameSystemInfo *mSystemInfo; + }; +} \ No newline at end of file diff --git a/include/al/stage/StageInfo.h b/include/al/stage/StageInfo.h new file mode 100644 index 0000000..4e0c2a5 --- /dev/null +++ b/include/al/stage/StageInfo.h @@ -0,0 +1,12 @@ +#pragma once + +#include "al/byaml/ByamlIter.h" + +namespace al { + + class Resource; + + struct StageInfo { + StageInfo(al::Resource *, al::ByamlIter const &, al::ByamlIter const &); + }; +} \ No newline at end of file diff --git a/include/al/string/StringTmp.h b/include/al/string/StringTmp.h new file mode 100644 index 0000000..8e93e08 --- /dev/null +++ b/include/al/string/StringTmp.h @@ -0,0 +1,17 @@ +#pragma once + +namespace al { + +template +class StringTmp : public sead::FixedSafeString { // equal to WFormatFixedSafeString +public: + StringTmp(const char* format, ...) : sead::FixedSafeString() { + std::va_list args; + va_start(args, format); + this->formatV(format, args); + va_end(args); + } + ~StringTmp() = default; +}; + +} // namespace al diff --git a/include/al/switch/StageSwitchKeeper.h b/include/al/switch/StageSwitchKeeper.h new file mode 100644 index 0000000..ca79dcc --- /dev/null +++ b/include/al/switch/StageSwitchKeeper.h @@ -0,0 +1,21 @@ +#pragma once + +#include "al/actor/IUseName.h" + +namespace al +{ + class StageSwitchKeeper; + + class IUseStageSwitch : virtual public al::IUseName + { + public: + virtual al::StageSwitchKeeper* getStageSwitchKeeper() const = 0; + virtual void initStageSwitchKeeper() = 0; + }; + + class StageSwitchKeeper + { + public: + StageSwitchKeeper(); + }; +}; \ No newline at end of file diff --git a/include/al/util.hpp b/include/al/util.hpp new file mode 100644 index 0000000..3ef495d --- /dev/null +++ b/include/al/util.hpp @@ -0,0 +1,510 @@ +#pragma once + +#include "al/scene/ISceneObj.h" +#include "al/scene/SceneObjHolder.h" +#include "al/util/AudioUtil.h" +#include "al/util/ControllerUtil.h" +#include "al/util/GraphicsUtil.h" +#include "al/util/LayoutUtil.h" +#include "al/util/LiveActorUtil.h" +#include "al/util/MathUtil.h" +#include "al/util/NerveUtil.h" +#include "al/util/CameraUtil.h" + +namespace al +{ + class LiveActor; + + class AreaObj; + +} +#include +#include +#include +#include +#include + +#include "al/scene/Scene.h" +#include "al/PlayerHolder/PlayerHolder.h" +#include "al/audio/AudioKeeper.h" +#include "al/camera/Projection.h" +#include "al/camera/CameraTargetBase.h" +#include "al/layout/IUseLayout.h" +#include "al/layout/LayoutKit.h" +#include "al/layout/LayoutActor.h" +#include "al/sensor/SensorMsg.h" +#include "al/stage/StageInfo.h" +#include "al/area/AreaObjGroup.h" +#include "al/async/FunctorBase.h" +#include "al/execute/ExecuteDirector.h" + +#include "game/Player/PlayerActorHakoniwa.h" + +#include "agl/DrawContext.h" + +#include "nn/ui2d/Texture.h" + +#include "types.h" + +template +al::LiveActor* createActorFunction(const char *name); + +namespace al +{ +// getters + + struct SceneMsgCtrl; + + sead::Vector3f *getCameraUp(al::IUseCamera const *, int); + + sead::Vector3f *getScale(al::LiveActor const *); + + float *getScaleX(al::LiveActor const *); + + float *getScaleY(al::LiveActor const *); + + float *getScaleZ(al::LiveActor const *); + + al::PlayerHolder *getScenePlayerHolder(al::Scene const *); + + PlayerActorBase *getPlayerActor(al::LiveActor const *, int); + + PlayerActorBase *tryGetPlayerActor(al::PlayerHolder const *, int); + + sead::Heap *getCurrentHeap(void); + + al::Projection *getProjection(al::IUseCamera const *, int); + + int getSubActorNum(al::LiveActor const *); + + al::LiveActor *getSubActor(al::LiveActor const *, const char *); + al::LiveActor *tryGetSubActor(al::LiveActor const *, const char *); + + al::LiveActor *getSubActor(al::LiveActor const *, int); + + int getPlayerControllerPort(int); + + char const *getActionName(al::LiveActor const *); + + char const *getActionFrame(al::LiveActor const *); + + bool isSklAnimExist(al::LiveActor const *, const char *); + bool clearSklAnimInterpole(al::LiveActor *); + + // setters + + void setTransY(al::LiveActor *, float); + + void setTrans(al::LiveActor *, sead::Vector3f const &); + + void setScale(al::LiveActor *, sead::Vector3f const &); + + void setScale(al::LiveActor *, float, float, float); + + void setScaleAll(al::LiveActor *, float); + + void setScaleX(al::LiveActor *, float); + + void setScaleY(al::LiveActor *, float); + + void setScaleZ(al::LiveActor *, float); + + void setGravity(al::LiveActor const *, sead::Vector3f const &); + + void setFront(al::LiveActor *, sead::Vector3f const &); + + void setQuat(al::LiveActor *, const sead::Quatf &); + + void setVelocityZero(al::LiveActor *); + + void setEffectParticleScale(al::IUseEffectKeeper *actor, char const *effectName, float scale); + + // layout stuff + + al::LayoutInitInfo *getLayoutInitInfo(al::ActorInitInfo const&); + + void requestCaptureRecursive(al::LayoutActor const*); + + void startAction(IUseLayoutAction*, const char *, const char *); + + bool isActionPlaying(al::IUseLayoutAction *, const char *action, const char *group); + + bool isActionEnd(al::IUseLayoutAction const*, char const*); + + void setPaneTexture(al::IUseLayout *, char const *, nn::ui2d::TextureInfo const *); + + void setPaneString(al::IUseLayout *layout, char const *paneName, char16_t const *, ushort); + + void setPaneStringFormat(al::IUseLayout *layout, char const *paneName, char const *format,...); + + void setPaneLocalTrans(al::IUseLayout *layout, const char *paneName, sead::Vector3f const &); + void setPaneLocalTrans(al::IUseLayout *layout, const char *paneName, sead::Vector2f const &); + void setPaneLocalSize(al::IUseLayout *layout, const char *paneName, sead::Vector2f const &); + void setPaneLocalScale(al::IUseLayout *layout, const char *paneName, sead::Vector2f const &); + void setPaneLocalRotate(al::IUseLayout *layout, const char *paneName, sead::Vector3f const &); + + sead::Vector3f &getPaneLocalTrans(const al::IUseLayout *layout, const char *paneName); + void getPaneLocalSize(sead::Vector2f *, const al::IUseLayout *layout, const char *paneName); + sead::Vector2f &getPaneLocalScale(const al::IUseLayout *layout, const char *paneName); + sead::Vector3f &getPaneLocalRotate(const al::IUseLayout *layout, const char *paneName); + + bool killLayoutIfActive(al::LayoutActor *); + + // camera stuff + + void setCameraTarget(al::IUseCamera *, al::CameraTargetBase *); + + // calc functions + + f32 calcDistance(al::LiveActor const *, al::LiveActor const*); // calculates distance between two actors + + f32 calcDistance(al::LiveActor const *, sead::Vector3f const&); // calculates distance between an actor and a position in the world + + void calcFrontDir(sead::Vector3f *result, al::LiveActor const *actor); + + // velocity stuff + + void addVelocity(al::LiveActor *,sead::Vector3f const&); + + void setVelocity(al::LiveActor *,sead::Vector3f const&); + + void scaleVelocityExceptDirection(al::LiveActor *,sead::Vector3f const&, float); + + void addVelocityToGravity(al::LiveActor *, float); + + // animation stuff + + void startVisAnimForAction(al::LiveActor*, char const*); + + void startVisAnim(al::LiveActor *, char const *); + void startMtpAnim(al::LiveActor *, char const *); + void startMclAnim(al::LiveActor *, char const *); + + float getSklAnimBlendWeight(al::LiveActor const*,int); + void setSklAnimBlendWeight(al::LiveActor *,float,int); + void setSklAnimBlendWeightDouble(al::LiveActor *, float); + void setSklAnimBlendWeightDouble(al::LiveActor *, float,float); + void setSklAnimBlendWeightTriple(al::LiveActor *, float,float,float); + void setSklAnimBlendWeightQuad(al::LiveActor *, float,float,float,float); + void setSklAnimBlendWeightFivefold(al::LiveActor *,float,float,float,float,float); + void setSklAnimBlendWeightSixfold(al::LiveActor *, float,float,float,float,float,float); + + void offCalcAnim(al::LiveActor *); + void onCalcAnim(al::LiveActor*); + + bool isVisAnimExist(const al::LiveActor *, const char *); + bool isMtpAnimExist(const al::LiveActor *, const char *); + bool isMclAnimExist(const al::LiveActor *, const char *); + + bool isActionEnd(al::LiveActor const *); + + bool isActionPlaying(al::LiveActor const *, char const *); + + bool tryStartActionSubActorAll(al::LiveActor *, char const *); + + bool tryStartActionIfNotPlaying(al::LiveActor*, char const*); + + bool tryStartAction(al::LiveActor *, char const *); + + void startAction(al::LiveActor *, char const *); + + const char * getPlayingSklAnimName(const al::LiveActor *actor, int index); + + bool tryStartSklAnimIfNotPlaying(al::LiveActor *actor, const char * animName); + + bool tryStartSklAnimIfExist(al::LiveActor *actor, const char * animName); + + // byml stuff + + bool tryGetByamlU8(uchar *,al::ByamlIter const&,char const*); + bool tryGetByamlU16(ushort *,al::ByamlIter const&,char const*); + bool tryGetByamlS16(short *,al::ByamlIter const&,char const*); + bool tryGetByamlS32(int *,al::ByamlIter const&,char const*); + bool tryGetByamlU32(uint *,al::ByamlIter const&,char const*); + bool tryGetByamlS64(long *,al::ByamlIter const&,char const*); + bool tryGetByamlU64(ulong *,al::ByamlIter const&,char const*); + bool tryGetByamlF32(float *,al::ByamlIter const&,char const*); + bool tryGetByamlV2f(sead::Vector2 *,al::ByamlIter const&); + bool tryGetByamlV3f(sead::Vector3 *,al::ByamlIter const&); + bool tryGetByamlV4f(sead::Vector4 *,al::ByamlIter const&); + bool tryGetByamlScale(sead::Vector3 *,al::ByamlIter const&); + bool tryGetByamlV2s32(sead::Vector2 *,al::ByamlIter const&); + bool tryGetByamlV3s32(sead::Vector3 *,al::ByamlIter const&); + bool tryGetByamlBox3f(sead::BoundBox3 *,al::ByamlIter const&); + bool tryGetByamlV3f(sead::Vector3 *,al::ByamlIter const&,char const*); + bool tryGetByamlV2f(sead::Vector2 *,al::ByamlIter const&,char const*); + bool tryGetByamlV4f(sead::Vector4 *,al::ByamlIter const&,char const*); + bool tryGetByamlScale(sead::Vector3 *,al::ByamlIter const&,char const*); + bool tryGetByamlV2s32(sead::Vector2 *,al::ByamlIter const&,char const*); + bool tryGetByamlV3s32(sead::Vector3 *,al::ByamlIter const&,char const*); + bool tryGetByamlBox3f(sead::BoundBox3 *,al::ByamlIter const&,char const*); + bool tryGetByamlString(char const**,al::ByamlIter const&,char const*); + bool tryGetByamlColor(sead::Color4f *,al::ByamlIter const&); + bool tryGetByamlColor(sead::Color4f *,al::ByamlIter const&,char const*); + bool tryGetByamlBool(bool *,al::ByamlIter const&,char const*); + bool tryGetByamlKeyStringOrNULL(al::ByamlIter const&,char const*); + bool tryGetByamlKeyIntOrZero(al::ByamlIter const&,char const*); + bool tryGetByamlKeyU32OrZero(al::ByamlIter const&,char const*); + bool tryGetByamlKeyFloatOrZero(al::ByamlIter const&,char const*); + bool tryGetByamlKeyBoolOrFalse(al::ByamlIter const&,char const*); + bool tryGetByamlIterByKey(al::ByamlIter *,al::ByamlIter const&,char const*); + bool tryGetByamlKeyAndIntByIndex(char const**,int *,al::ByamlIter const&,int); + + // nerve stuff + + bool isLessStep(al::IUseNerve const*,int); // checks if the current nerve has been activated for a certain amount of frames(?) + + bool isFirstStep(al::IUseNerve const *); + + bool isNerve(al::IUseNerve const*, al::Nerve const*); + + void setNerve(al::IUseNerve *,al::Nerve const*); + + // effect stuff + + void emitEffect(al::IUseEffectKeeper *effectKeeper, char const *effectName, sead::Vector3f const *effectPosition); + + bool tryEmitEffect(al::IUseEffectKeeper *effectKeeper, char const *effectName, sead::Vector3f const *effectPosition); + + void tryDeleteEffect(al::IUseEffectKeeper *effectKeeper, char const *effectName); + + // sensor stuff + + // enum SensorType { + // Unknown, // 0 + // Player, // 1 + // PlayerAttack, // 2 + // PlayerFoot // 3 + // }; + + al::HitSensor *getHitSensor(al::LiveActor const *host, char const *name); + + al::LiveActor *getSensorHost(al::HitSensor const *); + + void invalidateHitSensors(al::LiveActor *); + void validateHitSensors(al::LiveActor *); + + void invalidateHitSensor(al::LiveActor *, const char *); + void validateHitSensor(al::LiveActor *, const char *); + + void addHitSensor(al::LiveActor *actor, al::ActorInitInfo const &initInfo, char const *sensorName, uint typeEnum, float radius, ushort maxCount, sead::Vector3f const& position); + + bool isMsgPlayerTrampleReflect(al::SensorMsg const *); + + bool isSensorPlayerAttack(al::HitSensor const *targetSensor); + + bool sendMsgPlayerHipDropKnockDown(al::HitSensor *target, al::HitSensor *source); + + // audio + + void tryPauseBgmIfLowPriority(al::IUseAudioKeeper const *keeper, const char *audioName, int unk); + + // player stuff + + void getClassName(const char **namePtr, const al::ActorInitInfo &info); + + void getDisplayName(const char **namePtr, const al::ActorInitInfo &info); + + // stage switch stuff + + // stage init stuff + + + bool tryInitPlacementSingleObject(al::Scene*, al::ActorInitInfo const&, int, char const*, + char const*); + + bool tryInitPlacementSingleObject(al::Scene *,al::ActorInitInfo const&,int,char const*); + + al::StageInfo *getStageInfoMap(al::Scene const*,int); + + void tryGetPlacementInfoAndCount(al::PlacementInfo *, int *, al::StageInfo const*, char const*); + + void getPlacementInfoByIndex(al::PlacementInfo*, al::PlacementInfo const&, int); + + bool tryGetPlacementId(al::PlacementId *pId, al::PlacementInfo const &placement); //{ return pId->init(placement); }; + bool tryGetPlacementId(al::PlacementId *pId, al::ActorInitInfo const &placement); + + void getObjectName(const char **namePtr, const al::PlacementInfo &placementInfo); + void getObjectName(const char **namePtr, const al::ActorInitInfo &placementInfo); + + bool tryGetObjectName(const char **namePtr, const al::PlacementInfo &placementInfo); + bool tryGetObjectName(const char **namePtr, const al::ActorInitInfo &placementInfo); + + bool tryGetStringArg(const char **namePtr, const al::PlacementInfo &info, const char *key); + bool tryGetStringArg(const char **namePtr, const al::ActorInitInfo &info, const char *key); + + bool tryGetClassName(const char **namePtr, const al::PlacementInfo &info); + bool tryGetClassName(const char **namePtr, const al::ActorInitInfo &info); + + bool tryGetDisplayName(const char **namePtr, const al::PlacementInfo &info); + bool tryGetDisplayName(const char **namePtr, const al::ActorInitInfo &info); + + bool tryGetTrans(sead::Vector3f *, al::PlacementInfo const&); + + // scene init + + void initPlacementObjectMap(al::Scene *, al::ActorInitInfo const &, char const *); + void initPlacementObjectDesign(al::Scene *, al::ActorInitInfo const &, char const *); + void initPlacementObjectSound(al::Scene *, al::ActorInitInfo const &, char const *); + + LiveActor* createPlacementActorFromFactory(al::ActorInitInfo const&, al::PlacementInfo const*); + + // layout init stuff + + void initLayoutActor(al::LayoutActor *,al::LayoutInitInfo const&,char const*,char const*); + + // actor init stuff + + bool tryGetArg(int *, al::ActorInitInfo const&, char const*); + bool tryGetArg(int *, al::PlacementInfo const&, char const*); + + bool tryGetArg(float *, al::ActorInitInfo const&, char const*); + bool tryGetArg(float *, al::PlacementInfo const&, char const*); + + bool tryGetArg(bool *, al::ActorInitInfo const&, char const*); + bool tryGetArg(bool *, al::PlacementInfo const&, char const*); + + bool tryGetArgV3f(sead::Vector3 *,al::ActorInitInfo const&, char const*); + bool tryGetArgV3f(sead::Vector3 *,al::PlacementInfo const&, char const*); + + bool tryGetArgV2f(sead::Vector2 *,al::ActorInitInfo const&, char const*); + bool tryGetArgV2f(sead::Vector2 *,al::PlacementInfo const&, char const*); + + void registerExecutorFunctor(char const *, al::ExecuteDirector *, al::FunctorBase const &); + + void initExecutorPlayer(al::LiveActor *,al::ActorInitInfo const&); + void initExecutorPlayerPreMovement(al::LiveActor *,al::ActorInitInfo const&); + void initExecutorPlayerMovement(al::LiveActor *,al::ActorInitInfo const&); + void initExecutorPlayerModel(al::LiveActor *,al::ActorInitInfo const&); + void initExecutorPlayerDecoration(al::LiveActor *,al::ActorInitInfo const&); + void initExecutorModelUpdate(al::LiveActor *, al::ActorInitInfo const &); + void initActorWithArchiveName(al::LiveActor *actor, al::ActorInitInfo const &initInfo, sead::SafeString const &archiveName, char const *suffix); + void initExecutorUpdate(al::LiveActor *,al::ActorInitInfo const&, const char *); + void initExecutorDraw(al::LiveActor *,al::ActorInitInfo const&, const char *); + void initActor(al::LiveActor *, al::ActorInitInfo const&); + void initActorCommon(al::LiveActor *actor, al::ActorInitInfo const &info, char const *dataFolder, char const *archiveName, char const *suffix); // not a real symbol + void initActorSuffix(al::LiveActor*, al::ActorInitInfo const&, char const*); + void initActorInitInfo(al::ActorInitInfo *,al::Scene const*,al::PlacementInfo const*,al::LayoutInitInfo const*,al::ActorFactory const*,al::SceneMsgCtrl *,GameDataHolderBase *); + + // misc + + void readSaveDataSync(const char* dataFile, uint, uint); + + bool isSuccessSaveDataSequence(); + + void validateCollisionParts(al::LiveActor*); + + void invalidateCollisionParts(al::LiveActor *); + + bool isExistCollisionParts(const al::LiveActor *); + + void copyPose(al::LiveActor *from, const al::LiveActor *to); + + void hideModelIfShow(al::LiveActor *); + void showModelIfHide(al::LiveActor *); + + void invalidateClipping(al::LiveActor *); + + void validateClipping(al::LiveActor *); + + void hideSilhouetteModelIfShow(al::LiveActor *); + + bool isExistDitherAnimator(const al::LiveActor *); + + void validateDitherAnim(al::LiveActor *); + void invalidateDitherAnim(al::LiveActor *); + + bool isHideModel(const al::LiveActor *); + + bool isDead(const al::LiveActor *); + + bool isAlive(const al::LiveActor *); + + char16_t *getSystemMessageString(al::IUseMessageSystem const *, char const *, char const *); + + void initPlacementByStageInfo(al::StageInfo const *, char const *, al::ActorInitInfo const &); + + al::AreaObjGroup *tryFindAreaObjGroup(al::IUseAreaObj const *, const char *areaName); + + sead::DrawContext *getSceneDrawContext(al::Scene const*); // these two things are all thats needed to setup text writer in the right context + + sead::LogicalFrameBuffer *getSceneFrameBufferMain(al::Scene const*); + + int getLayoutDisplayWidth(); + int getLayoutDisplayHeight(); + + void executeDraw(al::LayoutKit const *, char const *); + + bool isExistFile(sead::SafeString const &filePath); + + al::StageInfo *getStageInfoMap(al::Scene const*,int); + + bool isVisAnimExist(const al::LiveActor *, const char *); + + bool isInAreaObj(al::LiveActor const *, const char *); + + al::AreaObj *tryFindAreaObj(al::LiveActor const *, const char *); + + void tryGetAreaObjArg(int *, al::AreaObj const *, const char *); + void tryGetAreaObjArg(float *, al::AreaObj const *, const char *); + void tryGetAreaObjArg(bool *, al::AreaObj const *, const char *); + + void tryGetAreaObjStringArg(const char **, al::AreaObj const *, const char *); + + void offCollide(al::LiveActor *); + void onCollide(al::LiveActor *); + + bool tryStartSe(al::IUseAudioKeeper const *, sead::SafeStringBase const &); + + void startSe(al::IUseAudioKeeper const *, sead::SafeStringBase const &); + + void startHitReaction(al::LiveActor const *, char const*); + + bool isInDeathArea(al::LiveActor const *); + + void calcCameraUpDir(sead::Vector3f *, al::IUseCamera const*, int); + + const unsigned char *tryGetBymlFromArcName(sead::SafeStringBase const &, sead::SafeStringBase const &); + + class ActorInitInfo; + + bool getArg(int *, const al::ActorInitInfo &, const char *); + + bool isActiveDemo(const al::Scene *); + + bool isEqualString(char const *, char const *); + bool isEqualString(sead::SafeStringBase const &, sead::SafeStringBase const &); + + bool isEqualSubString(char const *, char const *); + + bool isOnGround(al::LiveActor const*, uint); + + bool isActiveDemo(al::Scene const *); + + bool isInWaterPos(al::LiveActor const*, sead::Vector3f const &); + + // interpolation functions + + void lerpVec(sead::Vector3f *result, sead::Vector3f const& from, sead::Vector3f const& to, float rate); + + void slerpQuat(sead::Quatf *result, sead::Quatf const& from, sead::Quatf const& to, float rate); + + // dither anim stuff + + bool isExistDitherAnimator(al::LiveActor const *); + + void stopDitherAnimAutoCtrl(al::LiveActor *); + void restartDitherAnimAutoCtrl(al::LiveActor *); + + void validateDitherAnim(al::LiveActor *); + void invalidateDitherAnim(al::LiveActor *); + + float getDitherAnimNearClipStartDistance(al::LiveActor const *); + float getDitherAnimNearClipEndDistance(al::LiveActor const *); + + void setDitherAnimSphereRadius(al::LiveActor *, float); + void setDitherAnimBoundingBox(al::LiveActor *, sead::Vector3f const&); + void setDitherAnimMaxAlpha(al::LiveActor *, float); + void setDitherAnimClippingJudgeLocalOffset(al::LiveActor *, sead::Vector3f const&); + void setDitherAnimClippingJudgeParam(al::LiveActor *, const char *); +} diff --git a/include/al/util/AudioUtil.h b/include/al/util/AudioUtil.h new file mode 100644 index 0000000..b46d632 --- /dev/null +++ b/include/al/util/AudioUtil.h @@ -0,0 +1,18 @@ +#pragma once + +#include "al/audio/AudioKeeper.h" +#include "sead/prim/seadSafeString.h" + +namespace al { + +bool checkIsPlayingSe(al::IUseAudioKeeper const*, const sead::SafeString&, const char*); + +bool isPlayingBgm(al::IUseAudioKeeper const*); + +bool isPlayingBgm(al::IUseAudioKeeper const*,char const*); + +void stopAllBgm(al::IUseAudioKeeper const*, int); + +bool tryStopAllBgm(al::IUseAudioKeeper const *, int); + +} \ No newline at end of file diff --git a/include/al/util/CameraUtil.h b/include/al/util/CameraUtil.h new file mode 100644 index 0000000..922266f --- /dev/null +++ b/include/al/util/CameraUtil.h @@ -0,0 +1,42 @@ +#pragma once + +#include + +#include "al/LiveActor/LiveActor.h" +#include "al/camera/CameraDirector.h" +#include "al/camera/CameraTicket.h" +#include "al/camera/CameraTargetBase.h" +#include "al/scene/Scene.h" + +namespace al { + +struct SceneCameraInfo; +struct PauseCameraCtrl; +struct CameraPoseInfo; + +sead::Vector3f* getCameraUp(al::IUseCamera const*, int); + +void requestStopCameraVerticalAbsorb(al::IUseCamera *); + +bool isActiveCamera(al::CameraTicket const*); +bool isActiveCameraTarget(al::CameraTargetBase const*); +bool isActiveCameraSubTarget(al::CameraSubTargetBase const*); +bool isActiveCameraInterpole(al::IUseCamera const*,int); +bool isActiveCameraInterpole(al::SceneCameraInfo const*, int); + +void startCamera(al::IUseCamera const*,al::CameraTicket *,int priority); +void startCameraSub(al::IUseCamera const*,al::CameraTicket *,int priority); +void startCameraShakeByAction(al::LiveActor const*,char const*,char const*,int,int); +void startCameraShakeByHitReaction(al::IUseCamera const*,char const*,char const*,char const*,int,int); +void startCameraInterpole(al::IUseCamera const*,int,int); +void restartCameraByDeathPlayer(al::Scene *); +void startCameraSnapShotMode(al::Scene *,bool); +void startCameraPause(al::PauseCameraCtrl*); + +void endCamera(al::IUseCamera const*,al::CameraTicket *,int,bool); +void endCameraWithNextCameraPose(al::IUseCamera const*,al::CameraTicket *,al::CameraPoseInfo const*,int); +void endCameraSub(al::IUseCamera const*,al::CameraTicket *,int); +void endCameraSnapShotMode(al::Scene *); +void endCameraPause(al::PauseCameraCtrl *); + +} \ No newline at end of file diff --git a/include/al/util/ControllerUtil.h b/include/al/util/ControllerUtil.h new file mode 100644 index 0000000..b093f51 --- /dev/null +++ b/include/al/util/ControllerUtil.h @@ -0,0 +1,40 @@ +#pragma once + +#include "sead/math/seadVector.h" + +namespace al { + bool isPadTriggerUp(int port); + bool isPadTriggerDown(int port); + bool isPadTriggerLeft(int port); + bool isPadTriggerRight(int port); + + bool isPadTriggerA(int port); + bool isPadTriggerB(int port); + bool isPadTriggerX(int port); + bool isPadTriggerY(int port); + + bool isPadTriggerZL(int port); + bool isPadTriggerZR(int port); + + bool isPadTriggerL(int port); + bool isPadTriggerR(int port); + + bool isPadHoldUp(int port); + bool isPadHoldDown(int port); + bool isPadHoldLeft(int port); + bool isPadHoldRight(int port); + + bool isPadHoldA(int port); + bool isPadHoldB(int port); + bool isPadHoldX(int port); + bool isPadHoldY(int port); + + bool isPadHoldL(int port); + bool isPadHoldR(int port); + + bool isPadHoldZL(int port); + bool isPadHoldZR(int port); + + sead::Vector2f *getLeftStick(int); + sead::Vector2f *getRightStick(int); +} \ No newline at end of file diff --git a/include/al/util/GraphicsUtil.h b/include/al/util/GraphicsUtil.h new file mode 100644 index 0000000..29ad602 --- /dev/null +++ b/include/al/util/GraphicsUtil.h @@ -0,0 +1,26 @@ +#pragma once + +namespace sead { + class LookAtCamera; + class Projection; +} + +namespace al { + class IUseCamera; + class Scene; + + void updateKitListPrev(Scene *); + void updateKitList(Scene *, const char *); + void updateKitListPost(Scene *); + + sead::LookAtCamera *getLookAtCamera(al::IUseCamera const*,int); + sead::Projection *getProjectionSead(al::IUseCamera const*,int); +} // namespace al + + + +// TODO: get this out of here +namespace rs +{ + void requestGraphicsPresetAndCubeMapPause(const al::Scene *); +} // namespace rs diff --git a/include/al/util/LayoutUtil.h b/include/al/util/LayoutUtil.h new file mode 100644 index 0000000..398ed7d --- /dev/null +++ b/include/al/util/LayoutUtil.h @@ -0,0 +1,53 @@ +#include +#include +#include +#include "al/layout/LayoutActor.h" +#include "al/layout/LayoutInitInfo.h" + +typedef unsigned short int ushort; + +namespace nn::ui2d { +class TextureInfo; +} + +namespace al +{ + + class IUseLayout; + class IUseLayoutAction; + + char16_t* getPaneStringBuffer(IUseLayout const* lyt, const char* paneName); + int getPaneStringBufferLength(IUseLayout const* lyt, const char* paneName); + + void startFreezeActionEnd(IUseLayoutAction*, char const*, char const*); + + void startHitReaction(LayoutActor const *, const char *, const char *); + + void hidePane(IUseLayout* lyt, const char* paneName); + void hidePaneNoRecursive(IUseLayout* lyt, const char* paneName); + void showPane(IUseLayout* lyt, const char* paneName); + void showPaneNoRecursive(IUseLayout* lyt, const char* paneName); + + void hidePaneRoot(al::IUseLayout *); + void hidePaneRootNoRecursive(al::IUseLayout *); + void showPaneRoot(al::IUseLayout *); + void showPaneRootNoRecursive(al::IUseLayout *); + + bool isHidePane(const IUseLayout *lyt, const char *paneName); + bool isHidePaneRoot(al::IUseLayout const*); + bool isActionPlaying(IUseLayoutAction *, const char *action, const char *group); + bool isActionEnd(IUseLayoutAction const*, char const*); + bool isExistPane(const al::IUseLayout *lyt, char const *paneName); + + void initLayoutActor(LayoutActor*, LayoutInitInfo const&, char const*, char const*); + void setActionFrameRate(IUseLayoutAction *,float,char const*); + void setPaneString(IUseLayout *layout, char const *paneName, char16_t const *paneValue, ushort); + void setPaneStringFormat(IUseLayout* layout, char const* paneName, char const* format, ...); + void setPaneTexture(IUseLayout*, char const*, nn::ui2d::TextureInfo const*); + void calcLayoutPosFromWorldPos(sead::Vector2f*, const al::IUseCamera*, const sead::Vector3f &); + void calcLayoutPosFromWorldPosSub(sead::Vector2f *, const al::IUseCamera *, const sead::Vector3f &); + void calcPaneTrans(sead::Vector2f*, IUseLayout const*, char const*); + void setLocalTrans(IUseLayout*, sead::Vector2f const&); + void setLocalScale(IUseLayout *, float); + +} // namespace al diff --git a/include/al/util/LiveActorUtil.h b/include/al/util/LiveActorUtil.h new file mode 100644 index 0000000..ace88f8 --- /dev/null +++ b/include/al/util/LiveActorUtil.h @@ -0,0 +1,169 @@ +#pragma once + +#include +#include +#include +#include +#include "al/LiveActor/LiveActor.h" +#include "al/async/FunctorBase.h" +#include "al/collision/Collider.h" +#include "game/Player/PlayerActorHakoniwa.h" +#include "al/layout/LayoutActor.h" +#include "al/layout/LayoutInitInfo.h" + +typedef unsigned int uint; + +namespace al { + + void tryInitFixedModelGpuBuffer(const LiveActor*); + void offUpdateMovementEffectAudioCollisionSensor(const LiveActor*); + void hideModel(LiveActor *); + void hideModelIfShow(const LiveActor*); + void showModelIfHide(const LiveActor*); + void setModelAlphaMask(const LiveActor*, float); + void resetPosition(const LiveActor*); + void onSyncClippingSubActor(LiveActor*, const LiveActor*); + void onSyncHideSubActor(LiveActor*, const LiveActor*); + void onSyncAlphaMaskSubActor(LiveActor*, const LiveActor*); + void setMaterialProgrammable(LiveActor*); + void startAction(LiveActor*, char const*); + void startAction(IUseLayoutAction*, const char *, const char *); + void startFreezeActionEnd(IUseLayoutAction *,char const*,char const*); + void startHitReaction(LiveActor*, char const*); + void invalidateClipping(const LiveActor *); + void validateClipping(const LiveActor *); + void setNerveAtActionEnd(LiveActor*, const al::Nerve*); + void updateMaterialCodeWater(LiveActor *); + void updateMaterialCodeWater(LiveActor *, bool); + void appearItem(const LiveActor *); + void turnToTarget(LiveActor*, const sead::Vector3f&, float); + void turnToTarget(LiveActor*, const al::LiveActor *, float); + + void expandClippingRadiusByShadowLength(LiveActor *,sead::Vector3f *, float); + + void initJointLocalXRotator(const LiveActor *,const float *,const char *); + void initJointLocalYRotator(const LiveActor *,const float *,const char *); + void initJointLocalZRotator(const LiveActor*, const float*, const char*); + + void initActorPoseTRSV(al::LiveActor *); + void initActorPoseTRMSV(al::LiveActor *); + void initActorPoseTRGMSV(al::LiveActor *); + void initActorPoseTFSV(al::LiveActor *); + void initActorPoseTFUSV(al::LiveActor *); + void initActorPoseTFGSV(al::LiveActor *); + void initActorPoseTQSV(al::LiveActor *); + void initActorPoseTQGSV(al::LiveActor *); + void initActorPoseTQGMSV(al::LiveActor *); + void initActorPoseT(al::LiveActor *,sead::Vector3 const&); + void initActorPoseTR(al::LiveActor *,sead::Vector3 const&,sead::Vector3 const&); + + void initLayoutPartsActor(LayoutActor*, LayoutActor*, const LayoutInitInfo&, char const*, + char const*); + void initCreateActorWithPlacementInfo(LiveActor*, const al::ActorInitInfo&); + void initMapPartsActor(LiveActor *, const al::ActorInitInfo &, const char *); + void initActorWithArchiveName(LiveActor*, const al::ActorInitInfo&, const sead::SafeString&, const char*); + void initJointControllerKeeper(const LiveActor*, int); + void initJointGlobalQuatController(const LiveActor*, const sead::Quatf*, const char*); + + void appearBreakModelRandomRotateY(LiveActor *); + + bool isNear(const LiveActor *, const LiveActor *, float); + bool isClipped(const LiveActor*); + bool isDead(const LiveActor*); + bool isAlive(const LiveActor*); + bool isHideModel(const LiveActor*); + bool isEffectEmitting(const IUseEffectKeeper*, const char*); + bool isActionEnd(const LiveActor*); + bool isActionPlaying(const LiveActor*, const char *); + bool isInvalidClipping(const LiveActor*); + bool isInWater(const LiveActor *); + bool isInWaterArea(const LiveActor *); + bool isOnGround(const LiveActor *, unsigned int); + bool isOnStageSwitch(IUseStageSwitch const *, const char *); + bool isValidStageSwitch(IUseStageSwitch const *, const char *); + bool isFallNextMove(const LiveActor *, const sead::Vector3f &, float, float); + bool isInDeathArea(LiveActor *); + bool isCollidedFloorCode(LiveActor *, const char *); + bool isNoCollide(LiveActor const *); + bool isNearPlayer(const LiveActor*, float); + bool isFallOrDamageCodeNextMove(const LiveActor *, const sead::Vector3f &, float, float); + bool isFaceToTargetDegreeH(const LiveActor*, const sead::Vector3f &, const sead::Vector3f &, float); + + bool tryOnSwitchDeadOn(IUseStageSwitch *); + bool trySyncStageSwitchAppear(LiveActor *); + PlayerActorHakoniwa* tryFindNearestPlayerActor(const LiveActor *); + bool tryFindNearestPlayerPos(sead::Vector3f *, const LiveActor *); + bool tryAddRippleMiddle(LiveActor*); + bool tryStartActionIfNotPlaying(LiveActor*, const char*); + + float getClippingRadius(al::LiveActor const*); + sead::Vector3f *getClippingObb(al::LiveActor *); + sead::Vector3f *getClippingCenterPos(al::LiveActor const*); + + sead::Vector3f& getTrans(const LiveActor*); + sead::Vector3f* getTransPtr(LiveActor*); + sead::Vector3f& getGravity(const LiveActor*); + sead::Vector3f* getGravityPtr(const LiveActor*); + sead::Vector3f& getFront(const LiveActor*); + sead::Vector3f* getFrontPtr(LiveActor*); + sead::Vector3f& getVelocity(const LiveActor*); + sead::Vector3f* getVelocityPtr(LiveActor*); + sead::Quatf& getQuat(al::LiveActor const*); + sead::Quatf* getQuatPtr(al::LiveActor *); + Collider* getActorCollider(LiveActor*); + + sead::Matrix34f* getJointMtxPtr(const LiveActor*, const char*); //return type might be const + + sead::Quatf* getQuatPtr(LiveActor *); + + sead::Vector3f* getOnGroundNormal(const LiveActor *, uint); + + void scaleVelocity(LiveActor*, float); + void scaleVelocityDirection(LiveActor*, sead::Vector3f const&, float); + + void setClippingObb(LiveActor*, sead::BoundBox3f const&); + void setClippingInfo(LiveActor*, float, sead::Vector3f const*); + void setClippingNearDistance(LiveActor *,float); + + void setTrans(LiveActor *, sead::Vector3f const &); + void setVelocity(LiveActor*, sead::Vector3f const&); + void setVelocity(LiveActor*, float, float, float); + void setVelocityX(LiveActor*, float); + void setVelocityY(LiveActor*, float); + void setVelocityZ(LiveActor*, float); + void setVelocityZero(LiveActor*); + void setVelocityBlowAttackAndTurnToTarget(LiveActor *, sead::Vector3f const&, + float, float); + void setActionFrameRate(LiveActor*, float); + + void addVelocityToGravityFittedGround(LiveActor*, float, unsigned int); + void addVelocityToGravity(LiveActor*, float); + void addVelocityToDirection(LiveActor*, sead::Vector3f const &, float); + void addVelocity(LiveActor*, sead::Vector3f const &); + void addVelocityX(LiveActor*, float); + void addVelocityY(LiveActor*, float); + void addVelocityZ(LiveActor*, float); + + void calcFrontDir(sead::Vector3f *, const LiveActor *); + void calcQuat(sead::Quatf*, const LiveActor*); + void calcJointFrontDir(sead::Vector3f*, const LiveActor*, const char*); + void calcJointPos(sead::Vector3f*, const LiveActor*, const char*); + + void makeQuatUpFront(sead::Quatf *, sead::Vector3f const &, sead::Vector3f const &); + + void rotateQuatYDirDegree(LiveActor *, float); + + f32* findActorParamF32(const LiveActor*, const char*); + + s32* findActorParamS32(const LiveActor*, const char*); + + LiveActor* getSubActor(const LiveActor*, const char*); //NOTE: unknown return type + + bool listenStageSwitchOnAppear(IUseStageSwitch *, al::FunctorBase const &functor); +} + +namespace rs { + +sead::Vector3f* getPlayerPos(const al::LiveActor*); + +} diff --git a/include/al/util/MathUtil.h b/include/al/util/MathUtil.h new file mode 100644 index 0000000..7347430 --- /dev/null +++ b/include/al/util/MathUtil.h @@ -0,0 +1,65 @@ +#pragma once + +#include + +namespace al { + +class LiveActor; + +void normalize(sead::Vector3f*); +float normalize(float, float, float); +float normalize(signed int, signed int, signed int); + +float easeIn(float); +float easeOut(float); +float easeInOut(float); + +float modf(float, float); +int modi(int, int); + +float sign(float); +int sign(int); + +float squareIn(float); +float squareOut(float); + +float powerIn(float, float); +float powerOut(float, float); + +float lerpValue(float, float, float); + +bool isNearZero(float, float); + +bool isNearZero(sead::Vector3f const &, float); + +template +inline T clamp(T value, T min, T max) { + if (value < min) + return min; + if (value > max) + return max; + return value; +} + +float calcSpringDumperForce(float unk1, float unk2, float unk3, float unk4); + +void separateVectorHV(sead::Vector3f*, sead::Vector3f*, const sead::Vector3f &, + const sead::Vector3f &); + +bool tryNormalizeOrDirZ(sead::Vector3f *); +bool tryNormalizeOrDirZ(sead::Vector3f *, sead::Vector3f const&); +bool tryNormalizeOrZero(sead::Vector3f*, sead::Vector3f const&); + +float calcAngleToTargetH(LiveActor const*,sead::Vector3f const&); +float calcAngleToTargetV(LiveActor const*,sead::Vector3f const&); +float calcAngleRadian(sead::Vector3f const&,sead::Vector3f const&); +float calcAngleDegree(sead::Vector3f const&,sead::Vector3f const&); +float calcAngleDegree(sead::Vector2f const&,sead::Vector2f const&); +float calcAngleOnPlaneRadian(sead::Vector3f const&,sead::Vector3f const&,sead::Vector3f const&); +float calcAngleOnPlaneDegree(sead::Vector3f const&,sead::Vector3f const&,sead::Vector3f const&); +float calcAngleOnPlaneDegreeOrZero(sead::Vector3f const&,sead::Vector3f const&,sead::Vector3f const&); +float calcAngleSignOnPlane(sead::Vector3f const&,sead::Vector3f const&,sead::Vector3f const&); +bool tryCalcAngleDegree(float *,sead::Vector3f const&,sead::Vector3f const&); +bool tryCalcAngleOnPlaneDegree(float *,sead::Vector3f const&,sead::Vector3f const&,sead::Vector3f const&); + +}; // namespace al \ No newline at end of file diff --git a/include/al/util/NerveUtil.h b/include/al/util/NerveUtil.h new file mode 100644 index 0000000..5a30051 --- /dev/null +++ b/include/al/util/NerveUtil.h @@ -0,0 +1,59 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "al/nerve/Nerve.h" +#include "al/nerve/NerveStateBase.h" + +#define NERVE_HEADER(Class, Action) \ + class Class##Nrv##Action : public al::Nerve { \ + public: \ + void execute(al::NerveKeeper*) override; \ + }; \ + Class##Nrv##Action nrv##Class##Action; + +#define NERVE_IMPL_(Class, Action, ActionFunc) \ + void Class##Nrv##Action::execute(al::NerveKeeper* keeper) { \ + static_cast(keeper->mParent)->exe##ActionFunc(); \ + } +#define NERVE_IMPL(Class, Action) NERVE_IMPL_(Class, Action, Action) + +// Fruity Nerve Implmentation +#define NERVE_DEF(CLASS, ACTION) \ + struct CLASS##Nrv##ACTION : public al::Nerve { \ + inline void execute(al::NerveKeeper* keeper) override \ + { \ + static_cast(keeper->mParent)->exe##ACTION(); \ + }; \ + const CLASS##Nrv##ACTION nrv##CLASS##ACTION; \ + } + +namespace al +{ + void setNerve(al::IUseNerve *, const al::Nerve *); + void setNerveAtStep(al::IUseNerve *, const al::Nerve *, int); + bool isStep(const al::IUseNerve *, int); + void setNerveAtGreaterEqualStep(al::IUseNerve *, const al::Nerve *, int); + bool isGreaterEqualStep(const al::IUseNerve *, int); + bool isNerve(const al::IUseNerve *, const al::Nerve *); + int getNerveStep(const al::IUseNerve *); + const al::Nerve* getCurrentNerve(const al::IUseNerve *); + bool isFirstStep(const al::IUseNerve *); + bool isLessStep(const al::IUseNerve *, int); + bool isGreaterStep(const al::IUseNerve *, int); + bool isInRangeStep(const al::IUseNerve *, int, int); + bool isIntervalStep(const al::IUseNerve *, int, int); + bool isIntervalOnOffStep(const al::IUseNerve *, int, int); + bool isNewNerve(const al::IUseNerve *); + int calcNerveInterval(const al::IUseNerve *, int, int); + float calcNerveRate(const al::IUseNerve *, int); + float calcNerveRate(const al::IUseNerve *, int, int); + float calcNerveEaseInRate(const al::IUseNerve *, int); + float calcNerveEaseInRate(const al::IUseNerve *, int, int); + + void initNerveState(al::IUseNerve *, al::NerveStateBase *, const al::Nerve *, const char *); + void initNerve(LiveActor *, const al::Nerve *, int); + void addNerveState(al::IUseNerve *, al::NerveStateBase *, const al::Nerve *, const char *); + bool updateNerveState(al::IUseNerve *); + bool updateNerveStateAndNextNerve(al::IUseNerve *, const al::Nerve *); + bool isStateEnd(const al::IUseNerve *); +}; \ No newline at end of file diff --git a/include/al/util/VectorUtil.h b/include/al/util/VectorUtil.h new file mode 100644 index 0000000..9a3fc81 --- /dev/null +++ b/include/al/util/VectorUtil.h @@ -0,0 +1,69 @@ +#pragma once + +#include +#include +#include "al/LiveActor/LiveActor.h" + +namespace al { + +class KeyPoseKeeper; + +bool isNearZero(const sead::Vector2f&, float); +void verticalizeVec(sead::Vector3f*, const sead::Vector3f&, const sead::Vector3f&); +bool tryNormalizeOrZero(sead::Vector3f*); +void normalize(sead::Vector3f*); +void turnVecToVecDegree(sead::Vector3f*, const sead::Vector3f&, const sead::Vector3f&, float); +void turnVecToVecRate(sead::Vector3f*, const sead::Vector3f&, const sead::Vector3f&, float); + +void calcQuatFront(sead::Vector3f*, const sead::Quatf&); +void makeQuatFrontUp(sead::Quatf *, const sead::Vector3f &, + const sead::Vector3f &); + +float calcAngleToTargetH(al::LiveActor const*,sead::Vector3f const&); +float calcAngleToTargetV(al::LiveActor const*,sead::Vector3f const&); +float calcAngleRadian(sead::Vector3f const&,sead::Vector3f const&); +float calcAngleDegree(sead::Vector3f const&,sead::Vector3f const&); +float calcAngleDegree(sead::Vector2f const&,sead::Vector2f const&); +bool tryCalcAngleDegree(float *,sead::Vector3f const&,sead::Vector3f const&); +float calcAngleOnPlaneRadian(sead::Vector3f const&,sead::Vector3f const&,sead::Vector3f const&); +float calcAngleOnPlaneDegree(sead::Vector3f const&, sead::Vector3f const&, sead::Vector3f const&); +float calcAngleOnPlaneDegreeOrZero(sead::Vector3f const&,sead::Vector3f const&,sead::Vector3f const&); +bool tryCalcAngleOnPlaneDegree(float *,sead::Vector3f const&,sead::Vector3f const&,sead::Vector3f const&); +float calcAngleSignOnPlane(sead::Vector3f const&, sead::Vector3f const&, sead::Vector3f const&); + +void calcDir(sead::Vector3f *,sead::Vector3f const&,sead::Vector3f const&); +void calcDirBetweenSensors(sead::Vector3f *,al::HitSensor const*,al::HitSensor const*); +void calcDirBetweenSensorsH(sead::Vector3f *,al::HitSensor const*,al::HitSensor const*); +void calcDirBetweenSensorsNormal(sead::Vector3f *,al::HitSensor const*,al::HitSensor const*,sead::Vector3f); +void calcDirClockwiseToDir(sead::Vector3f *,al::LiveActor const*,sead::Vector3f const&); +void calcDirClockwiseToPlayer(sead::Vector3f *,al::LiveActor const*); +void calcDirClockwiseToPos(sead::Vector3f *,al::LiveActor const*,sead::Vector3f const&); +void calcDirFromLongitudeLatitude(sead::Vector3f *,float,float); +void calcDirH(sead::Vector3f *,sead::Vector3f const&,sead::Vector3f const&); +void calcDirIndexNearXY(sead::Vector3 const&,sead::Vector3 const&); +void calcDirIndexNearYZ(sead::Vector3 const&,sead::Vector3 const&); +void calcDirIndexNearZX(sead::Vector3 const&,sead::Vector3 const&); +void calcDirOnPlane(sead::Vector3f *,sead::Vector3f const&,sead::Vector3f const&,sead::Vector3f const&); +void calcDirSlide(sead::Vector3f *,sead::Vector3f const&,sead::Vector3f const&); +void calcDirToActor(sead::Vector3f *,al::LiveActor const*,al::LiveActor const*); +void calcDirToActorH(sead::Vector3f *,al::LiveActor const*,al::LiveActor const*); +void calcDirToActorH(sead::Vector3f *,al::LiveActor const*,sead::Vector3f const&); +void calcDirToNextKey(sead::Vector3f *,al::KeyPoseKeeper const*); +void calcDirVerticalAny(sead::Vector3f *,sead::Vector3f const&); +void calcDirViewInput(sead::Vector3f *,sead::Vector2f const&,sead::Vector3f const&,sead::Matrix34f const*); +void calcDirViewInput2D(sead::Vector3f *,sead::Vector2f const&,sead::Vector3f const&,sead::Matrix34f const*); + +void rotateVectorCenterDegree(sead::Vector3f *output, sead::Vector3f const &dir,sead::Vector3f const &axis, sead::Vector3f const ¢er, float angle); + +void rotateVectorDegree(sead::Vector3f* output, const sead::Vector3f& dir, + const sead::Vector3f& axis, float angle); + +void rotateVectorDegreeX(sead::Vector3f*, float); + +void rotateVectorDegreeY(sead::Vector3f*, float); + +void rotateVectorDegreeZ(sead::Vector3f*, float); + +void rotateVectorQuat(sead::Vector3f *,sead::Quatf const&); + +} // namespace al diff --git a/include/algorithms/CaptureAnims.h b/include/algorithms/CaptureAnims.h new file mode 100644 index 0000000..86b47c9 --- /dev/null +++ b/include/algorithms/CaptureAnims.h @@ -0,0 +1,493 @@ +#pragma once + +#include +#include "crc32.h" +#include "basis/seadTypes.h" + +namespace CaptureAnims { + + enum class Type : s16 { + Unknown = -1, + // Capture Anims + BubbleCannonJump, + Down, + HackCancelJump, + HackHighJump, + HackJump, + HackStart, + HackStartDown, + HackWait, + HackWaitSpeedy, + LandFrontDown, + LandFrontUp, + MoveSpeedy, + Up, + Angry, + AppearSign, + AppearStart, + AttackSuccess, + Blow, + BlowDown, + Clash, + Coverd, + DamageCap, + Find, + HackCharge, + HackChargeFull, + HackChargeTurn, + HackRunCoverd, + PressDown, + RunCoverd, + RunNaked, + Swoon, + SwoonEnd, + SwoonStart, + Trampled, + TrampledEnd, + TurnCoverd, + TurnNaked, + BlowEnd, + BlowSign, + BlowStart, + BlowWide, + Reaction, + Charge, + ChargeStart, + Dummy, + Idle, + ReactionCap, + ReactionCapSand, + ReactionJump, + ReactionJumpSand, + RunHack, + RunStartHack, + WaitHack, + Attack, + AttackHit, + AttackSecond, + AttackSecondSign, + AttackSign, + HackAttack, + HackAttackJump, + HackAttackMiss, + HackAttackQuick, + HackJumpEnd, + HackJumpHigh, + JumpEnd, + JumpStart, + PressDownBlow, + PressDownPress, + SwoonStartLand, + HighFall, + HighJump, + LandSwim, + NpcFall, + NpcJump, + NpcJumpStart, + RunFast, + RunSlow, + RunStay, + Swim, + SwimHackStart, + SwimReaction, + SwimSwoon, + SwimSwoonEnd, + SwimSwoonStart, + SwimSwoonStartLand, + SwoonStartFall, + UpperPunch, + Appear, + Shot, + SwoonTrampled, + AttackEnd, + AttackStart, + MoveEnd, + MoveStart, + Recover, + Trample, + Expand, + ExpandAir, + ExpandEnemy, + ExpandSign, + ExpandSignEnemy, + ExpandWait, + ExpandWaitEnd, + Hold, + Shrink, + ShrinkAir, + ShrinkReactionHead, + ShrinkReactionHip, + TurnEnemy, + TurnHack, + WaitAir, + FallNormal, + Glide, + GlideDrop, + GlideL, + GlideLStart, + GlideR, + GlideRStart, + GlideRise, + GlideStart, + HackEnd, + HackEndFly, + JumpEndNormal, + ReactionTrampled, + Talk, + WaitNormal, + WaitSandSink, + AttackTrample, + AttackUp, + Break, + BreakGroundHit, + BreakReaction, + BreakWait, + FallFly, + Fly, + FlyChase, + FlyWait, + RecoverSign, + Boost, + BoostStart, + Explosion, + FallDown, + FlyWaitStart, + Standby, + Turbo, + AttackTower, + DashTower, + DashTowerBottom, + FallTower, + FindTower, + HackEndTower, + JumpTower, + LandTower, + Miss, + MissTower, + PressDownTower, + Reset, + RideOn, + RideOnTower, + RunTower, + RunTowerBottom, + SandGeyser, + SandGeyserTower, + SandWaitTower, + SandWalkTower, + SlideTower, + SwoonLoop, + WaitTower, + WalkTower, + WalkTowerBottom, + EnemyRun, + HackRun, + Choke, + ChokeEnd, + ChokeStart, + HackStartChoke, + Look, + Swallow, + SwoonChoke, + SwoonEndChoke, + SwoonStartChoke, + Vomit, + WaitChoke, + DashR, + FishingUp, + FishingUpGold, + JumpGround, + ReactionWall, + RollingRail, + RollingRailReverse, + RollingReverse, + SwimStart, + SwimSurfaceEnemy, + SwimWaitStart, + TurnPlayer, + WaitGround, + AdlibWait, + Generate, + JumpEndHigh, + JumpEndLow, + Stretch, + StretchFall, + StretchRun, + StretchWait, + UpperObjStart, + UpperObjWait, + BlowDownCommon, + PressDownCommon, + Reload, + Shoot, + SwoonReaction, + AttackMove, + AttackMoveForest, + AttackWaitL, + AttackWaitR, + DashAfterL, + DashAfterR, + DashL, + EnemyAttack, + EnemyAttackL, + EnemyAttackLEnd, + EnemyAttackLStart, + EnemyAttackR, + EnemyAttackREnd, + EnemyAttackRStart, + EnemyAttackSign, + EnemyFall, + EnemyFallStart, + EnemyLand, + EnemyRunStart, + FindMario, + FootHoldJumpL, + FootHoldJumpR, + FootHoldL, + FootHoldR, + HackStartShort, + HackStartWithTurn, + ListPose, + Lost, + MoveTouch, + NoticeSniff, + ReactionSeaOfTrees, + RunAfterL, + RunAfterR, + RunL, + RunR, + RunStartL, + RunStartR, + SleepReactionHipDrop, + SleepSeaOfTrees, + SwoonStartDashClash, + TurnEndL, + TurnEndR, + TurnL180, + TurnL90, + TurnR180, + TurnR90, + WaitL, + WaitR, + WaitSniff, + WakeUpSwoonStart, + WalkAfterL, + WalkAfterR, + WalkEndL, + WalkEndR, + WalkGroundL, + WalkGroundR, + WalkL, + WalkR, + WalkStart, + WalkStartL, + WalkStartR, + AppearBall, + JumpStick, + SpinL, + SpinR, + SpinThrustL, + SpinThrustR, + Stick, + StickBendHorizontal, + StickBendVertical, + Thrust, + ThrustCancel, + ThrustEnd, + ThrustSign, + ThrustWait, + TrampleDown, + AttackPull, + Back, + BackEnd, + BackReturn, + HackDash, + HackDashPull, + HackMove, + HackPull, + HackPullStart, + HitAction, + HitEnd, + HoleIn, + Return, + Bubble, + // All Capture Actions + Bull, + Byugo, + BlowStartEnemy, + BlowStartHack, + IdleHack, + Stop, + FireBros, + Frog, + HackLand, + HackOff, + HackOn, + NpcLand, + HammerBros, + Imomu, + ExpandAirEnemy, + ExpandAirHack, + ExpandHack, + ExpandSignHack, + ShrinkAirHack, + ShrinkEnemy, + ShrinkHack, + ShrinkReactionHeadEnemy, + ShrinkReactionHeadHack, + ShrinkReactionHipEnemy, + ShrinkReactionHipHack, + Kakku, + FallHack, + KaronWing, + EnemyFly, + HackFly, + Killer, + Default, + SignExplosion, + Kuribo, + KuriboWing, + PackunFire, + ChokeDefault, + ChokeCap, + Eat, + VomitCap, + VomitDefault, + PackunPoison, + EatDown, + Pukupuku, + DashRSurface, + DashRWater, + RollingRSurface, + RollingRWater, + RollingLSurface, + RollingLWater, + SwimStartSurface, + SwimStartWater, + SwimWaitStartSurface, + SwimWaitStartWater, + SwimWaitSurface, + SwimWaitWater, + SwimWaitWaterHack, + SwimWater, + WaitMove, + AdlibWaitMove, + RunMove, + FallMove, + JumpEndEnemy, + JumpEndLowHack, + JumpEndHighHack, + Tank, + BlowDownCaptureParade, + PressDownCaptureParade, + MoveL, + MoveR, + MoveAfterL, + MoveAfterR, + MoveStartL, + MoveStartR, + Tsukkun, + StickBend, + ThrustEnemy, + ThrustHack, + ThrustWaitEnemy, + ThrustWaitHack, + Wanwan, + BackChain, + BackDirect, + WanwanBig, + End + }; + + static constexpr size_t ToValue(Type type) { return static_cast(type); } + + static constexpr Type ToType(std::uint16_t value) {return static_cast(value);} + + static constexpr std::array s_Strs { + // Capture Anims + "BubbleCannonJump", "Down", "HackCancelJump", "HackHighJump", "HackJump", "HackStart", + "HackStartDown", "HackWait", "HackWaitSpeedy", "LandFrontDown", "LandFrontUp", + "MoveSpeedy", "Up", "Angry", "AppearSign", "AppearStart", "AttackSuccess", "Blow", + "BlowDown", "Clash", "Coverd", "DamageCap", "Find", "HackCharge", "HackChargeFull", + "HackChargeTurn", "HackRunCoverd", "PressDown", "RunCoverd", "RunNaked", "Swoon", + "SwoonEnd", "SwoonStart", "Trampled", "TrampledEnd", "TurnCoverd", "TurnNaked", + "BlowEnd", "BlowSign", "BlowStart", "BlowWide", "Reaction", "Charge", "ChargeStart", + "Dummy", "Idle", "ReactionCap", "ReactionCapSand", "ReactionJump", "ReactionJumpSand", + "RunHack", "RunStartHack", "WaitHack", "Attack", "AttackHit", "AttackSecond", + "AttackSecondSign", "AttackSign", "HackAttack", "HackAttackJump", "HackAttackMiss", + "HackAttackQuick", "HackJumpEnd", "HackJumpHigh", "JumpEnd", "JumpStart", + "PressDownBlow", "PressDownPress", "SwoonStartLand", "HighFall", "HighJump", "LandSwim", + "NpcFall", "NpcJump", "NpcJumpStart", "RunFast", "RunSlow", "RunStay", "Swim", + "SwimHackStart", "SwimReaction", "SwimSwoon", "SwimSwoonEnd", "SwimSwoonStart", + "SwimSwoonStartLand", "SwoonStartFall", "UpperPunch", "Appear", "Shot", "SwoonTrampled", + "AttackEnd", "AttackStart", "MoveEnd", "MoveStart", "Recover", "Trample", "Expand", + "ExpandAir", "ExpandEnemy", "ExpandSign", "ExpandSignEnemy", "ExpandWait", + "ExpandWaitEnd", "Hold", "Shrink", "ShrinkAir", "ShrinkReactionHead", + "ShrinkReactionHip", "TurnEnemy", "TurnHack", "WaitAir", "FallNormal", "Glide", + "GlideDrop", "GlideL", "GlideLStart", "GlideR", "GlideRStart", "GlideRise", + "GlideStart", "HackEnd", "HackEndFly", "JumpEndNormal", "ReactionTrampled", "Talk", + "WaitNormal", "WaitSandSink", "AttackTrample", "AttackUp", "Break", "BreakGroundHit", + "BreakReaction", "BreakWait", "FallFly", "Fly", "FlyChase", "FlyWait", "RecoverSign", + "Boost", "BoostStart", "Explosion", "FallDown", "FlyWaitStart", "Standby", "Turbo", + "AttackTower", "DashTower", "DashTowerBottom", "FallTower", "FindTower", "HackEndTower", + "JumpTower", "LandTower", "Miss", "MissTower", "PressDownTower", "Reset", "RideOn", + "RideOnTower", "RunTower", "RunTowerBottom", "SandGeyser", "SandGeyserTower", + "SandWaitTower", "SandWalkTower", "SlideTower", "SwoonLoop", "WaitTower", "WalkTower", + "WalkTowerBottom", "EnemyRun", "HackRun", "Choke", "ChokeEnd", "ChokeStart", + "HackStartChoke", "Look", "Swallow", "SwoonChoke", "SwoonEndChoke", "SwoonStartChoke", + "Vomit", "WaitChoke", "DashR", "FishingUp", "FishingUpGold", "JumpGround", + "ReactionWall", "RollingRail", "RollingRailReverse", "RollingReverse", "SwimStart", + "SwimSurfaceEnemy", "SwimWaitStart", "TurnPlayer", "WaitGround", "AdlibWait", + "Generate", "JumpEndHigh", "JumpEndLow", "Stretch", "StretchFall", "StretchRun", + "StretchWait", "UpperObjStart", "UpperObjWait", "BlowDownCommon", "PressDownCommon", + "Reload", "Shoot", "SwoonReaction", "AttackMove", "AttackMoveForest", "AttackWaitL", + "AttackWaitR", "DashAfterL", "DashAfterR", "DashL", "EnemyAttack", "EnemyAttackL", + "EnemyAttackLEnd", "EnemyAttackLStart", "EnemyAttackR", "EnemyAttackREnd", + "EnemyAttackRStart", "EnemyAttackSign", "EnemyFall", "EnemyFallStart", "EnemyLand", + "EnemyRunStart", "FindMario", "FootHoldJumpL", "FootHoldJumpR", "FootHoldL", + "FootHoldR", "HackStartShort", "HackStartWithTurn", "ListPose", "Lost", "MoveTouch", + "NoticeSniff", "ReactionSeaOfTrees", "RunAfterL", "RunAfterR", "RunL", "RunR", + "RunStartL", "RunStartR", "SleepReactionHipDrop", "SleepSeaOfTrees", + "SwoonStartDashClash", "TurnEndL", "TurnEndR", "TurnL180", "TurnL90", "TurnR180", + "TurnR90", "WaitL", "WaitR", "WaitSniff", "WakeUpSwoonStart", "WalkAfterL", + "WalkAfterR", "WalkEndL", "WalkEndR", "WalkGroundL", "WalkGroundR", "WalkL", "WalkR", + "WalkStart", "WalkStartL", "WalkStartR", "AppearBall", "JumpStick", "SpinL", "SpinR", + "SpinThrustL", "SpinThrustR", "Stick", "StickBendHorizontal", "StickBendVertical", + "Thrust", "ThrustCancel", "ThrustEnd", "ThrustSign", "ThrustWait", "TrampleDown", + "AttackPull", "Back", "BackEnd", "BackReturn", "HackDash", "HackDashPull", "HackMove", + "HackPull", "HackPullStart", "HitAction", "HitEnd", "HoleIn", "Return", + // All Capture Actions + "Bubble", "Bull", "Byugo", "BlowStartEnemy", "BlowStartHack", "IdleHack", "Stop", + "FireBros", "Frog", "HackLand", "HackOff", "HackOn", "NpcLand", "HammerBros", "Imomu", + "ExpandAirEnemy", "ExpandAirHack", "ExpandHack", "ExpandSignHack", "ShrinkAirHack", + "ShrinkEnemy", "ShrinkHack", "ShrinkReactionHeadEnemy", "ShrinkReactionHeadHack", + "ShrinkReactionHipEnemy", "ShrinkReactionHipHack", "Kakku", "FallHack", "KaronWing", + "EnemyFly", "HackFly", "Killer", "Default", "SignExplosion", "Kuribo", "KuriboWing", + "PackunFire", "ChokeDefault", "ChokeCap", "Eat", "VomitCap", "VomitDefault", + "PackunPoison", "EatDown", "Pukupuku", "DashRSurface", "DashRWater", "RollingRSurface", + "RollingRWater", "RollingLSurface", "RollingLWater", "SwimStartSurface", + "SwimStartWater", "SwimWaitStartSurface", "SwimWaitStartWater", "SwimWaitSurface", + "SwimWaitWater", "SwimWaitWaterHack", "SwimWater", "WaitMove", "AdlibWaitMove", + "RunMove", "FallMove", "JumpEndEnemy", "JumpEndLowHack", "JumpEndHighHack", "Tank", + "BlowDownCaptureParade", "PressDownCaptureParade", "MoveL", "MoveR", "MoveAfterL", + "MoveAfterR", "MoveStartL", "MoveStartR", "Tsukkun", "StickBend", "ThrustEnemy", + "ThrustHack", "ThrustWaitEnemy", "ThrustWaitHack", "Wanwan", "BackChain", "BackDirect", + "WanwanBig" + }; + + // these ifdefs are really dumb but it makes clangd happy so /shrug +#ifndef ANALYZER + static constexpr crc32::HashArray s_Hashes(s_Strs); +#endif + + static constexpr Type FindType(std::string_view const& str) { +#ifndef ANALYZER + return ToType(s_Hashes.FindIndex(str)); +#else + return Type::Unknown; +#endif + } + + static constexpr const char *FindStr(Type type) { + return s_Strs.at(ToValue(type)); + } +} \ No newline at end of file diff --git a/include/algorithms/CaptureTypes.h b/include/algorithms/CaptureTypes.h new file mode 100644 index 0000000..b98552a --- /dev/null +++ b/include/algorithms/CaptureTypes.h @@ -0,0 +1,103 @@ +#pragma once + +#include +#include "crc32.h" +#include "basis/seadTypes.h" + +namespace CaptureTypes { + + enum class Type : s16 { + Unknown = -1, + AnagramAlphabetCharacter, + Byugo, + Bubble, + Bull, + Car, + ElectricWire, + KillerLauncherMagnum, + KuriboPossessed, + WanwanBig, + KillerLauncher, + Koopa, + Wanwan, + Pukupuku, + PukupukuSnow, + Gamane, + FireBrosPossessed, + PackunFire, + Frog, + Kakku, + Hosui, + HammerBrosPossessed, + Megane, + KaronWing, + KuriboWing, + PackunPoison, + Radicon, + Tank, + Tsukkun, + TRex, + TRexSleep, + TRexPatrol, + Imomu, + SenobiGeneratePoint, + End + }; + + static constexpr size_t ToValue(Type type) { return static_cast(type); } + + static constexpr Type ToType(std::uint16_t value) {return static_cast(value);} + + static constexpr std::array s_Strs { + "AnagramAlphabetCharacter", + "Byugo", + "Bubble", + "Bull", + "Car", + "ElectricWire", + "KillerLauncherMagnum", + "KuriboPossessed", + "WanwanBig", // has sub-actors + "KillerLauncher", + "Koopa", + "Wanwan", // has sub-actors + "Pukupuku", + "PukupukuSnow", + "Gamane", // has sub-actors + "FireBrosPossessed", + "PackunFire", + "Frog", + "Kakku", + "Hosui", + "HammerBrosPossessed", + "Megane", + "KaronWing", + "KuriboWing", + "PackunPoison", + "Radicon", + "Tank", + "Tsukkun", + "TRex", + "TRexSleep", + "TRexPatrol", + "Imomu", + "SenobiGeneratePoint" + }; + + // these ifdefs are really dumb but it makes clangd happy so /shrug +#ifndef ANALYZER + static constexpr crc32::HashArray s_Hashes(s_Strs); +#endif + + static constexpr Type FindType(std::string_view const& str) { +#ifndef ANALYZER + return ToType(s_Hashes.FindIndex(str)); +#else + return Type::Unknown; +#endif + } + + static constexpr const char *FindStr(Type type) { + return s_Strs.at(ToValue(type)); + } +} \ No newline at end of file diff --git a/include/algorithms/PlayerAnims.h b/include/algorithms/PlayerAnims.h new file mode 100644 index 0000000..5e2e9ad --- /dev/null +++ b/include/algorithms/PlayerAnims.h @@ -0,0 +1,1159 @@ +#pragma once + +#include +#include "crc32.h" +#include "basis/seadTypes.h" + +namespace PlayerAnims { + + enum class Type : s16 { + Unknown = -1, + // Action Names + ChairSitDown, + DamageDown, + DamageDownSwim, + DamageDownSwimSurface, + DemoWorldMoveForwardFirst, + DemoWorldMoveForwardNormal, + MotorcycleRide, + MotorcycleRideClash, + MotorcycleRideJump, + MotorcycleRideLand, + MotorcycleRideRunStart, + Move, + MoveMoon, + ExitPictureDown, + NoDamageDown, + NoDamageDownSwim, + NoDamageDownSwimSurface, + RestartSpinJumpL, + RestartSpinJumpR, + JumpCapCatch, + JumpCapCatchAir, + SandWait, + SandWalk, + StartSpinJumpL, + StartSpinJumpR, + SwimSurfaceNormal, + SwimSurfaceCarry, + DemoGetShineGrandStartNormal, + DemoGetShineGrandStartEmpty, + DemoCapOffWait, + // Anim Names + AreaWait64, + AreaWaitAloha, + AreaWaitBalance, + AreaWaitBeach, + AreaWaitCold, + AreaWaitDance01, + AreaWaitDance02, + AreaWaitDance03, + AreaWaitFight, + AreaWaitGetwarm, + AreaWaitGuitar, + AreaWaitHeatGround, + AreaWaitHot, + AreaWaitJog, + AreaWaitLookUp, + AreaWaitSayCheese, + AreaWaitScared, + AreaWaitSearch, + AreaWaitSigh, + AreaWaitSitDown, + AreaWaitSleepy, + AreaWaitSmell, + AreaWaitStink, + AreaWaitStretch, + AreaWaitView, + AreaWaitWaterfall, + AreaWaitWonder, + ArrowShoot, + ArrowShootStart, + BallToss, + BallTossGround, + BattleWait, + BedSleep, + BedSleepStart, + BedSnooze, + BedSnoozeStart, + BikeRide, + Bind, + Brake, + BubbleJump, + BubbleStart, + BubbleWait, + CanoeDamage, + CanoeDamageEnd, + CanoeDamageStart, + CanoePaddle, + CanoeTurnL, + CanoeTurnR, + CanoeWait, + Carry, + CarryFront, + CarryFrontStart, + CarryFrontThrow, + CarryUp, + CarryUpStart, + CarryUpThrow, + CatapultStart, + CatchCap, + CatchCapJump, + CatchCapJumpParts, + CatchCapJumpPartsReverse, + CatchCapParts, + CatchKoopaCap, + ClashWorldStandUp, + ClimbTreeHandStandWait, + Damage, + DamageLand, + DamageSwim, + DamageSwimSurface, + DamageSwimSurfaceLand, + DamageWait, + Dash, + DashBrake, + DashFast, + DashTurn, + Dead, + Dead01, + Dead02, + Dead03, + Dead04, + DeadFall, + DeadFire, + DeadIce, + DeadPoison, + DeadSand, + DeadWallow, + DeadWater, + DemoAppearFromHome, + DemoBattleEndGiantWanderBoss, + DemoBattleStartBossKnuckle, + DemoBattleStartBreeda, + DemoBattleStartBreedaFirst, + DemoBattleStartGolemClimb, + DemoBossRaidAttack, + DemoCrashHome, + DemoCrashHomeFall, + DemoEnding01, + DemoEnding02, + DemoEnding03, + DemoEnding04, + DemoEnterChurch, + DemoGetShine, + DemoGetShineCloseUp, + DemoGetShineEnd, + DemoGetShineGrandCloseUp, + DemoGetShineGrandCloseUpEnd, + DemoGetShineGrandEnd, + DemoGetShineGrandStart, + DemoGetShineLand, + DemoGetShinePaper, + DemoGetShineRock, + DemoGetShineScissors, + DemoGetShineStart, + DemoHackFirst, + DemoHackKoopa01, + DemoHackKoopa02, + DemoJangoCapSearch, + DemoJangoGetUp, + DemoJangoLookAround, + DemoJangoStolen, + DemoJangoStolenLoop, + DemoMeetCapNpcC01, + DemoMeetCapNpcC01TalkWait, + DemoMeetCapNpcC02, + DemoMeetCapNpcC02ATalkWait, + DemoMeetCapNpcC02BTalkWait, + DemoMeetCapNpcC03, + DemoMeetCapNpcC04TalkWait, + DemoMeetCapNpcC06TalkWait, + DemoMeetCapNpcC07TalkWait, + DemoMeetCapNpcC08TalkWait, + DemoMeetCapNpcC10A, + DemoMeetCapNpcC10ATalkWait, + DemoMeetCapNpcC10B, + DemoMeetCapNpcC10BTalkWait, + DemoOpening01, + DemoOpeningCap, + DemoOpeningDown, + DemoPayToHome, + DemoReset, + DemoReturnToHome, + DemoSitDownTalk, + DemoSitDownWaitFirst, + DemoStartJango, + DemoStartJango2, + DemoStartUpHome, + DemoStartUpHomeSky, + DemoStartWaterfall, + DemoTakeOffKoopaForMoon, + DemoTalkCapManHeroAppear, + DemoTalkCapManHeroWalk, + DemoWarpEnd, + DemoWarpStart, + DemoWorldLavaScenario1End, + DemoWorldMoveBackward, + DemoWorldMoveBackward1, + DemoWorldMoveBackward2, + DemoWorldMoveBackward3, + DemoWorldMoveForward, + DemoWorldMoveForwardArrive, + DemoWorldMoveForwardNormal1, + DemoWorldMoveForwardNormal2, + DemoWorldMoveForwardNormal3, + DemoWorldMoveMoonBackward, + DemoWorldMoveMoonForward, + DemoWorldMoveMoonForwardFirst, + DemoWorldTakeoff, + DemoWorldTakeoffEast, + DemoWorldTakeoffForMoon, + DemoWorldTakeoffForMoonFirst, + DemoWorldTakeoffForMoonFirstTuxedo, + DemoWorldTakeoffWest, + DemoWorldWarpHole01, + DemoWorldWarpHole02, + DemoWorldWarpHole03, + Dive, + DiveInWater, + DokanIn, + DokanInHome, + DokanInUpsideDown, + DokanJump, + DokanOut, + DokanOutUpsideDown, + DokanReady, + DokanReadyHome, + DokanSideIn, + DokanSideOut, + DoorIn, + DoorOut, + DoorStart, + Fall, + Fire, + FireRun, + FireRunStart, + GetShine, + GetShineCity, + GetShineEmpty, + GetShineGrand, + GetShineSub, + GrabCeilJump, + GrabCeilStart, + GrabCeilSwing, + GrabCeilWait, + Hack, + HeadSliding, + HeadSlidingStart, + HipDrop, + HipDropLand, + HipDropReaction, + HipDropStart, + HomeCapManHeroAppear, + Jump, + Jump2, + Jump3, + JumpBack, + JumpBroad, + JumpBroad2, + JumpBroad3, + JumpBroad4, + JumpBroad5, + JumpBroad6, + JumpBroad7, + JumpBroad8, + JumpBroad9, + JumpCapCatchCommon, + JumpCapLeapFrog, + JumpDashFast, + JumpEndHack, + JumpFlap, + JumpHipDrop, + JumpInterp, + JumpNpcTrample, + JumpObjectReaction, + JumpReverse, + JumpReverseInterp, + JumpTurn, + Kick, + KoopaCapPunchFinishL, + KoopaCapPunchFinishLStart, + KoopaCapPunchFinishR, + KoopaCapPunchFinishRStart, + KoopaCapPunchL, + KoopaCapPunchLStart, + KoopaCapPunchR, + KoopaCapPunchRStart, + KoopaDemoBattleStartChurchFirstLv2, + KoopaDemoBattleStartChurchLv2, + KoopaDemoBattleStartChurchSecondLv2, + KoopaDemoBattleStartFirstLv1, + KoopaDemoBattleStartFirstLv2, + KoopaDemoBattleStartSecondLv1, + KoopaDemoBattleStartSecondLv2, + KoopaDemoBattleStartTalkBlendLv1, + KoopaDemoClashBasement, + Land, + LandDownFall, + LandJump3, + LandRolling, + LandStiffen, + LandTurn, + MainScenarioCameraWait, + MofumofuDemoOpening1, + MofumofuDemoOpening2, + MotorcycleRideC, + MotorcycleRideClashC, + MotorcycleRideClashL, + MotorcycleRideClashR, + MotorcycleRideJumpC, + MotorcycleRideJumpL, + MotorcycleRideJumpR, + MotorcycleRideL, + MotorcycleRideLandC, + MotorcycleRideLandL, + MotorcycleRideLandR, + MotorcycleRideOn, + MotorcycleRideR, + MotorcycleRideRunStartC, + MotorcycleRideRunStartL, + MotorcycleRideRunStartR, + MotorcycleRideStart, + MotorcycleRideStartL, + MotorcycleRideStartR, + MotorcycleWait, + OpeningStandUp, + PauseMenu2Player, + PauseMenuContinue, + PauseMenuContinueEnd, + PauseMenuData, + PauseMenuHelp, + PauseMenuNewGame, + PauseMenuSave, + PauseMenuStart, + PauseMenuWait, + PoleCatch, + PoleClimb, + PoleFall, + PoleHandStandEnd, + PoleHandStandJump, + PoleHandStandStart, + PoleHandStandTurn, + PoleHandStandWait, + PoleTurn, + PoleWait, + Punch, + Push, + RabbitGet, + RaceManHack, + RaceManHackEnd, + RaceManHackStart, + RaceManJumpEnd, + RaceManJumpStart, + RaceManResultLose, + RaceManResultWin, + RaceResultLose, + RaceResultWin, + ReactionCapOn, + Rolling, + RollingEnd, + RollingEndBackUp, + RollingJump, + RollingLand, + RollingStandUp, + RollingStart, + RoswellPut, + RoswellRun, + RoswellThrow, + RoswellWait, + Run, + RunMoon, + RunStart, + SandWaitNormal, + SandWaitStrong, + SandWalkNormal, + SandWalkStrong, + SitDown, + SitDownEnd, + SitDownLand, + SitDownSleep, + SitDownSleepEnd, + SitDownSleepStart, + SitDownStart, + Sleep, + SleepStart, + Slide, + SlopeSlide, + SlopeSlideBack, + Snooze, + SnoozeStart, + SphinxRideClash, + SphinxRideFall, + SphinxRideGetOn, + SphinxRideJump, + SphinxRideJumpStart, + SphinxRideOn, + SphinxRideRide, + SphinxRideRideOn, + SphinxRideRideStartL, + SphinxRideRideStartR, + SphinxRideRunSlow, + SphinxRideStop, + SphinxRideStopStart, + SpinCap, + SpinCapAirStart, + SpinCapAirStartCapCatch, + SpinCapAirStartDoubleDown, + SpinCapAirStartDoubleLeft, + SpinCapAirStartDoubleRight, + SpinCapAirStartDoubleUp, + SpinCapAirStartLeft, + SpinCapAirStartLong, + SpinCapAirStartRight, + SpinCapEnd, + SpinCapJumpStart, + SpinCapStart, + SpinCapStart2Left, + SpinCapStart2Right, + SpinCapStart3Left, + SpinCapStart3Right, + SpinCapStartCapCatch, + SpinCapStartDoubleDown, + SpinCapStartDoubleLeft, + SpinCapStartDoubleRight, + SpinCapStartDoubleUp, + SpinCapStartLeft, + SpinCapStartLong, + SpinCapStartRight, + SpinCapStartRolling, + SpinCapWait, + SpinGroundL, + SpinGroundR, + SpinJump, + SpinJumpDownFall, + SpinJumpDownFallL, + SpinJumpDownFallR, + SpinJumpL, + SpinJumpLoop, + SpinJumpR, + SpinJumpStart, + SpinSeparate, + SpinSeparateSwim, + SquatEnd, + SquatLand, + SquatStart, + SquatWait, + SquatWalk, + StabStart, + StabUndarWait, + StabUnderStart, + StabWait, + StabWallWait, + SwimDieOver, + SwimDive, + SwimFallIn, + SwimHeadSliding, + SwimHeadSlidingEnd, + SwimHeadSlidingIn, + SwimHeadSlidingStart, + SwimHipDrop, + SwimHipDropLand, + SwimHipDropStart, + SwimJumpHipDrop, + SwimLand, + SwimSpinCapStart, + SwimSpinCapStartDoubleDown, + SwimSpinCapStartDoubleLeft, + SwimSpinCapStartDoubleRight, + SwimSpinCapStartDoubleUp, + SwimSpinCapStartLeft, + SwimSpinCapStartRight, + SwimSquat, + SwimSquatWalk, + SwimStand, + SwimStandMove, + SwimStandSurface, + SwimStandWait, + SwimSurface, + SwimTalkWait, + SwimTrample, + SwimTrampoline, + SwimWait, + SwimWalk, + TalkEnd, + TalkTurn, + TalkTurnL90, + TalkTurnR90, + TalkWait, + TestDemoDiverA, + TestDemoDiverB, + TestDemoE3001, + TestRunBack, + TestRunFront, + TestRunLeft, + TestRunRight, + TestRunWait, + ThrowCap, + ThrowCapJump, + ThrowCapJumpParts, + ThrowCapParts, + TouchJump, + TouchJumpLong, + TouchJumpLongSign, + TractorBubbleEmd, + TractorBubbleEnd, + TractorBubbleStart, + TractorBubbleWait, + TreeClimb, + TreeFall, + Turn, + TurnPoint, + TurnStep, + Wait, + WaitCold, + WaitDemo, + WaitDigPoint, + WaitHot, + WaitRelax, + WaitRelaxStart, + WaitVeryCold, + Walk, + WalkDemo, + WalkSoft, + WallCatch, + WallCatchEnd, + WallCatchEndFast, + WallCatchEndJump, + WallCatchMoveL, + WallCatchMoveR, + WallCatchStart, + WallJump, + WallKeep, + WallKeepReverse, + WallLand, + WallSlideL, + WallSlideR, + WarpIn, + WarpOut, + WarpWait, + WaterRoadMove, + WearEnd, + WhipAttackEnd, + WhipAttackStart, + WhipAttackWait, + WhipWait, + WorldWarpBind, + WorldWarpBindStart, + WorldWarpIn, + WorldWarpOut, + // Capture Anims + BubbleCannonJump, + Down, + HackCancelJump, + HackHighJump, + HackJump, + HackStart, + HackStartDown, + HackWait, + HackWaitSpeedy, + LandFrontDown, + LandFrontUp, + MoveSpeedy, + Up, + Angry, + AppearSign, + AppearStart, + AttackSuccess, + Blow, + BlowDown, + Clash, + Coverd, + DamageCap, + Find, + HackCharge, + HackChargeFull, + HackChargeTurn, + HackRunCoverd, + PressDown, + RunCoverd, + RunNaked, + Swoon, + SwoonEnd, + SwoonStart, + Trampled, + TrampledEnd, + TurnCoverd, + TurnNaked, + BlowEnd, + BlowSign, + BlowStart, + BlowWide, + Reaction, + Charge, + ChargeStart, + Dummy, + Idle, + ReactionCap, + ReactionCapSand, + ReactionJump, + ReactionJumpSand, + RunHack, + RunStartHack, + WaitHack, + Attack, + AttackHit, + AttackSecond, + AttackSecondSign, + AttackSign, + HackAttack, + HackAttackJump, + HackAttackMiss, + HackAttackQuick, + HackJumpEnd, + HackJumpHigh, + JumpEnd, + JumpStart, + PressDownBlow, + PressDownPress, + SwoonStartLand, + HighFall, + HighJump, + LandSwim, + NpcFall, + NpcJump, + NpcJumpStart, + RunFast, + RunSlow, + RunStay, + Swim, + SwimHackStart, + SwimReaction, + SwimSwoon, + SwimSwoonEnd, + SwimSwoonStart, + SwimSwoonStartLand, + SwoonStartFall, + UpperPunch, + Appear, + Shot, + SwoonTrampled, + AttackEnd, + AttackStart, + MoveEnd, + MoveStart, + Recover, + Trample, + Expand, + ExpandAir, + ExpandEnemy, + ExpandSign, + ExpandSignEnemy, + ExpandWait, + ExpandWaitEnd, + Hold, + Shrink, + ShrinkAir, + ShrinkReactionHead, + ShrinkReactionHip, + TurnEnemy, + TurnHack, + WaitAir, + FallNormal, + Glide, + GlideDrop, + GlideL, + GlideLStart, + GlideR, + GlideRStart, + GlideRise, + GlideStart, + HackEnd, + HackEndFly, + JumpEndNormal, + ReactionTrampled, + Talk, + WaitNormal, + WaitSandSink, + AttackTrample, + AttackUp, + Break, + BreakGroundHit, + BreakReaction, + BreakWait, + FallFly, + Fly, + FlyChase, + FlyWait, + RecoverSign, + Boost, + BoostStart, + Explosion, + FallDown, + FlyWaitStart, + Standby, + Turbo, + AttackTower, + DashTower, + DashTowerBottom, + FallTower, + FindTower, + HackEndTower, + JumpTower, + LandTower, + Miss, + MissTower, + PressDownTower, + Reset, + RideOn, + RideOnTower, + RunTower, + RunTowerBottom, + SandGeyser, + SandGeyserTower, + SandWaitTower, + SandWalkTower, + SlideTower, + SwoonLoop, + WaitTower, + WalkTower, + WalkTowerBottom, + EnemyRun, + HackRun, + Choke, + ChokeEnd, + ChokeStart, + HackStartChoke, + Look, + Swallow, + SwoonChoke, + SwoonEndChoke, + SwoonStartChoke, + Vomit, + WaitChoke, + DashR, + FishingUp, + FishingUpGold, + JumpGround, + ReactionWall, + RollingRail, + RollingRailReverse, + RollingReverse, + SwimStart, + SwimSurfaceEnemy, + SwimWaitStart, + TurnPlayer, + WaitGround, + AdlibWait, + Generate, + JumpEndHigh, + JumpEndLow, + Stretch, + StretchFall, + StretchRun, + StretchWait, + UpperObjStart, + UpperObjWait, + BlowDownCommon, + PressDownCommon, + Reload, + Shoot, + SwoonReaction, + AttackMove, + AttackMoveForest, + AttackWaitL, + AttackWaitR, + DashAfterL, + DashAfterR, + DashL, + EnemyAttack, + EnemyAttackL, + EnemyAttackLEnd, + EnemyAttackLStart, + EnemyAttackR, + EnemyAttackREnd, + EnemyAttackRStart, + EnemyAttackSign, + EnemyFall, + EnemyFallStart, + EnemyLand, + EnemyRunStart, + FindMario, + FootHoldJumpL, + FootHoldJumpR, + FootHoldL, + FootHoldR, + HackStartShort, + HackStartWithTurn, + ListPose, + Lost, + MoveTouch, + NoticeSniff, + ReactionSeaOfTrees, + RunAfterL, + RunAfterR, + RunL, + RunR, + RunStartL, + RunStartR, + SleepReactionHipDrop, + SleepSeaOfTrees, + SwoonStartDashClash, + TurnEndL, + TurnEndR, + TurnL180, + TurnL90, + TurnR180, + TurnR90, + WaitL, + WaitR, + WaitSniff, + WakeUpSwoonStart, + WalkAfterL, + WalkAfterR, + WalkEndL, + WalkEndR, + WalkGroundL, + WalkGroundR, + WalkL, + WalkR, + WalkStart, + WalkStartL, + WalkStartR, + AppearBall, + JumpStick, + SpinL, + SpinR, + SpinThrustL, + SpinThrustR, + Stick, + StickBendHorizontal, + StickBendVertical, + Thrust, + ThrustCancel, + ThrustEnd, + ThrustSign, + ThrustWait, + TrampleDown, + AttackPull, + Back, + BackEnd, + BackReturn, + HackDash, + HackDashPull, + HackMove, + HackPull, + HackPullStart, + HitAction, + HitEnd, + HoleIn, + Return, + Bubble, + // All Capture Actions + Bull, + Byugo, + BlowStartEnemy, + BlowStartHack, + IdleHack, + Stop, + FireBros, + Frog, + HackLand, + HackOff, + HackOn, + NpcLand, + HammerBros, + Imomu, + ExpandAirEnemy, + ExpandAirHack, + ExpandHack, + ExpandSignHack, + ShrinkAirHack, + ShrinkEnemy, + ShrinkHack, + ShrinkReactionHeadEnemy, + ShrinkReactionHeadHack, + ShrinkReactionHipEnemy, + ShrinkReactionHipHack, + Kakku, + FallHack, + KaronWing, + EnemyFly, + HackFly, + Killer, + Default, + SignExplosion, + Kuribo, + KuriboWing, + PackunFire, + ChokeDefault, + ChokeCap, + Eat, + VomitCap, + VomitDefault, + PackunPoison, + EatDown, + Pukupuku, + DashRSurface, + DashRWater, + RollingRSurface, + RollingRWater, + RollingLSurface, + RollingLWater, + SwimStartSurface, + SwimStartWater, + SwimWaitStartSurface, + SwimWaitStartWater, + SwimWaitSurface, + SwimWaitWater, + SwimWaitWaterHack, + SwimWater, + WaitMove, + AdlibWaitMove, + RunMove, + FallMove, + JumpEndEnemy, + JumpEndLowHack, + JumpEndHighHack, + Tank, + BlowDownCaptureParade, + PressDownCaptureParade, + MoveL, + MoveR, + MoveAfterL, + MoveAfterR, + MoveStartL, + MoveStartR, + Tsukkun, + StickBend, + ThrustEnemy, + ThrustHack, + ThrustWaitEnemy, + ThrustWaitHack, + Wanwan, + BackChain, + BackDirect, + WanwanBig, + End + }; + + static constexpr size_t ToValue(Type type) { return static_cast(type); } + + static constexpr Type ToType(std::uint16_t value) {return static_cast(value);} + + static constexpr std::array s_Strs { + // Action Names + "ChairSitDown", "DamageDown", "DamageDownSwim", "DamageDownSwimSurface", + "DemoWorldMoveForwardFirst", "DemoWorldMoveForwardNormal", "MotorcycleRide", + "MotorcycleRideClash", "MotorcycleRideJump", "MotorcycleRideLand", + "MotorcycleRideRunStart", "Move", "MoveMoon", "ExitPictureDown", "NoDamageDown", + "NoDamageDownSwim", "NoDamageDownSwimSurface", "RestartSpinJumpL", "RestartSpinJumpR", + "JumpCapCatch", "JumpCapCatchAir", "SandWait", "SandWalk", "StartSpinJumpL", + "StartSpinJumpR", "SwimSurfaceNormal", "SwimSurfaceCarry", + "DemoGetShineGrandStartNormal", "DemoGetShineGrandStartEmpty", "DemoCapOffWait", + // Anim Names + "AreaWait64", "AreaWaitAloha", "AreaWaitBalance", "AreaWaitBeach", "AreaWaitCold", + "AreaWaitDance01", "AreaWaitDance02", "AreaWaitDance03", "AreaWaitFight", + "AreaWaitGetwarm", "AreaWaitGuitar", "AreaWaitHeatGround", "AreaWaitHot", "AreaWaitJog", + "AreaWaitLookUp", "AreaWaitSayCheese", "AreaWaitScared", "AreaWaitSearch", + "AreaWaitSigh", "AreaWaitSitDown", "AreaWaitSleepy", "AreaWaitSmell", "AreaWaitStink", + "AreaWaitStretch", "AreaWaitView", "AreaWaitWaterfall", "AreaWaitWonder", "ArrowShoot", + "ArrowShootStart", "BallToss", "BallTossGround", "BattleWait", "BedSleep", + "BedSleepStart", "BedSnooze", "BedSnoozeStart", "BikeRide", "Bind", "Brake", + "BubbleJump", "BubbleStart", "BubbleWait", "CanoeDamage", "CanoeDamageEnd", + "CanoeDamageStart", "CanoePaddle", "CanoeTurnL", "CanoeTurnR", "CanoeWait", "Carry", + "CarryFront", "CarryFrontStart", "CarryFrontThrow", "CarryUp", "CarryUpStart", + "CarryUpThrow", "CatapultStart", "CatchCap", "CatchCapJump", "CatchCapJumpParts", + "CatchCapJumpPartsReverse", "CatchCapParts", "CatchKoopaCap", "ClashWorldStandUp", + "ClimbTreeHandStandWait", "Damage", "DamageLand", "DamageSwim", "DamageSwimSurface", + "DamageSwimSurfaceLand", "DamageWait", "Dash", "DashBrake", "DashFast", "DashTurn", + "Dead", "Dead01", "Dead02", "Dead03", "Dead04", "DeadFall", "DeadFire", "DeadIce", + "DeadPoison", "DeadSand", "DeadWallow", "DeadWater", "DemoAppearFromHome", + "DemoBattleEndGiantWanderBoss", "DemoBattleStartBossKnuckle", "DemoBattleStartBreeda", + "DemoBattleStartBreedaFirst", "DemoBattleStartGolemClimb", "DemoBossRaidAttack", + "DemoCrashHome", "DemoCrashHomeFall", "DemoEnding01", "DemoEnding02", "DemoEnding03", + "DemoEnding04", "DemoEnterChurch", "DemoGetShine", "DemoGetShineCloseUp", + "DemoGetShineEnd", "DemoGetShineGrandCloseUp", "DemoGetShineGrandCloseUpEnd", + "DemoGetShineGrandEnd", "DemoGetShineGrandStart", "DemoGetShineLand", + "DemoGetShinePaper", "DemoGetShineRock", "DemoGetShineScissors", "DemoGetShineStart", + "DemoHackFirst", "DemoHackKoopa01", "DemoHackKoopa02", "DemoJangoCapSearch", + "DemoJangoGetUp", "DemoJangoLookAround", "DemoJangoStolen", "DemoJangoStolenLoop", + "DemoMeetCapNpcC01", "DemoMeetCapNpcC01TalkWait", "DemoMeetCapNpcC02", + "DemoMeetCapNpcC02ATalkWait", "DemoMeetCapNpcC02BTalkWait", "DemoMeetCapNpcC03", + "DemoMeetCapNpcC04TalkWait", "DemoMeetCapNpcC06TalkWait", "DemoMeetCapNpcC07TalkWait", + "DemoMeetCapNpcC08TalkWait", "DemoMeetCapNpcC10A", "DemoMeetCapNpcC10ATalkWait", + "DemoMeetCapNpcC10B", "DemoMeetCapNpcC10BTalkWait", "DemoOpening01", "DemoOpeningCap", + "DemoOpeningDown", "DemoPayToHome", "DemoReset", "DemoReturnToHome", "DemoSitDownTalk", + "DemoSitDownWaitFirst", "DemoStartJango", "DemoStartJango2", "DemoStartUpHome", + "DemoStartUpHomeSky", "DemoStartWaterfall", "DemoTakeOffKoopaForMoon", + "DemoTalkCapManHeroAppear", "DemoTalkCapManHeroWalk", "DemoWarpEnd", "DemoWarpStart", + "DemoWorldLavaScenario1End", "DemoWorldMoveBackward", "DemoWorldMoveBackward1", + "DemoWorldMoveBackward2", "DemoWorldMoveBackward3", "DemoWorldMoveForward", + "DemoWorldMoveForwardArrive", "DemoWorldMoveForwardNormal1", + "DemoWorldMoveForwardNormal2", "DemoWorldMoveForwardNormal3", + "DemoWorldMoveMoonBackward", "DemoWorldMoveMoonForward", + "DemoWorldMoveMoonForwardFirst", "DemoWorldTakeoff", "DemoWorldTakeoffEast", + "DemoWorldTakeoffForMoon", "DemoWorldTakeoffForMoonFirst", + "DemoWorldTakeoffForMoonFirstTuxedo", "DemoWorldTakeoffWest", "DemoWorldWarpHole01", + "DemoWorldWarpHole02", "DemoWorldWarpHole03", "Dive", "DiveInWater", "DokanIn", + "DokanInHome", "DokanInUpsideDown", "DokanJump", "DokanOut", "DokanOutUpsideDown", + "DokanReady", "DokanReadyHome", "DokanSideIn", "DokanSideOut", "DoorIn", "DoorOut", + "DoorStart", "Fall", "Fire", "FireRun", "FireRunStart", "GetShine", "GetShineCity", + "GetShineEmpty", "GetShineGrand", "GetShineSub", "GrabCeilJump", "GrabCeilStart", + "GrabCeilSwing", "GrabCeilWait", "Hack", "HeadSliding", "HeadSlidingStart", "HipDrop", + "HipDropLand", "HipDropReaction", "HipDropStart", "HomeCapManHeroAppear", "Jump", + "Jump2", "Jump3", "JumpBack", "JumpBroad", "JumpBroad2", "JumpBroad3", "JumpBroad4", + "JumpBroad5", "JumpBroad6", "JumpBroad7", "JumpBroad8", "JumpBroad9", + "JumpCapCatchCommon", "JumpCapLeapFrog", "JumpDashFast", "JumpEndHack", "JumpFlap", + "JumpHipDrop", "JumpInterp", "JumpNpcTrample", "JumpObjectReaction", "JumpReverse", + "JumpReverseInterp", "JumpTurn", "Kick", "KoopaCapPunchFinishL", + "KoopaCapPunchFinishLStart", "KoopaCapPunchFinishR", "KoopaCapPunchFinishRStart", + "KoopaCapPunchL", "KoopaCapPunchLStart", "KoopaCapPunchR", "KoopaCapPunchRStart", + "KoopaDemoBattleStartChurchFirstLv2", "KoopaDemoBattleStartChurchLv2", + "KoopaDemoBattleStartChurchSecondLv2", "KoopaDemoBattleStartFirstLv1", + "KoopaDemoBattleStartFirstLv2", "KoopaDemoBattleStartSecondLv1", + "KoopaDemoBattleStartSecondLv2", "KoopaDemoBattleStartTalkBlendLv1", + "KoopaDemoClashBasement", "Land", "LandDownFall", "LandJump3", "LandRolling", + "LandStiffen", "LandTurn", "MainScenarioCameraWait", "MofumofuDemoOpening1", + "MofumofuDemoOpening2", "MotorcycleRideC", "MotorcycleRideClashC", + "MotorcycleRideClashL", "MotorcycleRideClashR", "MotorcycleRideJumpC", + "MotorcycleRideJumpL", "MotorcycleRideJumpR", "MotorcycleRideL", "MotorcycleRideLandC", + "MotorcycleRideLandL", "MotorcycleRideLandR", "MotorcycleRideOn", "MotorcycleRideR", + "MotorcycleRideRunStartC", "MotorcycleRideRunStartL", "MotorcycleRideRunStartR", + "MotorcycleRideStart", "MotorcycleRideStartL", "MotorcycleRideStartR", "MotorcycleWait", + "OpeningStandUp", "PauseMenu2Player", "PauseMenuContinue", "PauseMenuContinueEnd", + "PauseMenuData", "PauseMenuHelp", "PauseMenuNewGame", "PauseMenuSave", "PauseMenuStart", + "PauseMenuWait", "PoleCatch", "PoleClimb", "PoleFall", "PoleHandStandEnd", + "PoleHandStandJump", "PoleHandStandStart", "PoleHandStandTurn", "PoleHandStandWait", + "PoleTurn", "PoleWait", "Punch", "Push", "RabbitGet", "RaceManHack", "RaceManHackEnd", + "RaceManHackStart", "RaceManJumpEnd", "RaceManJumpStart", "RaceManResultLose", + "RaceManResultWin", "RaceResultLose", "RaceResultWin", "ReactionCapOn", "Rolling", + "RollingEnd", "RollingEndBackUp", "RollingJump", "RollingLand", "RollingStandUp", + "RollingStart", "RoswellPut", "RoswellRun", "RoswellThrow", "RoswellWait", "Run", + "RunMoon", "RunStart", "SandWaitNormal", "SandWaitStrong", "SandWalkNormal", + "SandWalkStrong", "SitDown", "SitDownEnd", "SitDownLand", "SitDownSleep", + "SitDownSleepEnd", "SitDownSleepStart", "SitDownStart", "Sleep", "SleepStart", "Slide", + "SlopeSlide", "SlopeSlideBack", "Snooze", "SnoozeStart", "SphinxRideClash", + "SphinxRideFall", "SphinxRideGetOn", "SphinxRideJump", "SphinxRideJumpStart", + "SphinxRideOn", "SphinxRideRide", "SphinxRideRideOn", "SphinxRideRideStartL", + "SphinxRideRideStartR", "SphinxRideRunSlow", "SphinxRideStop", "SphinxRideStopStart", + "SpinCap", "SpinCapAirStart", "SpinCapAirStartCapCatch", "SpinCapAirStartDoubleDown", + "SpinCapAirStartDoubleLeft", "SpinCapAirStartDoubleRight", "SpinCapAirStartDoubleUp", + "SpinCapAirStartLeft", "SpinCapAirStartLong", "SpinCapAirStartRight", "SpinCapEnd", + "SpinCapJumpStart", "SpinCapStart", "SpinCapStart2Left", "SpinCapStart2Right", + "SpinCapStart3Left", "SpinCapStart3Right", "SpinCapStartCapCatch", + "SpinCapStartDoubleDown", "SpinCapStartDoubleLeft", "SpinCapStartDoubleRight", + "SpinCapStartDoubleUp", "SpinCapStartLeft", "SpinCapStartLong", "SpinCapStartRight", + "SpinCapStartRolling", "SpinCapWait", "SpinGroundL", "SpinGroundR", "SpinJump", + "SpinJumpDownFall", "SpinJumpDownFallL", "SpinJumpDownFallR", "SpinJumpL", + "SpinJumpLoop", "SpinJumpR", "SpinJumpStart", "SpinSeparate", "SpinSeparateSwim", + "SquatEnd", "SquatLand", "SquatStart", "SquatWait", "SquatWalk", "StabStart", + "StabUndarWait", "StabUnderStart", "StabWait", "StabWallWait", "SwimDieOver", + "SwimDive", "SwimFallIn", "SwimHeadSliding", "SwimHeadSlidingEnd", "SwimHeadSlidingIn", + "SwimHeadSlidingStart", "SwimHipDrop", "SwimHipDropLand", "SwimHipDropStart", + "SwimJumpHipDrop", "SwimLand", "SwimSpinCapStart", "SwimSpinCapStartDoubleDown", + "SwimSpinCapStartDoubleLeft", "SwimSpinCapStartDoubleRight", "SwimSpinCapStartDoubleUp", + "SwimSpinCapStartLeft", "SwimSpinCapStartRight", "SwimSquat", "SwimSquatWalk", + "SwimStand", "SwimStandMove", "SwimStandSurface", "SwimStandWait", "SwimSurface", + "SwimTalkWait", "SwimTrample", "SwimTrampoline", "SwimWait", "SwimWalk", "TalkEnd", + "TalkTurn", "TalkTurnL90", "TalkTurnR90", "TalkWait", "TestDemoDiverA", + "TestDemoDiverB", "TestDemoE3001", "TestRunBack", "TestRunFront", "TestRunLeft", + "TestRunRight", "TestRunWait", "ThrowCap", "ThrowCapJump", "ThrowCapJumpParts", + "ThrowCapParts", "TouchJump", "TouchJumpLong", "TouchJumpLongSign", "TractorBubbleEmd", + "TractorBubbleEnd", "TractorBubbleStart", "TractorBubbleWait", "TreeClimb", "TreeFall", + "Turn", "TurnPoint", "TurnStep", "Wait", "WaitCold", "WaitDemo", "WaitDigPoint", + "WaitHot", "WaitRelax", "WaitRelaxStart", "WaitVeryCold", "Walk", "WalkDemo", + "WalkSoft", "WallCatch", "WallCatchEnd", "WallCatchEndFast", "WallCatchEndJump", + "WallCatchMoveL", "WallCatchMoveR", "WallCatchStart", "WallJump", "WallKeep", + "WallKeepReverse", "WallLand", "WallSlideL", "WallSlideR", "WarpIn", "WarpOut", + "WarpWait", "WaterRoadMove", "WearEnd", "WhipAttackEnd", "WhipAttackStart", + "WhipAttackWait", "WhipWait", "WorldWarpBind", "WorldWarpBindStart", "WorldWarpIn", + "WorldWarpOut", + // Capture Anims + "BubbleCannonJump", "Down", "HackCancelJump", "HackHighJump", "HackJump", "HackStart", + "HackStartDown", "HackWait", "HackWaitSpeedy", "LandFrontDown", "LandFrontUp", + "MoveSpeedy", "Up", "Angry", "AppearSign", "AppearStart", "AttackSuccess", "Blow", + "BlowDown", "Clash", "Coverd", "DamageCap", "Find", "HackCharge", "HackChargeFull", + "HackChargeTurn", "HackRunCoverd", "PressDown", "RunCoverd", "RunNaked", "Swoon", + "SwoonEnd", "SwoonStart", "Trampled", "TrampledEnd", "TurnCoverd", "TurnNaked", + "BlowEnd", "BlowSign", "BlowStart", "BlowWide", "Reaction", "Charge", "ChargeStart", + "Dummy", "Idle", "ReactionCap", "ReactionCapSand", "ReactionJump", "ReactionJumpSand", + "RunHack", "RunStartHack", "WaitHack", "Attack", "AttackHit", "AttackSecond", + "AttackSecondSign", "AttackSign", "HackAttack", "HackAttackJump", "HackAttackMiss", + "HackAttackQuick", "HackJumpEnd", "HackJumpHigh", "JumpEnd", "JumpStart", + "PressDownBlow", "PressDownPress", "SwoonStartLand", "HighFall", "HighJump", "LandSwim", + "NpcFall", "NpcJump", "NpcJumpStart", "RunFast", "RunSlow", "RunStay", "Swim", + "SwimHackStart", "SwimReaction", "SwimSwoon", "SwimSwoonEnd", "SwimSwoonStart", + "SwimSwoonStartLand", "SwoonStartFall", "UpperPunch", "Appear", "Shot", "SwoonTrampled", + "AttackEnd", "AttackStart", "MoveEnd", "MoveStart", "Recover", "Trample", "Expand", + "ExpandAir", "ExpandEnemy", "ExpandSign", "ExpandSignEnemy", "ExpandWait", + "ExpandWaitEnd", "Hold", "Shrink", "ShrinkAir", "ShrinkReactionHead", + "ShrinkReactionHip", "TurnEnemy", "TurnHack", "WaitAir", "FallNormal", "Glide", + "GlideDrop", "GlideL", "GlideLStart", "GlideR", "GlideRStart", "GlideRise", + "GlideStart", "HackEnd", "HackEndFly", "JumpEndNormal", "ReactionTrampled", "Talk", + "WaitNormal", "WaitSandSink", "AttackTrample", "AttackUp", "Break", "BreakGroundHit", + "BreakReaction", "BreakWait", "FallFly", "Fly", "FlyChase", "FlyWait", "RecoverSign", + "Boost", "BoostStart", "Explosion", "FallDown", "FlyWaitStart", "Standby", "Turbo", + "AttackTower", "DashTower", "DashTowerBottom", "FallTower", "FindTower", "HackEndTower", + "JumpTower", "LandTower", "Miss", "MissTower", "PressDownTower", "Reset", "RideOn", + "RideOnTower", "RunTower", "RunTowerBottom", "SandGeyser", "SandGeyserTower", + "SandWaitTower", "SandWalkTower", "SlideTower", "SwoonLoop", "WaitTower", "WalkTower", + "WalkTowerBottom", "EnemyRun", "HackRun", "Choke", "ChokeEnd", "ChokeStart", + "HackStartChoke", "Look", "Swallow", "SwoonChoke", "SwoonEndChoke", "SwoonStartChoke", + "Vomit", "WaitChoke", "DashR", "FishingUp", "FishingUpGold", "JumpGround", + "ReactionWall", "RollingRail", "RollingRailReverse", "RollingReverse", "SwimStart", + "SwimSurfaceEnemy", "SwimWaitStart", "TurnPlayer", "WaitGround", "AdlibWait", + "Generate", "JumpEndHigh", "JumpEndLow", "Stretch", "StretchFall", "StretchRun", + "StretchWait", "UpperObjStart", "UpperObjWait", "BlowDownCommon", "PressDownCommon", + "Reload", "Shoot", "SwoonReaction", "AttackMove", "AttackMoveForest", "AttackWaitL", + "AttackWaitR", "DashAfterL", "DashAfterR", "DashL", "EnemyAttack", "EnemyAttackL", + "EnemyAttackLEnd", "EnemyAttackLStart", "EnemyAttackR", "EnemyAttackREnd", + "EnemyAttackRStart", "EnemyAttackSign", "EnemyFall", "EnemyFallStart", "EnemyLand", + "EnemyRunStart", "FindMario", "FootHoldJumpL", "FootHoldJumpR", "FootHoldL", + "FootHoldR", "HackStartShort", "HackStartWithTurn", "ListPose", "Lost", "MoveTouch", + "NoticeSniff", "ReactionSeaOfTrees", "RunAfterL", "RunAfterR", "RunL", "RunR", + "RunStartL", "RunStartR", "SleepReactionHipDrop", "SleepSeaOfTrees", + "SwoonStartDashClash", "TurnEndL", "TurnEndR", "TurnL180", "TurnL90", "TurnR180", + "TurnR90", "WaitL", "WaitR", "WaitSniff", "WakeUpSwoonStart", "WalkAfterL", + "WalkAfterR", "WalkEndL", "WalkEndR", "WalkGroundL", "WalkGroundR", "WalkL", "WalkR", + "WalkStart", "WalkStartL", "WalkStartR", "AppearBall", "JumpStick", "SpinL", "SpinR", + "SpinThrustL", "SpinThrustR", "Stick", "StickBendHorizontal", "StickBendVertical", + "Thrust", "ThrustCancel", "ThrustEnd", "ThrustSign", "ThrustWait", "TrampleDown", + "AttackPull", "Back", "BackEnd", "BackReturn", "HackDash", "HackDashPull", "HackMove", + "HackPull", "HackPullStart", "HitAction", "HitEnd", "HoleIn", "Return", + // All Capture Actions + "Bubble", "Bull", "Byugo", "BlowStartEnemy", "BlowStartHack", "IdleHack", "Stop", + "FireBros", "Frog", "HackLand", "HackOff", "HackOn", "NpcLand", "HammerBros", "Imomu", + "ExpandAirEnemy", "ExpandAirHack", "ExpandHack", "ExpandSignHack", "ShrinkAirHack", + "ShrinkEnemy", "ShrinkHack", "ShrinkReactionHeadEnemy", "ShrinkReactionHeadHack", + "ShrinkReactionHipEnemy", "ShrinkReactionHipHack", "Kakku", "FallHack", "KaronWing", + "EnemyFly", "HackFly", "Killer", "Default", "SignExplosion", "Kuribo", "KuriboWing", + "PackunFire", "ChokeDefault", "ChokeCap", "Eat", "VomitCap", "VomitDefault", + "PackunPoison", "EatDown", "Pukupuku", "DashRSurface", "DashRWater", "RollingRSurface", + "RollingRWater", "RollingLSurface", "RollingLWater", "SwimStartSurface", + "SwimStartWater", "SwimWaitStartSurface", "SwimWaitStartWater", "SwimWaitSurface", + "SwimWaitWater", "SwimWaitWaterHack", "SwimWater", "WaitMove", "AdlibWaitMove", + "RunMove", "FallMove", "JumpEndEnemy", "JumpEndLowHack", "JumpEndHighHack", "Tank", + "BlowDownCaptureParade", "PressDownCaptureParade", "MoveL", "MoveR", "MoveAfterL", + "MoveAfterR", "MoveStartL", "MoveStartR", "Tsukkun", "StickBend", "ThrustEnemy", + "ThrustHack", "ThrustWaitEnemy", "ThrustWaitHack", "Wanwan", "BackChain", "BackDirect", + "WanwanBig" + }; + + // these ifdefs are really dumb but it makes clangd happy so /shrug +#ifndef ANALYZER + static constexpr crc32::HashArray s_Hashes(s_Strs); +#endif + + static constexpr Type FindType(std::string_view const& str) { +#ifndef ANALYZER + return ToType(s_Hashes.FindIndex(str)); +#else + return Type::Unknown; +#endif + } + + static constexpr const char *FindStr(Type type) { + return s_Strs.at(ToValue(type)); + } +} \ No newline at end of file diff --git a/include/algorithms/WipeTypes.h b/include/algorithms/WipeTypes.h new file mode 100644 index 0000000..5f40910 --- /dev/null +++ b/include/algorithms/WipeTypes.h @@ -0,0 +1,77 @@ +#pragma once + +// Probably will go unused + +#include +#include "crc32.h" +#include "basis/seadTypes.h" + +namespace WipeTypes { + + enum class Type : s16 { + Unknown = -1, + 中間ワープ, // Intermediate warp, + タイトルロゴ, // Title logo, + ワープ絵画, // Warp painting, + ホーム離陸, // Home takeoff, + 地下工場, // Underground factory, + 樹海, // Aokigahara, + クッパLV1後, // After Bowser LV1, + 教会崩落, // Church collapse, + 教会落下, // Church fall, + 電線脱出ED, // Wire escape ED, + ワールドワープホール, // World Warp Hall, + 教会に入る, // Enter the church, + 教会から出る, // Get out of the church, + 墜落W前, // Before the crash W, + オープニング, // opening, + ホーム陥落, // Home fall, + 溶岩シナリオ1終了, // Lava scenario 1 end, + ワールド間移動デモ室内へ用, // For inter-world movement demo room, + ワールド間移動デモ終了, // Inter-world movement demo finished, + End + }; + + static constexpr size_t ToValue(Type type) { return static_cast(type); } + + static constexpr Type ToType(std::uint16_t value) {return static_cast(value);} + + static constexpr std::array s_Strs { + "中間ワープ", + "タイトルロゴ", + "ワープ絵画", + "ホーム離陸", + "地下工場", + "樹海", + "クッパLV1後", + "教会崩落", + "教会落下", + "電線脱出ED", + "ワールドワープホール", + "教会に入る", + "教会から出る", + "墜落W前", + "オープニング", + "ホーム陥落", + "溶岩シナリオ1終了", + "ワールド間移動デモ室内へ用", + "ワールド間移動デモ終了用" + }; + + // these ifdefs are really dumb but it makes clangd happy so /shrug +#ifndef ANALYZER + static constexpr crc32::HashArray s_Hashes(s_Strs); +#endif + + static constexpr Type FindType(std::string_view const& str) { +#ifndef ANALYZER + return ToType(s_Hashes.FindIndex(str)); +#else + return Type::Unknown; +#endif + } + + static constexpr const char *FindStr(Type type) { + return s_Strs.at(ToValue(type)); + } +} \ No newline at end of file diff --git a/include/algorithms/crc32.h b/include/algorithms/crc32.h new file mode 100644 index 0000000..ddc8e83 --- /dev/null +++ b/include/algorithms/crc32.h @@ -0,0 +1,122 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +// these ifdefs are really dumb but it makes clangd happy so /shrug +#ifndef ANALYZER +#include +#endif + +// Credits to Shadow for making a majority of this code for me! + +namespace crc32 { + + static constexpr uint32_t s_Table[256] = + { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL + }; + + constexpr uint32_t HashStr(std::string_view const& str) + { + uint32_t crc = 0xffffffff; + for (auto c : str) + crc = (crc >> 8) ^ s_Table[(crc ^ c) & 0xff]; + return crc ^ 0xffffffff; + } + + template + struct HashArray { + using HashType = std::uint32_t; + using PairType = std::pair; + using HashArrayType = std::array; + + HashArrayType m_Hashes; + + constexpr HashArray(std::array const& strings) : m_Hashes() { + /* Hash and store all provided strings. */ + for(size_t i = 0; i < strings.size(); i++) { + m_Hashes[i] = { crc32::HashStr(strings[i]), i }; + } + + /* Sort by hashes. */ + std::sort(m_Hashes.begin(), m_Hashes.end(), [](auto &left, auto &right) { + return left.first < right.first; + }); + } + + constexpr std::int64_t FindIndex(std::string_view const& str) const { + auto hash = crc32::HashStr(str); + auto begin = m_Hashes.cbegin(); + auto end = m_Hashes.cend(); + +#ifndef ANALYZER + /* Binary search for string. */ + auto pair = std::ranges::lower_bound(begin, end, hash, {}, &PairType::first); + + if (pair == end || pair->first != hash) + return -1; + else + return pair->second; +#else + return -1; +#endif + + } + }; +} \ No newline at end of file diff --git a/include/cameras/CameraPoserCustom.h b/include/cameras/CameraPoserCustom.h new file mode 100644 index 0000000..e1e00a7 --- /dev/null +++ b/include/cameras/CameraPoserCustom.h @@ -0,0 +1,33 @@ +#pragma once + +#include "al/camera/CameraPoser.h" +#include "al/camera/alCameraPoserFunction.h" + +#include "sead/math/seadVector.h" + +#include "al/util.hpp" + +// cc = custom cameras + +namespace cc { + class CameraPoserCustom : public al::CameraPoser { + public: + CameraPoserCustom(char const*); + virtual void loadParam(al::ByamlIter const&) override; + virtual void start(al::CameraStartInfo const&) override; + virtual void init() override; + void reset(void); + virtual void update(void) override; + virtual void movement(void) override; + + float mOffsetY = 120.0f; + float mDist = 1600.0f; + float mAngleV = 0.0f; + float mAngleH = 0.0f; + float mPrevH = 0.0f; + float mPrevV = 0.0f; + float mSnapSpeed = 0.15f; + bool mIsResetAngleIfSwitchTarget = false; + sead::Vector3f mPrevTargetDir = sead::Vector3f::ey; + }; +} \ No newline at end of file diff --git a/include/debugMenu.hpp b/include/debugMenu.hpp new file mode 100644 index 0000000..717c504 --- /dev/null +++ b/include/debugMenu.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "sead/devenv/seadDebugFontMgrNvn.h" +#include "sead/gfx/seadPrimitiveRenderer.h" +#include "sead/gfx/seadTextWriter.h" +#include "sead/basis/seadNew.h" +#include "sead/gfx/seadViewport.h" + +#include "agl/DrawContext.h" +#include "agl/utl.h" + +#include "game/System/GameSystem.h" + +#include "al/util.hpp" +#include "logger.hpp" + +extern sead::TextWriter *gTextWriter; + +bool setupDebugMenu(agl::DrawContext* context, sead::Viewport* viewport); + +void drawBackground(agl::DrawContext *context); \ No newline at end of file diff --git a/include/game/Actors/ChurchDoor.h b/include/game/Actors/ChurchDoor.h new file mode 100644 index 0000000..252a830 --- /dev/null +++ b/include/game/Actors/ChurchDoor.h @@ -0,0 +1,7 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" + +class ChurchDoor : public al::LiveActor { + +}; \ No newline at end of file diff --git a/include/game/Actors/CoinStackGroup.h b/include/game/Actors/CoinStackGroup.h new file mode 100644 index 0000000..713575f --- /dev/null +++ b/include/game/Actors/CoinStackGroup.h @@ -0,0 +1,12 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" + +struct CoinStack; // stub class + +class CoinStackGroup : public al::LiveActor +{ + public: + void setStackAsCollected(CoinStack *stack); + void generateCoinStackGroup(al::ActorInitInfo const &, int count); +}; \ No newline at end of file diff --git a/include/game/Actors/IUseDemoSkip.h b/include/game/Actors/IUseDemoSkip.h new file mode 100644 index 0000000..adef6f4 --- /dev/null +++ b/include/game/Actors/IUseDemoSkip.h @@ -0,0 +1,5 @@ +#pragma once + +class IUseDemoSkip { + +}; \ No newline at end of file diff --git a/include/game/Actors/KuriboHack.h b/include/game/Actors/KuriboHack.h new file mode 100644 index 0000000..3e00007 --- /dev/null +++ b/include/game/Actors/KuriboHack.h @@ -0,0 +1,7 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" + +class KuriboHack : public al::LiveActor { + +}; \ No newline at end of file diff --git a/include/game/Actors/ReflectBombGenerator.h b/include/game/Actors/ReflectBombGenerator.h new file mode 100644 index 0000000..93f0b57 --- /dev/null +++ b/include/game/Actors/ReflectBombGenerator.h @@ -0,0 +1,3 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" \ No newline at end of file diff --git a/include/game/Actors/Shine.h b/include/game/Actors/Shine.h new file mode 100644 index 0000000..f27db23 --- /dev/null +++ b/include/game/Actors/Shine.h @@ -0,0 +1,38 @@ +#pragma once + +#include "al/actor/ActorDimensionKeeper.h" +#include "game/Info/QuestInfo.h" +#include "types.h" + +#include "game/Info/ShineInfo.h" +#include "game/Interfaces/IUseDimension.h" +#include "al/LiveActor/LiveActor.h" + +class Shine : public al::LiveActor , public IUseDimension { + public: + Shine(const char* actorName); + + ActorDimensionKeeper *getActorDimensionKeeper() const override; + + void offAppear(); + void onAppear(); + + void getDirectWithDemo(void); + void getDirect(); + void get(); + + void onSwitchGet(void); + + bool isGot() const; + + void setGrandShine(void); + + unsigned char padding[0x10]; + // 0x11C mIsEmptyShine + ShineInfo *curShineInfo; // 0x120 + unsigned char padding_290[0x278 - 0x128]; + QuestInfo *shineQuestInfo; // 0x278 + void *unkPtr1; // 0x280 + ActorDimensionKeeper *mDimensionKeeper; // 0x288 + int shineId; // 0x290 +}; \ No newline at end of file diff --git a/include/game/Actors/ShineTowerRocket.h b/include/game/Actors/ShineTowerRocket.h new file mode 100644 index 0000000..1d8c4ec --- /dev/null +++ b/include/game/Actors/ShineTowerRocket.h @@ -0,0 +1,9 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "al/event/IEventFlowEventReceiver.h" +#include "IUseDemoSkip.h" + +class ShineTowerRocket : public al::LiveActor, public al::IEventFlowEventReceiver, public IUseDemoSkip { + // virtual void makeActorDead 0x30 +}; \ No newline at end of file diff --git a/include/game/Actors/WorldEndBorderKeeper.h b/include/game/Actors/WorldEndBorderKeeper.h new file mode 100644 index 0000000..51ab886 --- /dev/null +++ b/include/game/Actors/WorldEndBorderKeeper.h @@ -0,0 +1,21 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "al/nerve/NerveExecutor.h" +#include "math/seadVector.h" + +class WorldEndBorderKeeper : public al::NerveExecutor { +public: + WorldEndBorderKeeper(al::LiveActor const*); + void exeInside(void); + void exeOutside(void); + void exePullBack(void); + void exeWaitBorder(void); + void reset(void); + void update(sead::Vector3f const&,sead::Vector3f const&,bool); + ~WorldEndBorderKeeper(); + + al::LiveActor* mActor; + sead::Vector3f unkVec1; // = sead::Vector3f::ex; + sead::Vector3f unkVec2; // = sead::Vector3f::ex; +}; \ No newline at end of file diff --git a/include/game/Controller/ControllerAppletFunction.h b/include/game/Controller/ControllerAppletFunction.h new file mode 100644 index 0000000..421e96d --- /dev/null +++ b/include/game/Controller/ControllerAppletFunction.h @@ -0,0 +1,9 @@ +#pragma once + +#include "al/gamepad/util.h" + +class ControllerAppletFunction { + public: + void connectControllerSinglePlay(al::GamePadSystem *); + void connectControllerSeparatePlay(al::GamePadSystem *); +}; \ No newline at end of file diff --git a/include/game/GameData/GameDataFile.h b/include/game/GameData/GameDataFile.h new file mode 100644 index 0000000..0dcd582 --- /dev/null +++ b/include/game/GameData/GameDataFile.h @@ -0,0 +1,310 @@ +/** + * @file GameDataFile.h + * @brief Holds data for an individual save file. + */ + +#pragma once + +#include "al/scene/SceneObjHolder.h" +#include "types.h" +#include "UniqueObjInfo.h" + +#include "sead/math/seadVector.h" +#include "sead/stream/seadStream.h" + +namespace al { + class ActorInitInfo; + class PlacementInfo; + class PlacementId; +} + +class GameDataHolder; +class ShineInfo; + +class GameDataFile +{ + public: + GameDataFile(GameDataHolder *); + void initializeData(void); + void tryReadByamlData(uchar const*); + void tryFindCoinCollectInfo(char const*,char const*); + void tryFindShineIndexByUniqueId(int); + void tryFindCoinCollectIndexByUniqueId(int); + void buyDefaultItem(void); + void unlockAchievementShineName(void); + void updateWorldMapIndex(void); + void updateWorldWarpIndex(void); + void initializeCheckpointTable(void); + void generateSaveDataIdForPrepo(void); + void resetMapIcon(void); + void wearDefault(void); + void initializeHintList(void); + void initializeCoinCollectList(void); + void resetTempData(void); + void addPlayTime(int,al::IUseSceneObjHolder const*); + void updateSaveTime(void); + void updateSaveTimeForDisp(void); + void updateSaveInfoForDisp(void); + void generateSaveDataIdForPrepoForWrite(void); + void resetSaveDataIdForPrepoForWrite(void); + void startStage(char const*,int); + void checkIsHomeStage(char const*); + void setGameClear(void); + void startDemoStage(char const*); + void changeNextStage(struct ChangeStageInfo const*,int); + void returnPrevStage(void); + void changeNextStageWithDemoWorldWarp(char const*); + void changeNextStageWithWorldWarpHole(char const*); + void restartStage(void); + void calcNextScenarioNo(void); + void tryGetStageNameCurrent(void); + void changeWipeType(char const*); + void setRestartPointId(al::PlacementId const*); + void clearStartId(void); + void tryGetRestartPointIdString(void); + void endStage(void); + void missAndRestartStage(void); + void checkGotShine(char const*); + void tryGetNextMainScenarioLabel(sead::BufferedSafeString *,sead::BufferedSafeString *); + void tryGetNextMainScenarioPos(sead::Vector3f *); + void tryFindNextMainScenarioInfo(void); + void addPayShine(int); + void addPayShineCurrentAll(void); + void addKey(int); + void addOpenDoorLockNum(int); + void tryFindSaveObjS32(al::PlacementId const*); + void addSessionMember(struct SessionMusicianType const&); + void addCoinCollect(al::PlacementId const*); + void useCoinCollect(int); + void tryFindExistCoinCollectStageName(int); + void payCoinToSphinx(void); + void answerCorrectSphinxQuiz(void); + void answerCorrectSphinxQuizAll(void); + void talkLocalLanguage(void); + void saveWorldTravelingStatus(char const*); + void startWorldTravelingPeach(void); + void setGrowFlowerTime(al::PlacementId const*,ulong); + void addGrowFlowerGrowLevel(al::PlacementId const*,uint); + void findGrowFlowerPotIdFromSeedId(al::PlacementId const*); + void addCoin(int); + void addPlayerJumpCount(void); + void addPlayerThrowCapCount(void); + void readFromStream(sead::ReadStream *,uchar *); + void tryReadByamlDataFromStream(sead::ReadStream *,uchar *,int); + void writeToStream(sead::WriteStream *,sead::Heap *); + void tryWriteByByaml(sead::WriteStream *,sead::Heap *); + void calcCheckpointIndexInScenario(int); + void changeNextSceneByGotCheckpoint(int); + void changeNextSceneByWarp(void); + void changeNextSceneByHome(void); + void startYukimaruRace(void); + void startYukimaruRaceTutorial(void); + void startRaceManRace(void); + void registerCheckpointTrans(al::PlacementId const*,sead::Vector3f const&); + void calcGetCheckpointNum(void); + void calcRestHintNum(void); + void unlockHint(void); + void unlockHintImpl(int); + void unlockHintAmiibo(void); + void unlockHintAddByMoonRock(void); + void calcHintNum(void); + void calcHintTrans(int); + void findHint(int); + void calcHintTransMostEasy(void); + void findHintInfoMostEasy(void); + void calcHintMoonRockNum(void); + void calcHintMoonRockTrans(int); + void findHintMoonRock(int); + void tryUnlockShineName(int,int); + void calcShineIndexTableNameAvailable(int *,int *,int); + void calcShineIndexTableNameUnlockable(int *,int *,int); + void unlockWorld(int); + void noPlayDemoWorldWarp(void); + void calcWorldWarpHoleThroughNum(void); + void enteredStage(void); + //void buyItem(ShopItem::ItemInfo const*,bool); + //void tryFindItemList(ShopItem::ItemInfo const*); + void calcHaveClothNum(void); + void calcHaveCapNum(void); + void calcHaveStickerNum(void); + void calcHaveGiftNum(void); + void buyItemAll(void); + void wearCostume(char const*); + void wearCap(char const*); + void addHackDictionary(char const*); + void findShine(int,int); + void calcShineNumInOneShine(int,int); + void checkAchievementShine(int,int); + void winRace(void); + void findRaceRecord(char const*); + void incrementRaceLoseCount(int); + void setUpdateJumpingRopeScoreFlag(void); + void setVolleyballBestCount(int); + void setUpdateVolleyballScoreFlag(void); + void setAmiiboNpcTrans(sead::Vector3f const&); + void setTimeBalloonNpcTrans(sead::Vector3f const&); + void setPoetterTrans(sead::Vector3f const&); + void setShopNpcTrans(sead::Vector3f const&,char const*,int); + void setMoonRockTrans(sead::Vector3f const&); + void setMiniGameInfo(sead::Vector3f const&,char const*); + void calcMiniGameNum(void); + void showExplainCheckpointFlag(void); + void calcShopNum(void); + void talkKakku(void); + void talkWorldTravelingPeach(void); + void talkCollectBgmNpc(void); + void noFirstNetwork(void); + void calcIsGetMainShineAll(al::IUseSceneObjHolder const*); + void calcIsGetShineAllInWorld(int); + void tryFindLinkedShineIndex(al::ActorInitInfo const&,al::IUseSceneObjHolder const*); + void tryFindLinkedShineIndex(al::ActorInitInfo const&,int,al::IUseSceneObjHolder const*); + void tryFindLinkedShineIndexByLinkName(al::IUseSceneObjHolder const*,al::ActorInitInfo const&,char const*); + void calcLinkedShineNum(al::ActorInitInfo const&); + void tryFindShineIndex(al::ActorInitInfo const&); + void tryFindShineIndex(char const*,char const*); + void disableHintById(int); + void enableHintById(int); + void setHintTrans(int,sead::Vector3f const&); + void resetHintTrans(int); + void registerShineInfo(ShineInfo const*,sead::Vector3f const&); + void calcRestShineInStageWithWorldProgress(char const*); + // void calcGetShineNumByObjectNameOrOptionalId(char const*, GameDataFile::CountType); + void calcGetShineNumByObjectNameWithWorldId(char const*,int); + void calcAllShineNumByObjectNameOrOptionalId(char const*); + void calcGetShineNumByStageName(char const*); + void tryFindAndInitShineInfoByOptionalId(ShineInfo *,char const*); + void tryFindUniqueId(ShineInfo const*); + void findUnlockShineNumCurrentWorld(bool *); + void trySetCollectedBgm(char const*,char const*); + // void setGotShine(GameDataFile::HintInfo const*); + // void tryWriteByByaml(al::ByamlWriter *); + + int getTotalShineNum(void); + void getCollectBgmByIndex(int); + u8 getMainScenarioNoCurrent(void) const; + int getStartShineNextIndex(void); + void getTokimekiMayorNpcFavorabilityRating(void); + void getShopNpcIconNumMax(void); + void getShopNpcTrans(int); + void getPoetterTrans(void); + void getTimeBalloonNpcTrans(void); + void getMiniGameNumMax(void); + void getRaceLoseCount(int); + int getWorldTotalShineNum(int); + int getWorldWarpHoleThroughNumMax(void); + void getCheckpointObjIdInWorld(int); + void getCheckpointNumMaxInWorld(void); + void getPlayerThrowCapCount(void); + void getPlayerJumpCount(void); + void getGrowFlowerGrowLevel(al::PlacementId const*); + void getGrowFlowerTime(al::PlacementId const*); + void getWorldTravelingStatus(void); + void getCoinCollectNum(void); + void getKeyNum(void); + int getPayShineNum(int); + int getShineNum(void); + void getAchievement(char const*); + void getPlayerStartId(void); + void getStageNameNext(void); + void getStageNameCurrent(void); + void getPlayerHitPointData(void); + void getLastUpdateTime(void); + void getPlayTimeTotal(void); + void getMainScenarioNo(int); + void getCollectedBgmMaxNum(void); + int getScenarioNo(void) const; + void getMiniGameName(int); + void getWorldTotalShineNumMax(int); + void getCheckpointTransInWorld(char const*); + void getCoinCollectGotNum(void); + void getTotalPayShineNum(void); + void getShineNum(int); + int getScenarioNo(int worldIndex) const; + void getCollectedBgmNum(void); + void getScenarioNoPlacement(void); + void getMiniGameTrans(int); + void getCoinCollectGotNum(int); + void getTotalShopShineNum(void); + + void setGotShine(int); + void setMainScenarioNo(int); + void setStartShine(ShineInfo const*); + void setKidsMode(bool); + void setTokimekiMayorNpcFavorabilityRating(int); + void setFlagOnTalkMessageInfo(int); + void setJangoTrans(sead::Vector3f const&); + void setJumpingRopeBestCount(int); + void setGrowFlowerTime(al::PlacementId const*,al::PlacementId const*,ulong); + void setSaveObjS32(al::PlacementId const*,int); + void setStartedObj(al::PlacementId const*); + void setGotShine(ShineInfo const*); + void setMissRestartInfo(al::PlacementInfo const&); + void setCheckpointId(al::PlacementId const*); + void setActivateHome(void); + void setOriginalHintTrans(int); + + bool isUnlockedWorld(int) const; + bool isAlreadyGoWorld(int) const; + bool isFirstTimeNextWorld(void) const; + bool isGotShine(ShineInfo const*) const; + bool isGotShine(int) const; + bool isStartedObj(char const*,char const*) const; + bool isAnswerCorrectSphinxQuizAll(int) const; + bool isTalkAlreadyLocalLanguage(void) const; + bool isBuyItem(char const*,sead::FixedSafeString<64> const*) const; + bool isOpenShineName(int,int) const; + bool isExistPoetter(void) const; + bool isAlreadyShowExplainCheckpointFlag(void) const; + bool isFlagOnTalkMessageInfo(int) const; + bool isTalkKakku(void) const; + bool isNextMainShine(struct QuestInfo const*) const; + bool isNextMainShine(int) const; + bool isMainShine(int) const; + bool isLatestGetMainShine(ShineInfo const*) const; + bool isEnableOpenMoonRock(int) const; + bool isCollectedBgm(char const*,char const*) const; + bool isPlayScenarioCamera(struct QuestInfo const*) const; + bool isFirstNetwork(void) const; + bool isTalkCollectBgmNpc(void) const; + bool isTalkWorldTravelingPeach(void) const; + bool isClearWorldMainScenario(int) const; + bool isShopSellout(int) const; + bool isExistTimeBalloonNpc(void) const; + bool isExistJango(void) const; + bool isGotShine(int,int) const; + bool isExistInHackDictionary(char const*) const; + // bool isBuyItem(ShopItem::ItemInfo const*) const; + bool isUnlockAchievementShineName(void) const; + bool isOpenMoonRock(int) const; + bool isEnableUnlockHint(void) const; + bool isGotCheckpoint(al::PlacementId *) const; + bool isGotCheckpointInWorld(int) const; + bool isPlayDemoPlayerDownForBattleKoopaAfter(void) const; + bool isUsedGrowFlowerSeed(al::PlacementId const*) const; + bool isStartWorldTravelingPeach(void) const; + bool isFirstWorldTravelingStatus(void) const; + bool isAnswerCorrectSphinxQuiz(int) const; + bool isPayCoinToSphinx(void) const; + bool isGotCoinCollect(al::PlacementId const*) const; + bool isExistSessionMember(struct SessionMusicianType const&) const; + bool isStartedObj(al::PlacementId const*,char const*) const; + bool isPayShineAllInAllWorld(void) const; + bool isUseMissRestartInfo(void) const; + bool isGoToCeremonyFromInsideHomeShip(void) const; + bool isRaceStart(void) const; + bool isGameClear(void) const; + bool isEmpty(void) const; + bool isKidsMode(void) const; + + undefined padding[0x5C8]; + UniqObjInfo** mUniqueInfo; // 0x5C8 + void *unkPtr1; // 0x5D0 + void *unkPtr2; // 0x5D8 + void *unkPtr3; // 0x5E0 + void* unkPtr4; // 0x5E8 + void* unkPtr5; // 0x5F0 + bool unkBool1; // 0x5F8 + bool unkBool2; // 0x5F9 + bool mIsCapEnable; // 0x5FA +}; + \ No newline at end of file diff --git a/include/game/GameData/GameDataFunction.h b/include/game/GameData/GameDataFunction.h new file mode 100644 index 0000000..3641870 --- /dev/null +++ b/include/game/GameData/GameDataFunction.h @@ -0,0 +1,141 @@ +/** + * @file GameDataFunction.h + * @brief Holds static functions for getting / storage save data. + */ + +#pragma once + +#include +#include "GameDataHolderAccessor.h" +#include "GameDataHolderWriter.h" +#include "al/area/ChangeStageInfo.h" +#include "game/GameData/GameDataFile.h" + +class GameDataFunction +{ +public: + + // sets the current worn costume + static void wearCostume(GameDataHolderWriter, char const *); + + // sets the current worn cap + static void wearCap(GameDataHolderWriter, char const*); + + // remove cappy + static void disableCapByPlacement(al::LiveActor const*); + + // restarts current stage + static void restartStage(GameDataHolderWriter); + + // restarts current stage + static void missAndRestartStage(GameDataHolderWriter); + + // attempts to change the current stage the player is in + static bool tryChangeNextStage(GameDataHolderWriter, ChangeStageInfo const *); + + // gets prev save file's current world id + static s32 getPrevWorldId(GameDataHolderAccessor); + // gets current save file's current world id + static s32 getCurrentWorldId(GameDataHolderAccessor); + // gets next save file's current world id + static s32 getNextWorldId(GameDataHolderAccessor); + + // gets current save file's current stage scenario no + static u8 getScenarioNo(al::LiveActor const*); + + static s32 calcNextScenarioNo(GameDataHolderAccessor); + // gets the current scenario No of the specified kingdom + static s32 getWorldScenarioNo(GameDataHolderAccessor, int); + + static char* getCurrentStageName(GameDataHolderAccessor); + + static char* getMainStageName(GameDataHolderAccessor, int); + + static char* getNextStageName(GameDataHolderAccessor); + + static s32 getCurrentShineNum(GameDataHolderAccessor); + + // gets total moons collected on a specified save file (-1 for current save) + static s32 getTotalShineNum(GameDataHolderAccessor, int); + + // gets the total amount of moons available in a kingdom + static s32 getWorldTotalShineNum(GameDataHolderAccessor, int); + + // checks save file if shine is collected in kingdom index + static bool isGotShine(GameDataHolderAccessor, int, int); + + // checks save file if shine is collected by shine index only (0 through 725) + static bool isGotShine(GameDataHolderAccessor, int); + + // Gets Index for X Kingdom + static s32 getWorldIndexWaterfall(void); + static s32 getWorldIndexMoon(void); + + // gets the current level of the Odyssey + static int getHomeLevel(GameDataHolderAccessor); + + // checks if cappy is enabled + static bool isEnableCap(GameDataHolderAccessor); + // enables cappy if not enabled already + static void enableCap(GameDataHolderWriter); + + // kills the player + static void killPlayer(GameDataHolderWriter); + + // damages the player + static void damagePlayer(GameDataHolderWriter); + + // upgrades the odyssey + static void upHomeLevel(GameDataHolderWriter); + + // Saves shine if obtained + static void setGotShine(GameDataHolderWriter, ShineInfo const*); + + //unlocks a kingdom based off index + static void unlockWorld(GameDataHolderWriter, int); + //sets the scenario of the specified kingdom + static void setMainScenarioNo(GameDataHolderWriter, int scenarioNo); + + // checks if the opening cutscene needs to play + static bool isPlayDemoOpening(GameDataHolderAccessor); + + // checks if odyssey is/needs a repair + static bool isRepairHome(GameDataHolderAccessor); + static void repairHome(GameDataHolderWriter); + + // checks if odyssey is crashed + static bool isCrashHome(GameDataHolderAccessor); + static void crashHome(GameDataHolderWriter); + + // checks if odyssey is activated + static bool isActivateHome(GameDataHolderAccessor); + static void activateHome(GameDataHolderWriter); + + // checks if the odyssey has launched for the first time. + static bool isLaunchHome(GameDataHolderAccessor); + static void launchHome(GameDataHolderWriter); + + static bool isHomeShipStage(GameDataHolder const *); + + // used during the event that enables the odyssey to be used (enables the globe for the odyssey) + static void talkCapNearHomeInWaterfall(al::LiveActor const*); + + // gives the player a life up heart + static void getLifeMaxUpItem(al::LiveActor const *); + + // gets current coin count + static s32 getCoinNum(GameDataHolderAccessor); + + // gets current purple coin count + static s32 getCoinCollectNum(GameDataHolderAccessor); + + // saves an objects Stage Name, Object ID, and custom value to the save file + static void saveObjS32(GameDataHolderWriter, al::PlacementId const*, int); + + // gets the value stored in the unique obj info that matches placement id and curstage + static bool tryFindSaveObjS32Value(int *value, GameDataHolderAccessor accessor, al::PlacementId const* objId); + + // subtracts the supplied int value from the current coin count + static void subCoin(GameDataHolderWriter, int value); + +}; \ No newline at end of file diff --git a/include/game/GameData/GameDataHolder.h b/include/game/GameData/GameDataHolder.h new file mode 100644 index 0000000..7d98138 --- /dev/null +++ b/include/game/GameData/GameDataHolder.h @@ -0,0 +1,111 @@ +/** + * @file GameDataHolder.h + * @brief Holds scenario / game data. + */ + +#pragma once + +#include "basis/seadTypes.h" +#include "game/GameData/GameDataFile.h" +#include "game/GameData/GameDataHolderBase.h" +#include "game/WorldList/WorldList.h" + +class GameDataHolder : public al::GameDataHolderBase +{ +public: + // GameDataHolder(al::MessageSystem const *); + GameDataHolder(); + + virtual ~GameDataHolder(); + + virtual char* getSceneObjName() const; + // virtual al::MessageSystem* getMessageSystem() const; + + void setPlayingFileId(s32 file); + void intitalizeData(); + void initialzeDataCommon(); + void resetTempSaveData(bool); + void initializeDataId(s32); + void readByamlData(s32, char const *); + s32 tryFindEmptyFileId() const; + + bool isRequireSave() const; + void setRequireSave(); + void setRequireSaveFalse(); + void setRequireSaveFrame(); + void updateRequireSaveFrame(); + bool isInvalidSaveForMoonGet() const; + void invalidateSaveForMoonGet(); + void validateSaveForMoonGet(); + void setLanguage(char const *); + char* getLanguage() const; + + void resetLocationName(); + void changeNextStageWithDemoWorldWarp(char const *); + bool tryChangeNextStageWithWorldWarpHole(char const *); + void returnPrevStage(); + char* getNextStageName() const; + char* getNextStageName(s32 idx) const; + GameDataFile* getGameDataFile(s32 idx) const; + // u64 getNextPlayerStartId() const; + char* getCurrentStageName() const; + char* tryGetCurrentStageName() const; + char* getCurrentStageName(s32 idx) const; + // void setCheckpointId(al::PlacementId const *); + char* tryGetRestartPointIdString() const; + void endStage(); + void startStage(char const *, s32); + // void onObjNoWriteSaveData(al::PlacementId const *); + // void offObjNoWriteSaveData(al::PlacementId const *); + // bool isOnObjNoWriteSaveData(al::PlacementId const *) const; + // void onObjNoWriteSaveDataResetMiniGame(al::PlacementId const*); + // void offObjNoWriteSaveDataResetMiniGame(al::PlacementId const *); + // bool isOnObjNoWriteSaveDataResetMiniGame(al::PlacementId const *) const; + // void onObjNoWriteSaveDataInSameScenario(al::PlacementId const *); + // bool isOnObjNoWriteSaveDataInSameScenario(al::PlacementId const *) const; + void writeTempSaveDataToHash(char const *, bool); + + void resetMiniGameData(); + s32 getPlayingFileId() const; + + s32 findUnlockShineNum(bool *, s32) const; + s32 calcBeforePhaseWorldNumMax(s32) const; + bool isFindKoopaNext(s32) const; + bool isBossAttackedHomeNext(s32) const; + void playScenarioStartCamera(s32); + bool isPlayAlreadyScenarioStartCamera() const; + + s32 getShineAnimFrame(s32) const; + s32 getCoinCollectNumMax(s32) const; + + void readFromSaveDataBufferCommonFileOnlyLanguage(); + void readFromSaveDataBuffer(const char *bufferName); + + void changeNextStage(struct ChangeStageInfo const*, int); + + int findUseScenarioNo(char const*); + + // unsigned char padding_20[0x20 - sizeof(al::ISceneObj)]; + // GameDataFile* mGameDataFile; + + int padding; // 0x10 + GameDataFile** mDataFileArr; // 0x18 + GameDataFile* mGameDataFile; // 0x20 + u64 _28; + u64 _30; + u64* _38; // SaveDataAccessSequence* + u32 _40; + u32 mRequireSaveFrame; // _44 + bool mIsInvalidSaveForMoonGet; // _48 + bool mChangeStageRelated; // _49 + u8 _4A; + u8 _4B; + u32 _4C; + sead::BufferedSafeString mLanguage; // _50 + u8 _58[0x90-0x68]; + sead::Heap* _90; + u8 _98[0xB9-0xA0]; + u64* _B8; // TempSaveData* + u8 _C0[0x1A0-0xD0]; + WorldList* mWorldList; // 0x190 +}; \ No newline at end of file diff --git a/include/game/GameData/GameDataHolderAccessor.h b/include/game/GameData/GameDataHolderAccessor.h new file mode 100644 index 0000000..60d1740 --- /dev/null +++ b/include/game/GameData/GameDataHolderAccessor.h @@ -0,0 +1,21 @@ +/** + * @file GameDataHolderAccessor.h + * @brief Wrapper class for GameDataHolder. + */ + +#pragma once + +#include "al/scene/SceneObjHolder.h" +#include "GameDataHolderWriter.h" + +// declaring this here because slappin it into util.hpp causes circular dependency issues +namespace al { + al::ISceneObj *getSceneObj(al::IUseSceneObjHolder const *holder, int index); +} + +class GameDataHolderAccessor : public GameDataHolderWriter +{ + public: + GameDataHolderAccessor(al::IUseSceneObjHolder const *IUseObjHolder) {mData = (GameDataHolder*)al::getSceneObj(IUseObjHolder, 18);} + GameDataHolderAccessor(al::SceneObjHolder const *objHolder) {mData = (GameDataHolder*)objHolder->getObj(18); } +}; \ No newline at end of file diff --git a/include/game/GameData/GameDataHolderBase.h b/include/game/GameData/GameDataHolderBase.h new file mode 100644 index 0000000..44e3ec8 --- /dev/null +++ b/include/game/GameData/GameDataHolderBase.h @@ -0,0 +1,12 @@ +#pragma once + +#include "al/hio/HioNode.h" +#include "al/message/IUseMessageSystem.h" +#include "al/scene/ISceneObj.h" + +namespace al { + class GameDataHolderBase : public ISceneObj, HioNode, IUseMessageSystem { + public: + + }; +} \ No newline at end of file diff --git a/include/game/GameData/GameDataHolderWriter.h b/include/game/GameData/GameDataHolderWriter.h new file mode 100644 index 0000000..970c5ca --- /dev/null +++ b/include/game/GameData/GameDataHolderWriter.h @@ -0,0 +1,8 @@ +#pragma once + +#include "GameDataHolder.h" + +class GameDataHolderWriter { +public: + GameDataHolder *mData; +}; \ No newline at end of file diff --git a/include/game/GameData/GameProgressData.h b/include/game/GameData/GameProgressData.h new file mode 100644 index 0000000..ae57936 --- /dev/null +++ b/include/game/GameData/GameProgressData.h @@ -0,0 +1,8 @@ +#pragma once + +class GameProgressData { + public: + int getHomeLevel(void) const; + void upHomeLevel(void); + void talkCapNearHomeInWaterfall(void); +}; \ No newline at end of file diff --git a/include/game/GameData/SaveDataAccessFunction.h b/include/game/GameData/SaveDataAccessFunction.h new file mode 100644 index 0000000..120ab6f --- /dev/null +++ b/include/game/GameData/SaveDataAccessFunction.h @@ -0,0 +1,10 @@ +#pragma once + +#include "game/GameData/GameDataHolder.h" + +namespace SaveDataAccessFunction { + + void startSaveDataInitSync(GameDataHolder *); + + void startSaveDataReadSync(GameDataHolder *); +} diff --git a/include/game/GameData/UniqueObjInfo.h b/include/game/GameData/UniqueObjInfo.h new file mode 100644 index 0000000..a9ce422 --- /dev/null +++ b/include/game/GameData/UniqueObjInfo.h @@ -0,0 +1,14 @@ +#pragma once + +#include "sead/prim/seadSafeString.hpp" +#include "types.h" + +class UniqObjInfo { + public: + bool isEqual(char const *, char const *); + void set(); + + undefined structSize[0x138]; +}; + +static_assert(sizeof(UniqObjInfo) == 0x138); \ No newline at end of file diff --git a/include/game/HakoniwaSequence/HakoniwaSequence.h b/include/game/HakoniwaSequence/HakoniwaSequence.h new file mode 100644 index 0000000..fe673cc --- /dev/null +++ b/include/game/HakoniwaSequence/HakoniwaSequence.h @@ -0,0 +1,101 @@ +#pragma once + +#include "types.h" + +#include "al/scene/Scene.h" +#include "al/audio/AudioDirector.h" +#include "al/layout/LayoutKit.h" +#include "al/layout/LayoutInitInfo.h" +#include "al/sequence/Sequence.h" +#include "al/sequence/SequenceInitInfo.h" +#include "al/gamepad/util.h" + +#include "game/StageScene/StageScene.h" +#include "game/WorldList/WorldResourceLoader.h" +#include "game/GameData/GameDataHolderAccessor.h" + +#include "HakoniwaStateDeleteScene.h" +#include "HakoniwaStateDemoOpening.h" +#include "HakoniwaStateDemoEnding.h" +#include "HakoniwaStateDemoWorldWarp.h" +#include "HakoniwaStateSimpleDemo.h" +#include "HakoniwaStateBootLoadData.h" + +namespace al +{ + class WipeHolder; + class ScreenCaptureExecutor; + class BootLayout; +} // namespace al + +class HakoniwaSequence : public al::Sequence { + public: + + HakoniwaSequence(const char *); + bool isDisposable(void); + void updatePadSystem(void); + void destroySceneHeap(bool); + void init(al::SequenceInitInfo const &); + void initSystem(void); + void update(void); + bool isEnableSave(void); + void drawMain(void); + al::Scene *getCurrentScene(void) const; // {return this->curScene} + + void* qword20; + void* qword28; + void* qword30; + void* qword38; + void* qword40; + void* qword48; + void* qword50; + void* qword58; + void* qword60; + void* qword68; + void* qword70; + void* qword78; + void* qword80; + void* qword88; + al::AudioDirector *mAudioDirector; // 0x90 + void *qword98; + void *qwordA0; + void *qwordA8; + al::Scene *curScene; // 0xB0 + GameDataHolderAccessor mGameDataHolder; // 0xB8 + al::GamePadSystem *mGamepadSys; // 0xC0 + HakoniwaStateDemoOpening *mDemoOpening; // 0xC8 + HakoniwaStateDemoEnding *mDemoEnding; // 0xD0 + HakoniwaStateDemoWorldWarp *mDemoWorldWarp; // 0xD8 + HakoniwaStateSimpleDemo *mSimpleDemo; // 0xE0 + HakoniwaStateBootLoadData *mBootLoadData; // 0xE8 + HakoniwaStateDeleteScene *mDeleteScene; // 0xF0 + al::LayoutKit* mLytKit; // 0xF8 + + // al::initSceneCreator(al::IUseSceneCreator *,al::SequenceInitInfo const&,al::GameDataHolderBase *,al::AudioDirector *,al::ScreenCaptureExecutor *,alSceneFunction::SceneFactory *) .text 00000000009F2270 0000007C 00000050 FFFFFFFFFFFFFFF8 R . . . B . . + + + // 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; +}; \ No newline at end of file diff --git a/include/game/HakoniwaSequence/HakoniwaStateBootLoadData.h b/include/game/HakoniwaSequence/HakoniwaStateBootLoadData.h new file mode 100644 index 0000000..e6c8b3d --- /dev/null +++ b/include/game/HakoniwaSequence/HakoniwaStateBootLoadData.h @@ -0,0 +1,9 @@ +#pragma once + +class HakoniwaSequence; +#include "game/WorldList/WorldResourceLoader.h" + +class HakoniwaStateBootLoadData { + public: + +}; \ No newline at end of file diff --git a/include/game/HakoniwaSequence/HakoniwaStateDeleteScene.h b/include/game/HakoniwaSequence/HakoniwaStateDeleteScene.h new file mode 100644 index 0000000..e792cbf --- /dev/null +++ b/include/game/HakoniwaSequence/HakoniwaStateDeleteScene.h @@ -0,0 +1,8 @@ +#pragma once + +class HakoniwaSequence; + +class HakoniwaStateDeleteScene { + public: + +}; \ No newline at end of file diff --git a/include/game/HakoniwaSequence/HakoniwaStateDemoEnding.h b/include/game/HakoniwaSequence/HakoniwaStateDemoEnding.h new file mode 100644 index 0000000..a673936 --- /dev/null +++ b/include/game/HakoniwaSequence/HakoniwaStateDemoEnding.h @@ -0,0 +1,9 @@ +#pragma once + +class HakoniwaSequence; +#include "game/WorldList/WorldResourceLoader.h" + +class HakoniwaStateDemoEnding { + public: + // HakoniwaStateDemoOpening(HakoniwaSequence *, al::WipeHolder *, al::ScreenCaptureExecutor *, WorldResourceLoader *, BootLayout *, const al::LayoutInitInfo *, HakoniwaStateDeleteScene *, al::AsyncFunctorThread *, LoadLayoutCtrl *) +}; \ No newline at end of file diff --git a/include/game/HakoniwaSequence/HakoniwaStateDemoOpening.h b/include/game/HakoniwaSequence/HakoniwaStateDemoOpening.h new file mode 100644 index 0000000..d27fed7 --- /dev/null +++ b/include/game/HakoniwaSequence/HakoniwaStateDemoOpening.h @@ -0,0 +1,9 @@ +#pragma once + +class HakoniwaSequence; +#include "game/WorldList/WorldResourceLoader.h" + +class HakoniwaStateDemoOpening { + public: + // HakoniwaStateDemoOpening(HakoniwaSequence *, al::WipeHolder *, al::ScreenCaptureExecutor *, WorldResourceLoader *, BootLayout *, const al::LayoutInitInfo *, HakoniwaStateDeleteScene *, al::AsyncFunctorThread *, LoadLayoutCtrl *) +}; \ No newline at end of file diff --git a/include/game/HakoniwaSequence/HakoniwaStateDemoWorldWarp.h b/include/game/HakoniwaSequence/HakoniwaStateDemoWorldWarp.h new file mode 100644 index 0000000..babcf51 --- /dev/null +++ b/include/game/HakoniwaSequence/HakoniwaStateDemoWorldWarp.h @@ -0,0 +1,9 @@ +#pragma once + +class HakoniwaSequence; +#include "game/WorldList/WorldResourceLoader.h" + +class HakoniwaStateDemoWorldWarp { + public: + +}; \ No newline at end of file diff --git a/include/game/HakoniwaSequence/HakoniwaStateSimpleDemo.h b/include/game/HakoniwaSequence/HakoniwaStateSimpleDemo.h new file mode 100644 index 0000000..223ffca --- /dev/null +++ b/include/game/HakoniwaSequence/HakoniwaStateSimpleDemo.h @@ -0,0 +1,9 @@ +#pragma once + +class HakoniwaSequence; +#include "game/WorldList/WorldResourceLoader.h" + +class HakoniwaStateSimpleDemo { + public: + +}; \ No newline at end of file diff --git a/include/game/Info/QuestInfo.h b/include/game/Info/QuestInfo.h new file mode 100644 index 0000000..5fab185 --- /dev/null +++ b/include/game/Info/QuestInfo.h @@ -0,0 +1,39 @@ +#pragma once + +#include "al/actor/ActorInitInfo.h" +#include "al/actor/Placement.h" +#include "al/scene/SceneObjHolder.h" +#include "math/seadVector.h" +#include "prim/seadSafeString.h" + +class QuestInfo : public al::IUseSceneObjHolder { +public: + + QuestInfo(void); + + virtual al::SceneObjHolder* getSceneObjHolder(void) const override { return mSceneObjHolder; }; + + void setStageName(char const*); + void setLabel(char const*); + void isEqual(QuestInfo const*); + + void init(al::PlacementInfo const&,al::SceneObjHolder *); + void init(al::PlacementInfo const&,al::ActorInitInfo const&); + void init(al::ActorInitInfo const&); + + void end(void); + void copy(QuestInfo const*); + void clear(void); + + int mQuestID = -1; //0x8 + sead::Vector3f mShineTrans = sead::Vector3f::zero; // 0xC + bool mIsMainQuest; // 0x18 + al::SceneObjHolder *mSceneObjHolder; // 0x20 + sead::FixedSafeString<0x80> mLabel; // 0x28 + sead::FixedSafeString<0x80> mStageName; // 0xC0 + bool mIsSingle; // 0x158 + sead::FixedSafeString<0x80> mObjID; // 0x160 + sead::FixedSafeString<0x80> mPlacementStageName; // 0x1F8 +}; + +static_assert(sizeof(QuestInfo) == 0x290, "Quest Info Size"); \ No newline at end of file diff --git a/include/game/Info/QuestInfoHolder.h b/include/game/Info/QuestInfoHolder.h new file mode 100644 index 0000000..5e76eda --- /dev/null +++ b/include/game/Info/QuestInfoHolder.h @@ -0,0 +1,55 @@ +#pragma once + +#include +#include "QuestInfo.h" +#include "al/actor/Placement.h" +#include "al/hio/HioNode.h" +#include "al/scene/ISceneObj.h" +#include "al/scene/SceneObjHolder.h" +#include "al/string/StringTmp.h" +#include "container/seadPtrArray.h" + +class QuestInfoHolder : public al::ISceneObj, public al::HioNode { +public: + QuestInfoHolder(int count); + // QuestInfoHolder(int count) { + // QuestInfo* infoHolder = new QuestInfo[count](); + // for (int i = 0; i < count; i++) { + // infoHolder[i] = QuestInfo(); + // } + + // mQuestArr = &infoHolder; + // }; + + virtual const char *getSceneObjName(void) override; + virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override; + + void validateQuest(QuestInfo const*); + void updateActiveList(int); + void tryFindQuest(al::PlacementInfo const&, al::SceneObjHolder *); + void tryFindQuest(QuestInfo const*); + void registerQuestInfo(QuestInfo const*); + void isActiveQuest(QuestInfo const*); + void invalidateQuest(QuestInfo const*); + void initSceneObjHolder(al::SceneObjHolder *); + void initAfterPlacementQuestObj(int); + void getQuestNum(int) const; + void getActiveQuestStageName(al::IUseSceneObjHolder const*) const; + al::StringTmp<0x80> getActiveQuestLabel(void) const; + void finalizeForScene(void); + void clearMainQuest(void); + void clearAll(void); + + int mMaxQuests; // 0x8 + QuestInfo **mQuestArr; // 0x10 + int unkInt1 = 0; // 0x18 + int unkInt2 = -1; // 0x1C + int unkInt3 = -1; // 0x20 + int mActiveQuestNo = -1; // 0x24 + QuestInfo** mActiveQuestList = nullptr; // 0x28 + int mActiveQuestCount = 0; // 0x30 + bool unkBool = 0; // 0x34 + void *unkPtr2 = nullptr; // 0x38 +}; + +static_assert(sizeof(QuestInfoHolder) == 0x40, "QuestInfoHolder Size"); \ No newline at end of file diff --git a/include/game/Info/ShineInfo.h b/include/game/Info/ShineInfo.h new file mode 100644 index 0000000..1ea023c --- /dev/null +++ b/include/game/Info/ShineInfo.h @@ -0,0 +1,39 @@ +#pragma once + +#include "sead/prim/seadSafeString.hpp" + +#include "al/LiveActor/LiveActor.h" +#include "al/util.hpp" + +struct ShineData; // unused class identical to this one (maybe) +struct QuestInfo; +struct UniqObjInfo; + +namespace al { + class IUseMessageSystem; +} + +class ShineInfo { + public: + ShineInfo(void); + + void clear(void); + void init(const char *, const char *, const char *, QuestInfo const *info, int shineId); + void initForHintPhoto(const al::LiveActor *, const al::IUseMessageSystem *, const al::ActorInitInfo &); + bool isEmpty(void) const; + bool isEqual(const ShineInfo *) const; + bool isEqual(const ShineData *) const; + void writeShineData(ShineData *) const; + void readShineData(ShineData *); + void readShineData(const UniqObjInfo *); + void copyShineInfo(const ShineInfo *); + + sead::FixedSafeString<0x80> stageName = sead::FixedSafeString<0x80>(); // 0x0 (Size: 0x98) + sead::FixedSafeString<0x80> objectId = sead::FixedSafeString<0x80>(); // 0xA0 + sead::FixedSafeString<0x80> scenObjId = sead::FixedSafeString<0x80>(); // 0x138 + + int shineId; // 1C8 + const QuestInfo *curQuest; // 1D0 + bool unkA; // 0x1D8 + unsigned long timeDay; // 0x1E0 +}; \ No newline at end of file diff --git a/include/game/InformationMovie/InformationMovieUpdater.h b/include/game/InformationMovie/InformationMovieUpdater.h new file mode 100644 index 0000000..4fae900 --- /dev/null +++ b/include/game/InformationMovie/InformationMovieUpdater.h @@ -0,0 +1,11 @@ +/** + * @file InformationMoviePlayer.h + * @brief unknown. + */ + +#pragma once + +class InformationMoviePlayer +{ + +}; \ No newline at end of file diff --git a/include/game/Input/InputSeparator.h b/include/game/Input/InputSeparator.h new file mode 100644 index 0000000..c248f50 --- /dev/null +++ b/include/game/Input/InputSeparator.h @@ -0,0 +1,37 @@ +#pragma once + +#include "al/scene/SceneObjHolder.h" + +class InputSeparator { +public: + InputSeparator(al::IUseSceneObjHolder const*,bool isNoSnapshot); + void checkDominant(bool); + void reset(void); + void update(void); + void updateForSnapShotMode(void); + + bool isHoldUiDown(void); + bool isHoldUiLeft(void); + bool isHoldUiRight(void); + bool isHoldUiUp(void); + bool isRepeatUiDown(void); + bool isRepeatUiLeft(void); + bool isRepeatUiRight(void); + bool isRepeatUiUp(void); + bool isTriggerDecrementPostProcessingFilterPreset(void); + bool isTriggerIncrementPostProcessingFilterPreset(void); + bool isTriggerSnapShotMode(void); + bool isTriggerUiDown(void); + bool isTriggerUiLeft(void); + bool isTriggerUiRight(void); + bool isTriggerUiUp(void); + + al::IUseSceneObjHolder* mSceneObjHolder; // 0x0 + bool unkBool; // 0x8 + bool unkBool2; // 0x9 + int unkInt; // 0xC + int unkInt2; // 0x10 + +}; + +static_assert(sizeof(InputSeparator) == 0x18, "InputSeparator size"); \ No newline at end of file diff --git a/include/game/Interfaces/IUseDimension.h b/include/game/Interfaces/IUseDimension.h new file mode 100644 index 0000000..0793ce1 --- /dev/null +++ b/include/game/Interfaces/IUseDimension.h @@ -0,0 +1,13 @@ +#pragma once +/** + * @file PlayerActorBase.h + * @brief Interfaces for Classes that use Dimensions +* Vtable loc: +*/ + +#include "al/actor/ActorDimensionKeeper.h" + +class IUseDimension { + public: + virtual ActorDimensionKeeper *getActorDimensionKeeper() const = 0; +}; \ No newline at end of file diff --git a/include/game/Interfaces/IUsePlayerCollision.h b/include/game/Interfaces/IUsePlayerCollision.h new file mode 100644 index 0000000..8f3eda4 --- /dev/null +++ b/include/game/Interfaces/IUsePlayerCollision.h @@ -0,0 +1,6 @@ +#pragma once + +class IUsePlayerCollision { + public: + +}; \ No newline at end of file diff --git a/include/game/Interfaces/IUsePlayerHack.h b/include/game/Interfaces/IUsePlayerHack.h new file mode 100644 index 0000000..5ecaa73 --- /dev/null +++ b/include/game/Interfaces/IUsePlayerHack.h @@ -0,0 +1,10 @@ +#pragma once +/** + * @file PlayerActorBase.h + * @brief Interfaces for Classes that use PlayerHack (PlayerActorBase) +* Vtable loc: +*/ + +class IUsePlayerHack { + +}; \ No newline at end of file diff --git a/include/game/Layouts/CoinCounter.h b/include/game/Layouts/CoinCounter.h new file mode 100644 index 0000000..2956385 --- /dev/null +++ b/include/game/Layouts/CoinCounter.h @@ -0,0 +1,29 @@ +#pragma once + +/* +* VTable Loc: 1CC3170 +*/ + +#include "al/layout/LayoutActor.h" +#include "al/layout/LayoutInitInfo.h" + +class CoinCounter : public al::LayoutActor { + public: + CoinCounter(char const*,al::LayoutInitInfo const&,bool); + void kill(void); + bool isWait(void) const; + bool tryStart(void); + void updateCountImmidiate(void); + bool tryEnd(void); + void startCountAnim(int); + void getCountTotalFromData(void); + void exeAppear(void); + void exeWait(void); + bool tryUpdateCount(void); + void exeEnd(void); + void exeAdd(void); + void exeSub(void); + void exeCountAnimAdd(void); + void exeCountAnimSub(void); + void getCountFromData(void); +}; \ No newline at end of file diff --git a/include/game/Layouts/CommonVerticalList.h b/include/game/Layouts/CommonVerticalList.h new file mode 100644 index 0000000..0035603 --- /dev/null +++ b/include/game/Layouts/CommonVerticalList.h @@ -0,0 +1,95 @@ +#pragma once + +#include "al/layout/LayoutActor.h" +#include "al/nerve/NerveExecutor.h" +#include "nn/ui2d/Texture.h" +#include "prim/seadSafeString.h" + +struct RollPartsData { + +}; + +class CommonVerticalList : public al::NerveExecutor { +public: + CommonVerticalList(al::LayoutActor*, al::LayoutInitInfo const&, bool); + ~CommonVerticalList(); + + void activate(void); + void addGroupAnimData(sead::FixedSafeString<64> const*,char const*); + void addStringData(sead::WFixedSafeString<512> const*,char const*); + void appearCursor(void); + void calcAnimRate(void); + void calcCursorPos(sead::Vector2f *); + void deactivate(void); + void decide(void); + void down(void); + void endCursor(void); + void getListPartsNum(void); + void getParts(int); + void getRollPartsSelected(int); + void getSelectedParts(void); + void hideAll(void); + void hideCursor(void); + void initData(int); + void initDataNoResetSelected(int); + void initDataWithIdx(int,int,int); + void jumpBottom(void); + void jumpTop(void); + void pageDown(void); + void pageUp(void); + void reject(void); + void rollLeft(void); + void rollRight(void); + void setEnableData(bool const*); + void setImageData(nn::ui2d::TextureInfo **,char const*); + void setRollPartsData(RollPartsData *); + void setRollPartsSelected(int,int); + void setSelectedIdx(int,int); + void startLoopActionAll(char const*,char const*); + void up(void); + void update(void); + void updateCursorPos(void); + void updateParts(void); + + bool isActive(void) const; + bool isDeactive(void) const; + bool isDecideEnd(void) const; + bool isRejectEnd(void) const; + + void exeActive(void); + void exeDeactive(void); + void exeDecide(void); + void exeDecideEnd(void); + void exeReject(void); + void exeRejectEnd(void); + + al::LayoutActor *mRootActor; // 0x10 + void *unkPtr1; // 0x18 + void *mListPartsArr; // 0x20 + struct CursorParts *mCursorParts; // 0x28 + struct ScrollBarParts *mScrollBarParts; // 0x30 + int mListPartsNum; // 0x38 + int mCurSelected; // 0x3C + int mIdx; // 0x40 + void *unkPtr2; // 0x48 + void *unkPtr3; // 0x50 + sead::Vector2f mCursorPos; // 0x58 + void *unkPtr4; // 0x60 + void *unkPtr5; // 0x68 + sead::WFixedSafeString<0x200> **mStringDataArr; // 0x70 + sead::FixedSafeString<0x90> **mPaneNameList; // 0x78 + void *unkPtr8; // 0x80 + void *unkPtr9; // 0x88 + const bool *mIsEnableData; // 0x90 + int mStringDataCount; // 0x98 + int unkInt2; // 0x9C + void *unkPtr12; // 0xA0 + void *unkPtr13; // 0xA8 + void *unkPtr14; // 0xB0 + void *unkPtr15; // 0xB8 + void* RollPartsArr; // 0xC0 + void* unkPtrX; // 0xC8 + +}; + +static_assert(sizeof(CommonVerticalList) == 0xD0, "CommonVerticalList size"); \ No newline at end of file diff --git a/include/game/Layouts/MapLayout.h b/include/game/Layouts/MapLayout.h new file mode 100644 index 0000000..844b510 --- /dev/null +++ b/include/game/Layouts/MapLayout.h @@ -0,0 +1,58 @@ +#include "al/layout/LayoutActor.h" +#include "al/layout/LayoutInitInfo.h" +#include "sead/math/seadMatrix.h" +#include "sead/math/seadVector.h" + +class MapIconLayout{}; +class IconType {}; +class MapIconInfo {}; + +struct MapLayout : public al::LayoutActor { + MapLayout(const char* name, const al::LayoutInitInfo& initInfo); + void changePrintWorld(int); + void loadTexture(); + void reset(); + void appear(); + void moveFocusLayout(const sead::Vector3f&, const sead::Vector2f&); + void updateST(); + void addAmiiboHint(); + void appearAmiiboHint(); + void end(); + void updatePlayerPosLayout(); + void appearWithHint(); + void appearWithMoonRockDemo(); + void appearCollectionList(); + bool isEnd(); + bool isEnableCheckpointWarp(); + void changeOut(); + void changeIn(); + void control(); + void updateLine(al::LayoutActor*); + void appearParts(); + void startNumberAction(); + void calcSeaOfTreeIconPos(sead::Vector3f*); + void setLocalTransAndAppear(MapIconLayout*, MapIconInfo*, const sead::Vector3f&, IconType, bool); + void calcMapTransAndAppear(MapIconLayout*, MapIconInfo*, const sead::Vector3f&, IconType, bool); + void scroll(const sead::Vector2f&); + void addSize(const sead::Vector2f&); + bool isAppear(); + sead::Matrix44f* getViewProjMtx(); + sead::Matrix44f* getProjMtx(); + void updateIconLine(al::LayoutActor*, const sead::Vector3f&, const sead::Vector2f&); + void focusIcon(const MapIconInfo*); + void lostFocusIcon(MapIconLayout*); + void tryCalcNorthDir(sead::Vector3f*); + const char* getSceneObjName() { + return "マップレイアウト"; + } + + void exeAppear(); + void exeWait(); + void exeHintInitWait(); + void exeHintAppear(); + void exeHintDecideIconAppear(); + void exeHintDecideIconWait(); + void exeHintPressDecide(); + void exeEnd(); + void exeChangeOut(); +}; diff --git a/include/game/Layouts/MapMini.h b/include/game/Layouts/MapMini.h new file mode 100644 index 0000000..e6a606c --- /dev/null +++ b/include/game/Layouts/MapMini.h @@ -0,0 +1,16 @@ +#pragma once + +#include "al/layout/LayoutActor.h" +class MapMini : public al::LayoutActor { +public: + MapMini(al::LayoutInitInfo const&,al::PlayerHolder const*); + void appearSlideIn(void); + void end(void); + void calcNearHintTrans(void); + + bool isEnd(void) const; + + void exeAppear(void); + void exeWait(void); + void exeEnd(void); +}; \ No newline at end of file diff --git a/include/game/Layouts/SimpleLayoutMenu.h b/include/game/Layouts/SimpleLayoutMenu.h new file mode 100644 index 0000000..feeb2f9 --- /dev/null +++ b/include/game/Layouts/SimpleLayoutMenu.h @@ -0,0 +1,20 @@ +#pragma once + +#include "al/layout/LayoutActor.h" + +class SimpleLayoutMenu : public al::LayoutActor { +public: + SimpleLayoutMenu(al::LayoutActor *,char const*,char const*,al::LayoutInitInfo const&,char const*); + SimpleLayoutMenu(char const*,char const*,al::LayoutInitInfo const&,char const*,bool); + + void exeAppear(void); + void exeEnd(void); + void exeEndWait(void); + void exeWait(void); + void isAppearOrWait(void); + void isEndWait(void); + void isWait(void); + void startAppear(char const*); + void startEnd(char const*); + +}; diff --git a/include/game/Player/Actions/PlayerActionGroundMoveControl.h b/include/game/Player/Actions/PlayerActionGroundMoveControl.h new file mode 100644 index 0000000..bdd807b --- /dev/null +++ b/include/game/Player/Actions/PlayerActionGroundMoveControl.h @@ -0,0 +1,73 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "game/Interfaces/IUsePlayerCollision.h" +#include "game/Player/PlayerConst.h" +#include "game/Player/PlayerInput.h" + +class PlayerActionGroundMoveControl { +public: + PlayerActionGroundMoveControl(al::LiveActor *,PlayerConst const*,PlayerInput const*,IUsePlayerCollision const*); + void initDash(struct IJudge *,float,int); + void setupDash(float,int); + void setup(float maxSpeed, float minSpeed, int normalAccelFrame, int stickOnBrakeFrame, int normalBrakeFrame, float gravityMove, float breakSpeed, int breakOnCounterBorder); + void appear(void); + void reset(sead::Vector3 const&); + void calcInitBrakeOnCounter(void); + void update(void); + void updateSkateMove(void); + void updateNormalMove(void); + void updateNormalAndSnap(sead::Vector3 *); + void calcTurnTiltRate(void); + void calcMoveInput(sead::Vector3 *,sead::Vector3 const&); + void isActiveSquatBrake(void); + void updateHillAffect(sead::Vector3 const&,sead::Vector3 const&,bool); + void calcMaxSpeed(float); + void calcAccelRate(float); + void updatePoseUpFront(sead::Vector3 const&, sead::Vector3 const&, float); + + void *qword0; + PlayerConst *mPlayerConst; + void *qword10; + void *qword18; + void *qword20; + bool byte28; + int dword2C; + int dword30; + int dword34; + float mMaxSpeed; + float mMinSpeed; + void *qword40; + int mNormalAccelFrame; + int mStickOnBrakeFrame; + int mNormalBrakeFrame; + float mGravityMove; + float mBreakSpeed; + int mBreakOnCounterBorder; + bool gap60[8]; + void *qword68; + void *qword70; + bool byte78; + bool gap79[3]; + int dword7C; + bool byte80; + bool gap81[3]; + void *qword84; + int dword8C; + void *qword90; + int dword98; + bool byte9C; + bool gap9D[3]; + int dwordA0; + bool byteA4; + bool gapA5[3]; + void *qwordA8; + void *qwordB0; + int dwordB8; + s16 wordBC; + bool gapBE[2]; + int dwordC0; + bool byteC4; + bool gapC5[15]; + s16 wordD4; +}; \ No newline at end of file diff --git a/include/game/Player/Attacks/PlayerSpinCapAttack.h b/include/game/Player/Attacks/PlayerSpinCapAttack.h new file mode 100644 index 0000000..605d27a --- /dev/null +++ b/include/game/Player/Attacks/PlayerSpinCapAttack.h @@ -0,0 +1,47 @@ +#pragma once + +#include "sead/math/seadVector.h" + +#include "al/sensor/HitSensor.h" + +#include "game/Player/HackCap.h" +#include "game/Player/PlayerConst.h" +#include "game/Player/PlayerInput.h" +#include "game/Player/PlayerAnimator.h" + +class PlayerTrigger; +class PlayerJudgePreInputCapThrow; +class PlayerCounterAfterCapCatch; + +class PlayerSpinCapAttack { + public: + PlayerSpinCapAttack(HackCap *, const PlayerConst *, const PlayerTrigger *, const PlayerInput *, const PlayerCounterAfterCapCatch *, const PlayerJudgePreInputCapThrow *); + void clearAttackInfo(void); + void setupAttackInfo(void); + void startCapSpinAttack(PlayerAnimator *, PlayerInput const *); + void startCapSpinAttackAir(PlayerAnimator *, PlayerInput const *); + void startCapSpinAttackSwim(PlayerAnimator *, PlayerInput const *); + void startSpinSeparate(PlayerAnimator *, PlayerInput const *); + void startSpinSeparateSwim(PlayerAnimator *, PlayerInput const *); + void startSpinSeparateSwimSurface(PlayerAnimator *, PlayerInput const *); + void startCapThrow(sead::Vector3f const & front, sead::Vector3f const & up, float speed, bool, sead::Vector3f const& unused); + void attackSpinMsg(al::HitSensor *, al::HitSensor *); + bool tryCancelCapState(PlayerAnimator *); + bool tryStartCapSpinGroundMiss(PlayerAnimator *); + bool tryStartCapSpinAirMiss(PlayerAnimator *); + bool isCapSpinAttack(void) const; + bool isValidAttackSensor(const PlayerAnimator *) const; + bool isEnablePlaySpinCapMiss(const PlayerAnimator *) const; + bool isSeparateSingleSpin(void) const; + bool isThrowSwingRightDir(void) const; + int getThrowFrameGround(void) const; + int getThrowFrameAir(void) const; + int getThrowFrameSwim(void) const; + + HackCap *mHackCap; // 0x0 + PlayerConst *mPlayerConst; // 0x8 + PlayerTrigger *mPlayerTrigger; // 0x10 + PlayerInput *mPlayerInput; // 0x18 + PlayerCounterAfterCapCatch *mCounterAfterCapCatch; // 0x20 + PlayerJudgePreInputCapThrow *jPreInputCapThrow; // 0x28 +}; \ No newline at end of file diff --git a/include/game/Player/CapFunction.h b/include/game/Player/CapFunction.h new file mode 100644 index 0000000..bc77a8f --- /dev/null +++ b/include/game/Player/CapFunction.h @@ -0,0 +1,10 @@ +#pragma once + +#include "HackCap.h" +#include "PlayerAnimator.h" + +class CapFunction +{ + public: + static void putOnCapPlayer(HackCap *, PlayerAnimator *); +}; \ No newline at end of file diff --git a/include/game/Player/HackCap.h b/include/game/Player/HackCap.h new file mode 100644 index 0000000..eb7fa57 --- /dev/null +++ b/include/game/Player/HackCap.h @@ -0,0 +1,206 @@ +#pragma once +/** + * @file HackCap.h + * @brief Main Class for HackCap (Cappy) +* Vtable loc: 1D75520 +*/ + +#include "al/LiveActor/LiveActor.h" +#include "al/sensor/HitSensor.h" +#include "al/sensor/SensorMsg.h" + +#include "game/Player/PlayerInput.h" +#include "game/Interfaces/IUsePlayerCollision.h" + +#include "HackCapThrowParam.h" +#include "HackCap/HackCapJointControlKeeper.h" + +class PlayerWallActionHistory; +class PlayerCapActionHistory; +class PlayerEyeSensorHitHolder; +class IUsePlayerHeightCheck; +class PlayerWetControl; +class PlayerJointControlKeeper; +class HackCapJudgePreInputSeparateThrow; +class HackCapJudgePreInputSeparateJump; +class PlayerSeparateCapFlag; + +class CapTargetInfo; + +class PlayerActorHakoniwa; // use a stub instead of the actual class file + + +#define HACKSIZE sizeof(al::LiveActor) + +class HackCap : public al::LiveActor { + public: + + HackCap(al::LiveActor const*,char const*,PlayerInput const*, struct PlayerAreaChecker const*, PlayerWallActionHistory const*, PlayerCapActionHistory const*, PlayerEyeSensorHitHolder const*,PlayerSeparateCapFlag const*,IUsePlayerCollision const*, IUsePlayerHeightCheck const*, PlayerWetControl const*, PlayerJointControlKeeper const*, HackCapJudgePreInputSeparateThrow *, HackCapJudgePreInputSeparateJump *); + + enum SwingHandType { + Left, + Right + }; + + void init(al::ActorInitInfo const&); + void hide(bool); + void movement(void); + void updateShadowMaskOffset(void); + void control(void); + void updateTargetLayout(void); + void updateCollider(void); + void updateFrameOutLayout(void); + void attackSpin(al::HitSensor *,al::HitSensor *,float); + void prepareLockOn(al::HitSensor *); + void sendMsgStartHack(al::HitSensor *); + void receiveRequestTransferHack(al::HitSensor *,al::HitSensor *); + void startThrowSeparatePlayHack(al::HitSensor *, sead::Vector3f const&, sead::Vector3f const&,float); + void startHack(void); + void emitHackStartEffect(void); + void noticeHackMarioEnter(void); + void noticeHackDemoPuppetableEnd(void); + void recordHack(void); + void addHackStartDemo(void); + void addLockOnKeepDemo(void); + void syncHackDamageVisibility(bool); + void endHack(void); + void startSpinAttack(char const*); + void startThrow(bool, sead::Vector3f const&, sead::Vector3f const&,float, sead::Vector2f const&, sead::Vector2f const&, sead::Vector3f const&,bool, sead::Vector3f const&, HackCap::SwingHandType,bool,float,int); + void startThrowSeparatePlay( sead::Vector3f const&, sead::Vector3f const&,float,bool); + void startThrowSeparatePlayJump( sead::Vector3f const&, sead::Vector3f const&,float); + void startCatch(char const*,bool, sead::Vector3f const&); + void forcePutOn(void); + void forceHack(al::HitSensor *, CapTargetInfo const*); // :eyes: + void resetLockOnParam(void); + void setupStartLockOn(void); + void cancelCapState(void); + void requestReturn(bool *); + void tryReturn(bool,bool *); + void updateCapPose(void); + void followTarget(void); + void syncPuppetSilhouette(void); + void recordCapJump(PlayerWallActionHistory *); + void getFlyingSpeedMax(void); + void getThrowSpeed(void); + void requestLockOnHitReaction(CapTargetInfo const*,char const*); + void startPuppet(void); + void endPuppet(void); + void hidePuppetCap(void); + void showPuppetCap(void); + void hidePuppetCapSilhouette(void); + void showPuppetCapSilhouette(void); + void startPuppetCheckpointWarp(void); + void startHackShineGetDemo(void); + void endHackThrowAndReturnHack(void); + void endHackShineGetDemo(void); + void calcHackFollowTrans( sead::Vector3f *,bool); + void makeFollowMtx(sead::Matrix34 *); + void updateCapEyeShowHide(bool,int); + void activateInvincibleEffect(void); + void syncInvincibleEffect(bool); + void updateSeparateMode(PlayerSeparateCapFlag const*); + void startRescuePlayer(void); + void prepareCooperateThrow(void); + void requestForceFollowSeparateHide(void); + void calcSeparateHideSpeedH(sead::Vector3f const&); + void updateModelAlphaForSnapShot(void); + void getPadRumblePort(void); + void updateThrowJoint(void); + void setupThrowStart(void); + void getThrowHeight(void); + void checkEnableThrowStartSpace(sead::Vector3f *, sead::Vector3f *, sead::Vector3f *, sead::Vector3f const&,float,float,bool, sead::Vector3f const&); + void updateWaterArea(void); + void getThrowRange(void); + void getThrowBrakeTime(void); + void startThrowCapEyeThrowAction(void); + void tryCollideReflectReaction(void); + void tryCollideWallReaction(void); + void changeThrowParamInWater(int,bool); + void addCurveOffset(void); + void tryAppendAttack(void); + void tryCollideWallReactionSpiral(void); + void endThrowSpiral(void); + void tryCollideWallReactionReflect(void); + void tryCollideWallReactionRollingGround(void); + void rollingGround(void); + void tryChangeSeparateThrow(void); + void getThrowBackSpeed(void); + void updateLavaSurfaceMove(void); + void tryCollideWallReactionStay(void); + void getThrowStayTime(void); + void getThrowStayTimeMax(void); + void getThrowSpeedAppend(void); + void getThrowRangeAppend(void); + void tryCollideWallLockOn(void); + void endHackThrowAndReturnHackOrHide(void); + void clearThrowType(void); + void calcReturnTargetPos( sead::Vector3f *); + void attackSensor(al::HitSensor *,al::HitSensor *); + void stayRollingOrReflect(void); + bool receiveMsg(al::SensorMsg const*,al::HitSensor *,al::HitSensor *); + void endMove(void); + void prepareTransferLockOn(al::HitSensor *); + void collideThrowStartArrow(al::HitSensor *, sead::Vector3f const&, sead::Vector3f const&, sead::Vector3f const&); + void trySendAttackCollideAndReaction(bool *); + void stayWallHit(void); + void endHackThrow(void); + + bool isFlying(void) const; + bool isNoPutOnHide(void) const; + bool isEnableThrow(void) const; + bool isEnableSpinAttack(void) const; + bool isSpinAttack(void) const; + bool isEnableRescuePlayer(void) const; + bool isRescuePlayer(void) const; + bool isEnableHackThrow(bool *) const; + bool isSeparateHipDropLand(void) const; + bool isSeparateHide(void) const; + bool isSeparateThrowFlying(void) const; + bool isEnableThrowSeparate(void) const; + bool isHoldInputKeepLockOn(void) const; + bool isRequestableReturn(void) const; + bool isLockOnEnableHackTarget(void) const; + bool isWaitHackLockOn(void) const; + bool isCatched(void) const; + bool isHide(void) const; + bool isPutOn(void) const; + bool isLockOnInterpolate(void) const; + bool isEnablePreInput(void) const; + bool isForceCapTouchJump(void) const; + bool isHackInvalidSeparatePlay(void) const; + bool isHoldSpinCapStay(void) const; + bool isThrowTypeSpiral(void) const; + bool isThrowTypeRolling(void) const; + bool isEnableHackThrowAutoCatch(void) const; + bool isEnableCapTouchJumpInput(void) const; + + void exeLockOn(void); + void exeHack(void); + void exeSpinAttack(void); + void exeCatch(void); + void exeTrample(void); + void exeTrampleLockOn(void); + void exeRescue(void); + void exeHide(void); + void exeThrowStart(void); + void exeThrow(void); + void exeThrowBrake(void); + void exeThrowSpiral(void); + void exeThrowTornado(void); + void exeThrowRolling(void); + void exeThrowRollingBrake(void); + void exeThrowStay(void); + void exeThrowAppend(void); + void exeRebound(void); + void exeReturn(void); + void exeBlow(void); + + void *unkPtr1; // 0x108 + void *unkPtr2; // 0x110 + al::LiveActor *mLockOnEyes; // 0x118 + al::LiveActor *mCapEyes; // 0x120 + PlayerActorHakoniwa *mPlayerActor; // 0x128 + unsigned char padding_220[0x220-0x130]; + HackCapThrowParam throwParam; // 0x220 + HackCapJointControlKeeper *mJointKeeper; // 0x2E0 +}; \ No newline at end of file diff --git a/include/game/Player/HackCap/CapTargetInfo.h b/include/game/Player/HackCap/CapTargetInfo.h new file mode 100644 index 0000000..8bcb0df --- /dev/null +++ b/include/game/Player/HackCap/CapTargetInfo.h @@ -0,0 +1,6 @@ +#pragma once + +class CapTargetInfo { + public: + +}; \ No newline at end of file diff --git a/include/game/Player/HackCap/HackCapJointControlKeeper.h b/include/game/Player/HackCap/HackCapJointControlKeeper.h new file mode 100644 index 0000000..43e8545 --- /dev/null +++ b/include/game/Player/HackCap/HackCapJointControlKeeper.h @@ -0,0 +1,17 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "sead/math/seadQuat.h" + +class HackCapJointControlKeeper { + public: + HackCapJointControlKeeper(void); + void initCapJointControl(al::LiveActor *); + void initDisplayCapJointControl(al::LiveActor *); + void updateRotateThrowZ(float,float); + void updateRotateStayZ(float); + void updateRotateY(float); + + sead::Vector3f mJointRot = sead::Vector3f(); + float mSkew = 0; +}; diff --git a/include/game/Player/HackCapThrowParam.h b/include/game/Player/HackCapThrowParam.h new file mode 100644 index 0000000..11bc3e4 --- /dev/null +++ b/include/game/Player/HackCapThrowParam.h @@ -0,0 +1,34 @@ +#pragma once + +#include "types.h" +#include "al/LiveActor/LiveActor.h" + +class HackCapThrowParam { // stores parameters used in calculating the way HackCap is thrown + public: + HackCapThrowParam(al::LiveActor *); + + f32* mHackThrowHeight; // 投げる高さ + f32* mMaxVel; // 最高速度 + f32* mConstThrowSpeed; // 連続投げ速度 + s32* mBreakTime; // ブレーキ時間 + f32* mMaxDist; // 到達距離 + s32* mEndpointStopTime; // 端点停止時間 + s32* mMaxEndpointStopTime; // 最大端点停止時間 + f32* mReturnStrength; // 戻り強さ + f32* mMaxRetSpeed; // 戻り最高速度 + f32* mTurnAngleLimit; // ターン限界角度 + f32* mWaterMaxSpeed; // [水中]最高速度 + f32* mWaterDist; // [水中]到達距離 + s32* mWaterBreakTime; // [水中]ブレーキ時間 + f32* mWaterMaxRetSpeed; // [水中]戻り最高速度 + f32* mTornadoDist; // [竜巻投げ]到達距離 + f32* mTornadoMaxDist; // [竜巻投げ]最高到達距離 + s32* mTornadoReflectTime; // [竜巻投げ]反射時間 + f32* mRollSpeed; // [転がし投げ]速度 + f32* mRollDistTop; // [転がし投げ]到達距離[上] + f32* mRollDistBottom; // [転がし投げ]到達距離[下] + s32* mRollBrakeTimeTop; // [転がし投げ]ブレーキ時間[上] + s32* mRollBrakeTimeBottom; // [転がし投げ]ブレーキ時間[下] + f32* mRollGroundGroundedPoseTrack; // [転がし投げ]姿勢追従[接地] + f32* mRollGroundAerialPoseTrack; // [転がし投げ]姿勢追従[空中] +}; \ No newline at end of file diff --git a/include/game/Player/PlayerActorBase.h b/include/game/Player/PlayerActorBase.h new file mode 100644 index 0000000..01f0baf --- /dev/null +++ b/include/game/Player/PlayerActorBase.h @@ -0,0 +1,17 @@ +#pragma once +/** + * @file PlayerActorBase.h + * @brief base class for PlayerActor +* Vtable loc: 1D77980 +*/ + +#include "PlayerHackKeeper.h" +#include "al/LiveActor/LiveActor.h" +#include "game/Interfaces/IUsePlayerHack.h" + +class PlayerActorBase : public al::LiveActor , public IUsePlayerHack { + public: + PlayerHackKeeper *getPlayerHackKeeper() const; + void movement(void); + int getPortNo(); +}; \ No newline at end of file diff --git a/include/game/Player/PlayerActorHakoniwa.h b/include/game/Player/PlayerActorHakoniwa.h new file mode 100644 index 0000000..02458ae --- /dev/null +++ b/include/game/Player/PlayerActorHakoniwa.h @@ -0,0 +1,74 @@ +#pragma once +/** + * @file PlayerActorBase.h + * @brief Main Class for the PlayerActor (Mario) + * Player Pose: TQGMSV +* Vtable loc: 1D780C0 +*/ + +#include "game/Interfaces/IUseDimension.h" +#include "al/actor/ActorDimensionKeeper.h" +#include "al/actor/ActorInitInfo.h" +#include "PlayerActorBase.h" +#include "PlayerPuppet.h" +#include "PlayerInput.h" +#include "PlayerAnimator.h" +#include "HackCap.h" +#include "PlayerModelKeeper.h" +#include "PlayerColliderHakoniwa.h" +#include "PlayerConst.h" +#include "PlayerHackKeeper.h" +#include "PlayerInfo.h" +#include "PlayerModelChangerHakoniwa.h" +#include "PlayerFormSensorCollisionArranger.h" +#include "PlayerInitInfo.h" + +#include "Attacks/PlayerSpinCapAttack.h" + +#define PACTORSIZE 0xC8 + +class PlayerActorHakoniwa : public PlayerActorBase , public IUseDimension { + public: + int *getPortNo(void) const; + PlayerHackKeeper *getPlayerHackKeeper() const; + void attackSensor(al::HitSensor *target, al::HitSensor *source); + void startDemoPuppetable(void); + void startPlayerPuppet(void); + void initPlayer(al::ActorInitInfo const&, PlayerInitInfo const&); + + unsigned char padding[0x18]; // 0x108 + PlayerInfo *mPlayerInfo; // 0x128 + PlayerConst *mPlayerConst; // 0x130 + PlayerInput *mPlayerInput; //0x138 + unsigned char padding_148[0x8]; // PlayerTrigger + HackCap *mHackCap; // 0x148 + ActorDimensionKeeper *mDimKeeper; // 0x150 + PlayerModelKeeper *mPlayerModelKeeper; // 0x158 + PlayerModelChangerHakoniwa *mModelChanger; // 0x160 + PlayerAnimator *mPlayerAnimator; // 0x168 + PlayerColliderHakoniwa *mPlayerCollider; // 0x170 + PlayerPuppet *mPlayerPuppet; // 0x178 + // 0x180 PlayerAreaChecker + // 0x188 WaterSurfaceFinder + // 0x190 unk + // 0x198 unk + // 0x1A0 unk + // 0x1A8 unk + // 0x1B0 unk + // 0x1B8 unk + // 0x1C0 unk + // 0x1C8 unk + // 0x1D0 unk + // 0x1D8 unk + // 0x1E0 unk + // 0x1E8 unk + // 0x1F0 unk + // 0x1F8 PlayerBindKeeper + unsigned char padding_208[0x208 - 0x180]; + PlayerHackKeeper *mHackKeeper; // 0x208 + PlayerFormSensorCollisionArranger *mCollArranger; // 0x210 + void *unkPtr2; // 0x218 + void *unkPtr3; // 0x220 + PlayerSpinCapAttack *mSpinCapAttack; // 0x228 + +}; \ No newline at end of file diff --git a/include/game/Player/PlayerAnimControlRun.h b/include/game/Player/PlayerAnimControlRun.h new file mode 100644 index 0000000..4464b60 --- /dev/null +++ b/include/game/Player/PlayerAnimControlRun.h @@ -0,0 +1,29 @@ +#pragma once + +#include "sead/math/seadVector.h" +#include "PlayerAnimator.h" +#include "PlayerConst.h" + +class IJudge; + +class PlayerEffect; + +// 0x40 in size +class PlayerAnimControlRun { + public: + PlayerAnimControlRun(PlayerAnimator *, PlayerConst const*, IJudge const*, PlayerEffect *, bool isMoon); + void reset(float, bool); + bool isAnimDashFast(void); + void update(float, sead::Vector3f const &); + + PlayerAnimator *mPlayerAnimator; // 0x0 + PlayerEffect *mPlayerEffect; // 0x8 + PlayerConst *mPlayerConst; // 0x10 + IJudge *mJudge; // 0x18 + bool unk1; // 0x20 + float unk2; // 0x24 + int unk3; // 0x28 + bool isMoveNormal; // 0x30 inverse of isMoon arg + undefined8 unk; // 0x32(?) + char *animName; // 0x38 +}; \ No newline at end of file diff --git a/include/game/Player/PlayerAnimFrameCtrl.h b/include/game/Player/PlayerAnimFrameCtrl.h new file mode 100644 index 0000000..c480d20 --- /dev/null +++ b/include/game/Player/PlayerAnimFrameCtrl.h @@ -0,0 +1,9 @@ +#pragma once +#include "al/LiveActor/LiveActor.h" +#include "sead/prim/seadSafeString.hpp" + +class PlayerAnimFrameCtrl { + public: + const char *getActionName(void) const; + void startAction(al::LiveActor *actor, sead::SafeString const &actionName); +}; \ No newline at end of file diff --git a/include/game/Player/PlayerAnimator.h b/include/game/Player/PlayerAnimator.h new file mode 100644 index 0000000..5341038 --- /dev/null +++ b/include/game/Player/PlayerAnimator.h @@ -0,0 +1,50 @@ +#pragma once + +#include "PlayerAnimFrameCtrl.h" +#include "PlayerModelHolder.h" +#include "sead/prim/seadSafeString.hpp" + +class PlayerAnimator { + public: + void startAnim(const sead::SafeString &animName); + void startSubAnim(const sead::SafeString &animName); + void startSubAnimOnlyAir(const sead::SafeString &animName); + void startUpperBodyAnimAndHeadVisKeep(const sead::SafeString &animName); + void startAnimDead(void); // chooses one of the 5 death animations and starts that animation + void endSubAnim(void); + + void updateAnimFrame(void); + void clearUpperBodyAnim(void); + + bool isAnim(const sead::SafeString &animName) const; + bool isSubAnim(sead::SafeString const &subAnimName) const; + bool isSubAnimEnd(void) const; + bool isUpperBodyAnimAttached(void) const; + + float getAnimFrame() const; + float getAnimFrameMax() const; + float getAnimFrameRate() const; + float getSubAnimFrame() const; + float getSubAnimFrameMax() const; + float getBlendWeight(int index); + + void setAnimRate(float); + void setAnimRateCommon(float); + void setAnimFrame(float); + void setAnimFrameCommon(float); + void setSubAnimFrame(float); + void setSubAnimRate(float); + void setBlendWeight(float,float,float,float,float,float); + void setModelAlpha(float); + void setPartsAnimRate(float, char const*); + void setPartsAnimFrame(float, char const*); + + + PlayerModelHolder *mModelHolder; // 0x0 + al::LiveActor *mPlayerDeco; // 0x8 + void *unkPtr; // 0x10 + PlayerAnimFrameCtrl *mAnimFrameCtrl; // 0x18 + sead::SafeString curAnim; // 0x20 + unsigned char padding_78[0x78 - 0x30]; + sead::SafeString curSubAnim; //0x78 +}; \ No newline at end of file diff --git a/include/game/Player/PlayerCameraTarget.h b/include/game/Player/PlayerCameraTarget.h new file mode 100644 index 0000000..996828d --- /dev/null +++ b/include/game/Player/PlayerCameraTarget.h @@ -0,0 +1,12 @@ +#pragma once + +#include "al/actor/ActorCameraTarget.h" + +class PlayerCameraTarget : public al::ActorCameraTarget +{ + public: + PlayerCameraTarget(al::LiveActor const *player); + + float unk1; + float unk2; +}; \ No newline at end of file diff --git a/include/game/Player/PlayerCollider.h b/include/game/Player/PlayerCollider.h new file mode 100644 index 0000000..cc0ef88 --- /dev/null +++ b/include/game/Player/PlayerCollider.h @@ -0,0 +1,7 @@ +#pragma once + +class PlayerCollider { + public: + void calcBoundingRadius(float *); + void setCollisionShapeScale(float); +}; \ No newline at end of file diff --git a/include/game/Player/PlayerColliderHakoniwa.h b/include/game/Player/PlayerColliderHakoniwa.h new file mode 100644 index 0000000..eb74486 --- /dev/null +++ b/include/game/Player/PlayerColliderHakoniwa.h @@ -0,0 +1,18 @@ +#pragma once + +#include "types.h" +#include "PlayerCollider.h" +#include "game/Interfaces/IUsePlayerCollision.h" + +class PlayerColliderHakoniwa : public IUsePlayerCollision { + public: + f32 getColliderRadius() const; + f32 getColliderDiskHalfHeight() const; + f32 getSafetyCeilSpace() const; + f32 getCeilCheckHeight() const; + f32 getGroundHeight() const; + f32 getShadowDropHeight() const; + f32 getFallDistance() const; + + PlayerCollider *getPlayerCollider() const; +}; \ No newline at end of file diff --git a/include/game/Player/PlayerConst.h b/include/game/Player/PlayerConst.h new file mode 100644 index 0000000..1acf0f2 --- /dev/null +++ b/include/game/Player/PlayerConst.h @@ -0,0 +1,1231 @@ +#pragma once + +#include "types.h" + +class PlayerConst { // 0x9A8 i think is PlayerConst's size, which is every single entry plus some extra space for something + public: // note: these functions are in the order that the addresses are in, so doing a bit of messing around with these declarations should also allow for the full header to be decompiled + virtual float getGravity(void) const; + virtual float getFrictionAttack(void) const; + virtual float getPushPower(void) const; + virtual float getWaitPoseDegreeMax(void) const; + virtual float getHillPoseDegreeMax(void) const; + virtual float getTiltPoseDegreeMax(void) const; + virtual float getSlerpQuatRate(void) const; + virtual float getSlerpQuatRateWait(void) const; + virtual float getSlerpQuatGrav(void) const; + virtual int getPreInputFrameCapThrow(void) const; + virtual int getEnableActionFrameCapCatch(void) const; + virtual float getJumpPowerCapCatch(void) const; + virtual float getJumpGravityCapCatch(void) const; + virtual int getRunTimeContinuousThrow(void) const; + virtual float getRunSpeedMaxContinuousThrow(void) const; + virtual int getRunAccelFrameContinuousThrow(void) const; + virtual float getSeparateCheckHeight(void) const; + virtual float getSeparateOffsetLerpRate(void) const; + virtual float getSeparateEnableThrowHeight(void) const; + virtual float getTall(void) const; + virtual float getCollisionRadius(void) const; + virtual float getCollisionRadiusSquat(void) const; + virtual float getCollisionRadiusStand(void) const; + virtual float getCollisionSmallStepHeight(void) const; + virtual float getCollisionResetLimit(void) const; + virtual float getReflectCeilingPower(void) const; + virtual float getReflectTossPower(void) const; + virtual float getReflectUpperPunchScaleH(void) const; + virtual float getCollisionHitDownAngleH(void) const; + virtual float getCollisionHitDownEscapeAngleV(void) const; + virtual float getShadowDropHeightScale(void) const; + virtual float getShadowDropNormalAdd(void) const; + virtual float getShadowDropLengthMin(void) const; + virtual float getShadowDropLengthMax(void) const; + virtual float getShadowDropLengthExtend(void) const; + virtual float getGravityDamage(void) const; + virtual float getHopPowerDamage(void) const; + virtual float getPushPowerDamage(void) const; + virtual int getDamageCancelFrame(void) const; + virtual int getDamageInvalidCount(void) const; + virtual int getDamageInvalidCountRecovery(void) const; + virtual int getDamageInvalidCountAbyss(void) const; + virtual float getNormalMinSpeed2D(void) const; + virtual float getNormalMaxSpeed2D(void) const; + virtual float getDashMaxSpeed2D(void) const; + virtual int getNormalAccelFrame2D(void) const; + virtual int getDashAccelFrame2D(void) const; + virtual int getNormalDashAnimFrame2D(void) const; + virtual int getNormalBrakeFrame2D(void) const; + virtual int getStickOnBrakeFrame2D(void) const; + virtual int getBrakeTurnStartFrame2D(void) const; + virtual float getTurnEndSpeedRate2D(void) const; + virtual float getJumpPowerMin2DArea(void) const; + virtual float getJumpPowerMax2DArea(void) const; + virtual float getJumpPowerMinBorder2D(void) const; + virtual float getJumpPowerMaxBorder2D(void) const; + virtual float getGravityMove(void) const; + virtual float getNormalMaxSpeed(void) const; + virtual float getNormalMinSpeed(void) const; + virtual int getNormalAccelFrame(void) const; + virtual float getRunAccelAverageScale(void) const; + virtual int getNormalBrakeFram(void) const; + virtual float getDashJudgeSpeed(void) const; + virtual int getStickOnBrakeFrame(void) const; + virtual int getNormalDashAnimFrame(void) const; + virtual float getRunAfterTurnSpeedMax(void) const; + virtual float getRunAfterTurnScale(void) const; + virtual int getRunAfterTurnFrame(void) const; + virtual int getBrakeTurnStartFrame(void) const; + virtual float getBrakeOnSpeedRate(void) const; + virtual int getBrakeOnCounterBorder(void) const; + virtual int getWallPushFrame(void) const; + virtual int getRunDeepDownFrame(void) const; + virtual int getRunDeepDownMargine(void) const; + virtual int getQuickTurnJumpFrame(void) const; + virtual int getRoundAccelFrame(void) const; + virtual int getRoundBrakeFrame(void) const; + virtual float getRoundFastDegree(void) const; + virtual int getRoundAccelFrameFast(void) const; + virtual float getRoundMinDegree(void) const; + virtual int getRoundBrakeFrameForce(void) const; + virtual float getRoundFastDegreeForce(void) const; + virtual float getRoundLimitDegreeForce(void) const; + virtual float getRoundLimitDegreeForceFast(void) const; + virtual int getRoundAccelFrameForceFast(void) const; + virtual float getRoundLimitDegreeMin(void) const; + virtual float getRoundLimitDegree(void) const; + virtual int getIceAccelFrame(void) const; + virtual int getIceBrakeFrame(void) const; + virtual int getIceBrakeFrameHigh(void) const; + virtual int getIceBrakeFrameWall(void) const; + virtual int getIceRoundAccelFrame(void) const; + virtual int getIceRoundAccelFrameFast(void) const; + virtual int getIceRoundBrakeFrame(void) const; + virtual float getIceRoundFastDegree(void) const; + virtual float getIceRoundMinDegree(void) const; + virtual float getIceRoundLimitDegree(void) const; + virtual float getHillAddSpeed(void) const; + virtual float getHillSubSpeed(void) const; + virtual int getHillAccelAddFrame(void) const; + virtual int getHillAccelSubFrame(void) const; + virtual float getHillAccelSubAngleMin(void) const; + virtual float getHillAccelSubAngleMax(void) const; + virtual float getStandAngleMin(void) const; + virtual float getStandAngleMax(void) const; + virtual float getHillAngleSpeedMin(void) const; + virtual float getHillAngleSpeedMax(void) const; + virtual int getSpinCapThrowFrame(void) const; + virtual int getSpinCapThrowFrameAir(void) const; + virtual int getSpinCapThrowFrameSwim(void) const; + virtual int getSpinCapThrowFrameSwing(void) const; + virtual int getSpinCapThrowFrameContinuous(void) const; + virtual int getSpinAttackFrame(void) const; + virtual int getSpinBrakeFrame(void) const; + virtual float getSpinAirJumpPower(void) const; + virtual float getSpinAirSpeedMax(void) const; + virtual float getGravitySpinAir(void) const; + virtual float getSlerpQuatRateSpinAir(void) const; + virtual float getSpinBrakeRate(void) const; + virtual float getSpinBrakeSideAccel(void) const; + virtual float getSpinBrakeSideBrakeRate(void) const; + virtual float getSpinBrakeSideMaxSpeedRate(void) const; + virtual float getSpinRoundLimitDegree(void) const; + virtual float getDamageFireJumpPower1st(void) const; + virtual float getDamageFireJumpPower2nd(void) const; + virtual float getDamageFireJumpMoveSpeed(void) const; + virtual float getDamageFireCeilHitSpeed(void) const; + virtual float getDamageFireGravity(void) const; + virtual int getDamageFireNoGravityFrame(void) const; + virtual int getDamageFireRunTime(void) const; + virtual float getDamageFireRunSpeed(void) const; + virtual float getDamageFireRunBrakeFrame(void) const; + virtual int getSandSinkDeadTime(void) const; + virtual int getSandSinkBrakeHeightH(void) const; + virtual int getSandSinkBrakeHeightV(void) const; + virtual float getSandSinkHeight(void) const; + virtual float getSandSinkCapThrow(void) const; + virtual float getSandSinkBrakeMinH(void) const; + virtual float getSandSinkBrakeMaxH(void) const; + virtual float getSandSinkBrakeMinV(void) const; + virtual float getSandSinkBrakeMaxV(void) const; + virtual float getSlopeSlideAngleStart(void) const; + virtual float getSlopeSlideAngleEnd(void) const; + virtual float getSlopeSlideAccel(void) const; + virtual float getSlopeSlideBrake(void) const; + virtual float getSlopeSlideMaxSpeed(void) const; + virtual float getSlopeSlideSpeedEnd(void) const; + virtual float getSlopeSlideSideAccel(void) const; + virtual float getSlopeSlideSideBrake(void) const; + virtual float getSlopeSlideSideMaxSpeed(void) const; + virtual float getSlopeTurnDegree(void) const; + virtual int getSlideInvalidFrame(void) const; + virtual int getSlopeForceFrame(void) const; + virtual float getSlopeSlideForceSideAccel(void) const; + virtual float getSlopeSlideForceSideBrake(void) const; + virtual float getSlopeSlideForceSideMaxSpeed(void) const; + virtual float getSlopeSlideForceTurnDegree(void) const; + virtual float getSlopeRollingSpeedStart(void) const; + virtual float getSlopeRollingSpeedBoost(void) const; + virtual float getSlopeRollingMaxSpeed(void) const; + virtual int getSlopeRollingFrameMinBoost(void) const; + virtual int getSlopeRollingFrameMin(void) const; + virtual float getSlopeRollingStartJumpPower(void) const; + virtual float getSlopeRollingStartSlideSpeed(void) const; + virtual float getSlopeRollingAccel(void) const; + virtual float getSlopeRollingBrake(void) const; + virtual float getSlopeRollingAgainst(void) const; + virtual float getSlopeRollingAnglePowerMax(void) const; + virtual float getSlopeRollingSpeedEnd(void) const; + virtual float getSlopeRollingSideAccel(void) const; + virtual float getSlopeRollingSideBrake(void) const; + virtual float getSlopeRollingSideMaxSpeed(void) const; + virtual int getSlopeRollingUnRollFrame(void) const; + virtual float getSlopeRollingEndBrake(void) const; + virtual float getSlopeRollingEndBrakeEndSpeed(void) const; + virtual float getSlopeRollingReStartAccel(void) const; + virtual float getSlopeRollingReStartMaxAdd(void) const; + virtual int getSlopeRollingReStarterval(void) const; + virtual int getSlopeRollingReStartSwing(void) const; + virtual int getSlopeRollingReStartCharge(void) const; + virtual int getSlopeRollingReStartForce(void) const; + virtual float getSlopeRollingAccelOnSkate(void) const; + virtual float getSlopeRollingSideAccelOnSkate(void) const; + virtual float getSlopeRollingBrakeOnSkate(void) const; + virtual int getExtendFrame(void) const; + virtual float getJumpInertiaRate(void) const; + virtual float getJumpPowerMin(void) const; + virtual float getJumpPowerMax(void) const; + virtual float getJumpGravity(void) const; + virtual float getJumpBaseSpeedMax(void) const; + virtual float getJumpMoveSpeedMin(void) const; + virtual float getJumpMoveSpeedMax(void) const; + virtual float getJumpAccelFront(void) const; + virtual float getJumpAccelBack(void) const; + virtual float getJumpAccelTurn(void) const; + virtual float getJumpTurnAngleStart(void) const; + virtual float getJumpTurnAngleLimit(void) const; + virtual float getJumpTurnAngleFast(void) const; + virtual float getJumpTurnAngleFastLimit(void) const; + virtual int getJumpTurnAccelFrame(void) const; + virtual int getJumpTurnAccelFrameFast(void) const; + virtual int getJumpTurnBrakeFrame(void) const; + virtual float getTrampleGravity(void) const; + virtual float getTrampleJumpPower(void) const; + virtual float getTrampleHighGravity(void) const; + virtual float getTrampleHighJumpPower(void) const; + virtual float getTrampleGravity2D(void) const; + virtual float getTrampleJumpPower2D(void) const; + virtual float getTrampleHighGravity2D(void) const; + virtual float getTrampleHighJumpPower2D(void) const; + virtual float getTrampleHipDropGravity(void) const; + virtual float getTrampleHipDropJumpPower(void) const; + virtual float getTrampleRisingBrakeVelH(void) const; + virtual float getTrampleJumpCodePower(void) const; + virtual float getTrampleJumpCodePowerSmall(void) const; + virtual float getCapLeapFrogJumpGravity(void) const; + virtual float getCapLeapFrogJumpPower(void) const; + virtual float getCapLeapFrogJumpPowerAir(void) const; + virtual float getObjLeapFrogJumpPower(void) const; + virtual float getObjLeapFrogJumpPowerHigh(void) const; + virtual float getCapHeadSpringJumpGravity(void) const; + virtual float getCapHeadSpringJumpPower(void) const; + virtual float getCapHeadSpringJumpGravityHigh(void) const; + virtual float getCapHeadSpringJumpPowerHigh(void) const; + virtual float getCapHeadSpringSpeedMax(void) const; + virtual int getContinuousJumpPreInputFrame(void) const; + virtual int getContinuousJumpCount(void) const; + virtual int getContinuousJumpTimer(void) const; + virtual float getContinuousJumpPowerMin(void) const; + virtual float getJumpPowerMax2nd(void) const; + virtual float getJumpGravity2nd(void) const; + virtual float getJumpPowerMax3rd(void) const; + virtual float getJumpGravity3rd(void) const; + virtual float getSpinFlowerJumpGravity(void) const; + virtual float getSpinFlowerJumpFallSpeedMax(void) const; + virtual float getSpinFlowerJumpMovePower(void) const; + virtual float getSpinFlowerJumpVelMax(void) const; + virtual int getSpinFlowerJumpStayFrame(void) const; + virtual float getSpinFlowerJumpStaySpeedMax(void) const; + virtual float getSpinFlowerJumpNoInputBrake(void) const; + virtual float getSpinFlowerJumpDownFallInitSpeed(void) const; + virtual float getSpinFlowerJumpDownFallPower(void) const; + virtual float getSpinFlowerJumpDownFallSpeedMax(void) const; + virtual float getJumpGravityForceRun(void) const; + virtual float getJumpPowerForceRun(void) const; + virtual float getCapCatchPopPower(void) const; + virtual float getCapCatchPopGravity(void) const; + virtual float getSquatJumpGravity(void) const; + virtual float getSquatJumpPower(void) const; + virtual float getSquatJumpBackPower(void) const; + virtual float getSquatJumpMovePowerFront(void) const; + virtual float getSquatJumpMovePowerSide(void) const; + virtual float getSquatJumpMoveSpeedMax(void) const; + virtual float getTurnJumpGravity(void) const; + virtual float getTurnJumpPower(void) const; + virtual float getTurnJumpVelH(void) const; + virtual float getTurnJumpBrake(void) const; + virtual float getTurnJumpAccel(void) const; + virtual float getTurnJumpSideAccel(void) const; + virtual float getLongJumpAccel(void) const; + virtual float getLongJumpBrake(void) const; + virtual float getLongJumpSideAccel(void) const; + virtual float getLongJumpGravity(void) const; + virtual float getLongJumpJumpPow(void) const; + virtual float getLongJumpMovePow(void) const; + virtual float getLongJumpInitSpeed(void) const; + virtual float getLongJumpSpeed(void) const; + virtual float getLongJumpSpeedMin(void) const; + virtual int getContinuousLongJumpCount(void) const; + virtual int getContinuousLongJumpTimer(void) const; + virtual float getGravityAir(void) const; + virtual float getFrictionAir(void) const; + virtual float getFallSpeedMax(void) const; + virtual float getLongFallDistance(void) const; + virtual float getFallWallScaleVelocity(void) const; + virtual int getDownFallFrameMin(void) const; + virtual float getGravityWallSlide(void) const; + virtual float getWallHeightLowLimit(void) const; + virtual float getWallKeepDegree(void) const; + virtual int getWallKeepFrame(void) const; + virtual float getWallJumpGravity(void) const; + virtual float getWallJumpHSpeed(void) const; + virtual float getWallJumpPower(void) const; + virtual int getWallJumpInvalidateInputFrame(void) const; + virtual int getWallInhibitAfterPunch(void) const; + virtual float getWallFollowAngleH(void) const; + virtual float getWallFollowAngleV(void) const; + virtual float getWallCatchDegree(void) const; + virtual float getWallCatchHeightEdgeTop(void) const; + virtual float getWallCatchHeightBottom(void) const; + virtual float getWallCatchKeepDegree(void) const; + virtual float getWallCatchMoveDegree(void) const; + virtual float getWallCatchMoveSpeed(void) const; + virtual float getWallCatchMoveHeightRange(void) const; + virtual int getWallCatchMoveerpolate(void) const; + virtual int getWallCatchMoveFrame(void) const; + virtual int getWallCatchMoveFrameFast(void) const; + virtual int getWallCatchMoveFrameSwing(void) const; + virtual float getWallCatchInputRepeatAngle(void) const; + virtual float getWallClimbDegree(void) const; + virtual int getWallClimbJumpStartFrame(void) const; + virtual int getWallClimbJumpEndFrame(void) const; + virtual int getWallClimbStartFrame(void) const; + virtual float getWallClimbGravity(void) const; + virtual float getWallFallJumpSpeed(void) const; + virtual float getWallClimbJumpSpeedV(void) const; + virtual float getWallClimbJumpSpeedH(void) const; + virtual float getWallClimbJumpGravity(void) const; + virtual int getWallClimbJumpInvalidFrame(void) const; + virtual float getWallCatchHipLocalOffset(void) const; + virtual float getWallCatchHipStability(void) const; + virtual float getWallCatchHipFriction(void) const; + virtual float getWallCatchHipLimitDegree(void) const; + virtual float getWallCatchStainAreaOffset(void) const; + virtual float getGrabCeilRange(void) const; + virtual float getGrabCeilBodyRadius(void) const; + virtual float getGrabCeilLeaveSpeedMin(void) const; + virtual float getGrabCeilLeavePopPower(void) const; + virtual float getGrabCeilLeavePopGravity(void) const; + virtual float getGrabCeilSwingStartOffset(void) const; + virtual float getGrabCeilReverseInputBorder(void) const; + virtual float getGrabCeilInputPowerBorder(void) const; + virtual float getGrabCeilSwingWaitEnergy(void) const; + virtual float getGrabCeilEnableJumpEnergy(void) const; + virtual float getGrabCeilEnableJumpEnergyMax(void) const; + virtual float getGrabCeilJumpForceAngle(void) const; + virtual float getGrabCeilJumpPower(void) const; + virtual float getGrabCeilJumpMoveMin(void) const; + virtual float getGrabCeilJumpMoveMax(void) const; + virtual float getGrabCeilJumpGravity(void) const; + virtual int getGrabCeilJumpInvalidFrame(void) const; + virtual int getGrabCeilEnableNextFrame(void) const; + virtual int getGrabCeilEnableFallSnapFrame(void) const; + virtual int getPoleClimbPreInputSwing(void) const; + virtual float getPoleClimbInputRepeatAngle(void) const; + virtual float getPoleClimbInputDegreeMove(void) const; + virtual float getPoleClimbCatchRange(void) const; + virtual float getPoleClimbCatchRangeMin(void) const; + virtual float getPoleClimbCatchRangeMax(void) const; + virtual float getPoleClimbJointAngleMin(void) const; + virtual float getPoleClimbJointAngleMax(void) const; + virtual float getPoleClimbJointRangeMin(void) const; + virtual float getPoleClimbJointRangeMax(void) const; + virtual float getPoleClimbMoveWallDegree(void) const; + virtual float getPoleClimbUpMargine(void) const; + virtual float getPoleClimbUpSpeed(void) const; + virtual int getPoleClimbUpFrame(void) const; + virtual int getPoleClimbUpFrameFast(void) const; + virtual int getPoleClimbUpFrameSwing(void) const; + virtual float getPoleClimbDownSpeed(void) const; + virtual float getPoleClimbDownSpeedFast(void) const; + virtual float getPoleClimbDownSpeedSwing(void) const; + virtual int getPoleClimbDownFrame(void) const; + virtual int getPoleClimbDownKeepTime(void) const; + virtual float getPoleClimbTurnDist(void) const; + virtual int getPoleClimbTurnFrame(void) const; + virtual int getPoleClimbTurnStopFrame(void) const; + virtual int getPoleTopStartFrame(void) const; + virtual int getPoleTopEndFrame(void) const; + virtual float getPoleTopTurnSpeed(void) const; + virtual float getPoleTopEndUnderOffsetY(void) const; + virtual int getGroundSpinFrame(void) const; + virtual float getGroundSpinMoveSpeedMax(void) const; + virtual float getGroundSpinAccelRate(void) const; + virtual float getGroundSpinBrakeRate(void) const; + virtual float getSpinJumpGravity(void) const; + virtual float getSpinJumpPower(void) const; + virtual float getSpinJumpMoveSpeedMax(void) const; + virtual float getSpinJumpDownFallInitSpeed(void) const; + virtual float getSpinJumpDownFallPower(void) const; + virtual float getSpinJumpDownFallSpeedMax(void) const; + virtual float getSquatBrakeEndSpeed(void) const; + virtual float getSquatAccelRate(void) const; + virtual float getSquatBrakeRate(void) const; + virtual float getSquatBrakeRateOnSkate(void) const; + virtual float getSquatBrakeSideAccel(void) const; + virtual float getSquatBrakeSideRate(void) const; + virtual float getSquatBrakeSideAccelOnSkate(void) const; + virtual float getSquatBrakeSideRateOnSkate(void) const; + virtual float getSquatBrakeSideMaxSpeedRate(void) const; + virtual float getSquatWalkSpeed(void) const; + virtual float getSquatWalkTurnSpeed(void) const; + virtual int getSquatWalkTurnFrame(void) const; + virtual float getSquatJumpCeilSlideSpeed2D(void) const; + virtual float getHipDropSpeed(void) const; + virtual float getHipDropGravity(void) const; + virtual float getHipDropSpeedMax(void) const; + virtual int getHipDropLandCancelFrame(void) const; + virtual float getHipDropHeight(void) const; + virtual int getHipDropMsgerval(void) const; + virtual float getJumpHipDropPower(void) const; + virtual int getJumpHipDropPermitBeginFrame(void) const; + virtual int getJumpHipDropPermitEndFrame(void) const; + virtual float getHeadSlidingSpeed(void) const; + virtual float getHeadSlidingSpeedMin(void) const; + virtual float getHeadSlidingBrake(void) const; + virtual float getHeadSlidingSideAccel(void) const; + virtual float getHeadSlidingJump(void) const; + virtual float getHeadSlidingGravityAir(void) const; + virtual float getSwimCenterOffset(void) const; + virtual float getSwimWallCatchOffset(void) const; + virtual float getSwimRisePower(void) const; + virtual float getSwimRiseSpeedMax(void) const; + virtual int getSwimRiseFrame(void) const; + virtual float getSwimGravity(void) const; + virtual float getSwimGravityWalk(void) const; + virtual float getSwimFallSpeedMax(void) const; + virtual float getSwimFloorAccelH(void) const; + virtual float getSwimFloorSpeedMaxH(void) const; + virtual float getSwimHighAccelH(void) const; + virtual float getSwimHighSpeedMaxH(void) const; + virtual float getSwimLowAccelH(void) const; + virtual float getSwimLowSpeedMaxH(void) const; + virtual float getSwimBrakeRateH(void) const; + virtual float getSwimWallHitSpeedMinH(void) const; + virtual int getSwimHighAccelPermitFrame(void) const; + virtual float getSwimFlowFieldBlend(void) const; + virtual float getSwimWalkAnimMinRate(void) const; + virtual float getSwimWalkAnimMaxRate(void) const; + virtual float getSwimWalkMaxSpeed(void) const; + virtual float getSwimSpinCapUpPower(void) const; + virtual float getSwimSpinCapUpSpeedMax(void) const; + virtual float getSwimRotStartAngle(void) const; + virtual float getSwimRotFastAngle(void) const; + virtual int getSwimRotAccelFrame(void) const; + virtual int getSwimRotAccelFrameFast(void) const; + virtual int getSwimRotBrakeFrame(void) const; + virtual float getSwimRotSpeedChangeStart(void) const; + virtual float getSwimRotSpeedForward(void) const; + virtual float getSwimRotSpeedMax(void) const; + virtual float getSwimSurfaceAccelH(void) const; + virtual float getSwimSurfaceSpeedMaxH(void) const; + virtual int getSwimSurfaceSpinCapFrame(void) const; + virtual float getSwimSurfaceSpinCapSpeedMaxH(void) const; + virtual float getSwimSurfaceStartDist(void) const; + virtual float getSwimSurfaceEndDist(void) const; + virtual float getSwimSurfaceGravity(void) const; + virtual float getSwimSurfaceBaseHeight(void) const; + virtual float getSwimSurfaceSpring(void) const; + virtual float getSwimSurfaceDamper(void) const; + virtual int getSwimSurfaceDamperStart(void) const; + virtual int getSwimSurfaceDamperFrame(void) const; + virtual float getSwimSurfaceEnableJumpHeight(void) const; + virtual int getSwimSurfacePreInputJumpFrame(void) const; + virtual float getSwimSurfaceMoveSpring(void) const; + virtual float getSwimSurfaceMoveDamper(void) const; + virtual float getSwimSurfaceMoveBaseHeight(void) const; + virtual float getSwimRunSurfaceBaseHeight(void) const; + virtual float getSwimRunSurfaceApproachRate(void) const; + virtual float getSwimRunSurfaceApproachLimit(void) const; + virtual float getSwimRunSurfaceBrakeBorder(void) const; + virtual float getSwimRunSurfaceBrakeH(void) const; + virtual float getSwimRunSurfaceApproachBorderMax(void) const; + virtual float getSwimRunSurfaceApproachBorderMin(void) const; + virtual float getSwimRunSurfaceApproachRateMin(void) const; + virtual float getSwimFallInSpeed(void) const; + virtual float getSwimFallInBrakeH(void) const; + virtual float getSwimFallInBrakeV(void) const; + virtual float getSwimHeadInBrakeH(void) const; + virtual float getSwimHeadInBrakeV(void) const; + virtual float getSwimHeadInRisePower(void) const; + virtual float getSwimHeadInRiseSpeedMax(void) const; + virtual float getSwimHeadInSurfaceHeight(void) const; + virtual int getSwimFallInForceSurfaceFrame(void) const; + virtual int getSwimFallInvalidJumpFrame(void) const; + virtual float getSwimDiveStartSpeed(void) const; + virtual float getSwimDiveBrake(void) const; + virtual float getSwimDiveEndSpeed(void) const; + virtual int getSwimDiveLandCount(void) const; + virtual int getSwimDiveLandCancelFrame(void) const; + virtual int getSwimDiveNoBrakeFrame(void) const; + virtual int getSwimDiveButtonValidFrame(void) const; + virtual int getSwimDiveEndFrame(void) const; + virtual float getSwimDiveInBrakeH(void) const; + virtual float getSwimDiveInBrakeV(void) const; + virtual float getSwimDiveInRisePower(void) const; + virtual float getSwimDiveInRiseSpeedMax(void) const; + virtual float getSwimDiveInSurfaceHeight(void) const; + virtual int getSwimDiveInKeepFrame(void) const; + virtual int getSwimHeadSlidingFrame(void) const; + virtual int getSwimHeadSlidingBrakeFrame(void) const; + virtual float getSwimHeadSlidingSpeed(void) const; + virtual float getSwimHeadSlidingSpeedEnd(void) const; + virtual float getSwimHeadSlidingBrake(void) const; + virtual float getSwimHeadSlidingSideAccel(void) const; + virtual float getSwimHeadSlidingJump(void) const; + virtual float getSwimHeadSlidingGravity(void) const; + virtual int getSwimHeadSlidingEndBrakeFrame(void) const; + virtual int getSwimHeadSlidingEndSpeedMin(void) const; + virtual float getSwimJumpHipDropSpeed(void) const; + virtual float getSwimJumpHipDropBrakeV(void) const; + virtual float getSwimJumpHipDropBrakeVCeiling(void) const; + virtual float getSwimJumpHipDropGravity(void) const; + virtual float getSwimJumpHipDropCancelSpeed(void) const; + virtual float getSwimJumpHipDropAccelH(void) const; + virtual float getSwimJumpHipDropMoveSpeedH(void) const; + virtual float getSwimJumpHipDropPopSpeed(void) const; + virtual float getSwimJumpHipDropPopJumpAdd(void) const; + virtual float getSwimTramplePower(void) const; + virtual float getDiveTramplePower(void) const; + virtual int getDiveTrampleCancelFrame(void) const; + virtual float getDamageSwimPushPower(void) const; + virtual float getDamageSwimGravity(void) const; + virtual int getDamageSwimCancelFrame(void) const; + virtual float getDamageSwimSurfaceGravity(void) const; + virtual float getDamageSwimSurfaceHopPower(void) const; + virtual float getDamageSwimSurfacePushPower(void) const; + virtual float getDamageSwimSurfaceLandSpeed(void) const; + virtual float getDamageSwimSurfaceLandBrake(void) const; + virtual float getDamageSwimSurfaceLandEndSpeed(void) const; + virtual int getDamageSwimSurfaceCancelFrame(void) const; + virtual float getDamageSwimBrakeRateGround(void) const; + virtual int getOxygenReduceFrame(void) const; + virtual int getOxygenNoReduceFrame(void) const; + virtual int getOxygenRecoveryFrame(void) const; + virtual int getOxygenDamageerval(void) const; + virtual int getIceWaterDamageerval(void) const; + virtual int getIceWaterRecoveryFrame(void) const; + virtual float getMoveAnimSpeedMax(void) const; + virtual float getAnimFrameRateSpeedMin(void) const; + virtual float getRunBorderSpeed(void) const; + virtual float getRunBlendRange(void) const; + virtual float getDashBorderSpeed(void) const; + virtual float getDashBlendRange(void) const; + virtual float getDashFastBorderSpeed(void) const; + virtual float getDashFastBlendRange(void) const; + virtual float getAnimFrameRateSpeedMax(void) const; + virtual float getAnimFrameRateRunStart(void) const; + virtual float getAnimFrameRateMinRun(void) const; + virtual float getAnimFrameRateMaxRun(void) const; + virtual float getAnimFrameRateMaxDash(void) const; + virtual float getAnimFrameRateMaxDashFast(void) const; + virtual float getRunStartPlayFrameScale(void) const; + virtual int getRunStartBlendFrame(void) const; + virtual float getDamageFireRunAnimRate(void) const; + virtual float getRunSkateAnimSpeedOffset(void) const; + virtual float getAnimFrameRateRange2D(void) const; + virtual float getAnimFrameRateMinRun2D(void) const; + virtual float getAnimFrameRateMaxRun2D(void) const; + virtual int getIKBlendFrameRun(void) const; + virtual float getIKBlendRateRunMin(void) const; + virtual float getIKBlendRateRunMax(void) const; + virtual float getRollingAnimBorderSpeedMin(void) const; + virtual float getRollingAnimBorderSpeedMax(void) const; + virtual float getRollingAnimFrameRateMin(void) const; + virtual float getRollingAnimFrameRateMax(void) const; + virtual int getSwimPaddleAnimerval(void) const; + virtual int getSwimPaddleAnimRateervalMax(void) const; + virtual int getSwimPaddleAnimRateervalMin(void) const; + virtual float getSwimPaddleAnimMaxRate(void) const; + virtual float getSwimBentForwardMax(void) const; + virtual float getSwimBentForwardBlendRate(void) const; + virtual float getSwimBentSideMax(void) const; + virtual float getSwimBentSpineMax(void) const; + virtual float getSwimBentSideBlendRate(void) const; + virtual float getSwimBentFrontMax(void) const; + virtual float getSwimBentFrontBlendRate(void) const; + virtual float getSwimWalkAnimSpeedMax(void) const; + virtual float getSwimWalkAnimSpeedMin(void) const; + virtual float getSwimWalkAnimFrameRateMax(void) const; + virtual float getSwimWalkAnimFrameRateMin(void) const; + virtual float getSandSinkBorderMin(void) const; + virtual float getSandSinkBorderMax(void) const; + virtual float getSandSinkBorderRateMin(void) const; + virtual float getSandSinkBorderRateMax(void) const; + virtual float getSandSinkFrameRateMin(void) const; + virtual float getSandSinkFrameRateMax(void) const; + virtual int getLookAtEyeKeepFrame(void) const; + virtual int getLookAtEyeKeepFrameInSight(void) const; + virtual int getLookAtEyeKeepFrameWait(void) const; + virtual float getLookAtEyeDistance(void) const; + virtual float getLookAtEyeAngleMinH(void) const; + virtual float getLookAtEyeAngleMinInSightH(void) const; + virtual float getLookAtEyeAngleMaxH(void) const; + virtual float getLookAtEyeAngleMinV(void) const; + virtual float getLookAtEyeAngleMinInSightV(void) const; + virtual float getLookAtEyeAngleMaxV(void) const; + virtual float getTiltEyeBorderStart(void) const; + virtual float getTiltEyeBorderEnd(void) const; + virtual float getTiltEyeAngleScale(void) const; + virtual float getCenterTiltRateMax(void) const; + virtual float getNoseChildLocalOffset(void) const; + virtual float getNoseStability(void) const; + virtual float getNoseFriction(void) const; + virtual float getNoseLimitDegree(void) const; + virtual float getMustacheChildLocalOffset(void) const; + virtual float getMustacheStability(void) const; + virtual float getMustacheFriction(void) const; + virtual float getMustacheLimitDegree(void) const; + virtual int getCaperpolateFrame(void) const; + virtual float getCapChildLocalOffset(void) const; + virtual float getCapStability(void) const; + virtual float getCapFriction(void) const; + virtual float getCapLimitDegree(void) const; + virtual float getCapTransStability(void) const; + virtual float getCapTransFriction(void) const; + virtual float getCapTransLimit(void) const; + virtual int getCapManHeroEyesWaitAppearFrame(void) const; + virtual int getDeadWipeStartDamage(void) const; + virtual int getDeadWipeWaitDamage(void) const; + virtual int getDeadWipeStartAbyss(void) const; + virtual int getDeadWipeWaitAbyss(void) const; + virtual int getDeadWipeStartAbyssWithCapMsg(void) const; + virtual int getDeadWipeWaitAbyssWithCapMsg(void) const; + virtual int getDeadWipeStartPress(void) const; + virtual int getDeadWipeWaitPress(void) const; + virtual int getDeadWipeStartSandSink(void) const; + virtual int getDeadWipeWaitSandSink(void) const; + // private: + float mGravity; + float mFrictionAttack; + float mPushPower; + float mWaitPoseDegreeMax; + float mHillPoseDegreeMax; + float mTiltPoseDegreeMax; + float mSlerpQuatRate; + float mSlerpQuatRateWait; + float mSlerpQuatGrav; + int mPreInputFrameCapThrow; + int mEnableActionFrameCapCatch; + float mJumpPowerCapCatch; + float mJumpGravityCapCatch; + int mRunTimeContinuousThrow; + float mRunSpeedMaxContinuousThrow; + int mRunAccelFrameContinuousThrow; + float mSeparateCheckHeight; + float mSeparateOffsetLerpRate; + float mSeparateEnableThrowHeight; + float mTall; + float mCollisionRadius; + float mCollisionRadiusSquat; + float mCollisionRadiusStand; + float mCollisionSmallStepHeight; + float mCollisionResetLimit; + float mReflectCeilingPower; + float mReflectTossPower; + float mReflectUpperPunchScaleH; + float mCollisionHitDownAngleH; + float mCollisionHitDownEscapeAngleV; + float mShadowDropHeightScale; + float mShadowDropNormalAdd; + float mShadowDropLengthMin; + float mShadowDropLengthMax; + float mShadowDropLengthExtend; + float mGravityDamage; + float mHopPowerDamage; + float mPushPowerDamage; + int mDamageCancelFrame; + int mDamageInvalidCount; + int mDamageInvalidCountRecovery; + int mDamageInvalidCountAbyss; + float mNormalMinSpeed2D; + float mNormalMaxSpeed2D; + float mDashMaxSpeed2D; + int mNormalAccelFrame2D; + int mDashAccelFrame2D; + int mNormalDashAnimFrame2D; + int mNormalBrakeFrame2D; + int mStickOnBrakeFrame2D; + int mBrakeTurnStartFrame2D; + float mTurnEndSpeedRate2D; + float mJumpPowerMin2DArea; + float mJumpPowerMax2DArea; + float mJumpPowerMinBorder2D; + float mJumpPowerMaxBorder2D; + float mGravityMove; + float mNormalMaxSpeed; + float mNormalMinSpeed; + int mNormalAccelFrame; + float mRunAccelAverageScale; + int mNormalBrakeFrame; + float mDashJudgeSpeed; + int mStickOnBrakeFrame; + int mNormalDashAnimFrame; + float mRunAfterTurnSpeedMax; + float mRunAfterTurnScale; + int mRunAfterTurnFrame; + int mBrakeTurnStartFrame; + float mBrakeOnSpeedRate; + int mBrakeOnCounterBorder; + int mWallPushFrame; + int mRunDeepDownFrame; + int mRunDeepDownMargine; + int mQuickTurnJumpFrame; + int mRoundAccelFrame; + int mRoundBrakeFrame; + float mRoundFastDegree; + int mRoundAccelFrameFast; + float mRoundMinDegree; + int mRoundBrakeFrameForce; + float mRoundFastDegreeForce; + float mRoundLimitDegreeForce; + float mRoundLimitDegreeForceFast; + int mRoundAccelFrameForceFast; + float mRoundLimitDegreeMin; + float mRoundLimitDegree; + int mIceAccelFrame; + int mIceBrakeFrame; + int mIceBrakeFrameHigh; + int mIceBrakeFrameWall; + int mIceRoundAccelFrame; + int mIceRoundAccelFrameFast; + int mIceRoundBrakeFrame; + float mIceRoundFastDegree; + float mIceRoundMinDegree; + float mIceRoundLimitDegree; + float mHillAddSpeed; + float mHillSubSpeed; + int mHillAccelAddFrame; + int mHillAccelSubFrame; + float mHillAccelSubAngleMin; + float mHillAccelSubAngleMax; + float mStandAngleMin; + float mStandAngleMax; + float mHillAngleSpeedMin; + float mHillAngleSpeedMax; + int mSpinCapThrowFrame; + int mSpinCapThrowFrameAir; + int mSpinCapThrowFrameSwim; + int mSpinCapThrowFrameSwing; + int mSpinCapThrowFrameContinuous; + int mSpinAttackFrame; + int mSpinBrakeFrame; + float mSpinAirJumpPower; + float mSpinAirSpeedMax; + float mGravitySpinAir; + float mSlerpQuatRateSpinAir; + float mSpinBrakeRate; + float mSpinBrakeSideAccel; + float mSpinBrakeSideBrakeRate; + float mSpinBrakeSideMaxSpeedRate; + float mSpinRoundLimitDegree; + float mDamageFireJumpPower1st; + float mDamageFireJumpPower2nd; + float mDamageFireJumpMoveSpeed; + float mDamageFireCeilHitSpeed; + float mDamageFireGravity; + int mDamageFireNoGravityFrame; + int mDamageFireRunTime; + float mDamageFireRunSpeed; + float mDamageFireRunBrakeFrame; + int mSandSinkDeadTime; + int mSandSinkBrakeHeightH; + int mSandSinkBrakeHeightV; + float mSandSinkHeight; + float mSandSinkCapThrow; + float mSandSinkBrakeMinH; + float mSandSinkBrakeMaxH; + float mSandSinkBrakeMinV; + float mSandSinkBrakeMaxV; + float mSlopeSlideAngleStart; + float mSlopeSlideAngleEnd; + float mSlopeSlideAccel; + float mSlopeSlideBrake; + float mSlopeSlideMaxSpeed; + float mSlopeSlideSpeedEnd; + float mSlopeSlideSideAccel; + float mSlopeSlideSideBrake; + float mSlopeSlideSideMaxSpeed; + float mSlopeTurnDegree; + int mSlideInvalidFrame; + int mSlopeForceFrame; + float mSlopeSlideForceSideAccel; + float mSlopeSlideForceSideBrake; + float mSlopeSlideForceSideMaxSpeed; + float mSlopeSlideForceTurnDegree; + float mSlopeRollingSpeedStart; + float mSlopeRollingSpeedBoost; + float mSlopeRollingMaxSpeed; + int mSlopeRollingFrameMinBoost; + int mSlopeRollingFrameMin; + float mSlopeRollingStartJumpPower; + float mSlopeRollingStartSlideSpeed; + float mSlopeRollingAccel; + float mSlopeRollingBrake; + float mSlopeRollingAgainst; + float mSlopeRollingAnglePowerMax; + float mSlopeRollingSpeedEnd; + float mSlopeRollingSideAccel; + float mSlopeRollingSideBrake; + float mSlopeRollingSideMaxSpeed; + int mSlopeRollingUnRollFrame; + float mSlopeRollingEndBrake; + float mSlopeRollingEndBrakeEndSpeed; + float mSlopeRollingReStartAccel; + float mSlopeRollingReStartMaxAdd; + int mSlopeRollingReStartinterval; + int mSlopeRollingReStartSwing; + int mSlopeRollingReStartCharge; + int mSlopeRollingReStartForce; + float mSlopeRollingAccelOnSkate; + float mSlopeRollingSideAccelOnSkate; + float mSlopeRollingBrakeOnSkate; + int mExtendFrame; + float mJumpInertiaRate; + float mJumpPowerMin; + float mJumpPowerMax; + float mJumpGravity; + float mJumpBaseSpeedMax; + float mJumpMoveSpeedMin; + float mJumpMoveSpeedMax; + float mJumpAccelFront; + float mJumpAccelBack; + float mJumpAccelTurn; + float mJumpTurnAngleStart; + float mJumpTurnAngleLimit; + float mJumpTurnAngleFast; + float mJumpTurnAngleFastLimit; + int mJumpTurnAccelFrame; + int mJumpTurnAccelFrameFast; + int mJumpTurnBrakeFrame; + float mTrampleGravity; + float mTrampleJumpPower; + float mTrampleHighGravity; + float mTrampleHighJumpPower; + float mTrampleGravity2D; + float mTrampleJumpPower2D; + float mTrampleHighGravity2D; + float mTrampleHighJumpPower2D; + float mTrampleHipDropGravity; + float mTrampleHipDropJumpPower; + float mTrampleRisingBrakeVelH; + float mTrampleJumpCodePower; + float mTrampleJumpCodePowerSmall; + float mCapLeapFrogJumpGravity; + float mCapLeapFrogJumpPower; + float mCapLeapFrogJumpPowerAir; + float mObjLeapFrogJumpPower; + float mObjLeapFrogJumpPowerHigh; + float mCapHeadSpringJumpGravity; + float mCapHeadSpringJumpPower; + float mCapHeadSpringJumpGravityHigh; + float mCapHeadSpringJumpPowerHigh; + float mCapHeadSpringSpeedMax; + int mContinuousJumpPreInputFrame; + int mContinuousJumpCount; + int mContinuousJumpTimer; + float mContinuousJumpPowerMin; + float mJumpPowerMax2nd; + float mJumpGravity2nd; + float mJumpPowerMax3rd; + float mJumpGravity3rd; + float mSpinFlowerJumpGravity; + float mSpinFlowerJumpFallSpeedMax; + float mSpinFlowerJumpMovePower; + float mSpinFlowerJumpVelMax; + int mSpinFlowerJumpStayFrame; + float mSpinFlowerJumpStaySpeedMax; + float mSpinFlowerJumpNoInputBrake; + float mSpinFlowerJumpDownFallInitSpeed; + float mSpinFlowerJumpDownFallPower; + float mSpinFlowerJumpDownFallSpeedMax; + float mJumpGravityForceRun; + float mJumpPowerForceRun; + float mCapCatchPopPower; + float mCapCatchPopGravity; + float mSquatJumpGravity; + float mSquatJumpPower; + float mSquatJumpBackPower; + float mSquatJumpMovePowerFront; + float mSquatJumpMovePowerSide; + float mSquatJumpMoveSpeedMax; + float mTurnJumpGravity; + float mTurnJumpPower; + float mTurnJumpVelH; + float mTurnJumpBrake; + float mTurnJumpAccel; + float mTurnJumpSideAccel; + float mLongJumpAccel; + float mLongJumpBrake; + float mLongJumpSideAccel; + float mLongJumpGravity; + float mLongJumpJumpPow; + float mLongJumpMovePow; + float mLongJumpInitSpeed; + float mLongJumpSpeed; + float mLongJumpSpeedMin; + int mContinuousLongJumpCount; + int mContinuousLongJumpTimer; + float mGravityAir; + float mFrictionAir; + float mFallSpeedMax; + float mLongFallDistance; + float mFallWallScaleVelocity; + int mDownFallFrameMin; + float mGravityWallSlide; + float mWallHeightLowLimit; + float mWallKeepDegree; + int mWallKeepFrame; + float mWallJumpGravity; + float mWallJumpHSpeed; + float mWallJumpPower; + int mWallJumpInvalidateInputFrame; + int mWallInhibitAfterPunch; + float mWallFollowAngleH; + float mWallFollowAngleV; + float mWallCatchDegree; + float mWallCatchHeightEdgeTop; + float mWallCatchHeightBottom; + float mWallCatchKeepDegree; + float mWallCatchMoveDegree; + float mWallCatchMoveSpeed; + float mWallCatchMoveHeightRange; + int mWallCatchMoveinterpolate; + int mWallCatchMoveFrame; + int mWallCatchMoveFrameFast; + int mWallCatchMoveFrameSwing; + float mWallCatchInputRepeatAngle; + float mWallClimbDegree; + int mWallClimbJumpStartFrame; + int mWallClimbJumpEndFrame; + int mWallClimbStartFrame; + float mWallClimbGravity; + float mWallFallJumpSpeed; + float mWallClimbJumpSpeedV; + float mWallClimbJumpSpeedH; + float mWallClimbJumpGravity; + int mWallClimbJumpInvalidFrame; + float mWallCatchHipLocalOffset; + float mWallCatchHipStability; + float mWallCatchHipFriction; + float mWallCatchHipLimitDegree; + float mWallCatchStainAreaOffset; + float mGrabCeilRange; + float mGrabCeilBodyRadius; + float mGrabCeilLeaveSpeedMin; + float mGrabCeilLeavePopPower; + float mGrabCeilLeavePopGravity; + float mGrabCeilSwingStartOffset; + float mGrabCeilReverseInputBorder; + float mGrabCeilInputPowerBorder; + float mGrabCeilSwingWaitEnergy; + float mGrabCeilEnableJumpEnergy; + float mGrabCeilEnableJumpEnergyMax; + float mGrabCeilJumpForceAngle; + float mGrabCeilJumpPower; + float mGrabCeilJumpMoveMin; + float mGrabCeilJumpMoveMax; + float mGrabCeilJumpGravity; + int mGrabCeilJumpInvalidFrame; + int mGrabCeilEnableNextFrame; + int mGrabCeilEnableFallSnapFrame; + int mPoleClimbPreInputSwing; + float mPoleClimbInputRepeatAngle; + float mPoleClimbInputDegreeMove; + float mPoleClimbCatchRange; + float mPoleClimbCatchRangeMin; + float mPoleClimbCatchRangeMax; + float mPoleClimbJointAngleMin; + float mPoleClimbJointAngleMax; + float mPoleClimbJointRangeMin; + float mPoleClimbJointRangeMax; + float mPoleClimbMoveWallDegree; + float mPoleClimbUpMargine; + float mPoleClimbUpSpeed; + int mPoleClimbUpFrame; + int mPoleClimbUpFrameFast; + int mPoleClimbUpFrameSwing; + float mPoleClimbDownSpeed; + float mPoleClimbDownSpeedFast; + float mPoleClimbDownSpeedSwing; + int mPoleClimbDownFrame; + int mPoleClimbDownKeepTime; + float mPoleClimbTurnDist; + int mPoleClimbTurnFrame; + int mPoleClimbTurnStopFrame; + int mPoleTopStartFrame; + int mPoleTopEndFrame; + float mPoleTopTurnSpeed; + float mPoleTopEndUnderOffsetY; + int mGroundSpinFrame; + float mGroundSpinMoveSpeedMax; + float mGroundSpinAccelRate; + float mGroundSpinBrakeRate; + float mSpinJumpGravity; + float mSpinJumpPower; + float mSpinJumpMoveSpeedMax; + float mSpinJumpDownFallInitSpeed; + float mSpinJumpDownFallPower; + float mSpinJumpDownFallSpeedMax; + float mSquatBrakeEndSpeed; + float mSquatAccelRate; + float mSquatBrakeRate; + float mSquatBrakeRateOnSkate; + float mSquatBrakeSideAccel; + float mSquatBrakeSideRate; + float mSquatBrakeSideAccelOnSkate; + float mSquatBrakeSideRateOnSkate; + float mSquatBrakeSideMaxSpeedRate; + float mSquatWalkSpeed; + float mSquatWalkTurnSpeed; + int mSquatWalkTurnFrame; + float mSquatJumpCeilSlideSpeed2D; + float mHipDropSpeed; + float mHipDropGravity; + float mHipDropSpeedMax; + int mHipDropLandCancelFrame; + float mHipDropHeight; + int mHipDropMsginterval; + float mJumpHipDropPower; + int mJumpHipDropPermitBeginFrame; + int mJumpHipDropPermitEndFrame; + float mHeadSlidingSpeed; + float mHeadSlidingSpeedMin; + float mHeadSlidingBrake; + float mHeadSlidingSideAccel; + float mHeadSlidingJump; + float mHeadSlidingGravityAir; + float mSwimCenterOffset; + float mSwimWallCatchOffset; + float mSwimRisePower; + float mSwimRiseSpeedMax; + int mSwimRiseFrame; + float mSwimGravity; + float mSwimGravityWalk; + float mSwimFallSpeedMax; + float mSwimFloorAccelH; + float mSwimFloorSpeedMaxH; + float mSwimHighAccelH; + float mSwimHighSpeedMaxH; + float mSwimLowAccelH; + float mSwimLowSpeedMaxH; + float mSwimBrakeRateH; + float mSwimWallHitSpeedMinH; + int mSwimHighAccelPermitFrame; + float mSwimFlowFieldBlend; + float mSwimWalkAnimMinRate; + float mSwimWalkAnimMaxRate; + float mSwimWalkMaxSpeed; + float mSwimSpinCapUpPower; + float mSwimSpinCapUpSpeedMax; + float mSwimRotStartAngle; + float mSwimRotFastAngle; + int mSwimRotAccelFrame; + int mSwimRotAccelFrameFast; + int mSwimRotBrakeFrame; + float mSwimRotSpeedChangeStart; + float mSwimRotSpeedForward; + float mSwimRotSpeedMax; + float mSwimSurfaceAccelH; + float mSwimSurfaceSpeedMaxH; + int mSwimSurfaceSpinCapFrame; + float mSwimSurfaceSpinCapSpeedMaxH; + float mSwimSurfaceStartDist; + float mSwimSurfaceEndDist; + float mSwimSurfaceGravity; + float mSwimSurfaceBaseHeight; + float mSwimSurfaceSpring; + float mSwimSurfaceDamper; + int mSwimSurfaceDamperStart; + int mSwimSurfaceDamperFrame; + float mSwimSurfaceEnableJumpHeight; + int mSwimSurfacePreInputJumpFrame; + float mSwimSurfaceMoveSpring; + float mSwimSurfaceMoveDamper; + float mSwimSurfaceMoveBaseHeight; + float mSwimRunSurfaceBaseHeight; + float mSwimRunSurfaceApproachRate; + float mSwimRunSurfaceApproachLimit; + float mSwimRunSurfaceBrakeBorder; + float mSwimRunSurfaceBrakeH; + float mSwimRunSurfaceApproachBorderMax; + float mSwimRunSurfaceApproachBorderMin; + float mSwimRunSurfaceApproachRateMin; + float mSwimFallInSpeed; + float mSwimFallInBrakeH; + float mSwimFallInBrakeV; + float mSwimHeadInBrakeH; + float mSwimHeadInBrakeV; + float mSwimHeadInRisePower; + float mSwimHeadInRiseSpeedMax; + float mSwimHeadInSurfaceHeight; + int mSwimFallInForceSurfaceFrame; + int mSwimFallInvalidJumpFrame; + float mSwimDiveStartSpeed; + float mSwimDiveBrake; + float mSwimDiveEndSpeed; + int mSwimDiveLandCount; + int mSwimDiveLandCancelFrame; + int mSwimDiveNoBrakeFrame; + int mSwimDiveButtonValidFrame; + int mSwimDiveEndFrame; + float mSwimDiveInBrakeH; + float mSwimDiveInBrakeV; + float mSwimDiveInRisePower; + float mSwimDiveInRiseSpeedMax; + float mSwimDiveInSurfaceHeight; + int mSwimDiveInKeepFrame; + int mSwimHeadSlidingFrame; + int mSwimHeadSlidingBrakeFrame; + float mSwimHeadSlidingSpeed; + float mSwimHeadSlidingSpeedEnd; + float mSwimHeadSlidingBrake; + float mSwimHeadSlidingSideAccel; + float mSwimHeadSlidingJump; + float mSwimHeadSlidingGravity; + int mSwimHeadSlidingEndBrakeFrame; + int mSwimHeadSlidingEndSpeedMin; + float mSwimJumpHipDropSpeed; + float mSwimJumpHipDropBrakeV; + float mSwimJumpHipDropBrakeVCeiling; + float mSwimJumpHipDropGravity; + float mSwimJumpHipDropCancelSpeed; + float mSwimJumpHipDropAccelH; + float mSwimJumpHipDropMoveSpeedH; + float mSwimJumpHipDropPopSpeed; + float mSwimJumpHipDropPopJumpAdd; + float mSwimTramplePower; + float mDiveTramplePower; + int mDiveTrampleCancelFrame; + float mDamageSwimPushPower; + float mDamageSwimGravity; + int mDamageSwimCancelFrame; + float mDamageSwimSurfaceGravity; + float mDamageSwimSurfaceHopPower; + float mDamageSwimSurfacePushPower; + float mDamageSwimSurfaceLandSpeed; + float mDamageSwimSurfaceLandBrake; + float mDamageSwimSurfaceLandEndSpeed; + int mDamageSwimSurfaceCancelFrame; + float mDamageSwimBrakeRateGround; + int mOxygenReduceFrame; + int mOxygenNoReduceFrame; + int mOxygenRecoveryFrame; + int mOxygenDamageinterval; + int mIceWaterDamageinterval; + int mIceWaterRecoveryFrame; + float mMoveAnimSpeedMax; + float mAnimFrameRateSpeedMin; + float mRunBorderSpeed; + float mRunBlendRange; + float mDashBorderSpeed; + float mDashBlendRange; + float mDashFastBorderSpeed; + float mDashFastBlendRange; + float mAnimFrameRateSpeedMax; + float mAnimFrameRateRunStart; + float mAnimFrameRateMinRun; + float mAnimFrameRateMaxRun; + float mAnimFrameRateMaxDash; + float mAnimFrameRateMaxDashFast; + float mRunStartPlayFrameScale; + int mRunStartBlendFrame; + float mDamageFireRunAnimRate; + float mRunSkateAnimSpeedOffset; + float mAnimFrameRateRange2D; + float mAnimFrameRateMinRun2D; + float mAnimFrameRateMaxRun2D; + int mIKBlendFrameRun; + float mIKBlendRateRunMin; + float mIKBlendRateRunMax; + float mRollingAnimBorderSpeedMin; + float mRollingAnimBorderSpeedMax; + float mRollingAnimFrameRateMin; + float mRollingAnimFrameRateMax; + int mSwimPaddleAniminterval; + int mSwimPaddleAnimRateintervalMax; + int mSwimPaddleAnimRateintervalMin; + float mSwimPaddleAnimMaxRate; + float mSwimBentForwardMax; + float mSwimBentForwardBlendRate; + float mSwimBentSideMax; + float mSwimBentSpineMax; + float mSwimBentSideBlendRate; + float mSwimBentFrontMax; + float mSwimBentFrontBlendRate; + float mSwimWalkAnimSpeedMax; + float mSwimWalkAnimSpeedMin; + float mSwimWalkAnimFrameRateMax; + float mSwimWalkAnimFrameRateMin; + float mSandSinkBorderMin; + float mSandSinkBorderMax; + float mSandSinkBorderRateMin; + float mSandSinkBorderRateMax; + float mSandSinkFrameRateMin; + float mSandSinkFrameRateMax; + int mLookAtEyeKeepFrame; + int mLookAtEyeKeepFrameInSight; + int mLookAtEyeKeepFrameWait; + float mLookAtEyeDistance; + float mLookAtEyeAngleMinH; + float mLookAtEyeAngleMinInSightH; + float mLookAtEyeAngleMaxH; + float mLookAtEyeAngleMinV; + float mLookAtEyeAngleMinInSightV; + float mLookAtEyeAngleMaxV; + float mTiltEyeBorderStart; + float mTiltEyeBorderEnd; + float mTiltEyeAngleScale; + float mCenterTiltRateMax; + float mNoseChildLocalOffset; + float mNoseStability; + float mNoseFriction; + float mNoseLimitDegree; + float mMustacheChildLocalOffset; + float mMustacheStability; + float mMustacheFriction; + float mMustacheLimitDegree; + int mCapinterpolateFrame; + float mCapChildLocalOffset; + float mCapStability; + float mCapFriction; + float mCapLimitDegree; + float mCapTransStability; + float mCapTransFriction; + float mCapTransLimit; + int mCapManHeroEyesWaitAppearFrame; + int mDeadWipeStartDamage; + int mDeadWipeWaitDamage; + int mDeadWipeStartAbyss; + int mDeadWipeWaitAbyss; + int mDeadWipeStartAbyssWithCapMsg; + int mDeadWipeWaitAbyssWithCapMsg; + int mDeadWipeStartPress; + int mDeadWipeWaitPress; + int mDeadWipeStartSandSink; + int mDeadWipeWaitSandSink; + int mDeadWipeStartNoOxygen; + int mDeadWipeWaitNoOxygen; + int mDeadWipeStartIceWater; + int mDeadWipeWaitIceWater; + float mCoinDashSpeed; + float mCoinDashSpeedLimit; + float mAdditionalSpeedLimit; +}; \ No newline at end of file diff --git a/include/game/Player/PlayerCostumeInfo.h b/include/game/Player/PlayerCostumeInfo.h new file mode 100644 index 0000000..4e7b240 --- /dev/null +++ b/include/game/Player/PlayerCostumeInfo.h @@ -0,0 +1,78 @@ +#pragma once + +struct PlayerBodyCostumeInfo { + PlayerBodyCostumeInfo() = default; + PlayerBodyCostumeInfo(const char *name) { + costumeName = name; + }; + const char *costumeName; + int mWarmLevel = 0; + bool mIsIgnoreTemperature = false; + bool mIsUseHeadSuffix = false; + bool mIsBigEar = false; + bool mIsHideHeadHair = false; + bool mIsUseBodyHair = false; + bool mIsExistHairNoCap = false; + bool mIsUseShortHead = false; + bool mIsNoPairHead = false; + bool mIsMario64 = false; + bool mIsHidePainNose = false; + bool mIsUseBeard = false; + bool mIsUseEarringPeach = false; + bool mIsUseEarringLink = false; +}; + +struct PlayerHeadCostumeInfo { + + PlayerHeadCostumeInfo() = default; + PlayerHeadCostumeInfo(const char *name) { + costumeName = name; + }; + + const char *costumeName; + bool mIsFullFace = false; + bool mIsShrinkNose = false; + bool mIsPreventHead = false; + bool mIsEnableBigEar = false; + bool mIsEnableHairNoCap = false; + bool mIsMario64 = false; + bool mIsHaveShort = false; + bool mIsHideBeard = false; + bool mIsHideEarringPeach = false; + bool mIsHideEarringLink = false; + bool mIsUseStrap = false; + bool mIsInvisibleHead = false; +}; + +class PlayerCostumeInfo { + public: + PlayerCostumeInfo(void) { + mBodyInfo = {0}; + mHeadInfo = {0}; + }; + + void init(PlayerBodyCostumeInfo const *body, PlayerHeadCostumeInfo const *head) { + mBodyInfo = body; + mHeadInfo = head; + }; + + bool isEnableBigEar(void) const; + bool isEnableHairNoCap(void) const; + bool isEnableCostume2D(void) const; + bool isNeedShrinkNose(void) const; + bool isNeedBodyHair(void) const; + bool isNeedSyncBodyHair(void) const; + bool isNeedFullFaceAnim(void) const; + bool isHidePainNose(void) const; + bool isEnableEarring(void) const; + bool isSyncFaceBeard(void) const; + bool isSyncStrap(void) const; + bool isFollowJoeStrap(void) const; + bool isPreventHeadPain(void) const; + bool isInvisibleHead(void) const; + + int calcWarmLevel(int level); + + const PlayerBodyCostumeInfo *mBodyInfo; + const PlayerHeadCostumeInfo *mHeadInfo; +}; \ No newline at end of file diff --git a/include/game/Player/PlayerFactory.h b/include/game/Player/PlayerFactory.h new file mode 100644 index 0000000..e991df3 --- /dev/null +++ b/include/game/Player/PlayerFactory.h @@ -0,0 +1,25 @@ +#pragma once + +#include "PlayerActorBase.h" +#include "PlayerActorHakoniwa.h" +#include "YukimaruRacePlayer.h" +#include "al/factory/Factory.h" + +template +PlayerActorBase* createPlayerFunction(const char *name); + +typedef PlayerActorBase* (*CreateHakoniwa)(const char* name); + +static al::NameToCreator playerEntries[] = { + {"PlayerActorHakoniwa", &createPlayerFunction}, + {"YukimaruRacePlayer", &createPlayerFunction} +}; + +class PlayerFactory : public al::Factory { + public: + PlayerFactory() { + this->factoryName = "プレイヤー生成"; + this->actorTable = playerEntries; + this->factoryCount = sizeof(playerEntries)/sizeof(playerEntries[0]); + }; +}; diff --git a/include/game/Player/PlayerFormSensorCollisionArranger.h b/include/game/Player/PlayerFormSensorCollisionArranger.h new file mode 100644 index 0000000..34e892e --- /dev/null +++ b/include/game/Player/PlayerFormSensorCollisionArranger.h @@ -0,0 +1,39 @@ +#pragma once + +#include "sead/math/seadVector.h" +#include "al/LiveActor/LiveActor.h" +#include "PlayerColliderHakoniwa.h" +#include "PlayerHackKeeper.h" + +class IPlayerModelChanger; + +class PlayerFormSensorCollisionArranger { + public: + PlayerFormSensorCollisionArranger(al::LiveActor *, PlayerColliderHakoniwa *, IPlayerModelChanger const*, PlayerHackKeeper const*); + void setFormModel3D(void); + void setFormModel2D(void); + void setFormActionSquat(void); + void setFormActionStandup(void); + void setFormActionWallGrab(sead::Vector3f const&); + void setFormActionGrabCeil(sead::Vector3f const&); + void setFormActionPoleClimb(sead::Vector3f const&); + void setFormActionSwim(void); + void setFormActionHack(void); + void setFormActionBind(bool); + void setFormActionRecovery(void); + void setFormActionAbyss(sead::Vector3f const&); + void setFormActionDead(void); + void setFormAttackSensorNone(void); + void setFormAttackSensorSpin(void); + void setFormAttackSensorTornado(void); + void setCollisionShapeOffsetGround(float); + const char *getHeadSensorName(void) const; + sead::Vector3f *getHeadPos(void) const; + float getHeadRadius(void) const; + sead::Vector3f *getBodyPos(void) const; + bool isEnableSafetyPointForm(void) const; + void update(void); + void syncForm(void); + void validateAttackSensor(void); + +}; \ No newline at end of file diff --git a/include/game/Player/PlayerFunction.h b/include/game/Player/PlayerFunction.h new file mode 100644 index 0000000..16c03f1 --- /dev/null +++ b/include/game/Player/PlayerFunction.h @@ -0,0 +1,37 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" + +#include "game/Player/PlayerJointControlPartsDynamics.h" +#include "game/Player/PlayerConst.h" + +#include "PlayerCostumeInfo.h" + +namespace al { + class Resource; +} + +class PlayerFunction +{ + public: + static int getPlayerInputPort(const al::LiveActor *); + static bool tryActivateAmiiboPreventDamage(const al::LiveActor *); + static bool isPlayerDeadStatus(const al::LiveActor *player); + static void syncBodyHairVisibility(al::LiveActor *, al::LiveActor *); + static void syncMarioFaceBeardVisibility(al::LiveActor *, al::LiveActor *); + static void syncMarioHeadStrapVisibility(al::LiveActor *); + static bool isNeedHairControl(PlayerBodyCostumeInfo const *, const char *); + static bool isInvisibleCap(PlayerCostumeInfo const *); + static void hideHairVisibility(al::LiveActor *); + + static PlayerConst *createMarioConst(char const *); + static void createCapModelName(sead::BufferedSafeStringBase *, char const *); + + static void initMarioModelActor2D(al::LiveActor *actor, al::ActorInitInfo const &initInfo, char const *model2DName, bool isInvisCap); + static al::Resource *initCapModelActor(al::LiveActor *, al::ActorInitInfo const &, char const *); + static al::Resource *initCapModelActorDemo(al::LiveActor *, al::ActorInitInfo const &, char const *); + static PlayerCostumeInfo *initMarioModelActor(al::LiveActor *player, const al::ActorInitInfo &initInfo, const char *modelName, const char *capType, al::AudioKeeper *keeper, bool isCloset); + // joint, init, pconst, nosescale, earscale + static PlayerCostumeInfo *initMarioModelActorDemo(PlayerJointControlPartsDynamics **jointCtrlPtr, al::LiveActor *player, const al::ActorInitInfo &initInfo, char const *bodyName, char const *capName, PlayerConst const *pConst,sead::Vector3f *noseScale, sead::Vector3f *earScale, bool isCloset); + static PlayerCostumeInfo *initMarioModelCommon(al::LiveActor *player, const al::ActorInitInfo &initInfo, char const *bodyName, char const *capName, int subActorNum, bool isDemo, al::AudioKeeper *audioKeeper, bool guessIsChromaKey, bool isCloset); +}; \ No newline at end of file diff --git a/include/game/Player/PlayerHackKeeper.h b/include/game/Player/PlayerHackKeeper.h new file mode 100644 index 0000000..dc46000 --- /dev/null +++ b/include/game/Player/PlayerHackKeeper.h @@ -0,0 +1,76 @@ +/** + * @file PlayerHackKeeper.h + * @brief Contains info on the current hack (capture) + */ + +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "game/Interfaces/IUsePlayerHack.h" +#include "game/Player/PlayerInput.h" +#include "game/Player/HackCap.h" +#include "game/Player/PlayerCollider.h" +#include "game/Player/HackCap/CapTargetInfo.h" + +struct HackEndParam; +struct PlayerRecoverySafetyPoint; +struct PlayerDamageKeeper; +struct IPlayerModelChanger; +struct IUsePlayerHeightCheck; + +class PlayerHackKeeper +{ + public: + PlayerHackKeeper(al::LiveActor *,HackCap *,PlayerRecoverySafetyPoint *,PlayerInput const*,sead::Matrix34f const*,PlayerDamageKeeper const*,IPlayerModelChanger const*,IUsePlayerHeightCheck const*); + void createHackModel(al::ActorInitInfo const&); + void startHack(al::HitSensor *,al::HitSensor *,al::LiveActor *); + void setupHack(al::HitSensor *,al::HitSensor *,al::LiveActor *); + void endHack(HackEndParam const*); + void endHackStartDemo(al::LiveActor *); + void startHackStartDemo(al::LiveActor *); + void startHackStartDemoPuppetable(al::LiveActor *); + void addHackStartDemo(al::LiveActor *); + void appearHackDemoModel(sead::Matrix34f const&,float); + void updateHackDemoModel(sead::Matrix34f const&,float); + void deleteHackDemoModelEffect(void); + void killHackDemoModel(void); + bool isActiveHackStartDemo(void) const; + void recordHack(void); + void cancelHackArea(void); + void cancelHack(void); + void cancelForceRecovery(void); + void tryEscapeHack(void); + void sendTransferHack(void); + void sendMarioDemo(void); + void forceKillHack(void); + void sendMarioDead(void); + void sendMarioInWater(void); + void sendMarioDeathArea(void); + void sendMsgEnableMapCheckPointWarp(void); + void sendMsgSelfCeilingCheckMiss(void); + void receiveRequestTransferHack(al::HitSensor *); + void requestDamage(void); + void receiveRequestDamage(void); + void sendSyncDamageVisibility(void); + void pushWorldEndBorder(sead::Vector3f const&); + const char *getCurrentHackName(void) const; + PlayerCollider *getPlayerCollision(void); + float getHackGuideHeight(void); + bool isHackGuideEnable(void) const; + float getHackStayGravityMargine(void); + void *getCollisionPartsFilter(void); + bool isHackGroupTalkScare(void) const; + bool isHackNoCollisionMsg(void) const; + bool isHackNoSeparateCameraInput(void) const; + bool isHackUsePlayerCollision(void) const; + bool isHackCancelCeilingCheck(void) const; + bool isHackInvalidLifeRecovery(void) const; + void requestForceHackStageStart(al::HitSensor *,CapTargetInfo const*,al::LiveActor *); + void executeForceHackStageStart(al::HitSensor *,IUsePlayerHack *); + void startDemo(void); + void endDemo(void); + + char padding[0x68]; + al::LiveActor *currentHackActor; + // 0x98 PlayerHackStartTexKeeper +}; \ No newline at end of file diff --git a/include/game/Player/PlayerInfo.h b/include/game/Player/PlayerInfo.h new file mode 100644 index 0000000..444e318 --- /dev/null +++ b/include/game/Player/PlayerInfo.h @@ -0,0 +1,50 @@ +#pragma once + +#include "HackCap.h" +#include "PlayerAnimator.h" +#include "PlayerInput.h" +#include "al/sensor/HitSensor.h" +#include "PlayerColliderHakoniwa.h" +#include "PlayerHackKeeper.h" +#include "PlayerCostumeInfo.h" +#include "PlayerModelChangerHakoniwa.h" + +class PlayerInfo { + public: + PlayerInfo(); + + PlayerModelChangerHakoniwa *pModelChanger; // 0x0 + struct PlayerOxygen *pOxygen; // 0x8 + PlayerAnimator *mPlayerAnimator; // 0x10 + struct PlayerBindKeeper *pBindKeeper; // 0x18 + struct PlayerDamageKeeper *pDamageKeeper; // 0x20 + struct PlayerDemoActionFlag *pDemoActionFlag; // 0x28 + struct PlayerEquipmentUser *pEquipmentUser; // 0x30 + HackCap *mHackCap; // 0x38 + struct WorldEndBorderKeeper *mWorldEndBorderKeeper; // 0x40 + struct PlayerCarryKeeper *pCarryKeeper; // 0x48 + struct PlayerJointControlKeeper *pJoinControlKeeper; // 0x50 + struct PlayerCounterIceWater *pCounterIceWater; // 0x58 + struct PlayerStainControl *pStainControl; // 0x60 + struct FootPrintHolder *mFootPrintHolder; // 0x68 + al::HitSensor *mHitSensor; // 0x70 + struct PlayerFormSensorCollisionArranger *pSensorCollArranger; // 0x78 + PlayerInput *pInput; // 0x80 + PlayerColliderHakoniwa *pColliderHakoniwa; // 0x88 + struct PlayerModelHolder *pModelHolder; // 0x90 + PlayerHackKeeper *pHackKeeper; // 0x98 + struct PlayerCapManHeroEyesControl *pCapManHeroEyesCtrl; // 0xA0 + struct PlayerRecoverySafetyPoint *pRecoverySafetyPoint; // 0xA8 + PlayerCostumeInfo *pCostumeInfo; // 0xB0 + struct PlayerJudgeCameraInWater *pJudgeCameraInWater; // 0xB8 + struct PlayerJudgeTalkGround *pJudgeTalkGround; // 0xC0 + struct PlayerJudgeTalkSwim *pJudgeTalkSwim; // 0xC8 + struct PlayerJudgeDead *pJudgeDead; // 0xD0 + struct PlayerJudgeDeadWipeStart *pJudgeDeadWipeStart; // 0xD8 + struct PlayerJudgeDrawForward *pJudgeDrawForward; // 0xE0 + struct PlayerJudgeSameNerve *pJudgeSameNervePoleClimb; // 0xE8 + struct PlayerJudgeSameNerve *pJudgeSameNerveGrabCeil; // 0xF0 + struct PlayerJudgeSameNerve *pJudgeSameNerveWallCatch; // 0xF8 + struct PlayerJudgeActiveCameraSubjective *pJudgeActiveCameraSubjective; // 0x100 + // theres a lot more judges and same nerves but im too lazy to get them all +}; \ No newline at end of file diff --git a/include/game/Player/PlayerInitInfo.h b/include/game/Player/PlayerInitInfo.h new file mode 100644 index 0000000..015c699 --- /dev/null +++ b/include/game/Player/PlayerInitInfo.h @@ -0,0 +1,5 @@ +#pragma once + +class PlayerInitInfo { + +}; \ No newline at end of file diff --git a/include/game/Player/PlayerInput.h b/include/game/Player/PlayerInput.h new file mode 100644 index 0000000..6ee66da --- /dev/null +++ b/include/game/Player/PlayerInput.h @@ -0,0 +1,11 @@ +#pragma once + + + +class PlayerInput { + public: + bool isMove(void) const; + bool isMoveDeepDown(void) const; + bool isMoveDeepDownNoSnap(void) const; + bool isNoInput(void) const; +}; \ No newline at end of file diff --git a/include/game/Player/PlayerJointControlPartsDynamics.h b/include/game/Player/PlayerJointControlPartsDynamics.h new file mode 100644 index 0000000..d6df372 --- /dev/null +++ b/include/game/Player/PlayerJointControlPartsDynamics.h @@ -0,0 +1,5 @@ +#pragma once + +class PlayerJointControlPartsDynamics { + public: +}; \ No newline at end of file diff --git a/include/game/Player/PlayerModelChangerHakoniwa.h b/include/game/Player/PlayerModelChangerHakoniwa.h new file mode 100644 index 0000000..32b6dde --- /dev/null +++ b/include/game/Player/PlayerModelChangerHakoniwa.h @@ -0,0 +1,13 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "PlayerCostumeInfo.h" +#include "PlayerModelHolder.h" +#include "game/Interfaces/IUseDimension.h" + +class PlayerPainPartsKeeper; + +class PlayerModelChangerHakoniwa { + public: + PlayerModelChangerHakoniwa(al::LiveActor const *, PlayerModelHolder *, PlayerPainPartsKeeper *, PlayerCostumeInfo *, IUseDimension const *); +}; \ No newline at end of file diff --git a/include/game/Player/PlayerModelHolder.h b/include/game/Player/PlayerModelHolder.h new file mode 100644 index 0000000..ae80c2d --- /dev/null +++ b/include/game/Player/PlayerModelHolder.h @@ -0,0 +1,25 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "sead/container/seadPtrArray.h" + +class PlayerModelHolder { +public: + struct Entry { + sead::FixedSafeString<0x80> mName; + al::LiveActor* mLiveActor; + }; + + PlayerModelHolder(unsigned int); + void registerModel(al::LiveActor*, char const*); + void changeModel(char const*); + al::LiveActor* findModelActor(char const*) const; + al::LiveActor* tryFindModelActor(char const*) const; + bool isCurrentModelLabel(char const*) const; + bool isCurrentModelLabelSubString(char const*) const; + + sead::PtrArray mBuffer; + Entry* currentModel; + sead::FixedSafeString<0x80> _10; + +}; \ No newline at end of file diff --git a/include/game/Player/PlayerModelKeeper.h b/include/game/Player/PlayerModelKeeper.h new file mode 100644 index 0000000..96f2e7d --- /dev/null +++ b/include/game/Player/PlayerModelKeeper.h @@ -0,0 +1,6 @@ +#pragma once + +class PlayerModelKeeper { + public: + +}; \ No newline at end of file diff --git a/include/game/Player/PlayerPuppet.h b/include/game/Player/PlayerPuppet.h new file mode 100644 index 0000000..973ce07 --- /dev/null +++ b/include/game/Player/PlayerPuppet.h @@ -0,0 +1,18 @@ +#pragma once + +class PlayerPuppet { + public: + void hide(void); + void hideShadow(void); + void hideSilhouette(void); + + void show(void); + void showShadow(void); + void showSilhouette(void); + + void invalidateCollisionCheck(void); + void invalidateSensor(void); + + void validateCollisionCheck(void); + void validateSensor(void); +}; \ No newline at end of file diff --git a/include/game/Player/States/PlayerStateRunHakoniwa.h b/include/game/Player/States/PlayerStateRunHakoniwa.h new file mode 100644 index 0000000..8a7f04d --- /dev/null +++ b/include/game/Player/States/PlayerStateRunHakoniwa.h @@ -0,0 +1,59 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "game/Interfaces/IUsePlayerCollision.h" +#include "game/Player/Actions/PlayerActionGroundMoveControl.h" +#include "game/Player/PlayerAnimator.h" +#include "game/Player/PlayerConst.h" +#include "game/Player/PlayerInput.h" +#include "al/nerve/ActorStateBase.h" + +class PlayerStateRunHakoniwa : public al::ActorStateBase { +public: + PlayerStateRunHakoniwa(al::LiveActor *,PlayerConst const*,PlayerInput const*,IUsePlayerCollision const*, struct PlayerCounterForceRun const*, struct PlayerCounterQuickTurnJump const*, struct PlayerTrigger *, PlayerAnimator *, struct PlayerEffect *, struct PlayerJointParamCenterDynamics *, struct IJudge const*,bool); + void appear(void); + void kill(void); + void control(void); + void isEnableLookAt(void); + void isRunDashFast(void); + void tryTurnJump(sead::Vector3 *); + void getCenterTiltRateMax(void); + void getCapDynamicsRate(void); + void exePivot(void); + void exeRun(void); + void exeBrake(void); + void exeTurn(void); + void exeWallPush(void); + ~PlayerStateRunHakoniwa(); + + PlayerConst *mPlayerConst; + PlayerInput *mPlayerInput; + IUsePlayerCollision *mPlayerCollider; + PlayerCounterForceRun *mCounterForceRun; + PlayerCounterQuickTurnJump *mCounterQuickTurnJump; + PlayerTrigger *mPlayerTrigger; + PlayerAnimator *mPlayerAnimator; + struct PlayerAnimControlRun *mPlayerAnimControlRun; + struct PlayerActionPivotTurnControl *mActionPivotTurnControl; + PlayerActionGroundMoveControl *mActionGroundMoveControl; // 0x68 + bool unkBool70; + int dword74; + int dword78; + int qword7C; + int qword80; + int qword84; + int dword88; + float mMaxSpeed; + int dword90; + int unkInt94; + struct PlayerJudgeWallPush *mPlayerJudgeWallPush; + void *qwordA0; + void *qwordA8; + PlayerEffect *mPlayerEffect; + bool byteB8; + int dwordBC; + void* mJointParamCenterDynamics; + bool unkBoolC8; +}; + +static_assert(sizeof(PlayerStateRunHakoniwa) == 0xD0, "Player State Run Size"); \ No newline at end of file diff --git a/include/game/Player/YukimaruRacePlayer.h b/include/game/Player/YukimaruRacePlayer.h new file mode 100644 index 0000000..0893c7f --- /dev/null +++ b/include/game/Player/YukimaruRacePlayer.h @@ -0,0 +1,20 @@ +#pragma once + +#include "game/Interfaces/IUseDimension.h" +#include "PlayerActorBase.h" +#include "PlayerPuppet.h" +#include "PlayerInput.h" +#include "PlayerAnimator.h" +#include "HackCap.h" +#include "PlayerModelKeeper.h" +#include "PlayerColliderHakoniwa.h" +#include "PlayerConst.h" +#include "PlayerHackKeeper.h" +#include "PlayerInfo.h" +#include "PlayerInitInfo.h" + +class YukimaruRacePlayer : public PlayerActorBase , public IUseDimension { + public: + void initPlayer(al::ActorInitInfo const &, PlayerInitInfo const &); + undefined size[0x1A8]; +}; \ No newline at end of file diff --git a/include/game/StageScene/StageScene.h b/include/game/StageScene/StageScene.h new file mode 100644 index 0000000..684d4b7 --- /dev/null +++ b/include/game/StageScene/StageScene.h @@ -0,0 +1,25 @@ +#pragma once + +#include "al/scene/Scene.h" +#include "game/StageScene/StageSceneLayout.h" +#include "game/StageScene/StageSceneStatePauseMenu.h" + +#define INHERITSIZE sizeof(al::Scene) + +class StageScene : public al::Scene +{ + public: + bool isPause() const; + // 0x88 StageResourceKeeper * + // 0x90 LiveActorKit * + // 0x98 LayoutKit * + // 0xA0 SceneObjHolder * + // 0xA8 SceneStopCtrl * + + unsigned char padding_180[0x180 - INHERITSIZE]; + StageSceneStatePauseMenu *mStatePauseMenu; // 0x180 + unsigned char padding_2D0[0x148]; + GameDataHolderAccessor mHolder; // 0x2D0 + unsigned char padding_2F8[0x20]; + StageSceneLayout *stageSceneLayout; // 0x2F8 +}; diff --git a/include/game/StageScene/StageSceneLayout.h b/include/game/StageScene/StageSceneLayout.h new file mode 100644 index 0000000..9f521f2 --- /dev/null +++ b/include/game/StageScene/StageSceneLayout.h @@ -0,0 +1,82 @@ +#pragma once + +#include "game/Layouts/CoinCounter.h" +#include "al/layout/LayoutActor.h" +#include "al/layout/LayoutInitInfo.h" +#include "al/layout/SimpleLayoutAppearWaitEnd.h" +#include "al/nerve/NerveStateBase.h" +#include "game/Layouts/MapMini.h" + +namespace al { + class SubCameraRenderer; + class PlayerHolder; +} + +class StageSceneLayout : public al::NerveStateBase { + public: + + StageSceneLayout(char const *, al::LayoutInitInfo const&, al::PlayerHolder const*, al::SubCameraRenderer const*); + + void control(void); + void updatePlayGuideMenuText(void); + void setDirtyFlagForPlayGuideMenu(void); + void tryAppearCoinCollectCounter(void); + void endWithoutCoin(bool); + void end(void); + void appearCoinCounterForDemo(void); + void endShineChipCompleteAnim(void); + void killShineCount(void); + void appearShineCountWait(void); + void endCloset(void); + void missEnd(void); + void appearPlayGuideCamera(void); + + void updateCounterParts(void); + void updateLifeCounter(void); + void updateKidsModeLayout(void); + + void start(void); + void startActionAll(char const*); + void startOnlyCoin(bool); + void tryStartLifeDemo(void); + void startCoinCountAnim(int); + void startCoinCollectCountAnim(int); + void startShineChipCompleteAnim(void); + void tryStartDemoGetLifeMaxUpItem(bool); + void startCloset(void); + void startShineCountAnim(bool); + + void exeAppear(void); + void exeWait(void); + void exeEnd(void); + void exeEndWithoutCoin(void); + void exeCoinCountAnim(void); + void exeShineChipComplete(void); + void exeShineCountAppear(void); + + bool isEnd(void) const; + bool isWait(void) const; + bool isActive(void) const; + bool isEndLifeDemo(void) const; + bool isEndCoinCountAnim(void) const; + bool isEndShineChipCompleteAnim(void) const; + bool isEndDemoGetLifeMaxUpItem(void) const; + bool isEndShineCountAnim(void) const; + bool isActionEndAll(void) const; + + CoinCounter *mCoinCountLyt; // 0x18 + struct CounterLifeCtrl * mHealthLyt; // 0x20 + struct ShineCounter * mShineCountLyt; // 0x28 + CoinCounter * mCoinCollectLyt; // 0x30 + struct ShineChipLayoutParts * mShineChipPartsLyt; // 0x38 + struct PlayGuideCamera * mPlayGuideCamLyt; // 0x40 + struct PlayGuideBgm * mPlayGuideBgmLyt; // 0x48 + MapMini * mMapMiniLyt; // 0x50 + al::PlayerHolder *mPlayerHolder; // 0x58 + void * unkPtr; // 0x60 + al::SimpleLayoutAppearWaitEnd * mPlayGuideMenuLyt; // 0x68 + void * voidPtr; // 0x70 + al::LayoutActor * mKidsModeLyt; // 0x78 +}; + +static_assert(sizeof(StageSceneLayout) == 0x80, "StageSceneLayout size"); \ No newline at end of file diff --git a/include/game/StageScene/StageSceneStateOption.h b/include/game/StageScene/StageSceneStateOption.h new file mode 100644 index 0000000..fcf88ef --- /dev/null +++ b/include/game/StageScene/StageSceneStateOption.h @@ -0,0 +1,128 @@ +#pragma once + +#include "al/message/MessageSystem.h" +#include "al/nerve/HostStateBase.h" +#include "al/message/IUseMessageSystem.h" +#include "al/layout/LayoutInitInfo.h" +#include "al/scene/Scene.h" +#include "al/LiveActor/LiveActor.h" +#include "al/util/GraphicsUtil.h" +#include "al/util/NerveUtil.h" +#include "game/Input/InputSeparator.h" +#include "game/Layouts/SimpleLayoutMenu.h" + +struct CommonVerticalList; + +class FooterParts { + public: + bool tryChangeTextFade(const char16_t *); +}; +class GameConfigData; + +namespace al +{ + class SimpleLayoutAppearWaitEnd; + class WindowConfirm; + class WindowConfirmData; + class KeyRepeatCtrl; +} // namespace al + +class StageSceneStateOption : public al::HostStateBase, public al::IUseMessageSystem { + public: + StageSceneStateOption(char const*,al::Scene *,al::LayoutInitInfo const&,FooterParts *,GameDataHolder *,bool); + ~StageSceneStateOption(); + + virtual al::MessageSystem* getMessageSystem(void) const override { return mMsgSystem; } + + void updateConfigDataInfo(GameConfigData const*); + void killAllLayouts(void); + void init(void); + void appear(void); + void kill(void); + void getSelectedFileId(void); + void decide(al::Nerve const*,SimpleLayoutMenu *,CommonVerticalList *); + void openConfirm(al::Nerve const*,SimpleLayoutMenu *,CommonVerticalList *); + void cancel(al::Nerve const*,SimpleLayoutMenu *,CommonVerticalList *); + void endConfig(void); + void updateSaveDataInfo(bool); + void changeNerve(al::Nerve const*, SimpleLayoutMenu*, CommonVerticalList*); + + bool isModeSelectEnd(void) const; + bool isChangeLanguage(void) const; + + void exeOptionTop(void); + void exeModeSelectSelecting(void); + void exeModeSelectSelectingByHelp(void); + void exeModeSelectConfirmYesNo(void); + void exeModeSelectConfirmEnd(void); + void exeConfig(void); + void exeDataManager(void); + void exeSaveDataSelecting(void); + void exeSaveDataConfirmYesNo(void); + void exeSaveDataSaving(void); + void exeSaveDataSaved(void); + void exeLoadDataSelecting(void); + void exeLoadDataConfirmNg(void); + void exeLoadDataConfirmYesNo(void); + void exeLoadDataSaving(void); + void exeDeleteDataSelecting(void); + void exeDeleteDataConfirmNg(void); + void exeDeleteDataConfirmYesNo(void); + void exeDeleteDataDeleting(void); + void exeDeleteDataDeleted(void); + void exeLanguageSetting(void); + void exeLanguageSettingConfirmYesNo(void); + void exeWaitEndDecideAnim(void); + void exeWaitEndDecideAnimAndAutoSave(void); + void exeWaitEndAutoSave(void); + void exeClose(void); + + void *field_0x28; + void *field_0x30; + void *field_0x38; + char *field_0x40; // stored with "RightIn" + char *field_0x48; // stored with "RightOut" + bool field_0x50; + unsigned char field_0x51[7]; + FooterParts *mFooterParts; + void *field_0x60; + SimpleLayoutMenu *field_0x68; + CommonVerticalList *field_0x70; + al::SimpleLayoutAppearWaitEnd *field_0x78; + CommonVerticalList *field_0x80; + SimpleLayoutMenu *field_0x88; + CommonVerticalList *field_0x90; + al::SimpleLayoutAppearWaitEnd *field_0x98; + FooterParts *field_0xa0; + SimpleLayoutMenu *field_0xa8; + CommonVerticalList *field_0xb0; + SimpleLayoutMenu *field_0xb8; + CommonVerticalList *field_0xc0; + SimpleLayoutMenu *field_0xc8; + void *field_0xd0; + al::WindowConfirmData *field_0xd8; + SimpleLayoutMenu *field_0xe0; + CommonVerticalList *field_0xe8; + void *field_0xf0; + void *field_0xf8; + void *field_0x100; + void *field_0x108; + void *field_0x110; + void *field_0x118; + void *field_0x120; + void *field_0x128; + void *field_0x130; + void *field_0x138; + int field_0x140; + int field_0x144; + SimpleLayoutMenu *field_0x148; + FooterParts *field_0x150; + CommonVerticalList *field_0x158; + al::WindowConfirm *field_0x160; + void *field_0x168; + al::Scene *mScene; + GameDataHolder *mDataHolder; + bool field_0x180; + al::MessageSystem *mMsgSystem; + InputSeparator *mInputSeperator; +}; \ No newline at end of file diff --git a/include/game/StageScene/StageSceneStatePauseMenu.h b/include/game/StageScene/StageSceneStatePauseMenu.h new file mode 100644 index 0000000..ecb7d05 --- /dev/null +++ b/include/game/StageScene/StageSceneStatePauseMenu.h @@ -0,0 +1,138 @@ +#pragma once + +#include "al/nerve/HostStateBase.h" +#include "al/layout/LayoutInitInfo.h" +#include "al/layout/SimpleLayoutAppearWaitEnd.h" +#include "al/scene/Scene.h" +#include "al/LiveActor/LiveActor.h" +#include "StageSceneLayout.h" +#include "StageSceneStateOption.h" + +#include "al/util.hpp" +#include "al/util/NerveUtil.h" + +#include "game/UI/MenuSelectParts.h" +#include "logger.hpp" + +class FooterParts; +class StageSceneStateStartSeparatePlay; +class StageSceneStateEndSeparatePlay; +class SceneAudioSystemPauseController; + +namespace al +{ + class WindowConfirm; + class KeyRepeatCtrl; + class WipeSimple; +} // namespace al + +class StageSceneStatePauseMenu : public al::HostStateBase { + public: + StageSceneStatePauseMenu(char const*,al::Scene *,al::SimpleLayoutAppearWaitEnd *,GameDataHolder *,al::SceneInitInfo const&,al::ActorInitInfo const&,al::LayoutInitInfo const&,al::WindowConfirm *,StageSceneLayout *,bool,SceneAudioSystemPauseController *); + ~StageSceneStatePauseMenu(); + + void appear(void); + void kill(void); + void killPauseMenu(void); + void killMarioModel(void); + void isNeedKillHost(void); + void startNormal(void); + void startAfterTitle(void); + void killAllOptionLayout(void); + void isEndToCancel(void); + void isEndToHelp(void); + void isLoadData(void); + void getSelectedFileId(void); + void isChangeLanguage(void); + void getLanguage(void); + void isNewGame(void); + void isModeSelectEnd(void); + void checkNeedKillByHostAndEnd(void); + void startActionMario(char const*); + void getMarioActor(void); + void isDrawLayout(void); + void isDrawLayoutMain(void); + void isDrawViewRenderer(void); + void isDrawChromakey(void); + void setNormal(void); + void appearMarioModel(void); + void updatePlayerPose(void); + void changeNerveAndReturn(al::Nerve const*); + void startPauseCamera(void); + void setAfterTitle(void); + + void exeAppear(void); + void exeWait(void); + void exeFadeBeforeHelp(void); + void exeStartHelp(void); + void exeWaitDraw(void); + void exeEnd(void); + void exeStartSeparatePlay(void); + void exeEndSeparatePlay(void); + void exeOption(void); + void exeSave(void); + void exeConfirmNewGame(void); + void exeNotExistEmptyFile(void); + + void exeServerConfig(void); + + al::SimpleLayoutAppearWaitEnd *field_0x20; // 0x20 + al::SimpleLayoutAppearWaitEnd *mMenuGuide; // 0x28 + al::SimpleLayoutAppearWaitEnd *mMenuRight; // 0x30 + FooterParts *mFooterParts; // 0x38 + MenuSelectParts *mSelectParts; // 0x40 + al::WipeSimple *mWipeSimple; // 0x48 + void *field_0x50; // 0x50 + int field_0x58; + int field_0x5c; + StageSceneStateStartSeparatePlay *mStateStartSeperatePlay; + StageSceneStateEndSeparatePlay *mStateEndSeperatePlay; + StageSceneStateOption *mStateOption; + al::LiveActor *mMarioHigh; + unsigned char field_0x80[39]; + GameDataHolder *mDataHolder; + void *field_0xb0; + al::WindowConfirm *field_0xb8; + void *field_0xc0; + al::KeyRepeatCtrl *field_0xc8; + StageSceneLayout *mStageSceneLyt; + int field_0xd8; + int field_0xdc; + ulong field_0xe0; + void *field_0xe8; +}; + +namespace { + NERVE_HEADER(StageSceneStatePauseMenu, Appear) + NERVE_HEADER(StageSceneStatePauseMenu, Wait) + NERVE_HEADER(StageSceneStatePauseMenu, FadeBeforeHelp) + NERVE_HEADER(StageSceneStatePauseMenu, StartHelp) + NERVE_HEADER(StageSceneStatePauseMenu, WaitDraw) + NERVE_HEADER(StageSceneStatePauseMenu, End) + NERVE_HEADER(StageSceneStatePauseMenu, StartSeparatePlay) + NERVE_HEADER(StageSceneStatePauseMenu, EndSeparatePlay) + NERVE_HEADER(StageSceneStatePauseMenu, Option) + NERVE_HEADER(StageSceneStatePauseMenu, Save) + NERVE_HEADER(StageSceneStatePauseMenu, ConfirmNewGame) + NERVE_HEADER(StageSceneStatePauseMenu, NotExistEmptyFile) + // custom nerves + NERVE_HEADER(StageSceneStatePauseMenu, ServerConfig) +} + +namespace { + NERVE_IMPL(StageSceneStatePauseMenu, Appear) + NERVE_IMPL(StageSceneStatePauseMenu, Wait) + NERVE_IMPL(StageSceneStatePauseMenu, FadeBeforeHelp) + NERVE_IMPL(StageSceneStatePauseMenu, StartHelp) + NERVE_IMPL(StageSceneStatePauseMenu, WaitDraw) + NERVE_IMPL(StageSceneStatePauseMenu, End) + NERVE_IMPL(StageSceneStatePauseMenu, StartSeparatePlay) + NERVE_IMPL(StageSceneStatePauseMenu, EndSeparatePlay) + NERVE_IMPL(StageSceneStatePauseMenu, Option) + NERVE_IMPL(StageSceneStatePauseMenu, Save) + NERVE_IMPL(StageSceneStatePauseMenu, ConfirmNewGame) + NERVE_IMPL(StageSceneStatePauseMenu, NotExistEmptyFile) + // custom nerves + NERVE_IMPL(StageSceneStatePauseMenu, ServerConfig) +} + diff --git a/include/game/StageScene/StageSceneStateServerConfig.hpp b/include/game/StageScene/StageSceneStateServerConfig.hpp new file mode 100644 index 0000000..cbcbe19 --- /dev/null +++ b/include/game/StageScene/StageSceneStateServerConfig.hpp @@ -0,0 +1,82 @@ +#pragma once + +#include "game/Input/InputSeparator.h" +#include "game/Layouts/CommonVerticalList.h" +#include "game/Layouts/SimpleLayoutMenu.h" +#include "al/message/MessageSystem.h" +#include "al/nerve/HostStateBase.h" +#include "al/message/IUseMessageSystem.h" +#include "al/layout/LayoutInitInfo.h" +#include "al/scene/Scene.h" +#include "al/util/NerveUtil.h" +#include "rs/util/InputUtil.h" + +#include "al/util.hpp" + +#include "game/GameData/GameDataHolder.h" + +#include "logger.hpp" +#include "server/gamemode/GameModeConfigMenu.hpp" + +class FooterParts; + +class StageSceneStateServerConfig : public al::HostStateBase, public al::IUseMessageSystem { + public: + StageSceneStateServerConfig(const char*, al::Scene*, const al::LayoutInitInfo&, + FooterParts*, GameDataHolder*, bool); + + enum ServerConfigOption { + GAMEMODECONFIG, + GAMEMODESWITCH, + RECONNECT, + SETIP + }; + + virtual al::MessageSystem* getMessageSystem(void) const override; + virtual void init(void) override; + virtual void appear(void) override; + virtual void kill(void) override; + + void exeMainMenu(); + void exeOpenKeyboard(); + void exeRestartServer(); + void exeGamemodeConfig(); + void exeGamemodeSelect(); + + void endSubMenu(); + + private: + + inline void subMenuStart(); + inline void subMenuUpdate(); + + al::MessageSystem* mMsgSystem = nullptr; + FooterParts* mFooterParts = nullptr; + GameDataHolder* mGameDataHolder = nullptr; + + InputSeparator *mInput = nullptr; + + SimpleLayoutMenu* mCurrentMenu = nullptr; + CommonVerticalList* mCurrentList = nullptr; + // Root Page, contains buttons for gamemode config, server reconnecting, and server ip address changing + SimpleLayoutMenu* mMainOptions = 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 + SimpleLayoutMenu* mModeSelect = nullptr; + CommonVerticalList* mModeSelectList = nullptr; + // Controls what shows up in specific gamemode config page + GameModeConfigMenu *mGamemodeConfigMenu = nullptr; + + bool mIsDecideConfig = false; +}; + +namespace { + NERVE_HEADER(StageSceneStateServerConfig, MainMenu) + NERVE_HEADER(StageSceneStateServerConfig, OpenKeyboard) + NERVE_HEADER(StageSceneStateServerConfig, RestartServer) + NERVE_HEADER(StageSceneStateServerConfig, GamemodeConfig) + NERVE_HEADER(StageSceneStateServerConfig, GamemodeSelect) +} \ No newline at end of file diff --git a/include/game/StaticInstances.h b/include/game/StaticInstances.h new file mode 100644 index 0000000..c8e7155 --- /dev/null +++ b/include/game/StaticInstances.h @@ -0,0 +1,2 @@ +// Header file to store static instances of classes +#pragma once \ No newline at end of file diff --git a/include/game/System/Application.h b/include/game/System/Application.h new file mode 100644 index 0000000..f64124f --- /dev/null +++ b/include/game/System/Application.h @@ -0,0 +1,13 @@ +#pragma once + +#include "GameFrameWorkNx.h" + +class Application { + public: + static const Application *sInstance; + + unsigned char padding_28[0x28]; + al::GameFrameworkNx *mFramework; // 0x28 +}; + +// const Application *Application::sInstance; \ No newline at end of file diff --git a/include/game/System/GameDrawInfo.h b/include/game/System/GameDrawInfo.h new file mode 100644 index 0000000..e278d8d --- /dev/null +++ b/include/game/System/GameDrawInfo.h @@ -0,0 +1,21 @@ +#pragma once + +//#include "agl/DrawContext.h" +#include "agl/RenderBuffer.h" + +namespace agl +{ + struct DrawContext; +} // namespace agl + + +namespace al +{ + class GameDrawInfo { + public: + agl::RenderBuffer *mFirstRenderBuffer; // 0x0 + agl::RenderBuffer *mSecondRenderBuffer; // 0x8 + bool unkBool; // 0x10 + agl::DrawContext *mDrawContext; // 0x18 + }; +} // namespace al diff --git a/include/game/System/GameFrameWorkNx.h b/include/game/System/GameFrameWorkNx.h new file mode 100644 index 0000000..c3574b1 --- /dev/null +++ b/include/game/System/GameFrameWorkNx.h @@ -0,0 +1,26 @@ +#pragma once + +#include "al/debug/GpuPerf.h" +#include "agl/DrawContext.h" +#include "agl/RenderBuffer.h" +#include "sead/framework/seadGameFramework.h" +#include "al/hio/HioNode.h" + +namespace al +{ + class GameFrameworkNx : public sead::GameFrameworkNx, public al::HioNode { + public: + unsigned char padding_198[0x198]; + agl::RenderBuffer *mCurRenderBuffer; // 0x198 + unsigned char padding_210[0x208 - 0x198]; + agl::DrawContext *mDrawContext; // 0x210 + agl::RenderBuffer *mFirstRenderBuffer; // 0x218 + void *unkPtr1; // 0x220 + agl::RenderBuffer *mSecondRenderBuffer; // 0x228 + unsigned char padding_248[0x18]; + al::GpuPerf *mGpuPerf; // 0x248 + unsigned char padding_268[0x18]; + bool unkBool; // 0x268 + bool unkBool2; // 0x269 + }; +} // namespace al diff --git a/include/game/System/GameSystem.h b/include/game/System/GameSystem.h new file mode 100644 index 0000000..c699b34 --- /dev/null +++ b/include/game/System/GameSystem.h @@ -0,0 +1,12 @@ +#pragma once + +#include "GameSystemInfo.h" +#include "al/nerve/NerveExecutor.h" + +class GameSystem : public al::NerveExecutor { + public: + void init(); + void *gap; + al::GameSystemInfo* mSystemInfo; // 0x18 + // 0x78 GameConfigData +}; \ No newline at end of file diff --git a/include/game/System/GameSystemInfo.h b/include/game/System/GameSystemInfo.h new file mode 100644 index 0000000..b187ac6 --- /dev/null +++ b/include/game/System/GameSystemInfo.h @@ -0,0 +1,44 @@ +#pragma once + +#include "GameFrameWorkNx.h" +#include "GameDrawInfo.h" + +namespace aal +{ + struct IAudioFrameProcess; +} // namespace aal + +namespace al +{ + struct NetworkSystem; + struct HtmlViewer; + struct EffectSystem; + struct LayoutSystem; + struct MessageSystem; + struct GamePadSystem; + struct AudioSystem; + struct WaveVibrationHolder; // :: aal::IAudioFrameProcess; +} // namespace al + +struct ProjectNfpDirector; +struct ApplicationMessageReceiver; +struct Application; + +namespace al { + class GameSystemInfo { + public: + void *gap1; + al::EffectSystem *mEffectSys; // 0x08 + al::LayoutSystem *mLayoutSys; // 0x10 + al::MessageSystem *mMessageSys; // 0x18 + al::NetworkSystem *mNetworkSys; // 0x20 + al::AudioSystem *mAudioSys; // 0x28 + al::GamePadSystem *mGamePadSys; // 0x30 + al::GameDrawInfo *mDrawInfo; // 0x38 from Application::sInstance + 0x30 + ProjectNfpDirector *mProjNfpDirector; // 0x48 + al::HtmlViewer *mHtmlViewer; // 0x50 + ApplicationMessageReceiver *mMessageReciever; // 0x58 + al::WaveVibrationHolder *mWaveVibrationHolder; // 0x60 + void *gap2; + }; +} \ No newline at end of file diff --git a/include/game/UI/MenuSelectParts.h b/include/game/UI/MenuSelectParts.h new file mode 100644 index 0000000..84c82aa --- /dev/null +++ b/include/game/UI/MenuSelectParts.h @@ -0,0 +1,58 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "al/layout/LayoutActor.h" +#include "al/nerve/NerveExecutor.h" +#include "al/layout/KeyRepeatCtrl.h" +#include "sead/container/seadPtrArray.h" + +#include "types.h" + +class MenuSelectParts : public al::NerveExecutor { + public: + MenuSelectParts(char const*,al::LayoutActor *,al::LiveActor *,al::LayoutInitInfo const&,int); + void update(void); + void appear(int); + void startActionPartsIllustSelectIndex(void); + void appearWait(void); + void setSelectMessage(int,char16_t const*); + bool isDecideContinue(void) const; + bool isDecideEnd(void) const; + bool isSelectContinue(void) const; + bool isDecideSetting(void) const; + bool isSelectSetting(void) const; + bool isDecideSave(void) const; + bool isSelectSave(void) const; + bool isDecideSeparatePlay(void) const; + bool isSelectSeparatePlay(void) const; + bool isDecideHelp(void) const; + bool isSelectHelp(void) const; + bool isDecideNewGame(void) const; + bool isSelectNewGame(void) const; + void calcPartsIndex(int); + void exeHide(void); + void exeAppear(void); + void startActionMarioSelectIndex(void); + void exeSelect(void); + void startActionMario(al::LiveActor *,char const*); + void exeDecideParts(void); + bool isInvalidSelect(void) const; + void exeDecideInterval(void); + void exeDecideEnd(void); + ~MenuSelectParts(); + + // void *vtable; + // void *unk1; // 0x08 + al::LayoutActor *mRootLayout; // 0x10 + int mMaxSelectParts; // 0x18 + int mCursorItemIdx; // 0x1C + sead::PtrArray mSelectParts; // 0x20-0x28 + al::LayoutActor *mCursorActor; // 0x30 + void *unk3; // 0x38 + al::LiveActor *mMarioHigh; // 0x40 + al::LiveActor *mCapEyes; // 0x48 + al::KeyRepeatCtrl *mKeyRepeatCtrl; // 0x50 + bool isMenuMain; // 0x58 +}; + +// static_assert(sizeof(MenuSelectParts) == 0x60); \ No newline at end of file diff --git a/include/game/WorldList/WorldList.h b/include/game/WorldList/WorldList.h new file mode 100644 index 0000000..ebc2dc1 --- /dev/null +++ b/include/game/WorldList/WorldList.h @@ -0,0 +1,10 @@ +#pragma once + +class WorldList { + public: + const char *getWorldDevelopName(int) const; + int tryFindWorldIndexByStageName(char const *stageName) const; + int getMoonRockScenarioNo(int worldId) const; + int findUseScenarioNo(const char *stageName) const; + bool checkIsMainStage(char const *stageName) const; +}; \ No newline at end of file diff --git a/include/game/WorldList/WorldResourceLoader.h b/include/game/WorldList/WorldResourceLoader.h new file mode 100644 index 0000000..14ceaf0 --- /dev/null +++ b/include/game/WorldList/WorldResourceLoader.h @@ -0,0 +1,7 @@ +#pragma once + +class WorldResourceLoader { + public: + void loadWorldResource(int,int,bool,char const *); + bool requestLoadWorldHomeStageResource(int worldIndex, int scenario); +}; \ No newline at end of file diff --git a/include/helpers.hpp b/include/helpers.hpp new file mode 100644 index 0000000..8e3bbd4 --- /dev/null +++ b/include/helpers.hpp @@ -0,0 +1,168 @@ +#pragma once + +#include +#include +#include "types.h" + +#include "sead/math/seadVector.h" +#include "sead/math/seadQuat.hpp" + +#include "al/util.hpp" + +#include "logger.hpp" +#include "puppets/PuppetInfo.h" + +#include "game/GameData/GameDataFunction.h" + +#define RAD(deg) (deg * (M_PI / 180)) // converts Degrees to Radians +#define DEG(rad) (rad * (180 / M_PI)) // converts Radians to Degrees +#define BTOC(bool) (bool ? "True" : "False") // converts boolean to true/false char +#define ACNT(arr) (sizeof(arr) / sizeof(arr[0])) // returns size of inputted array +// used to convert macro values to strings +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) + +bool isPartOf(const char* w1, const char* w2); + +int indexOf(char *w1, char c1); + +void logVector(const char* vectorName, sead::Vector3f vector); + +void logQuat(const char *quatName, sead::Quatf quat); + +sead::Vector3f QuatToEuler(sead::Quatf *quat); + +float vecMagnitude(sead::Vector3f const &input); + +float quatAngle(sead::Quatf const &q1, sead::Quatf &q2); + +bool isInCostumeList(const char *costumeName); + +const char *tryGetPuppetCapName(PuppetInfo *info); +const char* tryGetPuppetBodyName(PuppetInfo* info); + +const char* tryConvertName(const char* className); + +void killMainPlayer(al::LiveActor* actor); +void killMainPlayer(PlayerActorHakoniwa* mainPlayer); + +__attribute__((used)) static const char* costumeNames[] = { + "Mario", + "Mario64", + "Mario64Metal", + "MarioAloha", + "MarioArmor", + "MarioBone", + "MarioClown", + "MarioColorClassic", + "MarioColorGold", + "MarioColorLuigi", + "MarioColorWaluigi", + "MarioColorWario", + "MarioCook", + "MarioDiddyKong", + "MarioDoctor", + "MarioExplorer", + "MarioFootball", + "MarioGolf", + "MarioGunman", + "MarioHakama", + "MarioHappi", + "MarioKing", + "MarioKoopa", + "MarioMaker", + "MarioMechanic", + "MarioNew3DS", + "MarioPainter", + "MarioPeach", + "MarioPilot", + "MarioPirate", + "MarioPoncho", + "MarioPrimitiveMan", + "MarioSailor", + "MarioScientist", + "MarioShopman", + "MarioSnowSuit", + "MarioSpaceSuit", + "MarioSuit", + "MarioSwimwear", + "MarioTailCoat", + "MarioTuxedo", + "MarioUnderwear" +}; +// full costume list from 1.3 +// attribute otherwise the build log is spammed with unused warnings +// __attribute__((used)) static const char* costumeNames[] = { +// "Mario", "Mario3D", "Mario64", "Mario64Metal", "MarioAloha", "MarioArmor", +// // "MarioArmorWestern", // DLC +// "MarioBandman", +// // "MarioBatter", // DLC +// "MarioBone", "MarioCaptain", "MarioClown", "MarioColorClassic", "MarioColorGold", +// "MarioColorLuigi", "MarioColorWaluigi", "MarioColorWario", +// // "MarioConductor", // DLC +// "MarioCook", "MarioDiddyKong", "MarioDoctor", "MarioDot", "MarioDot3d", "MarioExplorer", +// "MarioFootball", "MarioGolf", "MarioGunman", "MarioHakama", "MarioHappi", +// // "MarioHariet", // DLC +// // "MarioHigh", +// "MarioKing", "MarioKoopa", "MarioMaker", "MarioMechanic", "MarioNew3DS", "MarioPainter", +// "MarioPeach", "MarioPilot", "MarioPirate", "MarioPoncho", "MarioPrimitiveMan", "MarioRacer", +// //"MarioRango", // DLC +// //"MarioRsv", // DLC +// "MarioSailor", "MarioSanta", +// // "MarioSatellite", // DLC +// "MarioScientist", "MarioShopman", "MarioSnowSuit", "MarioSpaceSuit", +// // "MarioSpewart", // DLC +// "MarioSuit", +// // "MarioSunshine", // DLC +// "MarioSwimwear", +// // "MarioTopper", // DLC +// "MarioTuxedo", +// // "MarioZombie" // DLC +// }; + +struct HackActorName { + const char *className; + const char *hackName; +}; + +// attribute otherwise the build log is spammed with unused warnings +__attribute__((used)) static HackActorName classHackNames[] = { + {"SenobiGeneratePoint", "Senobi"}, + {"KuriboPossessed", "Kuribo"}, + {"KillerLauncher", "Killer"}, + {"KillerLauncherMagnum", "KillerMagnum"}, + {"FireBrosPossessed", "FireBros"}, + {"HammerBrosPossessed", "HammerBros"}, + {"ElectricWire", "ElectricWireMover"}, + {"TRexSleep", "TRex"}, + {"TRexPatrol", "TRex"}, + {"WanwanBig", "Wanwan"}, // FIXME: this will make chain chomp captures always be the small + // variant for syncing + {"Koopa","KoopaHack"} +}; + +struct Transform +{ + sead::Vector3f *position; + sead::Quatf *rotation; +}; + +// From Boss Room Unity Example +class VisualUtils +{ + +public: + /* + * @brief Smoothly interpolates towards the parent transform. + * @param moveTransform The transform to interpolate + * @param targetTransform The transform to interpolate towards. + * @param timeDelta Time in seconds that has elapsed, for purposes of interpolation. + * @param closingSpeed The closing speed in m/s. This is updated by SmoothMove every time it is called, and will drop to 0 whenever the moveTransform has "caught up". + * @param maxAngularSpeed The max angular speed to to rotate at, in degrees/s. + */ + static float SmoothMove(Transform moveTransform, Transform targetTransform, float timeDelta, + float closingSpeed, float maxAngularSpeed); + + constexpr static const float k_MinSmoothSpeed = 0.1f; + constexpr static const float k_TargetCatchupTime = 0.2f; +}; \ No newline at end of file diff --git a/include/layouts/HideAndSeekIcon.h b/include/layouts/HideAndSeekIcon.h new file mode 100644 index 0000000..b704023 --- /dev/null +++ b/include/layouts/HideAndSeekIcon.h @@ -0,0 +1,36 @@ +#pragma once + +#include "al/layout/LayoutActor.h" +#include "al/layout/LayoutInitInfo.h" +#include "al/util/NerveUtil.h" + +#include "logger.hpp" +#include "server/gamemode/GameModeTimer.hpp" + +// TODO: kill layout if going through loading zone or paused + +class HideAndSeekIcon : public al::LayoutActor { + public: + HideAndSeekIcon(const char* name, const al::LayoutInitInfo& initInfo); + + void appear() override; + + bool tryStart(); + bool tryEnd(); + + void showHiding(); + void showSeeking(); + + void exeAppear(); + void exeWait(); + void exeEnd(); + + private: + struct HideAndSeekInfo *mInfo; +}; + +namespace { + NERVE_HEADER(HideAndSeekIcon, Appear) + NERVE_HEADER(HideAndSeekIcon, Wait) + NERVE_HEADER(HideAndSeekIcon, End) +} \ No newline at end of file diff --git a/include/layouts/NameTag.h b/include/layouts/NameTag.h new file mode 100644 index 0000000..19edc2a --- /dev/null +++ b/include/layouts/NameTag.h @@ -0,0 +1,45 @@ +#pragma once + +#include "al/layout/LayoutActor.h" +#include "al/util/NerveUtil.h" +#include "al/util/LayoutUtil.h" +#include "al/util/LiveActorUtil.h" +#include "al/util/MathUtil.h" + +class PuppetActor; + +class NameTag : public al::LayoutActor { +public: + NameTag(PuppetActor*, const al::LayoutInitInfo&, float startDist, float endDist, const char *playerName); + + void appear(void) override; + void control(void) override; + void updateTrans(void); + void update(void); + void end(void); + void setText(char const*); + + bool isNearPlayerActor(float) const; + bool isVisible() const; + + const char *getCurrentState(); + + void exeAppear(void); + void exeWait(void); + void exeEnd(void); + void exeHide(void); + + PuppetActor *mPuppet; // 0x130 + const char *mPaneName; // 0x138 + float mStartDist; // 0x140 + float mEndDist; // 0x144 + float mNormalizedDist; // 0x148 + +}; + +namespace { +NERVE_HEADER(NameTag, Appear) +NERVE_HEADER(NameTag, Wait) +NERVE_HEADER(NameTag, End) +NERVE_HEADER(NameTag, Hide) +} // namespace \ No newline at end of file diff --git a/include/logger.hpp b/include/logger.hpp new file mode 100644 index 0000000..b88cbb7 --- /dev/null +++ b/include/logger.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "SocketBase.hpp" +#include "types.h" + +class Logger : public SocketBase { + public: + Logger(const char* ip, u16 port, const char* name) : SocketBase(name) { + this->init(ip, port); + }; + nn::Result init(const char* ip, u16 port) override; + + static void createInstance(); + static void setLogName(const char *name) { if(sInstance) sInstance->setName(name); } + static void log(const char* fmt, ...); + static void log(const char* fmt, va_list args); + + static void enableName() { if(sInstance) sInstance->isDisableName = false; } + static void disableName() { if(sInstance) sInstance->isDisableName = true; } + + int read(char *out); + bool pingSocket(); + + private: + static Logger* sInstance; + bool isDisableName; +}; \ No newline at end of file diff --git a/include/main.hpp b/include/main.hpp new file mode 100644 index 0000000..7b82e89 --- /dev/null +++ b/include/main.hpp @@ -0,0 +1,75 @@ +#include "al/LiveActor/LiveActor.h" +#include "al/camera/CameraTicket.h" +#include "al/util.hpp" +#include "al/layout/LayoutActor.h" +#include "al/layout/LayoutKit.h" +#include "al/gamepad/util.h" +#include "al/camera/CameraPoser.h" +#include "al/camera/alCameraPoserFunction.h" +#include "al/factory/ProjectActorFactory.h" +#include "al/area/AreaObjGroup.h" +#include "al/actor/DemoActor.h" +#include "al/area/ChangeStageInfo.h" + +#include "game/StageScene/StageScene.h" +#include "game/Layouts/CoinCounter.h" +#include "game/Player/PlayerFunction.h" +#include "game/Player/PlayerCameraTarget.h" +#include "game/Player/PlayerAnimControlRun.h" +#include "game/Player/PlayerFactory.h" +#include "game/Player/PlayerCostumeInfo.h" +#include "game/Controller/ControllerAppletFunction.h" +#include "game/GameData/GameDataHolderWriter.h" +#include "game/GameData/GameDataFunction.h" +#include "game/Actors/Shine.h" +#include "game/HakoniwaSequence/HakoniwaSequence.h" +#include "game/UI/MenuSelectParts.h" +#include "game/StageScene/StageSceneStateServerConfig.hpp" +#include "game/System/Application.h" + +#include "rs/util.hpp" +#include "rs/util/SensorUtil.h" + +#include "sead/math/seadVector.h" +#include "sead/math/seadMatrix.h" +#include "sead/prim/seadSafeString.hpp" +#include "sead/gfx/seadCamera.h" +#include "sead/basis/seadNew.h" +#include "sead/gfx/seadColor.h" +#include "types.h" + +#include "agl/DrawContext.h" +#include "agl/RenderBuffer.h" +#include "agl/utl.h" + +#include "nn/swkbd/swkbd.h" + +#include "helpers.hpp" +#include "logger.hpp" +#include "server/Client.hpp" +#include "debugMenu.hpp" +#include "Keyboard.hpp" +#include "server/DeltaTime.hpp" + +static const int playBufSize = 8; + +static bool isInGame = false; + +static bool debugMode = false; + +constexpr const char* captureNames[] = { + "AnagramAlphabetCharacter", "Byugo", "Bubble", "Bull", "Car", "ElectricWire", + "KillerLauncherMagnum", "KuriboPossessed", + "WanwanBig", // has sub-actors + "KillerLauncher", "Koopa", + "Wanwan", // has sub-actors + "Pukupuku", "PukupukuSnow", + "Gamane", // has sub-actors + "FireBrosPossessed", "PackunFire", "Frog", "Kakku", "Hosui", "HammerBrosPossessed", "Megane", + "KaronWing", "KuriboWing", "PackunPoison", "Radicon", "Tank", "Tsukkun", "TRex", "TRexSleep", + "TRexPatrol", + // "Yukimaru", (is a player actor) + "Imomu", "SenobiGeneratePoint" + // "HackFork", + // "Yoshi" (is a player actor) +}; \ No newline at end of file diff --git a/include/nn.h b/include/nn.h new file mode 100644 index 0000000..fcd8d4a --- /dev/null +++ b/include/nn.h @@ -0,0 +1,12 @@ + +#pragma once + +#include "nn/result.h" +#include "nn/util.h" +#include "nn/os.h" +#include "nn/fs.h" +#include "nn/diag.h" +#include "nn/nifm.h" +#include "nn/settings.h" +#include "nn/err.h" +#include "nn/socket.h" \ No newline at end of file diff --git a/include/nn/account.h b/include/nn/account.h new file mode 100644 index 0000000..1f05d2f --- /dev/null +++ b/include/nn/account.h @@ -0,0 +1,82 @@ +/** + * @file account.h + * @brief Account service implementation. + */ + +#pragma once + +#include "os.h" +#include "types.h" + +#include "logger.hpp" + +namespace nn +{ + namespace account + { + // typedef char Nickname[0x21]; + // typedef u64 Uid[0x2]; + + struct Nickname { + char name[0x21] = {}; + }; + struct Uid { + char data[0x10] = {}; + + bool operator==(const Uid &rhs) const { + return memcmp(data, rhs.data, 0x10) == 0; + } + + Uid& operator=(const Uid& other) + { + memcpy(this->data, other.data, 0x10); + return *this; + } + + inline void print() { + Logger::log("Player ID: 0x"); + Logger::disableName(); + for (size_t i = 0; i < 0x10; i++) { Logger::log("%02X", data[i]); } + Logger::log("\n"); + Logger::enableName(); + } + + inline void print(const char *prefix) { + Logger::log("%s: 0x", prefix); + Logger::disableName(); + for (size_t i = 0; i < 0x10; i++) { Logger::log("%02X", data[i]); } + Logger::log("\n"); + Logger::enableName(); + } + }; + + typedef u64 NetworkServiceAccountId; + + class AsyncContext; + struct UserHandle; + + void Initialize(); + Result ListAllUsers(s32 *, nn::account::Uid *, s32 numUsers); + Result OpenUser(nn::account::UserHandle *, nn::account::Uid const &); + Result IsNetworkServiceAccountAvailable(bool *out, nn::account::UserHandle const &); + void CloseUser(nn::account::UserHandle const &); + + Result EnsureNetworkServiceAccountAvailable(nn::account::UserHandle const &userHandle); + Result EnsureNetworkServiceAccountIdTokenCacheAsync(nn::account::AsyncContext *, nn::account::UserHandle const &); + Result LoadNetworkServiceAccountIdTokenCache(u64 *, char *, u64, nn::account::UserHandle const &); + + Result GetLastOpenedUser(nn::account::Uid *); + Result GetNickname(nn::account::Nickname *nickname, nn::account::Uid const &userID); + + class AsyncContext + { + public: + AsyncContext(); + + Result HasDone(bool *); + Result GetResult(); + Result Cancel(); + Result GetSystemEvent(nn::os::SystemEvent *); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/atk.h b/include/nn/atk.h new file mode 100644 index 0000000..0c6c310 --- /dev/null +++ b/include/nn/atk.h @@ -0,0 +1,21 @@ +#pragma once + +#include "types.h" + +namespace nn { namespace atk { + +class SoundArchive +{ +public: + const char* GetItemLabel(u32 id) const; + u32 GetItemId(char const* label) const; +}; + +class SoundActor // Inherits SoundStartable, size: 0x7C +{ +public: + virtual ~SoundActor(); + u8 data[0x7C-0x4]; +}; + +} } diff --git a/include/nn/atk/SoundArchivePlayer.h b/include/nn/atk/SoundArchivePlayer.h new file mode 100644 index 0000000..d35bff7 --- /dev/null +++ b/include/nn/atk/SoundArchivePlayer.h @@ -0,0 +1,40 @@ +/** + * @file SoundArchivePlayer.h + * @brief Basic sound player from a sound archive. + */ + +#pragma once + +#include "detail/AdvancedWaveSoundRuntime.h" +#include "detail/SequenceSoundRuntime.h" +#include "detail/SoundArchiveManager.h" +#include "detail/StreamSoundRuntime.h" +#include "detail/WaveSoundRuntime.h" + +namespace nn +{ + namespace atk + { + class SoundArchivePlayer + { + public: + SoundArchivePlayer(); + + virtual ~SoundArchivePlayer(); + + bool IsAvailable() const; + void Finalize(); + void StopAllSound(s32, bool); + void DisposeInstances(); + + nn::atk::detail::SoundArchiveManager mArchiveManager; // _8 + nn::atk::detail::SequenceSoundRuntime mSeqSoundRuntime; // _50 + nn::atk::detail::WaveSoundRuntime mWaveSoundRuntime; // _130 + nn::atk::detail::AdvancedWaveSoundRuntime mAdvancedWaveSound; // _1B0 + nn::atk::detail::StreamSoundRuntime mStreamSoundRuntime; // _1E0 + u64 _290; + u32 _298; + u8 _29C[0x2E8-0x29C]; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/atk/SoundDataManager.h b/include/nn/atk/SoundDataManager.h new file mode 100644 index 0000000..2ca0be8 --- /dev/null +++ b/include/nn/atk/SoundDataManager.h @@ -0,0 +1,28 @@ +/** + * @file SoundDataManager.h + * @brief Sound data management implementation. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace atk + { + class SoundDataManager + { + public: + SoundDataManager(); + virtual ~SoundDataManager(); + + virtual void InvalidateData(void const *, void const *); + virtual void SetFileAddressToTable(u32, void const *); + virtual u64 GetFileAddressFromTable(u32) const; + virtual u32 GetFileAddressImpl(u32) const; + + u8 _0[0x240]; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/atk/SoundPlayer.h b/include/nn/atk/SoundPlayer.h new file mode 100644 index 0000000..d77103b --- /dev/null +++ b/include/nn/atk/SoundPlayer.h @@ -0,0 +1,60 @@ +/** + * @file SoundPlayer.h + * @brief Sound player. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace atk + { + enum PauseMode + { + + }; + + class SoundPlayer + { + public: + SoundPlayer(); + ~SoundPlayer(); + + void StopAllSound(s32); + void Update(); + void DoFreePlayerHeap(); + void detail_SortPriorityList(bool); + void PauseAllSound(s32, bool); + void PauseAllSound(bool, s32, nn::atk::PauseMode); + void SetVolume(f32 vol); + void SetLowPassFilterFrequency(f32 filterFreq); + void SetBiquadFilter(s32 filterType, f32 baseFreq); + void SetDefaultOutputLine(u32 line); + + void detail_SetPlayableSoundLimit(s32 limit); + bool CanPlaySound(s32); + + u64 _0; + u64 _8; + u64 _10; + u64 _18; + u64 _20; + u64 _28; + u64 _30; + u64 _38; + s32 _40; + s32 mPlayableSoundCount; // _44 + s32 _48; + f32 mVolume; // _4C + f32 mLowPassFreq; // _50 + s32 mFilterType; // _54 + f32 mBaseFreq; // _58 + u32 mDefaultOutputLine; // _5C + f32 mOutputVolume; // _60 + u64 _64; + u64 _6C; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/atk/detail/AdvancedWaveSoundRuntime.h b/include/nn/atk/detail/AdvancedWaveSoundRuntime.h new file mode 100644 index 0000000..b78860a --- /dev/null +++ b/include/nn/atk/detail/AdvancedWaveSoundRuntime.h @@ -0,0 +1,32 @@ +/** + * @file AdvancedWaveSoundRuntime.h + * @brief Runtime wave sound api. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace atk + { + namespace detail + { + class AdvancedWaveSoundRuntime + { + public: + AdvancedWaveSoundRuntime(); + ~AdvancedWaveSoundRuntime(); + + void Initialize(s32, void **, void const *); + void Finalize(); + s32 GetActiveCount() const; + void SetupUserParam(void **, u64); + void Update(); + + u8 _0[0x30]; + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/atk/detail/BasicSound.h b/include/nn/atk/detail/BasicSound.h new file mode 100644 index 0000000..04090b0 --- /dev/null +++ b/include/nn/atk/detail/BasicSound.h @@ -0,0 +1,143 @@ +/** + * @file BasicSound.h + * @brief A basic sound. + */ + +#pragma once + +#include "types.h" +#include "nn/atk/SoundPlayer.h" + +namespace nn +{ + namespace atk + { + class SoundActor; + + enum MixMode + { + + }; + + namespace detail + { + class PlayerHeap; + class ExternalSoundPlayer; + + class BasicSound + { + public: + BasicSound(); + virtual ~BasicSound(); + + virtual void Initialize(); + virtual void Finalize(); + virtual bool IsPrepared() const = 0; + virtual bool IsAttachedTempSpecialHandle() = 0; + virtual void DetachTempSpecialHandle() = 0; + virtual void OnUpdatePlayerPriority(); + virtual void UpdateMoveValue(); + virtual void OnUpdateParam(); + + void SetPriority(s32, s32); + void GetPriority(s32 *, s32 *) const; + void ClearIsFinalizedForCannotAllocatedResourceFlag(); + void SetId(u32 newID); + bool IsAttachedGeneralHandle(); + void DetachGeneralHandle(); + bool IsAttachedTempGeneralHandle(); + void DetachTempGeneralHandle(); + void StartPrepared(); + void Stop(s32); + void SetPlayerPriority(s32); + void ForceStop(); + void Pause(bool, s32); + void Mute(bool, s32); + void SetAutoStopCounter(s32); + void FadeIn(s32); + bool IsPause() const; + bool IsMute() const; + void Update(); + void UpdateParam(); + void UpdateMoveValue(); + void CalculateVolume() const; + f32 CalculatePitch() const; + f32 CalculateLpfFrequency() const; + u32 CalculateOutLineFlag() const; + void CalculateBiquadFilter(s32 *, f32 *) const; + void AttachPlayerHeap(nn::atk::detail::PlayerHeap *); + void DetachPlayerHeap(nn::atk::detail::PlayerHeap *); + void AttachSoundPlayer(nn::atk::SoundPlayer *); + void DetachSoundPlayer(nn::atk::SoundPlayer *); + void AttachSoundActor(nn::atk::SoundActor *); + void DetachSoundActor(nn::atk::SoundActor *); + void AttachExternalSoundPlayer(nn::atk::detail::ExternalSoundPlayer *); + void DetachExternalSoundPlayer(nn::atk::detail::ExternalSoundPlayer *); + u32 GetRemainingFadeFrames() const; + u32 GetRemainingPauseFadeFrames() const; + u32 GetRemainingMuteFadeFrames() const; + void SetInitialVolume(f32 vol); + f32 GetInitialVolume() const; + void SetVolume(f32, s32); + s32 GetVolume() const; + void SetPitch(f32); + f32 GetPitch() const; + void SetLpfFreq(f32); + f32 GetLpfFreq() const; + void SetBiquadFilter(s32, f32); + void GetBiquadFilter(s32 *, f32 *) const; + void SetOutputLine(u32); + u32 GetOutputLine() const; + void ResetOutputLine(); + void SetMixMode(nn::atk::MixMode); + nn::atk::MixMode GetMixMode(); + void SetPan(f32); + f32 GetPan() const; + void SetSurroundPan(f32); + f32 GetSurroundPan() const; + void SetMainSend(f32); + f32 GetMainSend() const; + + u64* _8; // nn::atk::detail::PlayerHeap* + u64* _10; // nn::atk::SoundHandle* + u64* _18; // nn::atk::SoundHandle* + nn::atk::SoundPlayer* mSoundPlayer; // _20 + u64* _28; // nn::atk::SoundActor* + u64* _30; // nn::atk::detail::ExternalSoundPlayer* + u64* _38; // nn::atk::SoundArchive* + u8 _40[0xF0-0x40]; + s32 mPriority; // _F0 + u32 _F4; + u32 _F8; + s32 mAutoStopCounter; // _FC + u64 _100; + u32 mID; // _108 + u32 _10C; + u32 _110; + u32 _114; + f32 mInitialVolume; // _118 + f32 mPitch; // _11C + f32 mLpfFreq; // _120 + f32 _124; + u32 mOutputLine; // _128 + f32 _12C; + f32 mVolume; // _130 + u32 _134; + u32 _138; + nn::atk::MixMode mMixMode; // _13C + f32 mPan; // _140 + f32 mSurroundPan; // _144 + f32 mMainSend; // _148 + u8 _14C[0x158-0x14C]; + f32 mOutputVol; // _158 + u8 _15C[0x190-0x15C]; + f32 mOutputPan; // _190 + f32 mOutputSurroundPan; // _194 + f32 mOutputMainSend; // _198 + f32 mOutputFxSend; // _19C + + static u64 g_LastInstanceId; + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/atk/detail/SequenceSoundRuntime.h b/include/nn/atk/detail/SequenceSoundRuntime.h new file mode 100644 index 0000000..735ad2b --- /dev/null +++ b/include/nn/atk/detail/SequenceSoundRuntime.h @@ -0,0 +1,41 @@ +/** + * @file SequenceSoundRuntime.h + * @brief Sequenced Sound Runtime Info + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace atk + { + namespace detail + { + class SoundArchiveManager; + + class SequenceSoundRuntime + { + public: + SequenceSoundRuntime(); + ~SequenceSoundRuntime(); + + void Initialize(s32, void **, void const *); + void Finalize(); + void SetupSequenceTrack(s32, void **, void const *); + void SetupUserParam(void **, u64); + bool IsSoundArchiveAvailable() const; + s32 GetActiveCount() const; + s32 GetFreeCount() const; + void SetSequenceSkipIntervalTick(s32 tick); + s32 GetSequenceSkipIntervalTick(); + void Update(); + + u8 _0[0xD0]; + nn::atk::detail::SoundArchiveManager* mArchiveManager; // _D0 + u64 _D8; + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/atk/detail/SoundArchiveManager.h b/include/nn/atk/detail/SoundArchiveManager.h new file mode 100644 index 0000000..59d010e --- /dev/null +++ b/include/nn/atk/detail/SoundArchiveManager.h @@ -0,0 +1,46 @@ +/** + * @file SoundArchiveManager.h + * @brief Sound archive manager implementation. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace atk + { + class SoundHandle; + class SoundArchive; + class SoundDataManager; + + namespace detail + { + class AddonSoundArchiveContainer; + + class SoundArchiveManager + { + public: + SoundArchiveManager(); + + virtual ~SoundArchiveManager(); + + void Initialize(nn::atk::SoundArchive const *, nn::atk::SoundDataManager const *); + void ChangeTargetArchive(char const *); + void Finalize(); + bool IsAvailable() const; + nn::atk::detail::AddonSoundArchiveContainer* GetAddonSoundArchive(char const *) const; + + u64 _8; + u64* _10; + nn::atk::detail::AddonSoundArchiveContainer* _18; + u64* _20; + nn::atk::SoundArchive* mSoundArchive; // _28 + u64 _30; + u64 _38; + u64 _40; + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/atk/detail/StreamSoundRuntime.h b/include/nn/atk/detail/StreamSoundRuntime.h new file mode 100644 index 0000000..9873a57 --- /dev/null +++ b/include/nn/atk/detail/StreamSoundRuntime.h @@ -0,0 +1,26 @@ +/** + * @file StreamSoundRuntime.h + * @brief Stream sound runtime information. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace atk + { + namespace detail + { + class StreamSoundRuntime + { + public: + StreamSoundRuntime(); + ~StreamSoundRuntime(); + + u8 _0[0xB0]; + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/atk/detail/WaveSoundRuntime.h b/include/nn/atk/detail/WaveSoundRuntime.h new file mode 100644 index 0000000..5c6db84 --- /dev/null +++ b/include/nn/atk/detail/WaveSoundRuntime.h @@ -0,0 +1,33 @@ +/** + * @file WaveSoundRuntime.h + * @brief Wave sound runtime info. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace atk + { + namespace detail + { + class WaveSoundRuntime + { + public: + WaveSoundRuntime(); + ~WaveSoundRuntime(); + + void Initialize(s32, void **, void const *); + void Finalize(); + s32 GetActiveCount() const; + s32 GetFreeWaveSoundCount() const; + void SetupUserParam(void **, u64); + void Update(); + + u8 _0[0x80]; + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/audio.h b/include/nn/audio.h new file mode 100644 index 0000000..8d992fd --- /dev/null +++ b/include/nn/audio.h @@ -0,0 +1,49 @@ +/** + * @file audio.h + * @brief Audio implementation. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace audio + { + struct AudioRendererConfig + { + u64* _0; + u64* _8; + u64* _10; + u64* _18; + u64* _20; + u64* _28; + u64* _30; + u64* _38; + u64* _40; + u64* _48; + u64* _50; + }; + + struct DelayType + { + u64* _0; + }; + + struct FinalMixType + { + u64* _0; + }; + + struct SubMixType + { + u64* _0; + }; + + void SetDelayInputOutput(nn::audio::DelayType *, s8 const *, s8 const *, s32); + void* RemoveDelay(nn::audio::AudioRendererConfig *, nn::audio::DelayType *, nn::audio::FinalMixType *); + void* RemoveDelay(nn::audio::AudioRendererConfig *, nn::audio::DelayType *, nn::audio::SubMixType *); + bool IsDelayRemoveable(nn::audio::DelayType *); + }; +}; \ No newline at end of file diff --git a/include/nn/crypto.h b/include/nn/crypto.h new file mode 100644 index 0000000..6702114 --- /dev/null +++ b/include/nn/crypto.h @@ -0,0 +1,89 @@ +/** + * @file crypto.h + * @brief Crypto service implementation. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace crypto + { + class Sha256Context; + + void DecryptAes128Cbc(void *, u64, void const *, u64, void const *, u64, void const *, u64); + void EncryptAes128Cbc(void *, u64, void const *, u64, void const *, u64, void const *, u64); + void DecryptAes128Ccm(void *, u64, void *, u64, void const *, u64, void const *, u64, void const *, u64, void const *, u64, u64); + + namespace detail + { + class Md5Impl + { + public: + void Initialize(); + void Update(void const *, u64 dataSize); + void ProcessBlock(); + void GetHash(void *, u64 hashSize); + void ProcessLastBlock(); + + u32 _0; + u32 _4; + u32 _8; + u32 _C; + u8 _10[0x50-0x10]; + u64 _50; + u32 _58; + }; + + class Sha1Impl + { + public: + void Initialize(); + void Update(void const *, u64); + void ProcessBlock(void const *); + void GetHash(void *destHash, u64); + void ProcessLastBlock(); + + u64 _0; + u64 _8; + u32 _10; + u128 _14; + u128 _24; + u128 _34; + u32 _44; + u64 _48; + u64 _50; + u64 _58; + u64 _60; + }; + + class Sha256Impl + { + public: + void Initialize(); + void Update(void const *, u64); + void ProcessBlocks(u8 const *, u64); + void GetHash(void *destHash, u64); + void ProcessLastBlock(); + void InitializeWithContext(nn::crypto::Sha256Context const *); + void GetContext(nn::crypto::Sha256Context *) const; + + u64 _0; + u64 _8; + u32 _10; + u128 _14; + u128 _24; + u128 _34; + u32 _44; + u64 _48; + u64 _50; + u64 _58; + u64 _60; + u64 _68; + u32 _70; + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/diag.h b/include/nn/diag.h new file mode 100644 index 0000000..c1acefa --- /dev/null +++ b/include/nn/diag.h @@ -0,0 +1,18 @@ +#pragma once + +#include "types.h" + +namespace nn { namespace diag { + +struct ModuleInfo +{ + const char* path; + u32 base; + u32 size; +}; + +u32 GetAllModuleInfo(ModuleInfo** outModuleInfos, void* buffer, u32 bufferLen); +u32 GetRequiredBufferSizeForGetAllModuleInfo(); +u32 GetModulePath(char* outName, u32 nameLenMax, u32 address); + +} } diff --git a/include/nn/err.h b/include/nn/err.h new file mode 100644 index 0000000..f2b1a8c --- /dev/null +++ b/include/nn/err.h @@ -0,0 +1,22 @@ +#pragma once + +#include "result.h" +#include "settings.h" + +namespace nn { namespace err { + +class ApplicationErrorArg +{ +public: + ApplicationErrorArg(); + ApplicationErrorArg(u32 code, const char* str1, const char* str2, const nn::settings::LanguageCode& languageCode); + + u8 data[0x1014]; +}; + +void ShowError(Result result); +void ShowApplicationError(const ApplicationErrorArg& arg); +void ShowUnacceptableApplicationVersionError(); +void ShowUnacceptableAddOnContentVersionError(); + +} } diff --git a/include/nn/friends.h b/include/nn/friends.h new file mode 100644 index 0000000..a46580f --- /dev/null +++ b/include/nn/friends.h @@ -0,0 +1,44 @@ +/** + * @file friends.h + * @brief Friend implementation. + */ + +#pragma once + +#include "account.h" +#include "os.h" + +namespace nn +{ + namespace friends + { + typedef char Url[0xA0]; + + class AsyncContext; + class Profile; + + void Initialize(); + Result GetProfileList(nn::friends::AsyncContext* context, nn::friends::Profile* profiles, nn::account::Uid const &userID, nn::account::NetworkServiceAccountId const *accountIDs, s32 numAccounts); + + class Profile + { + public: + Profile(); + + nn::account::NetworkServiceAccountId GetAccountId() const; + nn::account::Nickname& GetNickname() const; + bool IsValid() const; + Result GetProfileImageUrl(nn::friends::Url *, s32); + }; + + class AsyncContext + { + public: + AsyncContext(); + ~AsyncContext(); + + Result GetSystemEvent(nn::os::SystemEvent *); + Result GetResult() const; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/fs.h b/include/nn/fs.h new file mode 100644 index 0000000..2df8217 --- /dev/null +++ b/include/nn/fs.h @@ -0,0 +1,91 @@ +#pragma once + +#include "result.h" + +namespace nn { namespace fs { + +const s32 PathLengthMax = 0x300; + +struct FileHandle +{ + u32 handle; +}; + +struct DirectoryHandle +{ + u32 handle; +}; + +struct DirectoryEntry +{ + char name[PathLengthMax+1]; // 0 + char _301[3]; // 301 + u8 type; // 304 + s64 fileSize; // 308 +}; + +enum OpenMode +{ + OpenMode_Read = 1 << 0, + OpenMode_Write = 1 << 1, + OpenMode_ReadWrite = OpenMode_Read | OpenMode_Write +}; + +enum DirectoryMode +{ + DirectoryMode_Directories = 1 << 0, + DirectoryMode_Files = 1 << 1, + DirectoryMode_DirectoriesFiles = DirectoryMode_Directories | DirectoryMode_Files +}; + +enum DirectoryEntryType +{ + DirectoryEntryType_Directory = 0, + DirectoryEntryType_File = 1 +}; + +struct ReadOption +{ + ReadOption(u32 flags = 0) : flags(flags) { } + u32 flags; +}; + +struct WriteOption +{ + enum Flags + { + Flush = 1 + }; + + WriteOption(u32 flags = 0) : flags(flags) { } + u32 flags; +}; + + +Result OpenFile(FileHandle* out, const char* path, s32 mode); +void CloseFile(FileHandle handle); +Result ReadFile(FileHandle handle, s64 offset, void* buffer, u32 size); +Result ReadFile(FileHandle handle, s64 offset, void* buffer, u32 size, const ReadOption& options); +Result WriteFile(FileHandle handle, s64 offset, const void* buffer, u32 size, const WriteOption& options = WriteOption(0)); +Result FlushFile(FileHandle handle); +Result GetFileSize(s64* out, FileHandle handle); +Result SetFileSize(FileHandle handle, s64 size); + +Result CreateFile(const char* path, s64 size); +Result DeleteFile(const char* path); +Result RenameFile(const char* path, const char* newPath); + +Result OpenDirectory(DirectoryHandle* out, const char* path, s32 mode); +void CloseDirectory(DirectoryHandle handle); +Result ReadDirectory(s64* out, DirectoryEntry* entries, DirectoryHandle handle, s64 maxEntryCount); +Result GetDirectoryEntryCount(s64* out, DirectoryHandle handle); + +Result CreateDirectory(char const* path); +Result DeleteDirectory(const char* path); +Result DeleteDirectoryRecursively(const char* path); +Result RenameDirectory(const char* path, const char* newPath); + +Result MountSdCard(const char* mountPoint); +void Unmount(const char* mountPoint); + +} } diff --git a/include/nn/g3d.h b/include/nn/g3d.h new file mode 100644 index 0000000..436bfd7 --- /dev/null +++ b/include/nn/g3d.h @@ -0,0 +1,3 @@ +#pragma once + +#include \ No newline at end of file diff --git a/include/nn/g3d/BindFuncTable.h b/include/nn/g3d/BindFuncTable.h new file mode 100644 index 0000000..225d3f2 --- /dev/null +++ b/include/nn/g3d/BindFuncTable.h @@ -0,0 +1,18 @@ +#pragma once + +#include "types.h" + +namespace nn +{ + namespace g3d + { + struct BindFuncTable + { + u64 _0; + u32 _8; + u32 _C; + u64 _10; + u64 _18; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/g3d/ResFile.h b/include/nn/g3d/ResFile.h new file mode 100644 index 0000000..cf2da25 --- /dev/null +++ b/include/nn/g3d/ResFile.h @@ -0,0 +1,69 @@ +/** + * @file ResFile.h + * @brief Resource file for models. + */ + +#pragma once + +#include "types.h" +#include "nn/gfx/api.h" +#include "nn/gfx/device.h" +#include "nn/gfx/memory.h" +#include "nn/util.h" + +#include "ResMaterialAnim.h" +#include "ResModel.h" +#include "ResSceneAnim.h" +#include "ResShapeAnim.h" + +namespace nn +{ + namespace g3d + { + typedef void* TextureRef; + + class ResFile : public nn::util::BinaryFileHeader + { + public: + static bool IsValid(void const *modelSrc); + void Relocate(); + void Unrelocate(); + static nn::g3d::ResFile* ResCast(void *); + s32 BindTexture(nn::g3d::TextureRef (*ref)(char const *, void *), void *); + void ReleaseTexture(); + void Setup(nn::gfx::TDevice, nn::gfx::ApiVersion<8>>> *); + void Setup(nn::gfx::TDevice,nn::gfx::ApiVersion<8>>> *, nn::gfx::TMemoryPool, nn::gfx::ApiVersion<8>>> *, s64, u64); + void Cleanup(nn::gfx::TDevice, nn::gfx::ApiVersion<8>>> *); + void Reset(); + + u64 mFileNameLength; // _20 + nn::g3d::ResModel* mModels; // _28 + u64 mModelDictOffset; // _30 + u64 mSkeleAnimOffset; // _38 + u64 mSkeleAnimDictOffset; // _40 + nn::g3d::ResMaterialAnim* mMatAnims; // _48 + u64 mMatAnimsDictOffset; // _50 + u64 mBoneVisiOffset; // _58 + u64 mBoneVisiDictOffset; // _60 + nn::g3d::ResShapeAnim* mShapeAnims; // _68 + u64 mShapeAnimDictOffset; // _70 + nn::g3d::ResSceneAnim* mSceneAnims; // _78 + u64 mSceneAnimDictOffset; // _80 + u64 mMemoryPool; // _88 + u64 mBufferSection; // _90 + u64 mEmbeddedFilesOffset; // _98 + u64 mEmbeddedFilesDictOffset; // _A0 + u64 mPadding; // _A8 + u64 mStrTableOffset; // _B0 + u32 mStrTableSize; // _B8 + u16 mModelCount; // _BC + u16 mSkeleAnimCount; // _BE + u16 mMatAnimCount; // _C0 + u16 mBoneAnimCount; // _C2 + u16 mShapeAnimCount; // _C4 + u16 mSceneAnimCount; // _C6 + u16 mExternalFileCount; // _C8 + u8 mPad[0x6]; // _CA + }; + }; +}; \ No newline at end of file diff --git a/include/nn/g3d/ResFogAnim.h b/include/nn/g3d/ResFogAnim.h new file mode 100644 index 0000000..e8e588d --- /dev/null +++ b/include/nn/g3d/ResFogAnim.h @@ -0,0 +1,25 @@ +#pragma once + +#include "types.h" + +namespace nn +{ + namespace g3d + { + class ResFogAnim + { + public: + char mMagic[4]; // _0 + u16 mFlags; // _4 + u16 mPad; // _6 + s32 mNumFrames; // _8 + u8 mNumCurves; // _C + u8 mIdxDistanceAttnFunc; // _D + u16 mNumUserData; // _E + u32 mSizeBaked; // _10 + u64 mNameOffset; // _14 + u64 mFuncNameOffset; // _1C + + }; + }; +}; \ No newline at end of file diff --git a/include/nn/g3d/ResLightAnim.h b/include/nn/g3d/ResLightAnim.h new file mode 100644 index 0000000..976c2ac --- /dev/null +++ b/include/nn/g3d/ResLightAnim.h @@ -0,0 +1,15 @@ +#pragma once + +#include "BindFuncTable.h" + +namespace nn +{ + namespace g3d + { + class ResLightAnim + { + public: + s32 Bind(nn::g3d::BindFuncTable const &); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/g3d/ResMaterial.h b/include/nn/g3d/ResMaterial.h new file mode 100644 index 0000000..fca9ea3 --- /dev/null +++ b/include/nn/g3d/ResMaterial.h @@ -0,0 +1,32 @@ +/** + * @file ResMaterial.h + * @brief Resource material for models. + */ + +#pragma once + +#include "types.h" +#include "nn/gfx/api.h" +#include "nn/gfx/device.h" + +namespace nn +{ + namespace g3d + { + typedef void* TextureRef; + + class ResMaterial + { + public: + u64 BindTexture(nn::g3d::TextureRef (*)(char const *, void *), void *); + void ForceBindTexture(nn::g3d::TextureRef const &, char const *); + void ReleaseTexture(); + void Setup(nn::gfx::TDevice, nn::gfx::ApiVersion<4>>> *); + void Cleanup(nn::gfx::TDevice, nn::gfx::ApiVersion<8>>> *); + void Reset(); + void Reset(u32); + + u8 _0[0xB4]; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/g3d/ResMaterialAnim.h b/include/nn/g3d/ResMaterialAnim.h new file mode 100644 index 0000000..fc52f30 --- /dev/null +++ b/include/nn/g3d/ResMaterialAnim.h @@ -0,0 +1,22 @@ +/** + * @file ResMaterialAnim.h + * @brief Resource file for material animations. + */ + +#pragma once + +namespace nn +{ + namespace g3d + { + typedef void* TextureRef; + + class ResMaterialAnim + { + public: + void ReleaseTexture(); + s32 BindTexture(nn::g3d::TextureRef (*)(char const*, void *), void *); + void Reset(); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/g3d/ResModel.h b/include/nn/g3d/ResModel.h new file mode 100644 index 0000000..2969d1a --- /dev/null +++ b/include/nn/g3d/ResModel.h @@ -0,0 +1,35 @@ +/** + * @file ResModel.h + * @brief Resource model. + */ + +#pragma once + +#include "types.h" +#include "nn/gfx/api.h" +#include "nn/gfx/device.h" + +namespace nn +{ + namespace g3d + { + class ResMaterial; + + typedef void* TextureRef; + + class ResModel + { + public: + u64 BindTexture(nn::g3d::TextureRef (*)(char const *, void *), void *); + void ForceBindTexture(nn::g3d::TextureRef const &, char const *); + void ReleaseTexture(); + void Setup(nn::gfx::TDevice, nn::gfx::ApiVersion<8>>> *); + void Cleanup(nn::gfx::TDevice, nn::gfx::ApiVersion<8>>> *); + void Reset(); + void Reset(u32); + nn::g3d::ResMaterial* FindMaterial(char const *materialName) const; + + u8 _0[0x70]; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/g3d/ResSceneAnim.h b/include/nn/g3d/ResSceneAnim.h new file mode 100644 index 0000000..b336df6 --- /dev/null +++ b/include/nn/g3d/ResSceneAnim.h @@ -0,0 +1,43 @@ +/** + * @file ResSceneAnim.h + * @brief Resource file for scene animations. + */ + +#pragma once + +#include "BindFuncTable.h" +#include "ResFogAnim.h" +#include "ResLightAnim.h" +#include "types.h" + +namespace nn +{ + namespace g3d + { + class ResSceneAnim + { + public: + s32 Bind(nn::g3d::BindFuncTable const &); + void Release(); + void Reset(); + + char mMagic[4]; // _0 + s32 mBlockOffset; // _4 + u64 mBlockSize; // _8 + u64 mNameOffset; // _10 + u64 mPathOffset; // _18 + u64 mCameraAnimOffset; // _20 + u64 mCameraAnimDictOffset; // _28 + nn::g3d::ResLightAnim* mLightAnims; // _30 + u64 mLightAnimDictOffset; // _38 + nn::g3d::ResFogAnim* mFogAnims; // _40 + u64 mFogAnimDictOffset; // _48 + u64 mUserDataOffset; // _50 + u64 mUserDataDictOffset; // _58 + u16 mUserDataCount; // _60 + u16 mCameraAnimCount; // _62 + u16 mLightAnimCount; // _64 + u16 mFogAnimCount; // _66 + }; + }; +}; \ No newline at end of file diff --git a/include/nn/g3d/ResShapeAnim.h b/include/nn/g3d/ResShapeAnim.h new file mode 100644 index 0000000..0564ad6 --- /dev/null +++ b/include/nn/g3d/ResShapeAnim.h @@ -0,0 +1,18 @@ +/** + * @file ResShapeAnim.h + * @brief Resource file for shape animations. + */ + +#pragma once + +namespace nn +{ + namespace g3d + { + class ResShapeAnim + { + public: + void Reset(); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/g3d/ResSkeletalAnim.h b/include/nn/g3d/ResSkeletalAnim.h new file mode 100644 index 0000000..4d5efaf --- /dev/null +++ b/include/nn/g3d/ResSkeletalAnim.h @@ -0,0 +1,18 @@ +/** + * @file ResSkeletalAnim.h + * @brief Resource file for skeletal animations. + */ + +#pragma once + +namespace nn +{ + namespace g3d + { + class ResSkeletalAnim + { + public: + void Reset(); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/g3d/g3d_ResFile.h b/include/nn/g3d/g3d_ResFile.h new file mode 100644 index 0000000..93d97f9 --- /dev/null +++ b/include/nn/g3d/g3d_ResFile.h @@ -0,0 +1,24 @@ +#pragma once + +#include "nn/util/util_AccessorBase.h" + +namespace nn +{ + namespace g3d + { + struct ResFileData + { + // empty for now + }; + + class ResFile : public nn::util::AccessorBase + { + public: + + static ResFile* ResCast(void *); + + void ReleaseTexture(); + void Reset(); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/gfx/api.h b/include/nn/gfx/api.h new file mode 100644 index 0000000..8b14315 --- /dev/null +++ b/include/nn/gfx/api.h @@ -0,0 +1,33 @@ +/** + * @file api.h + * @brief GFX API version and typing. + */ + +#pragma once + +namespace nn +{ + namespace gfx + { + // passes both ApiType<4> and ApiVersion<8> + template + class ApiVariation + { + + }; + + // usually passed as just a 4 + template + class ApiType + { + + }; + + // usually passed as just a 8 + template + class ApiVersion + { + + }; + }; +}; \ No newline at end of file diff --git a/include/nn/gfx/buffer.h b/include/nn/gfx/buffer.h new file mode 100644 index 0000000..43d2c8a --- /dev/null +++ b/include/nn/gfx/buffer.h @@ -0,0 +1,32 @@ +/** + * @file buffer.h + * @brief GFX Buffers. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace gfx + { + class BufferInfo + { + public: + void SetDefault(); + + u64 mInfo; // _0 + }; + + class BufferTextureViewInfo + { + public: + void SetDefault(); + + u64 _0; + u64 _8; + u64 _10; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/gfx/detail/bufferimpl.h b/include/nn/gfx/detail/bufferimpl.h new file mode 100644 index 0000000..15c1140 --- /dev/null +++ b/include/nn/gfx/detail/bufferimpl.h @@ -0,0 +1,51 @@ +/** + * @file bufferimpl.h + * @brief Buffer implementation for GFX. + */ + +#pragma once + +#include "nn/gfx/api.h" +#include "nn/gfx/buffer.h" + +namespace nn +{ + namespace gfx + { + class GpuAddress; + + namespace detail + { + template + class BufferImpl + { + public: + BufferImpl(); + ~BufferImpl(); + + void Initialize(nn::gfx::detail::DeviceImpl,nn::gfx::ApiVersion<8>>> *,nn::gfx::BufferInfo const&,nn::gfx::detail::MemoryPoolImpl,nn::gfx::ApiVersion<8>>> *, s64, u64); + void Finalize(nn::gfx::detail::DeviceImpl,nn::gfx::ApiVersion<8>>> *); + void* Map() const; + void Unmap() const; + void FlushMappedRange(s64, u64) const; + void InvalidateMappedRange(s64, u64) const; + void GetGpuAddress(nn::gfx::GpuAddress *) const; + + T* mBuff; // _0 + }; + + template + class CommandBufferImpl + { + public: + CommandBufferImpl(); + ~CommandBufferImpl(); + + void Reset(); + void Begin(); + void End(); + void Dispatch(s32, s32, s32); + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/gfx/detail/deviceimpl.h b/include/nn/gfx/detail/deviceimpl.h new file mode 100644 index 0000000..105bb79 --- /dev/null +++ b/include/nn/gfx/detail/deviceimpl.h @@ -0,0 +1,28 @@ +/** + * @file deviceimpl.h + * @brief Device implementation for GFX. + */ + +#pragma once + +#include "nn/gfx/device.h" + +namespace nn +{ + namespace gfx + { + namespace detail + { + template + class DeviceImpl + { + public: + DeviceImpl(); + ~DeviceImpl(); + + void Initialize(nn::gfx::DeviceInfo const &deviceInfo); + void Finalize(); + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/gfx/detail/pool.h b/include/nn/gfx/detail/pool.h new file mode 100644 index 0000000..f97c69e --- /dev/null +++ b/include/nn/gfx/detail/pool.h @@ -0,0 +1,41 @@ +#pragma once + +#include "deviceimpl.h" + +namespace nn +{ + namespace gfx + { + struct MemoryPoolInfo; + + namespace detail + { + class MemoryPoolData + { + public: + void SetDefault(); + + s32 _0; // set to 0x88 + s32 _4; + u64 _8; + }; + + template + class MemoryPoolImpl + { + public: + MemoryPoolImpl(); + ~MemoryPoolImpl(); + + void Initialize(nn::gfx::detail::DeviceImpl, nn::gfx::ApiVersion<8>>> *, nn::gfx::MemoryPoolInfo const &); + void Finalize(nn::gfx::detail::DeviceImpl, nn::gfx::ApiVersion<8>>> *); + void* Map() const; + void Unmap() const; + void FlushMappedRange(s64, u64) const; + void InvalidateMappedRange(s64, u64) const; + + u8 _0[0x120]; // pool data + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/gfx/device.h b/include/nn/gfx/device.h new file mode 100644 index 0000000..1f02bac --- /dev/null +++ b/include/nn/gfx/device.h @@ -0,0 +1,27 @@ +/** + * @file device.h + * @brief Device implementation for GFX. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace gfx + { + class DeviceInfo + { + public: + + u64 mInfo; // _0 + }; + + template + class TDevice + { + + }; + }; +}; \ No newline at end of file diff --git a/include/nn/gfx/memory.h b/include/nn/gfx/memory.h new file mode 100644 index 0000000..8c0e5b6 --- /dev/null +++ b/include/nn/gfx/memory.h @@ -0,0 +1,16 @@ +/** + * @file memory.h + * @brief GFX Memory Pool. + */ + +#pragma once + +namespace nn +{ + namespace gfx + { + // todo: finish me! + template + class TMemoryPool { }; + }; +}; \ No newline at end of file diff --git a/include/nn/hid.h b/include/nn/hid.h new file mode 100644 index 0000000..051f76d --- /dev/null +++ b/include/nn/hid.h @@ -0,0 +1,24 @@ +/** + * @file hid.h + * @brief Functions that help process gamepad inputs. + */ + +#pragma once + +#include "types.h" +#include "util.h" + +namespace nn +{ + namespace hid + { + struct NpadHandheldState; + struct NpadStyleTag; + + void InitializeNpad(); + void SetSupportedNpadIdType(u32 const* , u64); + void SetSupportedNpadStyleSet(nn::util::BitFlagSet<32, nn::hid::NpadStyleTag>); + void GetNpadStyleSet(u32 const &); + void GetNpadStates(nn::hid::NpadHandheldState *, s32, u32 const &); + }; +}; \ No newline at end of file diff --git a/include/nn/image.h b/include/nn/image.h new file mode 100644 index 0000000..8cc0b25 --- /dev/null +++ b/include/nn/image.h @@ -0,0 +1,64 @@ +/** + * @file image.h + * @brief JPEG decoding library. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace image + { + // there's probably more + enum JpegStatus + { + OK = 0, + INVALID_FORMAT = -32, + UNSUPPORTED_FORMAT = -33, + OUT_OF_MEMORY = -64, + }; + + enum PixelFormat + { + RGBA32, + RGB24 + }; + + enum ProcessStage + { + UNREGISTERED = 0, + REGISTERED = 1, + ANALYZED = 2 + }; + + struct Dimension + { + f32 width; + f32 height; + }; + + class JpegDecoder + { + public: + JpegDecoder(); + virtual ~JpegDecoder(); + + void SetImageData(void const *source, u64 size); + nn::image::JpegStatus Analyze(); + nn::image::Dimension GetAnalyzedDimension() const; + s64 GetAnalyzedWorkBufferSize() const; + JpegStatus Decode(void *out, s64, s32 alignment, void *, s64); + + nn::image::ProcessStage mProcessStage; // _8 + void* mData; // _C + s64 mSize; // _14 + s32 _18; + nn::image::PixelFormat mFormat; // _1C + Dimension mImgDimensions; // _20 + s64 _28; + // rest is related to EXIF processing + }; + }; +}; \ No newline at end of file diff --git a/include/nn/init.h b/include/nn/init.h new file mode 100644 index 0000000..bf4dc56 --- /dev/null +++ b/include/nn/init.h @@ -0,0 +1,24 @@ +/** + * @file init.h + * @brief Initialization functions for OS related functions. + */ + +#pragma once + +#include "mem.h" +#include "types.h" + +namespace nn +{ + namespace init + { + void InitializeAllocator(void *addr, u64 size); + nn::mem::StandardAllocator* GetAllocator(); + + namespace detail + { + void* DefaultAllocatorForThreadLocal(u64, u64); + void* DefaultDeallocatorForThreadLocal(void *, u64); + }; + } +}; \ No newline at end of file diff --git a/include/nn/mem.h b/include/nn/mem.h new file mode 100644 index 0000000..3ce39ba --- /dev/null +++ b/include/nn/mem.h @@ -0,0 +1,33 @@ +/** + * @file mem.h + * @brief Memory allocation functions. + */ + +#pragma once + +#include "os.h" +#include "types.h" + +namespace nn +{ + namespace mem + { + class StandardAllocator + { + public: + StandardAllocator(); + + void Initialize(void* address, u64 size); + void Finalize(); + void* Reallocate(void* address, u64 newSize); + void* Allocate(u64 size); + void Free(void* address); + void Dump(); + + bool mIsInitialized; // _0 + bool mIsEnabledThreadCache; // _1 + u16 _2; + u64* mAllocAddr; // _4 + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/RootObject.h b/include/nn/nex/RootObject.h new file mode 100644 index 0000000..f3d919e --- /dev/null +++ b/include/nn/nex/RootObject.h @@ -0,0 +1,33 @@ +/** + * @file RootObject.h + * @brief RootObject for NEX. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace nex + { + class RootObject + { + public: + enum TargetPool; + + virtual ~RootObject(); + + void* operator new(std::u64); + void operator delete(void *); + void* operator new(std::u64, char const *, u32); + void* operator new[](std::u64); + void* operator new[](std::u64, char const *, u32); + void operator delete[](void *); + void operator delete(void *,char const *, u32); + void operator delete[](void *,char const *, u32); + void* operator new(std::u64, nn::nex::RootObject::TargetPool); + void* operator new(std::u64, nn::nex::RootObject::TargetPool, char const *, u32); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/auth.h b/include/nn/nex/auth.h new file mode 100644 index 0000000..3ec7522 --- /dev/null +++ b/include/nn/nex/auth.h @@ -0,0 +1,25 @@ +/** + * @file auth.h + * @brief Authorization for DDL. + */ + +#pragma once + +#include "ddl.h" +#include "types.h" + +namespace nn +{ + namespace nex + { + class NintendoAuthenticationDDLDeclarations : public nn::nex::DDLDeclarations + { + public: + virtual ~NintendoAuthenticationDDLDeclarations(); + virtual void Init(); + + void Register(); + + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/berkeley.h b/include/nn/nex/berkeley.h new file mode 100644 index 0000000..4329737 --- /dev/null +++ b/include/nn/nex/berkeley.h @@ -0,0 +1,52 @@ +#pragma once + +#include "types.h" + +namespace nn +{ + namespace nex + { + + namespace TransportProtocol + { + static enum Type { + unk1, // or this one + unk2, // i think we need to use this one + unk3, + unk4, + unk5, + unk6 + }; + } + + namespace SocketDriver + { + struct InetAddress { + + }; + + enum _SocketFlag { + + }; + } + + + namespace BerkeleySocketDriver { + class BerkeleySocket + { + public: + BerkeleySocket(); + BerkeleySocket(const nn::nex::BerkeleySocketDriver::BerkeleySocket *, int); + ~BerkeleySocket(); + + bool Open(nn::nex::TransportProtocol::Type); + bool SetAsync(bool); + bool SetBroadcastMode(bool); // empty class that always returns true + bool Bind(ushort &); + bool LastSocketErrorToResult(char const*, long); + s32 GetLastSocketError(long); // unknown if this returns anything, it branches to an external function probably located in nnsdk, but uses of it seem to require some sort of int + s32 RecvFrom(uchar *, ulong, nn:nex::SocketDriver::InetAddress *, unsigned long *, nn::nex::SocketDriver::_SocketFlag); + }; + } + }; +}; \ No newline at end of file diff --git a/include/nn/nex/buffer.h b/include/nn/nex/buffer.h new file mode 100644 index 0000000..8de56cd --- /dev/null +++ b/include/nn/nex/buffer.h @@ -0,0 +1,28 @@ +/** + * @file buffer.h + * @brief NEX buffer implementation. + */ + +#pragma once + +#include "string.h" +#include "types.h" + +namespace nn +{ + namespace nex + { + // todo + class Buffer + { + public: + Buffer(nn::nex::Buffer const &); + Buffer(nn::nex::Buffer &&); + Buffer(nn::nex::String const &); + + void FreeDataBuffer(u8 *, u64); + + virtual ~Buffer(); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/cache.h b/include/nn/nex/cache.h new file mode 100644 index 0000000..fd6f63a --- /dev/null +++ b/include/nn/nex/cache.h @@ -0,0 +1,36 @@ +/** + * @file cache.h + * @brief NEX Cache Mangement. + */ + +#pragma once + +#include "string.h" + +namespace nn +{ + namespace nex + { + class BasicCache; + + class CacheManager + { + public: + CacheManager(); + ~CacheManager(); + + nn::nex::BasicCache* GetCache(nn::nex::String const &); + }; + + class BasicCache + { + public: + BasicCache(nn::nex::String const &); + + virtual ~BasicCache(); + + u64 _8; + u8 _10; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/checksum.h b/include/nn/nex/checksum.h new file mode 100644 index 0000000..6bb72f3 --- /dev/null +++ b/include/nn/nex/checksum.h @@ -0,0 +1,66 @@ +/** + * @file checksum.h + * @brief NEX Checksum Implementation. + */ + +#pragma once + +#include "buffer.h" +#include "RootObject.h" +#include "types.h" + +namespace nn +{ + namespace nex + { + class ChecksumAlgorithm : public nn::nex::RootObject + { + public: + ChecksumAlgorithm(); + + virtual ~ChecksumAlgorithm(); + + virtual bool ComputeChecksum(nn::nex::Buffer const &, nn::nex::Buffer *) = 0; + // virtual bool ComputeChecksum(u8 const **, u64 const *, u64, nn::nex::SignatureBytes &) = 0; + virtual bool IsReady() const; + virtual void ComputeChecksumForTransport(u8 const *, u64); + virtual u32 ComputeChecksumForTransportArray(u8 const **, u64 const*, u64) = 0; + virtual u32 GetChecksumLength() = 0; + + u64 _8; + u8 _10; + }; + + class MD5Checksum : public nn::nex::ChecksumAlgorithm + { + public: + MD5Checksum(); + + virtual ~MD5Checksum(); + + virtual bool ComputeChecksum(nn::nex::Buffer const &, nn::nex::Buffer *); + virtual u32 ComputeChecksumForTransportArray(u8 const **, u64 const*, u64); + virtual u32 GetChecksumLength(); + }; + + class CRC16Checksum : public nn::nex::ChecksumAlgorithm + { + public: + CRC16Checksum(); + + virtual ~CRC16Checksum(); + + virtual bool ComputeChecksum(nn::nex::Buffer const &, nn::nex::Buffer *); + virtual u32 ComputeChecksumForTransportArray(u8 const **, u64 const*, u64); + virtual u32 GetChecksumLength(); + }; + + /* + this actually inherits some sort of KeyedChecksum thing. whatever + class HMACChecksum : public nn::nex::ChecksumAlgorithm + { + + }; + */ + }; +}; \ No newline at end of file diff --git a/include/nn/nex/client.h b/include/nn/nex/client.h new file mode 100644 index 0000000..91bbb3e --- /dev/null +++ b/include/nn/nex/client.h @@ -0,0 +1,119 @@ +/** + * @file client.h + * @brief Client implementations for NEX. + */ +#pragma once + +#include "system.h" + +namespace nn +{ + namespace nex + { + class Credentials; + class EndPoint; + class Message; + class ProtocolCallContext; + class ProtocolRequestBrokerInterface; + + class Protocol : public nn::nex::SystemComponent + { + public: + enum _Command + { + Response, + Request + }; + + enum _Type + { + Client, // implemented in nn::nex::ClientProtocol + Server // implemented in nn::nex::ServerProtocol + }; + + Protocol(u32); + + virtual ~Protocol(); + + virtual char* GetType() const; + virtual bool IsAKindOf(char const *) const; + virtual void EnforceDeclareSysComponentMacro(); + + virtual bool BeginInitialization(); + virtual bool BeginTermination(); + + virtual nn::nex::Protocol::_Type GetProtocolType() const = 0; + virtual void EndPointDisconnected(nn::nex::EndPoint *); + virtual void FaultDetected(nn::nex::EndPoint *, u32); + virtual nn::nex::Protocol* Clone() const; + virtual bool Reload(); + + nn::nex::EndPoint* GetOutgoingConnection() const; + void SetIncomingConnection(nn::nex::EndPoint *); + void SetProtocolID(u16); + void AddMethodID(nn::nex::Message *, u32); + void CopyMembers(nn::nex::Protocol const *); + void AssociateProtocolRequestBroker(nn::nex::ProtocolRequestBrokerInterface *); + void ClearFlag(u32 newFlag); + + static void ExtractProtocolKey(nn::nex::Message *, nn::nex::Protocol::_Command &, u16 &); + static bool IsOldRVDDLVersion(nn::nex::EndPoint *); + + u16 mProtocolID; // _48 + u16 _4A; + u32 _4C; + nn::nex::EndPoint* mOutgoingConnection; // _50 + nn::nex::ProtocolRequestBrokerInterface* mBrokerInterface; // _58 + u32 mFlags; // _60 + u32 _64; + nn::nex::EndPoint* mIncomingConnection; // _68 + u32 mUseLoopback; // _70 (boolean) + u32 _74; + u64 _78; + u32 _80; + u32 _84; + }; + + class ClientProtocol : public nn::nex::Protocol + { + public: + ClientProtocol(u32); + + virtual ~ClientProtocol(); + + virtual char* GetType() const; + virtual bool IsAKindOf(char const *) const; + virtual void EnforceDeclareSysComponentMacro(); + + virtual nn::nex::Protocol::_Type GetProtocolType() const = 0; + + virtual void ExtractCallSpecificResults(nn::nex::Message *, nn::nex::ProtocolCallContext *) = 0; + virtual nn::nex::ClientProtocol* CreateResponder() const = 0; + virtual void SetDefaultCredentials(nn::nex::Credentials *); + + bool SendOverLocalLoopback(nn::nex::ProtocolCallContext *, nn::nex::Message *); + bool SendRMCMessage(nn::nex::ProtocolCallContext *, nn::nex::Message *); + void ProcessResponse(nn::nex::Message *, nn::nex::EndPoint *); + + nn::nex::Credentials* mCredentials; // _88 + }; + + class ServerProtocol : public nn::nex::Protocol + { + public: + ServerProtocol(u32); + + virtual ~ServerProtocol(); + + virtual char* GetType() const; + virtual bool IsAKindOf(char const *) const; + virtual void EnforceDeclareSysComponentMacro(); + + virtual nn::nex::Protocol::_Type GetProtocolType() const = 0; + + virtual void DispatchProtocolMessage(nn::nex::Message *, nn::nex::Message *, bool *, nn::nex::EndPoint *) = 0; + virtual void DispatchProtocolMessageWithAttemptCount(u64, nn::nex::Message *, nn::nex::Message *, bool *, int *, nn::nex::EndPoint *); + virtual bool UseAttemptCountMethod(); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/data.h b/include/nn/nex/data.h new file mode 100644 index 0000000..52cc6a5 --- /dev/null +++ b/include/nn/nex/data.h @@ -0,0 +1,24 @@ +/** + * @file data.h + * @brief NEX Data. + */ + +#pragma once + +#include "RootObject.h" + +namespace nn +{ + namespace nex + { + class Data : public nn::nex::RootObject + { + public: + Data(); + + virtual ~Data(); + + u8 _8; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/ddl.h b/include/nn/nex/ddl.h new file mode 100644 index 0000000..afc3508 --- /dev/null +++ b/include/nn/nex/ddl.h @@ -0,0 +1,44 @@ +/** + * @file ddl.h + * @brief DDL Declaration Implementation. + */ + +#pragma once + +#include "RootObject.h" +#include "types.h" + +namespace nn +{ + namespace nex + { + class DDLDeclarations : public nn::nex::RootObject + { + public: + DDLDeclarations(bool); + + virtual ~DDLDeclarations(); + + virtual void Init() = 0; + + void RegisterIfRequired(); + void Unregister(); + static void UnregisterAll(); + void LoadAll(); + void Load(); + void UnloadAll(); + void Unload(); + void ResetDOClassIDs(); + + u32 mNumDecsLoaded; // _8 + u8 _C; + u8 _D; // padding + u8 _E; // ^^ + u8 _F; // ^^ + u64 _10; + bool _18; + + static nn::nex::DDLDeclarations* s_pFirstDDLDecl; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/dynamic.h b/include/nn/nex/dynamic.h new file mode 100644 index 0000000..9eb79ac --- /dev/null +++ b/include/nn/nex/dynamic.h @@ -0,0 +1,24 @@ +/** + * @file dynamic.h + * @brief NEX Dyamnic Runtime. + */ + +#pragma once + +#include "RootObject.h" + +namespace nn +{ + namespace nex + { + class DynamicRunTimeInterface : public nn::nex::RootObject + { + public: + DynamicRunTimeInterface(); + + virtual ~DynamicRunTimeInterface(); + + u64* GetInstance(); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/encryption.h b/include/nn/nex/encryption.h new file mode 100644 index 0000000..e29c0c9 --- /dev/null +++ b/include/nn/nex/encryption.h @@ -0,0 +1,65 @@ +/** + * @file encryption.h + * @brief NEX Encryption Algorithm. + */ + +#pragma once + +#include "buffer.h" +#include "key.h" +#include "RootObject.h" +#include "sead/critical.h" + +namespace nn +{ + namespace nex + { + class EncryptionAlgorithm : public nn::nex::RootObject + { + public: + EncryptionAlgorithm(u32, u32); + + virtual ~EncryptionAlgorithm(); + + virtual bool Encrypt(nn::nex::Buffer const &, nn::nex::Buffer *) = 0; + virtual bool Encrypt(nn::nex::Buffer *); + virtual bool Decrypt(nn::nex::Buffer const &, nn::nex::Buffer *) = 0; + virtual bool Decrypt(nn::nex::Buffer *); + virtual bool GetErrorString(u32, char *destStr, u64 errLen); + virtual void KeyHasChanged(); + + bool SetKey(nn::nex::Key const &key); + + u64 _8; + u64 _10; + u64 _18; + u64 _20; + u64 _28; + u64 _30; + u64 _38; + u64 _40; + }; + + class RC4Encryption : public nn::nex::EncryptionAlgorithm + { + public: + RC4Encryption(); + + virtual ~RC4Encryption(); + + virtual bool Encrypt(nn::nex::Buffer const &, nn::nex::Buffer *); + virtual bool Encrypt(nn::nex::Buffer *); + virtual bool Decrypt(nn::nex::Buffer const &, nn::nex::Buffer *); + virtual bool Decrypt(nn::nex::Buffer *); + + virtual void KeyHasChanged(); + + void GetDefaultKey(); + void PrepareEncryption(); + void ReinitStateArray(); + void SetReinitEverytime(bool); + + u8 _48[0x298-0x48]; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/hash.h b/include/nn/nex/hash.h new file mode 100644 index 0000000..076692e --- /dev/null +++ b/include/nn/nex/hash.h @@ -0,0 +1,40 @@ +/** + * @file hash.h + * @brief NEX Hash Implementation. + */ + +#pragma once + +#include "nn/crypto.h" +#include "RootObject.h" +#include "types.h" + +namespace nn +{ + namespace nex + { + class MD5 : public nn::crypto::detail::Md5Impl, public nn::nex::RootObject + { + public: + MD5(); + + void init(); + void raw_digest(u8 *); + void hex_digest(); + + u8 _5C[0x74-0x5C]; + }; + + class Sha1 : public nn::crypto::detail::Sha1Impl, public nn::nex::RootObject + { + public: + Sha1(); + + void Update(void const *, u64); + void GetHash(void *, u64); + void GenerateHash(void *, u64, void const *, u64); + + u32 _68; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/instance.h b/include/nn/nex/instance.h new file mode 100644 index 0000000..b39e448 --- /dev/null +++ b/include/nn/nex/instance.h @@ -0,0 +1,50 @@ +/** + * @file instance.h + * @brief NEX Instance Controllers. + */ +#pragma once + +#include "RootObject.h" + +namespace nn +{ + namespace nex + { + class InstanceTable; + + class InstanceControl : public nn::nex::RootObject + { + public: + InstanceControl(u32, u32); + + u32 mInstanceContext; // _8 + u32 mInstanceType; // _C + void* mDelegateInstance; // _10 + bool mIsValidControl; // _18 + u8 _19; // probably padding + u8 _1A; + u8 _1B; + + static nn::nex::InstanceTable* s_oInstanceTable; + }; + + class InstanceTable : public nn::nex::RootObject + { + public: + InstanceTable(); + + virtual ~InstanceTable(); + + bool AddInstance(nn::nex::InstanceControl *, u32, u32); + void DelInstance(nn::nex::InstanceControl *, u32, u32); + u32 CreateContext(); + bool DeleteContext(u32); + void AllocateExtraContexts(u64 size); + void FreeExtraContexts(); + u32 GetHighestID() const; + u32 FindInstanceContext(nn::nex::InstanceControl *, u32); + + u8 _0[0x94]; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/key.h b/include/nn/nex/key.h new file mode 100644 index 0000000..bceae69 --- /dev/null +++ b/include/nn/nex/key.h @@ -0,0 +1,42 @@ +/** + * @file key.h + * @brief NEX Key Implementation. + */ + +#pragma once + +#include "RootObject.h" +#include "string.h" + +namespace nn +{ + namespace nex + { + class Key : public nn::nex::RootObject + { + public: + Key(); + Key(u8 const *src, u64 size); + Key(u64 size); + Key(nn::nex::Key const &); + Key(nn::nex::String const &); + + virtual ~Key(); + + u64* GetContentPtr(); + u64 GetLength() const; + nn::nex::Key& operator=(nn::nex::Key const &); + bool operator==(nn::nex::Key const &); + bool operator!=(nn::nex::Key const &); + void PrepareContentPtr(u64); + nn::nex::String* ToString(); + void ExtractToString(nn::nex::String *) const; + void Trace(u64) const; + void GenerateRandomKey(u64); + + u64* mContentPtrStart; // _10 + u64* mContentPtrEnd; // _18 + + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/plugin.h b/include/nn/nex/plugin.h new file mode 100644 index 0000000..605e38a --- /dev/null +++ b/include/nn/nex/plugin.h @@ -0,0 +1,36 @@ +/** + * @file plugin.h + * @brief Plugin interface for NEX. + */ + +#pragma once + +#include "RootObject.h" + +namespace nn +{ + namespace nex + { + class PluginObject : public nn::nex::RootObject { }; + + class Plugin : public nn::nex::RootObject + { + public: + Plugin(); + + virtual ~Plugin(); + + // there's a bunch of pure virtual methods but nothing ever inherits this class... + virtual bool Initalize(); + virtual void ThreadAttach(); + virtual void ThreadDetach(); + virtual void Destroy(); + + void SetLibrary(void *); + + void* mLibrary; // _8s + + static nn::nex::Plugin* s_pInstance; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/pseudo.h b/include/nn/nex/pseudo.h new file mode 100644 index 0000000..4dd176a --- /dev/null +++ b/include/nn/nex/pseudo.h @@ -0,0 +1,87 @@ +/** + * @file psuedo.h + * @brief Psuedo variable implementation for NEX. + */ + +#pragma once + +#include "instance.h" +#include "RootObject.h" +#include "types.h" + +namespace nn +{ + namespace nex + { + class PseudoGlobalVariableList; + + class PseudoGlobalVariableRoot : public nn::nex::RootObject + { + public: + PseudoGlobalVariableRoot(); + + virtual ~PseudoGlobalVariableRoot(); + + virtual void AllocateExtraContexts() = 0; + virtual void FreeExtraContexts() = 0; + virtual void ResetContext(u32) = 0; + virtual PseudoGlobalVariableRoot* GetNext() = 0; + virtual void SetNext(PseudoGlobalVariableRoot* pNextVariable) = 0; + + static void ResetContextForAllVariables(u32); + static void AllocateExtraContextsForAllVariables(u64); + static void FreeExtraContextsForAllVariables(); + static s64 GetNbOfExtraContexts(); + + nn::nex::PseudoGlobalVariableRoot* mNextRoot; // _8 + + static s64 s_uiNbOfExtraContexts; + static PseudoGlobalVariableList s_oList; + }; + + class PseudoGlobalVariableList : public nn::nex::RootObject + { + public: + PseudoGlobalVariableList(); + + virtual ~PseudoGlobalVariableList(); + + void AddVariable(nn::nex::PseudoGlobalVariableRoot *); + void RemoveVariable(nn::nex::PseudoGlobalVariableRoot *); + static nn::nex::PseudoGlobalVariableRoot* GetVariable(u32 idx); + static u32 FindVariableIndex(nn::nex::PseudoGlobalVariableRoot *); + void AllocateExtraContextsForAllVariables(); + void FreeExtraContextsForAllVariables(); + void ResetContextForAllVariables(u32); + static u32 GetNbOfVariables(); + + static PseudoGlobalVariableRoot* s_pVariableListHead; + static u32 m_uiNbOfVariables; + }; + + template + class PseudoGlobalVariable : public nn::nex::PseudoGlobalVariableRoot + { + public: + PseudoGlobalVariable(); + + virtual ~PseudoGlobalVariable(); + + virtual void AllocateExtraContexts(); + virtual void FreeExtraContexts(); + virtual void ResetContext(u32); + virtual PseudoGlobalVariableRoot* GetNext(); + virtual void SetNext(PseudoGlobalVariableRoot* pNextVariable); + }; + + class PseudoSingleton : public nn::nex::InstanceControl + { + public: + PseudoSingleton(u32); + + virtual ~PseudoSingleton(); + + static bool s_bUseInstantiationContext; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/reference.h b/include/nn/nex/reference.h new file mode 100644 index 0000000..9f6b6b8 --- /dev/null +++ b/include/nn/nex/reference.h @@ -0,0 +1,21 @@ +/** + * @file reference.h + * @brief Reference implementations for NEX. + */ +#pragma once + +#include "RootObject.h" + +namespace nn +{ + namespace nex + { + class RefCountedObject : public nn::nex::RootObject + { + public: + virtual ~RefCountedObject(); + + u32 _8; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/string.h b/include/nn/nex/string.h new file mode 100644 index 0000000..9f349cf --- /dev/null +++ b/include/nn/nex/string.h @@ -0,0 +1,36 @@ +/** + * @file string.h + * @brief NEX String Implementation. + */ + +#pragma once + +#include "RootObject.h" + +namespace nn +{ + namespace nex + { + class String : public nn::nex::RootObject + { + public: + bool operator<(nn::nex::String const &); + + void Truncate(u64) const; + u64 GetLength() const; + void Reserve(u64); + void SetBufferChar(char *); + void SetStringToPreReservedBuffer(char const *); + s32 GetWideCharLength() const; + void CopyString(char *, u64) const; + void CreateCopy(wchar_t **) const; + void ReleaseCopy(wchar_t *); + void ToUpper(); + void ToLower(); + void DeleteContent(); + + template + void Assign(T const *); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/system.h b/include/nn/nex/system.h new file mode 100644 index 0000000..186d17a --- /dev/null +++ b/include/nn/nex/system.h @@ -0,0 +1,70 @@ +/** + * @file system.h + * @brief System state / component interface for NEX. + */ + +#pragma once + +#include "reference.h" +#include "string.h" + +namespace nn +{ + namespace nex + { + class SystemComponent : public nn::nex::RefCountedObject + { + public: + + enum _State + { + State_Uninitialized = 1 << 0, + State_Initializing = 1 << 1, + State_Ready = 1 << 2, + State_ReadyInUse = 1 << 3, + State_Terminating = 1 << 4, + State_TerminatingWhileInUse = 1 << 5, + State_Terminated = 1 << 6, + State_Faulty = 1 << 7, + State_Unknown = 1 << 8, + State_HighestState = 1 << 8 + }; + + SystemComponent(nn::nex::String const &); + + virtual ~SystemComponent(); + + virtual char* GetType() const; + virtual bool IsAKindOf(char const *) const; + virtual void EnforceDeclareSysComponentMacro() = 0; + virtual void StateTransition(nn::nex::SystemComponent::_State); + virtual void OnInitialize(); + virtual void OnTerminate(); + virtual bool BeginInitialization(); + virtual bool EndInitialization(); + virtual bool BeginTermination(); + virtual bool EndTermination(); + virtual bool ValidTransition(nn::nex::SystemComponent::_State); + virtual bool UseIsAllowed(); + virtual nn::nex::SystemComponent::_State TestState(); + virtual void DoWork(); + + nn::nex::SystemComponent::_State Initialize(); + nn::nex::SystemComponent::_State Terminate(); + + u8 _C; + u8 _D; + u8 _E; + u8 _F; + u64 _10; + u64 _18; + u64 _20; + u32 _28; + u32 _2C; + u64 _30; + nn::nex::SystemComponent::_State mState; // _38 + u32 _3C; + u64 _40; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nex/time.h b/include/nn/nex/time.h new file mode 100644 index 0000000..3b370f7 --- /dev/null +++ b/include/nn/nex/time.h @@ -0,0 +1,54 @@ +/** + * @file time.h + * @brief NEX Time Library. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace nex + { + class TimeProvider; + + class Time + { + public: + static void Reset(); + static void RegisterTimeProvider(TimeProvider *provider); + + Time Multiply(f32) const; + Time Divide(f32) const; + Time Scale(f32) const; + + static Time ConvertTimeoutToDeadline(u32 timeout); + static u32 ConvertDeadlineToTimeout(Time deadline); + + u64 mCurTime; // _0 + + static u64* s_pfGetSessionTime; // some sort of callback? + + }; + + class SystemClock + { + public: + SystemClock(); + + virtual ~SystemClock(); + + static void RegisterTimeProvider(nn::nex::TimeProvider *, bool); + static void ApplyCorrection(Time curTime, Time newTime); + static Time ProtectedGetTime(); + static Time GetTimeImpl(bool); + static Time GetTimeImplCorrectless(); + static void Reset(); + + static nn::nex::TimeProvider* s_pTimeProvider; + static bool s_needCorrection; + static bool s_tiCorrection; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/nifm.h b/include/nn/nifm.h new file mode 100644 index 0000000..df405a3 --- /dev/null +++ b/include/nn/nifm.h @@ -0,0 +1,15 @@ +#pragma once + +#include "types.h" +#include "result.h" + +namespace nn { namespace nifm { + +Result Initialize(); +void SubmitNetworkRequest(); +void SubmitNetworkRequestAndWait(); +void CancelNetworkRequest(); +bool IsNetworkRequestOnHold(); +bool IsNetworkAvailable(); + +} } diff --git a/include/nn/nn.h b/include/nn/nn.h new file mode 100644 index 0000000..0f30e06 --- /dev/null +++ b/include/nn/nn.h @@ -0,0 +1,27 @@ +/** + * @file nn.h + * @brief Barebones NN functions, such as init and nnMain. + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +int main(int argc, char **argv); +void nninitStartup(); + +void _init(); +void _fini(); +void __nnDetailNintendoSdkRuntimeObjectFileRefer(); +void __nnDetailNintendoSdkRuntimeObjectFile(); +void __nnDetailNintendoSdkNsoFileRefer(); + +void __nnmusl_init_dso_0(); +void __nnmusl_fini_dso_0(); +void __nnDetailNintendoSdkNsoFile_0(); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/include/nn/oe.h b/include/nn/oe.h new file mode 100644 index 0000000..422e780 --- /dev/null +++ b/include/nn/oe.h @@ -0,0 +1,34 @@ +/** + * @file oe.h + * @brief Extenstions to OS functions. + */ + +#pragma once + +#include "settings.h" +#include "types.h" + +namespace nn +{ + namespace oe + { + typedef s32 FocusHandlingMode; + typedef s32 PerformanceMode; + + void Initialize(); + void SetPerformanceConfiguration(nn::oe::PerformanceMode, s32); + s32 GetOperationMode(); + s32 GetPerformanceMode(); + void SetResumeNotificationEnabled(bool); + void SetOperationModeChangedNotificationEnabled(bool); + void SetPerformanceModeChangedNotificationEnabled(bool); + void SetFocusHandlingMode(nn::oe::FocusHandlingMode); + bool TryPopNotificationMessage(u32 *); + s32 GetCurrentFocusState(); + void EnableGamePlayRecording(void *, u64); + bool IsUserInactivityDetectionTimeExtended(); + void SetUserInactivityDetectionTimeExtended(bool); + void FinishStartupLogo(); + nn::settings::LanguageCode GetDesiredLanguage(); + }; +}; \ No newline at end of file diff --git a/include/nn/os.h b/include/nn/os.h new file mode 100644 index 0000000..ceee980 --- /dev/null +++ b/include/nn/os.h @@ -0,0 +1,265 @@ +/** + * @file os.h + * @brief Operating System implementations. + */ + +#pragma once + +#include + +#include +#include + +namespace nn { +namespace os { +namespace detail { +struct InternalCriticalSection { + u32 Image; +}; + +struct InternalConditionVariable { + u32 Image; +}; +} // namespace detail + +typedef u64 Tick; + +struct LightEventType { + std::aligned_storage_t<0xc, 4> storage; +}; + +// https://github.com/misson20000/nn-types/blob/master/nn_os.h +struct EventType { + nn::os::EventType* _x0; + nn::os::EventType* _x8; + bool isSignaled; + bool initiallySignaled; + bool shouldAutoClear; + bool isInit; + u32 signalCounter; + u32 signalCounter2; + nn::os::detail::InternalCriticalSection crit; + nn::os::detail::InternalConditionVariable condvar; +}; +typedef EventType Event; + +// https://github.com/misson20000/nn-types/blob/master/nn_os.h +struct ThreadType { + u64 field_8; + u64 field_10; + u64 field_18; + char field_20[32]; + uint32_t thread_status; + char field_41; + u16 field_42; + uint32_t thread_prio_shift; + uint64_t thread_stack_base_addr; + uint64_t thread_stack_base_addr_mirror; + uint64_t thread_stack_size; + uint64_t thread_param; + uint64_t thread_func; + u64 field_70; + u64 field_78; + u64 field_80; + char field_88[0x100]; + char thread_name[0x20]; + const char* thread_name_addr; + nn::os::detail::InternalCriticalSection crit; + nn::os::detail::InternalConditionVariable condvar; + u32 thread_handle; +}; +#ifdef SWITCH +static_assert(sizeof(ThreadType) == 0x1C0, "Wrong size"); +#endif + +struct MessageQueueType { + u64 _x0; + u64 _x8; + u64 _x10; + u64 _x18; + void* Buffer; + u32 MaxCount; + u32 Count; + u32 Offset; + bool Initialized; + detail::InternalCriticalSection _x38; + detail::InternalConditionVariable _x3C; + detail::InternalConditionVariable _x40; +}; + +struct ConditionVariableType {}; + +struct SemaphoreType { + std::aligned_storage_t<0x28, 8> storage; +}; + +struct SystemEvent; +struct SystemEventType; + +// ARG +void SetHostArgc(s32); +s32 GetHostArgc(); +void SetHostArgv(char**); +char** GetHostArgv(); + +// MEMORY +void InitializeVirtualAddressMemory(); +Result AllocateAddressRegion(u64*, u64); +Result AllocateMemory(u64*, u64); +Result AllocateMemoryPages(u64, u64); +void AllocateMemoryBlock(u64*, u64); +void FreeMemoryBlock(u64, u64); +void SetMemoryHeapSize(u64); + +// MUTEX +struct MutexType { + u8 curState; // _0 + bool isRecursiveMutex; // _1 + s32 lockLevel; // _2 + u8 _6[0x20 - 0xE]; +}; + +void InitializeMutex(nn::os::MutexType*, bool, s32); +void FinalizeMutex(nn::os::MutexType*); +void LockMutex(nn::os::MutexType*); +bool TryLockMutex(nn::os::MutexType*); +void UnlockMutex(nn::os::MutexType*); +bool IsMutexLockedByCurrentThread(nn::os::MutexType const*); + +// QUEUE +void InitializeMessageQueue(nn::os::MessageQueueType*, u64* buf, u64 queueCount); +void FinalizeMessageQueue(nn::os::MessageQueueType*); + +bool TrySendMessageQueue(MessageQueueType*, u64); +void SendMessageQueue(MessageQueueType*, u64); +bool TimedSendMessageQueue(MessageQueueType*, u64, nn::TimeSpan); + +bool TryReceiveMessageQueue(u64* out, MessageQueueType*); +void ReceiveMessageQueue(u64* out, MessageQueueType*); +bool TimedReceiveMessageQueue(u64* out, MessageQueueType*, nn::TimeSpan); + +bool TryPeekMessageQueue(u64*, MessageQueueType const*); +void PeekMessageQueue(u64*, MessageQueueType const*); +bool TimedPeekMessageQueue(u64*, MessageQueueType const*); + +bool TryJamMessageQueue(nn::os::MessageQueueType*, u64); +void JamMessageQueue(nn::os::MessageQueueType*, u64); +bool TimedJamMessageQueue(nn::os::MessageQueueType*, u64, nn::TimeSpan); + +// CONDITION VARIABLE +void InitializeConditionVariable(ConditionVariableType*); +void FinalizeConditionVariable(ConditionVariableType*); + +void SignalConditionVariable(ConditionVariableType*); +void BroadcastConditionVariable(ConditionVariableType*); +void WaitConditionVariable(ConditionVariableType*); +u8 TimedWaitConditionVariable(ConditionVariableType*, MutexType*, nn::TimeSpan); + +// THREAD +Result CreateThread(nn::os::ThreadType*, void (*)(void*), void* arg, void* srcStack, u64 stackSize, + s32 priority, s32 coreNum); +Result CreateThread(nn::os::ThreadType*, void (*)(void*), void* arg, void* srcStack, u64 stackSize, + s32 priority); +void DestroyThread(nn::os::ThreadType*); +void StartThread(nn::os::ThreadType*); +void SetThreadName(nn::os::ThreadType*, char const* threadName); +void SetThreadNamePointer(nn::os::ThreadType*, char const*); +char* GetThreadNamePointer(nn::os::ThreadType const*); +nn::os::ThreadType* GetCurrentThread(); +void GetCurrentStackInfo(uintptr_t* stack_addr, size_t* stack_size); +s32 ChangeThreadPriority(nn::os::ThreadType* thread, s32 priority); +s32 GetThreadPriority(nn::os::ThreadType const* thread); +u64 GetThreadId(const nn::os::ThreadType* thread); +void YieldThread(); +void SuspendThread(nn::os::ThreadType*); +void ResumeThread(nn::os::ThreadType*); +void SleepThread(nn::TimeSpan); +void WaitThread(nn::os::ThreadType*); +void SetThreadCoreMask(nn::os::ThreadType*, int, u64 mask); + +// EVENTS +void InitializeEvent(EventType*, bool initiallySignaled, bool autoclear); +void FinalizeEvent(EventType*); +void SignalEvent(EventType*); +void WaitEvent(EventType*); +bool TryWaitEvent(EventType*); +bool TimedWaitEvent(EventType*, nn::TimeSpan); +void ClearEvent(EventType*); + +// LIGHT EVENTS +void InitializeLightEvent(LightEventType*, bool initiallySignaled, bool autoclear); +void FinalizeLightEvent(LightEventType*); +void SignalLightEvent(LightEventType*); +void WaitLightEvent(LightEventType*); +bool TimedWaitLightEvent(LightEventType*, nn::TimeSpan); +void ClearLightEvent(LightEventType*); + +TimeSpan ConvertToTimeSpan(Tick ticks); + +// SEMAPHORES +void InitializeSemaphore(SemaphoreType* semaphore, s32 initial_count, s32 max_count); +void FinalizeSemaphore(SemaphoreType* semaphore); +void AcquireSemaphore(SemaphoreType* semaphore); +bool TryAcquireSemaphore(SemaphoreType* semaphore); +void ReleaseSemaphore(SemaphoreType* semaphore); + +// EXCEPTION HANDLING +typedef union { + u64 x; ///< 64-bit AArch64 register view. + u32 w; ///< 32-bit AArch64 register view. + u32 r; ///< AArch32 register view. +} CpuRegister; +/// Armv8 NEON register. + +typedef union { + u128 v; ///< 128-bit vector view. + double d; ///< 64-bit double-precision view. + float s; ///< 32-bit single-precision view. +} FpuRegister; + +struct UserExceptionInfo { + u32 ErrorDescription; ///< See \ref ThreadExceptionDesc. + u32 pad[3]; + + CpuRegister CpuRegisters[29]; ///< GPRs 0..28. Note: also contains AArch32 registers. + CpuRegister FP; ///< Frame pointer. + CpuRegister LR; ///< Link register. + CpuRegister SP; ///< Stack pointer. + CpuRegister PC; ///< Program counter (elr_el1). + + u64 padding; + + FpuRegister FpuRegisters[32]; ///< 32 general-purpose NEON registers. + + u32 PState; ///< pstate & 0xFF0FFE20 + u32 AFSR0; + u32 AFSR1; + u32 ESR; + + CpuRegister FAR; ///< Fault Address Register. +}; +void SetUserExceptionHandler(void (*)(UserExceptionInfo*), void*, ulong, UserExceptionInfo*); + +// OTHER +void GenerateRandomBytes(void*, u64); +nn::os::Tick GetSystemTick(); +nn::os::Tick GetSystemTickFrequency(); +u64 GetThreadAvailableCoreMask(); +void SetMemoryHeapSize(u64 size); + +// Thread-local storage +struct TlsSlot { + u32 slot; +}; +Result AllocateTlsSlot(TlsSlot* slot_out, void (*)(u64)); +void FreeTlsSlot(TlsSlot slot); +u64 GetTlsValue(TlsSlot slot); +void SetTlsValue(TlsSlot slot, u64 value); +u32 GetCurrentCoreNumber(); + +namespace detail { +extern s32 g_CommandLineParameter; +extern char** g_CommandLineParameterArgv; +}; // namespace detail +}; // namespace os +}; // namespace nn diff --git a/include/nn/result.h b/include/nn/result.h new file mode 100644 index 0000000..b454815 --- /dev/null +++ b/include/nn/result.h @@ -0,0 +1,24 @@ +#pragma once + +#include "types.h" + +namespace nn { + +struct Result +{ + Result(u32 value = 0) : value(value) { } + + inline bool isSuccess() + { + return value == 0; + } + + inline bool isFailure() + { + return !isSuccess(); + } + + u32 value; +}; + +} diff --git a/include/nn/settings.h b/include/nn/settings.h new file mode 100644 index 0000000..09e7d31 --- /dev/null +++ b/include/nn/settings.h @@ -0,0 +1,12 @@ +#pragma once + +namespace nn { namespace settings { + +struct LanguageCode +{ + char data[8]; +}; + +void GetLanguageCode(LanguageCode* out); + +} } diff --git a/include/nn/socket.h b/include/nn/socket.h new file mode 100644 index 0000000..2fc4b6d --- /dev/null +++ b/include/nn/socket.h @@ -0,0 +1,37 @@ +#pragma once + +#include "../types.h" + + +struct in_addr +{ + u32 data; // 0 +}; + +struct sockaddr +{ + u8 _0; // 0 + u8 family; // 1 + u16 port; // 2 + in_addr address; // 4 + u8 _8[8]; // 8 +}; + + +namespace nn { namespace socket { + +Result Initialize(void* pool, ulong poolSize, ulong allocPoolSize, int concurLimit); + +s32 SetSockOpt(s32 socket, s32 socketLevel, s32 option, void const*, u32 len); + +s32 Socket(s32 domain, s32 type, s32 protocol); +s32 Connect(s32 socket, const sockaddr* address, u32 addressLen); +Result Close(s32 socket); + +s32 Send(s32 socket, const void* data, ulong dataLen, s32 flags); +s32 Recv(s32 socket, void* out, ulong outLen, s32 flags); + +u16 InetHtons(u16 val); +s32 InetAton(const char* addressStr, in_addr* addressOut); + +} } diff --git a/include/nn/ssl.h b/include/nn/ssl.h new file mode 100644 index 0000000..f116eed --- /dev/null +++ b/include/nn/ssl.h @@ -0,0 +1,38 @@ +/** + * @file ssl.h + * @brief SSL implementation. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace ssl + { + enum CertificateFormat + { + PEM = 0x01, + DER = 0x02 + }; + + class Context + { + public: + enum SslVersion + { + Auto = 0x01, + v10 = 0x08, + v11 = 0x10, + v12 = 0x20 + }; + + Result Create(nn::ssl::Context::SslVersion version); + Result ImportServerPki(u64 *, char const *certData, u32 certSize, nn::ssl::CertificateFormat certFormat); + }; + + Result Initialize(); + Result Finalize(); + }; +}; \ No newline at end of file diff --git a/include/nn/swkbd/swkbd.h b/include/nn/swkbd/swkbd.h new file mode 100644 index 0000000..fb822f5 --- /dev/null +++ b/include/nn/swkbd/swkbd.h @@ -0,0 +1,217 @@ +#pragma once + +#include +#include +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +typedef unsigned char uchar; + +namespace nn +{ + namespace swkbd + { + enum Preset + { + Default, + Password, + UserName, + DownloadCode, + Max_Preset + }; + + enum KeyboardMode + { + ModeLanguageSet1, + ModeNumeric, + ModeASCII, + ModeLanguageSet1Latin, + ModeAlphabet, + ModeSimplifiedChinese, + ModeTraditionalChinese, + ModeKorean, + ModeLanguageSet2, + ModeMax_KeyboardMode, + ModeFull, + ModeFullLatin + }; + + enum InvalidChar + { + Space = 1 << 1, + AtMark = 1 << 2, + Percent = 1 << 3, + Slash = 1 << 4, + BackSlash = 1 << 5, + Numeric = 1 << 6, + OutsideOfDownloadCode = 1 << 7, + OutsideOfMiiNickName = 1 << 8, + Force32 = 1 << 9 + }; + + enum PasswordMode + { + Show, + Hide, + Max_PasswordMode + }; + + enum InputFormMode + { + OneLine, + MultiLine, + Separate, + Max_InputFormMode + }; + + enum InitialCursorPos + { + First, + Last, + Max_InitialCursorPos + }; + + enum TextCheckResult + { + Success, + ShowFailureDialog, + ShowConfirmDialog, + Max_TextCheckResult + }; + + enum DictionaryLang + { + Japanese, + AmericanEnglish, + CanadianFrench, + LatinAmericanSpanish, + Reserved1, + BritishEnglish, + French, + German, + Spanish, + Italian, + Dutch, + Portuguese, + Russian, + Reserved2, + SimplifiedChinesePinyin, + TraditionalChineseCangjie, + TraditionalChineseSimplifiedCangjie, + TraditionalChineseZhuyin, + Korean, + Max_DictionaryLang + }; + + struct DictionaryInfo + { + uint offset; // 0x0 + ushort size; // 0x4 + 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 + { + + KeyboardMode keyboardMode; + char okText[0x12]; + char16_t leftOptionalSymbolKey; + char16_t rightOptionalSymbolKey; + bool isPredictionEnabled; + InvalidChar invalidCharFlag; + InitialCursorPos initialCursorPos; + char headerText[0x82]; + char subText[0x102]; + char guideText[0x202]; + int textMaxLength; + int textMinLength; + PasswordMode passwordMode; + InputFormMode inputFormMode; + bool isUseNewLine; + bool isUseUtf8; + bool isUseBlurBackground; + int _initialStringOffset; + int _initialStringLength; + int _userDictionaryOffset; + int _userDictionaryNum; + bool _isUseTextCheck; + void *_textCheckCallback; + int separateTextPos[0x8]; + }; + + struct ShowKeyboardArg + { + KeyboardConfig keyboardConfig; // 0x0 + const char* workBuf; // 0x400 + long workBufSize; // 0x408 + const char* textCheckWorkBuf; // 0x98 + long textCheckWorkBufSize; // 0xA0 + const char* _customizeDicBuf; // 0xA8 + long _customizeDicBufSize; // 0xB0 + }; + + class String { + public: + String(int size) { + bufsize = size; + strBuf = (char *)malloc(bufsize); + } + + const char *cstr() { return strBuf; } + private: + char *strBuf; + int bufsize; + }; + + ulong GetRequiredWorkBufferSize(bool); + ulong GetRequiredStringBufferSize(void); + void MakePreset(nn::swkbd::KeyboardConfig *,nn::swkbd::Preset); + //void SetHeaderText(nn::swkbd::KeyboardConfig *,char16_t const*); + //void SetSubText(nn::swkbd::KeyboardConfig*, char16_t const*); + void SetOkText(nn::swkbd::KeyboardConfig *,char16_t const*); + void SetOkTextUtf8(nn::swkbd::KeyboardConfig *,char const*); + void SetLeftOptionalSymbolKey(nn::swkbd::KeyboardConfig *,char16_t); + void SetLeftOptionalSymbolKeyUtf8(nn::swkbd::KeyboardConfig *,char const*); + void SetRightOptionalSymbolKey(nn::swkbd::KeyboardConfig *,char16_t); + void SetRightOptionalSymbolKeyUtf8(nn::swkbd::KeyboardConfig *,char const*); + void SetHeaderText(nn::swkbd::KeyboardConfig *,char16_t const*); + void SetHeaderTextUtf8(nn::swkbd::KeyboardConfig *,char const*); + void SetSubText(nn::swkbd::KeyboardConfig *,char16_t const*); + void SetSubTextUtf8(nn::swkbd::KeyboardConfig *,char const*); + void SetGuideText(nn::swkbd::KeyboardConfig *,char16_t const*); + void SetGuideTextUtf8(nn::swkbd::KeyboardConfig *,char const*); + void SetInitialText(nn::swkbd::ShowKeyboardArg *,char16_t const*); + void SetInitialTextUtf8(nn::swkbd::ShowKeyboardArg *,char const*); + //void SetUserWordList(nn::swkbd::ShowKeyboardArg *,nn::swkbd::UserWord const*,int); + void ShowKeyboard(nn::swkbd::String *,nn::swkbd::ShowKeyboardArg const&); + + } // namespace swkbd +} // namespace nn diff --git a/include/nn/system_settings.ini b/include/nn/system_settings.ini new file mode 100644 index 0000000..600d03c --- /dev/null +++ b/include/nn/system_settings.ini @@ -0,0 +1,53 @@ +; 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 \ No newline at end of file diff --git a/include/nn/time.h b/include/nn/time.h new file mode 100644 index 0000000..4a731d5 --- /dev/null +++ b/include/nn/time.h @@ -0,0 +1,82 @@ +/** + * @file time.h + * @brief Time implementation. + */ + +#pragma once + +#include + +namespace nn { +class TimeSpan { +public: + u64 nanoseconds; + + static TimeSpan FromNanoSeconds(u64 nanoSeconds) { + TimeSpan ret; + ret.nanoseconds = nanoSeconds; + return ret; + } + + static TimeSpan FromSeconds(u64 seconds) { + return FromNanoSeconds(seconds * 1000 * 1000 * 1000); + } + static TimeSpan FromMinutes(u64 minutes) { + return FromNanoSeconds(minutes * 1000 * 1000 * 1000 * 60); + } + static TimeSpan FromHours(u64 hours) { + return FromNanoSeconds(hours * 1000 * 1000 * 1000 * 60 * 60); + } + static TimeSpan FromDays(u64 days) { + return FromNanoSeconds(days * 1000 * 1000 * 1000 * 60 * 60 * 24); + } +}; + +namespace time { + +Result Initialize(); +bool IsInitialized(); + +struct CalendarTime { + s16 year; + s8 month; + s8 day; + s8 hour; + s8 minute; + s8 second; +}; + +enum DayOfTheWeek { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }; + +struct TimeZone { + char standardTimeName[0x8]; + bool _9; // daylight savings or something? + s32 utcOffset; // in seconds +}; + +struct CalendarAdditionalInfo { + nn::time::DayOfTheWeek dayOfTheWeek; + s32 dayofYear; + nn::time::TimeZone timeZone; +}; + +struct PosixTime { + u64 time; +}; + +class StandardUserSystemClock { +public: + static Result GetCurrentTime(nn::time::PosixTime*); +}; + +struct TimeZoneRule; // shrug + +Result ToCalendarTime(nn::time::CalendarTime*, nn::time::CalendarAdditionalInfo*, + nn::time::PosixTime const&); +Result ToCalendarTime(nn::time::CalendarTime*, nn::time::CalendarAdditionalInfo*, + nn::time::PosixTime const&, nn::time::TimeZoneRule const&); +Result ToPosixTime(int*, PosixTime*, int, const CalendarTime&); +CalendarTime ToCalendarTimeInUtc(const PosixTime&); +PosixTime ToPosixTimeFromUtc(const CalendarTime&); +}; // namespace time +}; // namespace nn diff --git a/include/nn/ui2d/Layout.h b/include/nn/ui2d/Layout.h new file mode 100644 index 0000000..ab0766f --- /dev/null +++ b/include/nn/ui2d/Layout.h @@ -0,0 +1,55 @@ +/** + * @file Layout.h + * @brief UI Layout implementation. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace ui2d + { + class AnimTransform; + class Pane; + + class Layout + { + public: + Layout(); + + virtual ~Layout(); + + virtual void DeleteAnimTransform(nn::ui2d::AnimTransform *); + virtual void BindAnimation(nn::ui2d::AnimTransform *); + virtual void UnbindAnimation(nn::ui2d::AnimTransform *); + virtual void UnbindAnimation(nn::ui2d::Pane *); + virtual void UnbindAllAnimation(); + + virtual void Animate(); + virtual void UpdateAnimFrame(f32 frame); + virtual void AnimateAndUpdateAnimFrame(f32 frame); + + static void SetAllocator(void* (*)(u64, u64, void *), void (*)(void *, void *), void *); + static void AllocateMemory(u64, u64); + static void AllocateMemory(u64); + void FreeMemory(void *src); + + u64 _10; + u64 _18; + u64 _20; + u64 _28; + u64 _30; + + u64 _40; + u64 _48; + u64 _50; + u64 _58; + u64 _60; + + static void* g_pAllocateFunction; + static void* g_pFreeFunction; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/ui2d/Material.h b/include/nn/ui2d/Material.h new file mode 100644 index 0000000..2faadf1 --- /dev/null +++ b/include/nn/ui2d/Material.h @@ -0,0 +1,32 @@ +/** + * @file Material.h + * @brief UI Material implementation. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace ui2d + { + class AnimTransform; + class BuildResultInformation; + struct UserShaderInformation; + + class Material + { + public: + Material(); + + void Initialize(); + void ReserveMem(s32, s32, s32, s32, bool, s32, bool, s32, bool, bool); + void SetupUserShaderConstantBufferInformation(nn::ui2d::UserShaderInformation const &); + + virtual ~Material(); + virtual void BindAnimation(nn::ui2d::AnimTransform *); + virtual void UnbindAnimation(nn::ui2d::AnimTransform *); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/ui2d/Pane.h b/include/nn/ui2d/Pane.h new file mode 100644 index 0000000..3c287f6 --- /dev/null +++ b/include/nn/ui2d/Pane.h @@ -0,0 +1,83 @@ +/** + * @file Pane.h + * @brief Base UI panel. + */ + +#pragma once + +#include "types.h" +#include "sead/runtime.h" + +namespace nn +{ + namespace ui2d + { + class AnimTransform; + class Layout; + + class Pane + { + public: + Pane(); + Pane(nn::ui2d::Pane const &); + + virtual ~Pane(); + + virtual sead::RuntimeTypeInfo::Interface* GetRuntimeTypeInfo() const; + virtual s32 GetVertexColor(s32); + virtual u8 GetColorElement(s32); + virtual void SetColorElement(u32, u8); + virtual u8 GetVertexColorElement(s32); + virtual void SetVertexColorElement(u32, u8); + virtual u32 GetMaterialCount() const; + virtual u64* GetMaterial(s32) const; + + virtual void BindAnimation(nn::ui2d::AnimTransform *, bool, bool); + virtual void UnbindAnimation(nn::ui2d::AnimTransform *, bool); + + void Initialize(); + void SetName(char const *); + void SetUserData(char const *); + void AppendChild(nn::ui2d::Pane *); + void PrependChild(nn::ui2d::Pane *); + void InsertChild(nn::ui2d::Pane *, nn::ui2d::Pane *); + void RemoveChild(nn::ui2d::Pane *); + void GetVertexPos() const; + + nn::ui2d::Pane* mParent; // _8 + u64 _10; + u64 _18; + u64 _20; + u64 _28; + u32 mPositionX; // _30 + u32 mPositionY; // _34 + u32 mPositionZ; // _38 + u32 mRotationX; // _3C + u32 mRotationY; // _40 + u32 mRotationZ; // _44 + u32 mScaleX; // _48 + u32 mScaleY; // _4C + u32 mSizeX; // _50 + u32 mSizeY; // _54 + u8 mFlags; // _58 (pane + 0x8) + u8 mAlpha; // _59 + u8 mAlphaInfluence; // _5A + u8 mOriginFlags; // _5B + u32 _5C; + u64 _60; + u64 _68; + u128 _70; + u128 _80; + u128 _90; + u64 _A0; + u64 _A8; + void* mAnimExtUserData; // _B0 + char[0x18] mPanelName; // _B8 + u8 _D0; + char [8] mUserData; // _D1 + u8 _D9; + u16 _DA; + u32 _DC; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/ui2d/Parts.h b/include/nn/ui2d/Parts.h new file mode 100644 index 0000000..c221e3b --- /dev/null +++ b/include/nn/ui2d/Parts.h @@ -0,0 +1,32 @@ +/** + * @file Parts.h + * @brief Layout parts. + */ + +#pragma once + +#include "Pane.h" + +namespace nn +{ + namespace ui2d + { + struct BuildArgSet; + struct ResParts; + + class Parts : nn::ui2d::Pane + { + public: + Parts(); + Parts(nn::ui2d::ResParts const *, nn::ui2d::ResParts const *, nn::ui2d::BuildArgSet const &); + Parts(nn::ui2d::Parts const &); + + virtual ~Parts(); + virtual sead::RuntimeTypeInfo::Interface* GetRuntimeTypeInfo() const; + + u64 _E0; + u64 _E8; + u32 _F0; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/ui2d/Texture.h b/include/nn/ui2d/Texture.h new file mode 100644 index 0000000..392de3d --- /dev/null +++ b/include/nn/ui2d/Texture.h @@ -0,0 +1,8 @@ +#pragma once + +namespace nn { + namespace ui2d { + class TextureInfo; + class TextureData; + } +} \ No newline at end of file diff --git a/include/nn/ui2d/detail/TexCoordArray.h b/include/nn/ui2d/detail/TexCoordArray.h new file mode 100644 index 0000000..ca438c3 --- /dev/null +++ b/include/nn/ui2d/detail/TexCoordArray.h @@ -0,0 +1,38 @@ +/** + * @file TexCoordArray.h + * @brief Texture coordinate array implementation. + */ + +#pragma once + +#include "types.h" +#include "../util/Float2.h" + +namespace nn +{ + namespace ui2d + { + class Layout; + + namespace detail + { + class TexCoordArray + { + public: + void Initialize(); + void Free(); + void Reserve(s32); + void SetSize(s32 size); + void GetCoord(nn::util::Float2 *, s32) const; + void SetCoord(s32, nn::util::Float2 const *); + void Copy(void const *, s32); + bool CompareCopiedInstanceTest(nn::ui2d::detail::TexCoordArray const &) const; + + u16 _0; + u16 _2; + u32 _4; // padding? + nn::ui2d::Layout* mLayout; // _8 + }; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/util.h b/include/nn/util.h new file mode 100644 index 0000000..9f88a91 --- /dev/null +++ b/include/nn/util.h @@ -0,0 +1,10 @@ +#pragma once + +#include "../types.h" + +namespace nn { namespace util { + +s32 SNPrintf(char* s, ulong n, const char* format, ...); +s32 VSNPrintf(char* s, ulong n, const char* format, va_list arg); + +} } diff --git a/include/nn/util/Float2.h b/include/nn/util/Float2.h new file mode 100644 index 0000000..170edfe --- /dev/null +++ b/include/nn/util/Float2.h @@ -0,0 +1,22 @@ +/** + * @file Float2.h + * @brief Some odd float implementation that I don't understand yet... + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace util + { + struct Float2 + { + u64 _0; + u64 _8; + u64 _10; + u64 _18; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/util/util_AccessorBase.h b/include/nn/util/util_AccessorBase.h new file mode 100644 index 0000000..350b720 --- /dev/null +++ b/include/nn/util/util_AccessorBase.h @@ -0,0 +1,17 @@ +#pragma once + +namespace nn +{ + namespace util + { + template + class AccessorBase : protected T + { + protected: + AccessorBase(); + + public: + typedef T value_type; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/vfx/Config.h b/include/nn/vfx/Config.h new file mode 100644 index 0000000..09e916d --- /dev/null +++ b/include/nn/vfx/Config.h @@ -0,0 +1,18 @@ +/** + * @file Config.h + * @brief VFX configuration. + */ + +#pragma once + +namespace nn +{ + namespace vfx + { + class Config + { + public: + virtual ~Config(); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/vfx/Heap.h b/include/nn/vfx/Heap.h new file mode 100644 index 0000000..52ccb6f --- /dev/null +++ b/include/nn/vfx/Heap.h @@ -0,0 +1,20 @@ +/** + * @file Heap.h + * @brief VFX heap implementation. + */ + +#pragma once + +#include "types.h" + +namespace nn +{ + namespace vfx + { + class Heap + { + public: + virtual ~Heap(); + }; + }; +}; \ No newline at end of file diff --git a/include/nn/vfx/System.h b/include/nn/vfx/System.h new file mode 100644 index 0000000..7f73533 --- /dev/null +++ b/include/nn/vfx/System.h @@ -0,0 +1,27 @@ +/** + * @file System.h + * @brief VFX system implementation. + */ + +#pragma once + +#include "Config.h" +#include "Heap.h" + +// this class is massive +namespace nn +{ + namespace vfx + { + class System + { + public: + System(nn::vfx::Config const &); + + virtual ~System(); + virtual void Initialize(nn::vfx::Heap *,nn::vfx::Heap *, nn::vfx::Config const &); + + u8 _0[0x1700]; + }; + }; +}; \ No newline at end of file diff --git a/include/nn/vi.h b/include/nn/vi.h new file mode 100644 index 0000000..6a3c57a --- /dev/null +++ b/include/nn/vi.h @@ -0,0 +1,34 @@ +/** + * @file vi.h + * @brief Visual interface implementation. + */ + +#pragma once + +#include "os.h" +#include "types.h" + +namespace nn +{ + namespace vi + { + class Display; + class Layer; + + enum ScalingMode + { + None, + Exact, + FitLayer, + ScaleAndCrop, + PreserveAspectRatio + }; + + void Initialize(); + Result OpenDefaultDisplay(nn::vi::Display **out_Disp); + Result CreateLayer(nn::vi::Layer *out_Layer*, nn::vi::Display *disp); + Result SetLayerScalingMode(nn::vi::Layer *layer, nn::vi::ScalingMode scalingMode); + Result GetDisplayVsyncEvent(nn::os::SystemEventType *, nn::vi::Display *); + Result GetNativeWindow(void **window, nn::vi::Layer *); + }; +}; \ No newline at end of file diff --git a/include/packets/CaptureInf.h b/include/packets/CaptureInf.h new file mode 100644 index 0000000..dc40f23 --- /dev/null +++ b/include/packets/CaptureInf.h @@ -0,0 +1,13 @@ +#pragma once + +#include "Packet.h" + +struct CaptureInf : Packet { + CaptureInf() : Packet() { + this->mType = PacketType::CAPTUREINF; + mPacketSize = sizeof(CaptureInf) - sizeof(Packet); + }; + + char hackName[0x20] = {}; + +}; \ No newline at end of file diff --git a/include/packets/ChangeStagePacket.h b/include/packets/ChangeStagePacket.h new file mode 100644 index 0000000..69d0f29 --- /dev/null +++ b/include/packets/ChangeStagePacket.h @@ -0,0 +1,14 @@ +#pragma once + +#include "Packet.h" + +struct ChangeStagePacket : Packet { + ChangeStagePacket() : Packet() { + this->mType = PacketType::CHANGESTAGE; + mPacketSize = sizeof(ChangeStagePacket) - sizeof(Packet); + }; + char changeStage[0x30] = {}; + char changeID[0x10] = {}; + s8 scenarioNo = -1; + u8 subScenarioType = -1; +}; \ No newline at end of file diff --git a/include/packets/CostumeInf.h b/include/packets/CostumeInf.h new file mode 100644 index 0000000..bba2277 --- /dev/null +++ b/include/packets/CostumeInf.h @@ -0,0 +1,15 @@ +#pragma once + +#include "Packet.h" + +struct CostumeInf : Packet { + CostumeInf() : Packet() {this->mType = PacketType::COSTUMEINF; mPacketSize = sizeof(CostumeInf) - sizeof(Packet);}; + CostumeInf(const char* body, const char* cap) : Packet() { + this->mType = PacketType::COSTUMEINF; + mPacketSize = sizeof(CostumeInf) - sizeof(Packet); + strcpy(bodyModel, body); + strcpy(capModel, cap); + } + char bodyModel[COSTUMEBUFSIZE] = {}; + char capModel[COSTUMEBUFSIZE] = {}; +}; \ No newline at end of file diff --git a/include/packets/GameInf.h b/include/packets/GameInf.h new file mode 100644 index 0000000..7b82954 --- /dev/null +++ b/include/packets/GameInf.h @@ -0,0 +1,22 @@ +#pragma once + +#include "Packet.h" +#include "al/util.hpp" + +struct GameInf : Packet { + GameInf() : Packet() {this->mType = PacketType::GAMEINF; mPacketSize = sizeof(GameInf) - sizeof(Packet);}; + bool is2D = false; + u8 scenarioNo = -1; + char stageName[0x40] = {}; + + bool operator==(const GameInf &rhs) const { + return ( + is2D == rhs.is2D && + scenarioNo == rhs.scenarioNo && + al::isEqualString(stageName, rhs.stageName) + ); + } + + bool operator!=(const GameInf& rhs) const { return !operator==(rhs); } + +}; \ No newline at end of file diff --git a/include/packets/HackCapInf.h b/include/packets/HackCapInf.h new file mode 100644 index 0000000..7434bd5 --- /dev/null +++ b/include/packets/HackCapInf.h @@ -0,0 +1,11 @@ +#pragma once + +#include "Packet.h" + +struct HackCapInf : Packet { + HackCapInf() : Packet() {this->mType = PacketType::HACKCAPINF; mPacketSize = sizeof(HackCapInf) - sizeof(Packet);}; + sead::Vector3f capPos; + sead::Quatf capQuat; + bool isCapVisible = false; + char capAnim[PACKBUFSIZE] = {}; +}; \ No newline at end of file diff --git a/include/packets/InitPacket.h b/include/packets/InitPacket.h new file mode 100644 index 0000000..002b93d --- /dev/null +++ b/include/packets/InitPacket.h @@ -0,0 +1,8 @@ +#pragma once + +#include "Packet.h" + +struct InitPacket : Packet { + InitPacket() : Packet() {this->mType = PacketType::CLIENTINIT; mPacketSize = sizeof(InitPacket) - sizeof(Packet);}; + u16 maxPlayers = 0; +}; \ No newline at end of file diff --git a/include/packets/Packet.h b/include/packets/Packet.h new file mode 100644 index 0000000..9fe183c --- /dev/null +++ b/include/packets/Packet.h @@ -0,0 +1,81 @@ +#pragma once + +#include "sead/math/seadVector.h" +#include "sead/math/seadQuat.h" + +#include "nn/account.h" + +#define PACKBUFSIZE 0x30 +#define COSTUMEBUFSIZE 0x20 + +#define MAXPACKSIZE 0x100 + +enum PacketType : short { + UNKNOWN, + CLIENTINIT, + PLAYERINF, + HACKCAPINF, + GAMEINF, + TAGINF, + PLAYERCON, + PLAYERDC, + COSTUMEINF, + SHINECOLL, + CAPTUREINF, + CHANGESTAGE, + CMD +}; + +// attribute otherwise the build log is spammed with unused warnings +__attribute((used)) static const char *packetNames[] = { + "Unknown", + "Player Info", + "Player Cap Info", + "Game Info", + "Tag Info", + "Player Connect", + "Player Disconnect", + "Costume Info", + "Moon Collection", + "Capture Info", + "Server Command" +}; + +enum SenderType { + SERVER, + CLIENT +}; + +enum ConnectionTypes { + INIT, + RECONNECT +}; + +// unused +/* +static const char *senderNames[] = { + "Server", + "Client" +}; +*/ + +struct Packet { + nn::account::Uid mUserID; // User ID of the packet owner + PacketType mType = PacketType::UNKNOWN; + short mPacketSize = 0; // represents packet size without size of header +}; + +// all packet types + +#include "packets/PlayerInfPacket.h" +#include "packets/PlayerConnect.h" +#include "packets/PlayerDC.h" +#include "packets/GameInf.h" +#include "packets/TagInf.h" +#include "packets/CostumeInf.h" +#include "packets/ServerCommand.h" +#include "packets/ShineCollect.h" +#include "packets/CaptureInf.h" +#include "packets/HackCapInf.h" +#include "packets/ChangeStagePacket.h" +#include "packets/InitPacket.h" \ No newline at end of file diff --git a/include/packets/PlayerConnect.h b/include/packets/PlayerConnect.h new file mode 100644 index 0000000..24e577e --- /dev/null +++ b/include/packets/PlayerConnect.h @@ -0,0 +1,10 @@ +#pragma once + +#include "Packet.h" + +struct PlayerConnect : Packet { + PlayerConnect() : Packet() {this->mType = PacketType::PLAYERCON; mPacketSize = sizeof(PlayerConnect) - sizeof(Packet);}; + ConnectionTypes conType; + u16 maxPlayerCount; + char clientName[COSTUMEBUFSIZE] = {}; +}; \ No newline at end of file diff --git a/include/packets/PlayerDC.h b/include/packets/PlayerDC.h new file mode 100644 index 0000000..d88432e --- /dev/null +++ b/include/packets/PlayerDC.h @@ -0,0 +1,7 @@ +#pragma once + +#include "Packet.h" + +struct PlayerDC : Packet { + PlayerDC() : Packet() {this->mType = PacketType::PLAYERDC; mPacketSize = sizeof(PlayerDC) - sizeof(Packet);}; +}; \ No newline at end of file diff --git a/include/packets/PlayerInfPacket.h b/include/packets/PlayerInfPacket.h new file mode 100644 index 0000000..0b54b0a --- /dev/null +++ b/include/packets/PlayerInfPacket.h @@ -0,0 +1,34 @@ +#pragma once + +#include "Packet.h" +#include "al/util.hpp" +#include "algorithms/PlayerAnims.h" + +struct PlayerInf : Packet { + PlayerInf() : Packet() {mType = PacketType::PLAYERINF; mPacketSize = sizeof(PlayerInf) - sizeof(Packet);}; + sead::Vector3f playerPos; + sead::Quatf playerRot; + float animBlendWeights[6]; + PlayerAnims::Type actName; + PlayerAnims::Type subActName; + + bool operator==(const PlayerInf &rhs) const { + bool isWeightsEqual = true; + for (size_t i = 0; i < 6; i++) + { + if(animBlendWeights[i] != rhs.animBlendWeights[i]) { + isWeightsEqual = false; + break; + } + } + return ( + playerPos == rhs.playerPos && + playerRot == rhs.playerRot && + isWeightsEqual && + actName == rhs.actName && + subActName == rhs.subActName + ); + } + + bool operator!=(const PlayerInf& rhs) const { return !operator==(rhs); } +}; \ No newline at end of file diff --git a/include/packets/ServerCommand.h b/include/packets/ServerCommand.h new file mode 100644 index 0000000..4edd608 --- /dev/null +++ b/include/packets/ServerCommand.h @@ -0,0 +1,8 @@ +#pragma once + +#include "Packet.h" + +struct ServerCommand : Packet { + ServerCommand(const char *command) : Packet() {this->mType = PacketType::CMD; strcpy(srvCmd, command); mPacketSize = sizeof(ServerCommand) - sizeof(Packet);}; + char srvCmd[PACKBUFSIZE] = {}; +}; \ No newline at end of file diff --git a/include/packets/ShineCollect.h b/include/packets/ShineCollect.h new file mode 100644 index 0000000..9f8a8c7 --- /dev/null +++ b/include/packets/ShineCollect.h @@ -0,0 +1,9 @@ +#pragma once + +#include "Packet.h" + +struct ShineCollect : Packet { + ShineCollect() : Packet() {this->mType = PacketType::SHINECOLL; mPacketSize = sizeof(ShineCollect) - sizeof(Packet);}; + int shineId = -1; + bool isGrand = false; +}; \ No newline at end of file diff --git a/include/packets/TagInf.h b/include/packets/TagInf.h new file mode 100644 index 0000000..22bcdb9 --- /dev/null +++ b/include/packets/TagInf.h @@ -0,0 +1,17 @@ +#pragma once + +#include "Packet.h" +#include "sead/basis/seadTypes.h" + +enum TagUpdateType : u8 { + TIME = 1 << 0, + STATE = 1 << 1 +}; + +struct TagInf : Packet { + TagInf() : Packet() { this->mType = PacketType::TAGINF; mPacketSize = sizeof(TagInf) - sizeof(Packet);}; + TagUpdateType updateType; + bool isIt = false; + u8 seconds; + u16 minutes; +}; \ No newline at end of file diff --git a/include/puppets/HackModelHolder.hpp b/include/puppets/HackModelHolder.hpp new file mode 100644 index 0000000..9e9de92 --- /dev/null +++ b/include/puppets/HackModelHolder.hpp @@ -0,0 +1,38 @@ +#pragma once +#include "al/LiveActor/LiveActor.h" +#include "al/util.hpp" + +#include "sead/prim/seadSafeString.hpp" + +#include "helpers.hpp" +#include "actors/PuppetHackActor.h" + +struct CaptureEntry { + PuppetHackActor *actor; + char className[0x16]; +}; + +class HackModelHolder { + public: + HackModelHolder() = default; + + PuppetHackActor *getCapture(const char *hackName); + PuppetHackActor *getCapture(int index); + + const char *getCaptureClass(int index); + bool addCapture(PuppetHackActor *capture, const char *hackName); + bool removeCapture(const char *hackName); + + int getEntryCount() { return mCaptureCount; }; + + bool setCurrent(const char* hackName); + + PuppetHackActor *getCurrentActor(); + const char *getCurrentActorName(); + + void resetList(); + private: + int mCaptureCount; + CaptureEntry *mCurCapture; + CaptureEntry mOnlineCaptures[128]; +}; \ No newline at end of file diff --git a/include/puppets/PuppetHolder.hpp b/include/puppets/PuppetHolder.hpp new file mode 100644 index 0000000..0b4efd6 --- /dev/null +++ b/include/puppets/PuppetHolder.hpp @@ -0,0 +1,39 @@ +#pragma once + + +#include "sead/container/seadPtrArray.h" +#include "sead/prim/seadSafeString.hpp" +#include "logger.hpp" +#include "actors/PuppetActor.h" + +class PuppetHolder { + public: + PuppetHolder(int size); + + void update(); + + bool tryRegisterPuppet(PuppetActor *puppet); + + bool tryRegisterDebugPuppet(PuppetActor *puppet); + + bool checkInfoIsInStage(PuppetInfo *info); + + int getSize() {return mPuppetArr.size(); } + + PuppetActor *getPuppetActor(int idx) {return mPuppetArr[idx];}; + + PuppetActor *getDebugPuppet(); + + void setStageInfo(const char *stageName, u8 scenarioNo); + + void clearPuppets() { mPuppetArr.clear(); } + + private: + sead::PtrArray mPuppetArr; + + PuppetActor *mDebugPuppet; + + sead::FixedSafeString<0x40> mStageName; + + u8 mScenarioNo; +}; \ No newline at end of file diff --git a/include/puppets/PuppetInfo.h b/include/puppets/PuppetInfo.h new file mode 100644 index 0000000..50086fd --- /dev/null +++ b/include/puppets/PuppetInfo.h @@ -0,0 +1,50 @@ +#pragma once + +#include "algorithms/PlayerAnims.h" +#include "packets/Packet.h" + +#include "al/LiveActor/LiveActor.h" + +#include "nn/account.h" + +#include "sead/math/seadVector.h" +#include "sead/math/seadQuat.h" + +struct PuppetInfo { + // General Puppet Info + char puppetName[0x10] = {}; // max user account name size is 10 chars, so this could go down to 0xB + bool isConnected = false; + nn::account::Uid playerID; + // Puppet Translation Info + sead::Vector3f playerPos = sead::Vector3f(0.f,0.f,0.f); + sead::Quatf playerRot = sead::Quatf(0.f,0.f,0.f,0.f); + // Puppet Stage Info + u8 scenarioNo = -1; + char stageName[0x40] = {}; + bool isInSameStage = false; + // Puppet Costume Info + char costumeBody[0x20] = {}; + char costumeHead[0x20] = {}; + // Puppet Capture Info + char curHack[0x40] = {}; + bool isCaptured = false; + bool isStartCapture = false; + // Puppet Model Info + PlayerAnims::Type curAnim; + PlayerAnims::Type curSubAnim; + char curAnimStr[PACKBUFSIZE] = {}; + char curSubAnimStr[PACKBUFSIZE] = {}; + float blendWeights[6] = {}; + float animRate = 0.f; + bool is2D = false; + // Puppet Hack Cap Info + sead::Vector3f capPos = sead::Vector3f(0.f,0.f,0.f); + sead::Quatf capRot = sead::Quatf(0.f,0.f,0.f,0.f); + char capAnim[PACKBUFSIZE] = {}; + bool isCapThrow = false; + bool isHoldThrow = false; + // Hide and Seek Gamemode Info + bool isIt = false; + u8 seconds = 0; + u16 minutes = 0; +}; \ No newline at end of file diff --git a/include/rs/util.hpp b/include/rs/util.hpp new file mode 100644 index 0000000..6da13c9 --- /dev/null +++ b/include/rs/util.hpp @@ -0,0 +1,79 @@ +#pragma once + +#include "game/GameData/GameDataFile.h" +#include "game/Info/QuestInfoHolder.h" +#include "sead/math/seadVector.h" +#include "al/util.hpp" +#include "al/sensor/SensorMsg.h" +#include "game/Player/PlayerActorHakoniwa.h" +#include "al/area/ChangeStageInfo.h" + +namespace rs { + + bool isModeE3Rom(void); + + bool isModeE3LiveRom(void); + + bool tryCalcMapNorthDir(sead::Vector3f *, al::IUseSceneObjHolder const*); + + void invalidateQuest(QuestInfo const *info); + + QuestInfoHolder *getQuestInfoHolder(al::IUseSceneObjHolder const*); + + char16_t* getWorldCoinCollectPictureFont(al::LayoutActor const*); + + bool calcOnGroundNormalOrGravityDir(sead::Vector3f*, al::LiveActor const*, IUsePlayerCollision const*); + + void buyCap(al::IUseSceneObjHolder const *, char const*); + void buyCloth(al::IUseSceneObjHolder const *, char const*); + + ChangeStageInfo *createChangeStageInfo(al::LiveActor const *actor, char const *changeStageID, char const *changeStageName, bool, int scenarioNo, ChangeStageInfo::SubScenarioType type); + ChangeStageInfo *createChangeStageInfo(al::LiveActor const*, al::PlacementInfo const&, char const*, char const*, bool, int, ChangeStageInfo::SubScenarioType); + ChangeStageInfo *createChangeStageInfo(const al::LiveActor *, const al::PlacementInfo *); + + bool isPlayerDamageStopDemo(const al::LiveActor *); + + PlayerActorHakoniwa * getPlayerActor(const al::Scene *); + + void get2DAreaPos(sead::Vector3 *, al::AreaObj const *); + + bool isInChangeStageArea(PlayerActorHakoniwa const*, sead::Vector3f const *); + + bool isPlayerOnGround(const al::LiveActor *); + + void faceToCamera(al::LiveActor *actor); + + bool isPlayerActiveMarioAmiiboInvincible(al::LiveActor *); + + bool isMsgPlayerAndCapObjHipDropAll(al::SensorMsg const *); + + bool isMsgPlayerDamage(al::SensorMsg const *); + + bool isMsgShineGet(al::SensorMsg const *); + + void saveCoinStack(al::LiveActor const* actor, al::PlacementId const* placement, int stackCount); + + bool isActiveDemo(al::LiveActor const *); + + bool isActiveDemoWithPlayer(al::Scene const *); + + bool isActiveDemoWithPlayerKeepCarry(al::Scene const *); + + bool isActiveDemoWithPlayerUseCoin(al::Scene const *); + + bool isActiveDemoShineGet(al::Scene const *); + + bool isActiveDemoWarp(al::Scene const *); + + bool isActiveDemoScenarioCamera(al::Scene const *); + + bool isActiveDemoTalk(al::Scene const *); + + void recoveryPlayerOxygen(const al::LiveActor *); + + bool is2D(IUseDimension const *); + + void calcGroundNormalOrGravityDir(sead::Vector3f *result, al::LiveActor const *actor, IUsePlayerCollision const *col); + + void calcPlayerFrontDir(sead::Vector3f *result, al::LiveActor const *); +} diff --git a/include/rs/util/InputUtil.h b/include/rs/util/InputUtil.h new file mode 100644 index 0000000..37b9069 --- /dev/null +++ b/include/rs/util/InputUtil.h @@ -0,0 +1,23 @@ +#pragma once + +#include "al/scene/SceneObjHolder.h" + +namespace rs { + bool isTriggerUiAnyABXY(al::IUseSceneObjHolder const*); + bool isTriggerUiCancel(al::IUseSceneObjHolder const*); + bool isTriggerUiDecide(class GameDataHolder const*); + bool isTriggerUiDecide(al::IUseSceneObjHolder const*); + bool isTriggerUiDown(al::IUseSceneObjHolder const*); + bool isTriggerUiL(al::IUseSceneObjHolder const*); + bool isTriggerUiLeft(al::IUseSceneObjHolder const*); + bool isTriggerUiPause(al::IUseSceneObjHolder const*); + bool isTriggerUiR(al::IUseSceneObjHolder const*); + bool isTriggerUiRacePause(al::IUseSceneObjHolder const*); + bool isTriggerUiRight(al::IUseSceneObjHolder const*); + bool isTriggerUiSelect(al::IUseSceneObjHolder const*); + bool isTriggerUiUp(al::IUseSceneObjHolder const*); + bool isTriggerUiX(al::IUseSceneObjHolder const*); + bool isTriggerUiY(al::IUseSceneObjHolder const*); + bool isTriggerUiZL(al::IUseSceneObjHolder const*); + bool isTriggerUiZR(al::IUseSceneObjHolder const*); +} \ No newline at end of file diff --git a/include/rs/util/ItemUtil.h b/include/rs/util/ItemUtil.h new file mode 100644 index 0000000..e9dd0d5 --- /dev/null +++ b/include/rs/util/ItemUtil.h @@ -0,0 +1,37 @@ +#pragma once + +#include "al/util/StringUtil.h" +#include "al/actor/ActorInitInfo.h" + +namespace rs { + enum ItemType { + COIN, + COIN2D, + COINBLOW, + COINBLOWVERYLITTLE, + COINPOPUP, + COINPOPUPWITHOUTHITREACTION, + COIN3, + COIN5, + COIN10, + COIN10AUTO, + COIN100, + COIN5COUNT, + LIFEUPITEM, + LIFEUPITEMBACK, + LIFEUPITEM2D, + LIFEMAXUPITEM, + LIFEMAXUPITEM2D, + SHINE, + AIRBUBBLE, + DOTMARIOCAT, + KURIBOMINI3, + KURIBOMINI8, + COINSTACKBOUND, + RANDOM + }; + + ItemType getItemType(const char *); + + ItemType getItemType(al::ActorInitInfo const &); +} \ No newline at end of file diff --git a/include/rs/util/LiveActorUtil.h b/include/rs/util/LiveActorUtil.h new file mode 100644 index 0000000..ab65598 --- /dev/null +++ b/include/rs/util/LiveActorUtil.h @@ -0,0 +1,9 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" + +namespace rs +{ + void initItemByPlacementInfo(al::LiveActor *, al::ActorInitInfo const &, bool); + float setShadowDropLength(al::LiveActor *,al::ActorInitInfo const&,char const*); +} // namespace rs diff --git a/include/rs/util/SensorUtil.h b/include/rs/util/SensorUtil.h new file mode 100644 index 0000000..959b520 --- /dev/null +++ b/include/rs/util/SensorUtil.h @@ -0,0 +1,1018 @@ +#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 + +namespace rs +{ + +void setAppearItemFactorAndOffsetByMsg(al::LiveActor const*, al::SensorMsg const*, + al::HitSensor const*); + +bool isMsgBreakBySword(al::SensorMsg const*); +bool isMsgStatueDrop(al::SensorMsg const*); +bool isMsgHackerDamageAndCancel(al::SensorMsg const*); +bool isMsgEnableMapCheckPointWarpCollidedGround(al::SensorMsg const*, al::LiveActor const*); +bool isMsgEnableMapCheckPointWarpCollidedGround(al::SensorMsg const*, IUsePlayerCollision const*); +bool isMsgAckCheckpoint(al::SensorMsg const*); +bool isMsgAckGetShine(al::SensorMsg const*); +bool isMsgAckLifeUp(al::SensorMsg const*); +bool isMsgAckLifeMaxUp(al::SensorMsg const*); +bool isMsgAskRailCollision(al::SensorMsg const*); +bool isMsgAttachCactusNeedle(al::SensorMsg const*); +bool isMsgAirExplosion(al::SensorMsg const*); +bool isMsgBelowObjBroken(al::SensorMsg const*); +bool isMsgBindCollidedGround(al::SensorMsg const*); +bool isMsgBindKeepDemoStart(al::SensorMsg const*); +bool isMsgBindKeepDemoExecute(al::SensorMsg const*); +bool isMsgBindKeepDemoEnd(al::SensorMsg const*); +bool isMsgBindRecoveryLife(al::SensorMsg const*); +bool isMsgBirdFlyAway(al::SensorMsg const*); +bool isMsgBlowObjAttack(al::SensorMsg const*); +bool isMsgMayorItemCollide(al::SensorMsg const*); +bool isMsgMayorItemReflect(al::SensorMsg const*); +bool isMsgBlowObjAttackReflect(al::SensorMsg const*); +bool isMsgBossKnuckleCounter(al::SensorMsg const*); +bool isMsgBossKnuckleFallAttack(al::SensorMsg const*); +bool isMsgBossKnuckleHackAttack(al::SensorMsg const*); +bool isMsgBossKnuckleIceConflict(al::SensorMsg const*); +bool isMsgBossKnuckleIceFallToMummy(al::SensorMsg const*); +bool isMsgBossKnuckleKillerAttack(al::SensorMsg const*); +bool isMsgBreakPartsBreak(al::SensorMsg const*); +bool isMsgBreedaSlap(al::SensorMsg const*); +bool isMsgBreedaPush(al::SensorMsg const*); +bool isMsgBubbleAttack(al::SensorMsg const*); +bool isMsgBubbleAttackToPecho(al::SensorMsg const*); +bool isMsgBubbleLauncherStart(al::SensorMsg const*); +bool isMsgBubbleReflectH(al::SensorMsg const*); +bool isMsgBubbleReflectV(al::SensorMsg const*); +bool isMsgBubbleWallTouch(al::SensorMsg const*); +bool isMsgBubbleGroundTouchTrigger(al::SensorMsg const*); +bool isMsgBullAttack(al::SensorMsg const*); +bool isMsgBullHackAttack(al::SensorMsg const*); +bool isMsgBullEnemyAttack(al::SensorMsg const*); +bool isMsgByugoBlow(al::SensorMsg const*); +bool isMsgCameraAngleElevationResetFast(al::SensorMsg const*); +bool isMsgCancelHack(al::SensorMsg const*); +bool isMsgCancelHackArea(al::SensorMsg const*); +bool isMsgCancelHackByDokan(al::SensorMsg const*); +bool isMsgCapAttack(al::SensorMsg const*); +bool isMsgCapAttackCollide(al::SensorMsg const*); +bool isMsgCapAttackRailMove(al::SensorMsg const*); +bool isMsgCapAttackStayRolling(al::SensorMsg const*); +bool isMsgCapAttackStayRollingCollide(al::SensorMsg const*); +bool isMsgCapBeamerBeam(al::SensorMsg const*); +bool isMsgCapCancelLockOn(al::SensorMsg const*); +bool isMsgCapChangeGiant(al::SensorMsg const*); +bool isMsgCapEnableLockOn(al::SensorMsg const*); +bool isMsgCapStartLockOn(al::SensorMsg const*); +bool isMsgCapKeepLockOn(al::SensorMsg const*); +bool isMsgCapGiantAttack(al::SensorMsg const*); +bool isMsgCapHipDrop(al::SensorMsg const*); +bool isMsgCapObjHipDrop(al::SensorMsg const*); +bool isMsgCapObjHipDropReflect(al::SensorMsg const*); +bool isMsgCapIgnoreCancelLockOn(al::SensorMsg const*); +bool isMsgCapIgnoreCancelMissReaction(al::SensorMsg const*); +bool isMsgCapIgnoreCollisionCheck(al::SensorMsg const*); +bool isMsgCapItemGet(al::SensorMsg const*); +bool isMsgCapReflect(al::SensorMsg const*); +bool isMsgCapReflectCollide(al::SensorMsg const*); +bool isMsgCapRethrow(al::SensorMsg const*); +bool isMsgCapTouchWall(al::SensorMsg const*); +bool isMsgCapTrampolineAttack(al::SensorMsg const*); +bool isMsgCatchBombThrough(al::SensorMsg const*); +bool isMsgCheckCarObstacle(al::SensorMsg const*); +bool isMsgCheckIsCardboardBox(al::SensorMsg const*); +bool isMsgChorobonAttack(al::SensorMsg const*); +bool isMsgClearFire(al::SensorMsg const*); +bool isMsgCollectAnimalTouchCollide(al::SensorMsg const*); +bool isMsgCollisionImpulse(al::SensorMsg const*); +bool isMsgConductLightning(al::SensorMsg const*); +bool isMsgConfirmFrailBox(al::SensorMsg const*); +bool isMsgConfirmBrokenFrailBox(al::SensorMsg const*); +bool isMsgDamageBallAttack(al::SensorMsg const*); +bool isMsgDamageBallBodyAttack(al::SensorMsg const*); +bool isMsgDigPointSmell(al::SensorMsg const*); +bool isMsgDonsukeAttack(al::SensorMsg const*); +bool isMsgDonsukeGroundAttack(al::SensorMsg const*); +bool isMsgDonsukePush(al::SensorMsg const*); +bool isMsgDragonAttack(al::SensorMsg const*); +bool isMsgEatExplosion(al::SensorMsg const*); +bool isMsgElectricWireNoLimitDistance(al::SensorMsg const*); +bool isMsgEnableInSaucePan(al::SensorMsg const*); +bool isMsgEnableMapCheckPointWarp(al::SensorMsg const*); +bool isMsgEndInSaucePan(al::SensorMsg const*); +bool isMsgEnemyAttack2D(al::SensorMsg const*); +bool isMsgEnemyAttack3D(al::SensorMsg const*); +bool isMsgEnemyAttackDash(al::SensorMsg const*); +bool isMsgFireBrosFireBallCollide(al::SensorMsg const*); +bool isMsgFireDamageAll(al::SensorMsg const*); +bool isMsgHackAttackFire(al::SensorMsg const*); +bool isMsgFireSwitchFire(al::SensorMsg const*); +bool isMsgEnemyAttackFireCollision(al::SensorMsg const*); +bool isMsgEnemyAttackTRex(al::SensorMsg const*); +bool isMsgPoisonDamageAll(al::SensorMsg const*); +bool isMsgEnemyAttackPoison(al::SensorMsg const*); +bool isMsgHackAttackPoison(al::SensorMsg const*); +bool isMsgPaintAttackPoison(al::SensorMsg const*); +bool isMsgConfirmPaintObj(al::SensorMsg const*); +bool isMsgConfirmPaintObjForSeed(al::SensorMsg const*); +bool isMsgEnemyAttackStrong(al::SensorMsg const*); +bool isMsgEnemyKick(al::SensorMsg const*); +bool isMsgRabbitKick(al::SensorMsg const*); +bool isMsgEnemyObjBreak(al::SensorMsg const*); +bool isMsgFireBlowerAttack(al::SensorMsg const*); +bool isMsgFishingAttack(al::SensorMsg const*); +bool isMsgFishingCancel(al::SensorMsg const*); +bool isMsgFishingFishApproach(al::SensorMsg const*); +bool isMsgFishingFishFloatTouch(al::SensorMsg const*); +bool isMsgFishingItemGet(al::SensorMsg const*); +bool isMsgFishingLineTouch(al::SensorMsg const*); +bool isMsgFishingStart(al::SensorMsg const*); +bool isMsgFishingUpImmediately(al::SensorMsg const*); +bool isMsgFishingUpImmediatelyPrepare(al::SensorMsg const*); +bool isMsgFishingWait(al::SensorMsg const*); +bool isMsgFrogHackTrample(al::SensorMsg const*); +bool isMsgGamaneBullet(al::SensorMsg const*); +bool isMsgGamaneBulletThrough(al::SensorMsg const*); +bool isMsgGamaneBulletForCoinFlower(al::SensorMsg const*); +bool isMsgGemyAim(al::SensorMsg const*); +bool isMsgGhostCancel(al::SensorMsg const*); +bool isMsgGhostPlay(al::SensorMsg const*); +bool isMsgGhostRecordEnd(al::SensorMsg const*); +bool isMsgGhostRecordStart(al::SensorMsg const*); +bool isMsgGhostRecordStartOk(al::SensorMsg const*); +bool isMsgGhostReverse(al::SensorMsg const*); +bool isMsgGhostStop(al::SensorMsg const*); +bool isMsgGiantWanderBossAttack(al::SensorMsg const*); +bool isMsgGiantWanderBossBulletAttack(al::SensorMsg const*); +bool isMsgGiantWanderBossBulletPush(al::SensorMsg const*); +bool isMsgGoldHammerAttack(al::SensorMsg const*); +bool isMsgGrowFlowerSeedDisablePush(al::SensorMsg const*); +bool isMsgGrowFlowerSeedNear(al::SensorMsg const*); +bool isMsgGrowPlantPush(al::SensorMsg const*); +bool isMsgGrowerAttack(al::SensorMsg const*); +bool isMsgGrowerWallAttack(al::SensorMsg const*); +bool isMsgGunetterAttack(al::SensorMsg const*); +bool isMsgGunetterBodyTouch(al::SensorMsg const*); +bool isMsgGunetterPush(al::SensorMsg const*); +bool isMsgHackAttack(al::SensorMsg const*); +bool isMsgHackAttackKick(al::SensorMsg const*); +bool isMsgHackAttackMapObj(al::SensorMsg const*); +bool isMsgHackBrosContact(al::SensorMsg const*); +bool isMsgHackDeathAreaSelfCheck(al::SensorMsg const*); +bool isMsgHackDemoEnd(al::SensorMsg const*); +bool isMsgHackDemoStart(al::SensorMsg const*); +bool isMsgHackInvalidEscape(al::SensorMsg const*); +bool isMsgHackInvalidEscapeNoReaction(al::SensorMsg const*); +bool isMsgHackMarioCheckpointFlagWarp(al::SensorMsg const*); +bool isMsgHackMarioDead(al::SensorMsg const*); +bool isMsgHackMarioDemo(al::SensorMsg const*); +bool isMsgHackMarioInWater(al::SensorMsg const*); +bool isMsgHackMoveRockForestPush(al::SensorMsg const*); +bool isMsgHackSelfCeilingCheckMiss(al::SensorMsg const*); +bool isMsgHackSyncDamageVisibility(al::SensorMsg const*); +bool isMsgHackUpperPunch(al::SensorMsg const*); +bool isMsgHackObjUpperPunch(al::SensorMsg const*); +bool isMsgHammerAttackDown(al::SensorMsg const*); +bool isMsgHammerAttackSide(al::SensorMsg const*); +bool isMsgHammerAttackSideCollide(al::SensorMsg const*); +bool isMsgHammerBrosHammerEnemyAttack(al::SensorMsg const*); +bool isMsgHammerBrosHammerHackAttack(al::SensorMsg const*); +bool isMsgHammerBrosHammerSearch(al::SensorMsg const*); +bool isMsgHipDropTransformReverse(al::SensorMsg const*); +bool isMsgHipDropTransformTransform(al::SensorMsg const*); +bool isMsgHipDropTransformingUp(al::SensorMsg const*); +bool isMsgHipDropTransformingDown(al::SensorMsg const*); +bool isMsgHipDropTransformingFinish(al::SensorMsg const*); +bool isMsgHitGrowFlowerPot(al::SensorMsg const*); +bool isMsgHitGrowPlantPot(al::SensorMsg const*); +bool isMsgHosuiAttack(al::SensorMsg const*); +bool isMsgHosuiAttackCollide(al::SensorMsg const*); +bool isMsgHosuiAttackNoEffect(al::SensorMsg const*); +bool isMsgHosuiAttackStrong(al::SensorMsg const*); +bool isMsgHosuiTouch(al::SensorMsg const*); +bool isMsgHosuiTrample(al::SensorMsg const*); +bool isMsgHosuiTrampleReflect(al::SensorMsg const*); +bool isMsgHosuiTrampleReflectHigh(al::SensorMsg const*); +bool isMsgIgnoreTouchTarget(al::SensorMsg const*); +bool isMsgIgnorePushMotorcycle(al::SensorMsg const*); +bool isMsgIcicleAttack(al::SensorMsg const*); +bool isMsgIgnoreMirrorWarp(al::SensorMsg const*); +bool isMsgIgnoredByRunawayNpc(al::SensorMsg const*); +bool isMsgImplantGrowFlowerSeed(al::SensorMsg const*); +bool isMsgInitTouchTargetInfo(al::SensorMsg const*); +bool isMsgItemAmiiboKoopa(al::SensorMsg const*); +bool isMsgIsExistPukupuku(al::SensorMsg const*); +bool isMsgJangoAttack(al::SensorMsg const*); +bool isMsgJangoRemoveCap(al::SensorMsg const*); +bool isMsgKakkuKick(al::SensorMsg const*); +bool isMsgKoopaBindStart(al::SensorMsg const*); +bool isMsgKoopaCapPlayerFocusTarget(al::SensorMsg const*); +bool isMsgKoopaCapPunchFinishL(al::SensorMsg const*); +bool isMsgKoopaCapPunchFinishR(al::SensorMsg const*); +bool isMsgKoopaCapPunchInvincibleL(al::SensorMsg const*); +bool isMsgKoopaCapPunchInvincibleR(al::SensorMsg const*); +bool isMsgKoopaCapPunchKnockBackL(al::SensorMsg const*); +bool isMsgKoopaCapPunchKnockBackR(al::SensorMsg const*); +bool isMsgKoopaCapPunchL(al::SensorMsg const*); +bool isMsgKoopaCapPunchR(al::SensorMsg const*); +bool isMsgKoopaCapSpinAttack(al::SensorMsg const*); +bool isMsgKoopaCatchKoopaCap(al::SensorMsg const*); +bool isMsgKoopaDashPunchAttack(al::SensorMsg const*); +bool isMsgKoopaFire2D(al::SensorMsg const*); +bool isMsgKoopaFireBallAttack(al::SensorMsg const*); +bool isMsgKoopaHackDamage(al::SensorMsg const*); +bool isMsgKoopaHackPunch(al::SensorMsg const*); +bool isMsgKoopaHackPunchCollide(al::SensorMsg const*); +bool isMsgKoopaHackTrample(al::SensorMsg const*); +bool isMsgKoopaInvalidHackPunchFaceToCollision(al::SensorMsg const*); +bool isMsgKoopaRingBeamInvalidTouch(al::SensorMsg const*); +bool isMsgKoopaTailAttack(al::SensorMsg const*); +bool isMsgKoopaTouchFloor(al::SensorMsg const*); +bool isMsgKouraAttack2D(al::SensorMsg const*); +bool isMsgKouraItemGet2D(al::SensorMsg const*); +bool isMsgKuribo2DTouch(al::SensorMsg const*); +bool isMsgKuriboCollisionDamage(al::SensorMsg const*); +bool isMsgKuriboCollisionKill(al::SensorMsg const*); +bool isMsgKuriboFlick(al::SensorMsg const*); +bool isMsgKuriboGirlAttack(al::SensorMsg const*); +bool isMsgKuriboGirlLove(al::SensorMsg const*); +bool isMsgKuriboTop(al::SensorMsg const*); +bool isMsgKuriboTowerNum(al::SensorMsg const*); +bool isMsgLaunchBlow(al::SensorMsg const*); +bool isMsgLineDancerLink(al::SensorMsg const*); +bool isMsgLongPushSensorHit(al::SensorMsg const*); +bool isMsgLongPushBoxHit(al::SensorMsg const*); +bool isMsgMagnetBulletAttack(al::SensorMsg const*); +bool isMsgMeganeAttack(al::SensorMsg const*); +bool isMsgMeganeHackTrample(al::SensorMsg const*); +bool isMsgMofumofuBodyChainExplode(al::SensorMsg const*); +bool isMsgMofumofuBulletUnexplosion(al::SensorMsg const*); +bool isMsgMoonBasementAttackMeteor(al::SensorMsg const*); +bool isMsgMoonBasementBreakShockwaveMeteor(al::SensorMsg const*); +bool isMsgMoonBasementRockSyncClippingRegist(al::SensorMsg const*); +bool isMsgMoonBasementRockSyncClippingInvalidate(al::SensorMsg const*); +bool isMsgMoonBasementRockSyncClippingValidate(al::SensorMsg const*); +bool isMsgMoonBasementRockThroughCollision(al::SensorMsg const*); +bool isMsgMorningStarWarpEnd(al::SensorMsg const*); +bool isMsgMorningStarWarpStart(al::SensorMsg const*); +bool isMsgMotorcycleAttack(al::SensorMsg const*); +bool isMsgMotorcycleCollideParkingLot(al::SensorMsg const*); +bool isMsgMotorcycleDashAttack(al::SensorMsg const*); +bool isMsgMotorcycleDashCollide(al::SensorMsg const*); +bool isMsgCactusNeedleAttack(al::SensorMsg const*); +bool isMsgCactusNeedleAttackStrong(al::SensorMsg const*); +bool isMsgNoLimitTouchJump(al::SensorMsg const*); +bool isMsgNoticePlayerDamage(al::SensorMsg const*); +bool isMsgNpcScareByEnemy(al::SensorMsg const*); +bool isMsgVolleyballNpcScareByEnemy(al::SensorMsg const*); +bool isMsgObjSnapForce(al::SensorMsg const*); +bool isMsgPackunEatCancel(al::SensorMsg const*); +bool isMsgPackunEatEnd(al::SensorMsg const*); +bool isMsgPackunEatStart(al::SensorMsg const*); +bool isMsgPackunEatStartFollow(al::SensorMsg const*); +bool isMsgPaint(al::SensorMsg const*); +bool isMsgPaintTexture(al::SensorMsg const*); +bool isMsgCheckPaintClear(al::SensorMsg const*); +bool isMsgCheckPaintAlpha(al::SensorMsg const*); +bool isMsgPartyPopperSoundAttack(al::SensorMsg const*); +bool isMsgPechoSpot(al::SensorMsg const*); +bool isMsgPlayerBallToss(al::SensorMsg const*); +bool isMsgPlayerCarryCameraSubjectiveStart(al::SensorMsg const*); +bool isMsgPlayerCarryCameraSubjectiveEnd(al::SensorMsg const*); +bool isMsgPlayerCarryShineGetStart(al::SensorMsg const*); +bool isMsgPlayerCarryShineGetEnd(al::SensorMsg const*); +bool isMsgPlayerCapCatch(al::SensorMsg const*); +bool isMsgPlayerCapHipDrop(al::SensorMsg const*); +bool isMsgPlayerCapPush(al::SensorMsg const*); +bool isMsgPlayerCapRecovery(al::SensorMsg const*); +bool isMsgPlayerCapTouchJump(al::SensorMsg const*); +bool isMsgPlayerCapTrample(al::SensorMsg const*); +bool isMsgPlayerCoinDashGet(al::SensorMsg const*); +bool isMsgPlayerEyePriorityTarget(al::SensorMsg const*); +bool isMsgPlayerDisregardHomingAttack(al::SensorMsg const*); +bool isMsgPlayerDisregardTargetMarker(al::SensorMsg const*); +bool isMsgPlayerEquipKoopaCap(al::SensorMsg const*); +bool isMsgPlayerFireBallAttack2D(al::SensorMsg const*); +bool isMsgPlayerFireBallAttack3D(al::SensorMsg const*); +bool isMsgPlayerHipDropDemoTrigger(al::SensorMsg const*); +bool isMsgPlayerHipDropHipDropSwitch(al::SensorMsg const*); +bool isMsgPlayerItemGet2D(al::SensorMsg const*); +bool isMsgPlayerJumpTakeOffFloor(al::SensorMsg const*); +bool isMsgPlayerObjectWallHit(al::SensorMsg const*); +bool isMsgPlayerObjLeapFrog(al::SensorMsg const*); +bool isMsgPlayerPenguinAttack(al::SensorMsg const*); +bool isMsgPlayerPenguinAttackReflect(al::SensorMsg const*); +bool isMsgPlayerPoleClimbKeep(al::SensorMsg const*); +bool isMsgPlayerPoleClimbReaction(al::SensorMsg const*); +bool isMsgPlayerRabbitGet(al::SensorMsg const*); +bool isMsgPlayerRollingObjHit(al::SensorMsg const*); +bool isMsgPlayerRollingWallHitDown(al::SensorMsg const*); +bool isMsgPlayerRollingWallHitMove(al::SensorMsg const*); +bool isMsgPlayerStartGrabCeil(al::SensorMsg const*); +bool isMsgPlayerStartWallJump(al::SensorMsg const*); +bool isMsgPlayerEndGrabCeil(al::SensorMsg const*); +bool isMsgPlayerSwordAttack(al::SensorMsg const*); +bool isMsgPlayerTouchFloorJumpCode(al::SensorMsg const*); +bool isMsgPlayerTrample2D(al::SensorMsg const*); +bool isMsgPlayerUpperPunch2D(al::SensorMsg const*); +bool isMsgPlayerObjUpperPunch2D(al::SensorMsg const*); +bool isMsgPropellerAttack(al::SensorMsg const*); +bool isMsgPukupukuDash(al::SensorMsg const*); +bool isMsgPukupukuKiss(al::SensorMsg const*); +bool isMsgPukupukuRollingAttack(al::SensorMsg const*); +bool isMsgPunchMachinePunchHook(al::SensorMsg const*); +bool isMsgPunchMachinePunchStraight(al::SensorMsg const*); +bool isMsgPunchMachinePunchUpper(al::SensorMsg const*); +bool isMsgPush2D(al::SensorMsg const*); +bool isMsgPushToFish(al::SensorMsg const*); +bool isMsgPushToMotorcycle(al::SensorMsg const*); +bool isMsgPushToPlayer(al::SensorMsg const*); +bool isMsgRadishAttack(al::SensorMsg const*); +bool isMsgRadishReflect(al::SensorMsg const*); +bool isMsgRaceStart(al::SensorMsg const*); +bool isMsgRaceStop(al::SensorMsg const*); +bool isMsgRaceWait(al::SensorMsg const*); +bool isMsgRequestChangeFireFlower(al::SensorMsg const*); +bool isMsgRequestChangeKinokoSuper(al::SensorMsg const*); +bool isMsgRequestPlayerJumpBreakFloor(al::SensorMsg const*); +bool isMsgRequestPlayerJump(al::SensorMsg const*); +bool isMsgRequestPlayerTrampleJump(al::SensorMsg const*); +bool isMsgRequestPlayerSpinJump(al::SensorMsg const*); +bool isMsgRequestSphinxJump(al::SensorMsg const*); +bool isMsgRideOnEnd(al::SensorMsg const*); +bool isMsgRideOnRelease(al::SensorMsg const*); +bool isMsgRideOnStart(al::SensorMsg const*); +bool isMsgRocketFlowerExtension(al::SensorMsg const*); +bool isMsgSandSharkAttack(al::SensorMsg const*); +bool isMsgSeedAttack(al::SensorMsg const*); +bool isMsgSeedAttackBig(al::SensorMsg const*); +bool isMsgSeedAttackHold(al::SensorMsg const*); +bool isMsgSeedItemGet(al::SensorMsg const*); +bool isMsgSeedReflect(al::SensorMsg const*); +bool isMsgSeedTouch(al::SensorMsg const*); +bool isMsgSenobiCancelStretch(al::SensorMsg const*); +bool isMsgSenobiPunchBlockTransparent(al::SensorMsg const*); +bool isMsgSenobiPartsMove(al::SensorMsg const*); +bool isMsgSenobiTrample(al::SensorMsg const*); +bool isMsgShibakenApproach(al::SensorMsg const*); +bool isMsgShibakenKick(al::SensorMsg const*); +bool isMsgSkaterAttack(al::SensorMsg const*); +bool isMsgSpherePush(al::SensorMsg const*); +bool isMsgSphinxJumpAttack(al::SensorMsg const*); +bool isMsgSphinxQuizRouteKill(al::SensorMsg const*); +bool isMsgSphinxRideAttack(al::SensorMsg const*); +bool isMsgSphinxRideAttackReflect(al::SensorMsg const*); +bool isMsgSphinxRideAttackTouchThrough(al::SensorMsg const*); +bool isMsgSphinxRideAttackTouch(al::SensorMsg const*); +bool isMsgStampTo2D(al::SensorMsg const*); +bool isMsgStartHack(al::SensorMsg const*); +bool isMsgStartInSaucePan(al::SensorMsg const*); +bool isMsgStatueDrop(al::SensorMsg const*); +bool isMsgStatueTrampleReflect(al::SensorMsg const*); +bool isMsgStatuePush(al::SensorMsg const*); +bool isMsgStatueSnap(al::SensorMsg const*); +bool isMsgSunshineAttack(al::SensorMsg const*); +bool isMsgTankBullet(al::SensorMsg const*); +bool isMsgTankBulletNoReaction(al::SensorMsg const*); +bool isMsgTankExplosion(al::SensorMsg const*); +bool isMsgTankHackTrample(al::SensorMsg const*); +bool isMsgTankKickHack(al::SensorMsg const*); +bool isMsgTankKickEnemy(al::SensorMsg const*); +bool isMsgTankLookOn(al::SensorMsg const*); +bool isMsgTestPunch(al::SensorMsg const*); +bool isMsgTestPunchStrong(al::SensorMsg const*); +bool isMsgTimerAthleticDemoStart(al::SensorMsg const*); +bool isMsgTouchDoorDrumn(al::SensorMsg const*); +bool isMsgTouchFireDrum2D(al::SensorMsg const*); +bool isMsgTrashBoxIn(al::SensorMsg const*); +bool isMsgTRexAttack(al::SensorMsg const*); +bool isMsgTRexAttackCollideAll(al::SensorMsg const*); +bool isMsgTRexAttackCollideBody(al::SensorMsg const*); +bool isMsgTRexAttackCollideHead(al::SensorMsg const*); +bool isMsgTRexDashAttack(al::SensorMsg const*); +bool isMsgTRexScrollPartsBreakWith(al::SensorMsg const*); +bool isMsgTsukkunForceCancelCollide(al::SensorMsg const*); +bool isMsgTsukkunHoldCollide(al::SensorMsg const*); +bool isMsgTsukkunThroughCollide(al::SensorMsg const*); +bool isMsgTsukkunThrustAll(al::SensorMsg const*); +bool isMsgTsukkunThrust(al::SensorMsg const*, bool*); +bool isMsgTsukkunThrustCollide(al::SensorMsg const*, bool*); +bool isMsgTsukkunNoTrace(al::SensorMsg const*); +bool isMsgTsukkunThrustHole(al::SensorMsg const*); +bool isMsgUtsuboAttack(al::SensorMsg const*); +bool isMsgWanderBossCameraRange(al::SensorMsg const*); +bool isMsgWanwanEnemyAttack(al::SensorMsg const*); +bool isMsgWanwanBlockAttack(al::SensorMsg const*); +bool isMsgWanwanHoleIn(al::SensorMsg const*); +bool isMsgWaterRoadIn(al::SensorMsg const*); +bool isMsgWaterRoadNear(al::SensorMsg const*); +bool isMsgWanwanPush(al::SensorMsg const*); +bool isMsgWanwanReboundAttack(al::SensorMsg const*); +bool isMsgWeaponItemGet(al::SensorMsg const*); +bool isMsgWhipAttack(al::SensorMsg const*); +bool isMsgWhipBind(al::SensorMsg const*); +bool isMsgWhipHold(al::SensorMsg const*); +bool isMsgWhipThrow(al::SensorMsg const*); +bool isMsgYokinBallAttack(al::SensorMsg const*); +bool isMsgYoshiDirectEat(al::SensorMsg const*); +bool isMsgYoshiTongueAttack(al::SensorMsg const*); +bool isMsgYoshiTongueEatBind(al::SensorMsg const*); +bool isMsgYoshiTongueEatBindCancel(al::SensorMsg const*); +bool isMsgYoshiTongueEatBindFinish(al::SensorMsg const*); +bool isMsgYoshiTongueEatHomingTarget(al::SensorMsg const*); +bool isMsgYukimaruPush(al::SensorMsg const*); +bool isMsgKillerAttackNoExplode(al::SensorMsg const*); +bool isMsgKillerMagnumAttack(al::SensorMsg const*); +bool isMsgKillerMagnumHackAttack(al::SensorMsg const*); +bool isMsgGabuzouAttack(al::SensorMsg const*); +bool isMsgStackerRollingAttack(al::SensorMsg const*); +bool isMsgStackerCapBoostAttack(al::SensorMsg const*); +bool isMsgIgnoreIgnitionBomb(al::SensorMsg const*); +bool isMsgExplosionReflectBomb(al::SensorMsg const*); +bool isMsgGolemStampPress(al::SensorMsg const*); +bool isMsgTsukkunThrustSpin(al::SensorMsg const*, bool*); +bool isMsgTsukkunThrustReflect(al::SensorMsg const*, bool*); +bool isMsgTsukkunThrustHitReflectCollide(al::SensorMsg const*, bool*); +bool isMsgTsukkunThrustReflectCollide(al::SensorMsg const*, bool*); +// bool isMsgSwitchOnWithSaveRequest(al::SensorMsg const*, SaveObjInfo**); +bool isMsgNpcCapReactionAll(al::SensorMsg const*); +bool isMsgHackNpcCapReactionAll(al::SensorMsg const*); +bool isMsgPlayerAndCapObjHipDropReflectAll(al::SensorMsg const*); +bool isMsgKoopaCapPunchAll(al::SensorMsg const*); +bool isMsgKoopaCapPunchInvincibleAll(al::SensorMsg const*); +bool isMsgKoopaCapPunchFinishAll(al::SensorMsg const*); +bool isMsgItemGet(al::SensorMsg const*); +bool isMsgItemGetByWeapon(al::SensorMsg const*); +bool isMsgItemGet2D(al::SensorMsg const*); +bool isMsgBlockUpperPunch2D(al::SensorMsg const*); +bool isMsgItemGetAll(al::SensorMsg const*); +bool isMsgShineGet(al::SensorMsg const*); +bool isMsgShineGet2D(al::SensorMsg const*); +bool isMsgShineReaction(al::SensorMsg const*); +bool isMsgKillByShineGet(al::SensorMsg const*); +bool isMsgKillByHomeDemo(al::SensorMsg const*); +bool isMsgEndHomeDemo(al::SensorMsg const*); +bool isMsgBreakBySword(al::SensorMsg const*); +bool isMsgPressDown(al::SensorMsg const*); +bool isMsgPlayerAndCapObjHipDropAll(al::SensorMsg const*); +bool isMsgAttackDirect(al::SensorMsg const*); +bool isMsgBlowDown(al::SensorMsg const*); +bool isMsgTrampleReflectAll(al::SensorMsg const*); +bool isMsgThrowObjHit(al::SensorMsg const*); +bool isMsgThrowObjHitReflect(al::SensorMsg const*); +bool isMsgPlayerAndCapHipDropAll(al::SensorMsg const*); +bool isMsgUpperPunchAll(al::SensorMsg const*); +bool isMsgBlockReaction2D(al::SensorMsg const*); +bool isMsgBlockReaction3D(al::SensorMsg const*); +bool isMsgBlockReactionAll(al::SensorMsg const*); +bool isMsgBreakFrailBox(al::SensorMsg const*); +bool isMsgDamageFrailBox(al::SensorMsg const*); +bool isMsgChorobonReaction(al::SensorMsg const*); +bool isMsgBreakSignBoard(al::SensorMsg const*); +bool isMsgBreakCollapseSandHill(al::SensorMsg const*); +bool isMsgPlayerDamage(al::SensorMsg const*); +bool isMsgPlayerDamage2D(al::SensorMsg const*); +bool isMsgPlayerDamageBlowDown(al::SensorMsg const*); +bool isMsgPlayerJumpRequestAll(al::SensorMsg const*); +bool isMsgDashPanel(al::SensorMsg const*, int*); +bool isMsgNetworkShootingShot(al::SensorMsg const*, int); +bool isMsgNetworkShootingChargeShot(al::SensorMsg const*, int); +bool isMsgRaceReturnToCourse(al::SensorMsg const*, sead::Vector3f*, sead::Vector3f*); +bool isMsgTrampolineCrackJump(float*, float*, al::SensorMsg const*); +bool isMsgGotogotonOn(al::SensorMsg const*); +bool isMsgGotogotonGoalExist(al::SensorMsg const*); +bool isMsgBossMagmaCatchPlayer(al::SensorMsg const*); +bool isMsgBossMagmaReleasePlayer(al::SensorMsg const*); +bool isMsgBossMagmaDeadDemoStart(al::SensorMsg const*); +bool isMsgBossMagmaDeadDemoEnd(al::SensorMsg const*); +bool isMsgBossMagmaQueryToBubble(al::SensorMsg const*); +bool isMsgMofumofuReflectAll(al::SensorMsg const*); +bool isMsgCheckFishingTarget(al::SensorMsg const*); +bool isMsgPlayerLookAtPosition(al::SensorMsg const*); +bool isMsgTargetMarkerPosition(al::SensorMsg const*); +bool isMsgSandGeyserRaise(al::SensorMsg const*); +bool isMsgInitCapTarget(al::SensorMsg const*); +bool isMsgTransferHack(al::SensorMsg const*); +bool isMsgRequestTransferHack(al::SensorMsg const*); +bool isMsgInitHack(al::SensorMsg const*); +bool isMsgEndHack(HackEndParam const**, al::SensorMsg const*); +bool isMsgHackDirectStageInit(IUsePlayerHack**, al::SensorMsg const*); +bool isMsgKillByBossBattleDemo(al::SensorMsg const*); +bool isMsgKillByHackFirstDemo(al::SensorMsg const*); +bool isMsgKillByMoonRockDemo(al::SensorMsg const*); +bool isMsgKillBySwitchTimer(al::SensorMsg const*); + +bool setMsgYoshiTongueEatBindRadiusAndOffset(al::SensorMsg const*, float, float); +bool setMsgYoshiTongueEatBindScale(al::SensorMsg const*, float); +bool setMsgPlayerLookAtPosition(al::SensorMsg const*, sead::Vector3f const&); +bool setMsgTargetMarkerPosition(al::SensorMsg const*, sead::Vector3f const&); + +bool requestHitReactionToAttacker(al::SensorMsg const*, al::HitSensor const*, al::HitSensor const*); + +bool sendMsgHackerNoReaction(IUsePlayerHack const*, al::HitSensor*, al::HitSensor*); +bool sendMsgHackerNoReactionWithoutShine(IUsePlayerHack const*, al::HitSensor*, al::HitSensor*); +bool sendMsgBreakFloorToPlayer(al::LiveActor const*); +bool sendMsgAckCheckpoint(al::HitSensor*, al::HitSensor*); +bool sendMsgAckGetShine(al::HitSensor*, al::HitSensor*); +bool sendMsgAckLifeUp(al::HitSensor*, al::HitSensor*); +bool sendMsgAckLifeMaxUp(al::HitSensor*, al::HitSensor*); +bool sendMsgAskRailCollision(al::HitSensor*, al::HitSensor*); +bool sendMsgBreakPartsBreak(al::HitSensor*, al::HitSensor*); +bool sendMsgBirdFlyAway(al::HitSensor*, al::HitSensor*); +bool sendMsgCameraAngleElevationResetFast(al::HitSensor*, al::HitSensor*); +bool sendMsgChorobonAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgConductLightning(al::HitSensor*, al::HitSensor*); +bool sendMsgDamageBallAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgDamageBallBodyAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgDonsukeAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgDonsukeGroundAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgDonsukePush(al::HitSensor*, al::HitSensor*); +bool sendMsgDragonAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgEatExplosion(al::HitSensor*, al::HitSensor*); +bool sendMsgElectricWireNoLimitDistance(al::HitSensor*, al::HitSensor*); +bool sendMsgEnemyAttack2D(al::HitSensor*, al::HitSensor*); +bool sendMsgEnemyAttack3D(al::HitSensor*, al::HitSensor*); +bool sendMsgEnemyAttackDash(al::HitSensor*, al::HitSensor*); +bool sendMsgHackAttackFire(al::HitSensor*, al::HitSensor*); +bool sendMsgEnemyAttackFireCollision(al::HitSensor*, al::HitSensor*); +bool sendMsgEnemyAttackPoison(al::HitSensor*, al::HitSensor*); +bool sendMsgEnemyAttackTRex(al::HitSensor*, al::HitSensor*); +bool sendMsgHackAttackPoison(al::HitSensor*, al::HitSensor*); +bool sendMsgConfirmPaintObj(al::HitSensor*, al::HitSensor*); +bool sendMsgConfirmPaintObjForSeed(al::HitSensor*, al::HitSensor*); +bool sendMsgPaintAttackPoison(al::HitSensor*, al::HitSensor*); +bool sendMsgEnemyKick(al::HitSensor*, al::HitSensor*); +bool sendMsgRabbitKick(al::HitSensor*, al::HitSensor*); +bool sendMsgFishingAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgFishingCancel(al::HitSensor*, al::HitSensor*); +bool sendMsgFishingFishApproach(al::HitSensor*, al::HitSensor*); +bool sendMsgFishingFishFloatTouch(al::HitSensor*, al::HitSensor*); +bool sendMsgFishingItemGet(al::HitSensor*, al::HitSensor*); +bool sendMsgFishingLineTouch(al::HitSensor*, al::HitSensor*); +bool sendMsgFishingStart(al::HitSensor*, al::HitSensor*); +bool sendMsgFishingUpImmediatelyPrepare(al::HitSensor*, al::HitSensor*); +bool sendMsgFireBrosFireBallCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgFireSwitchFire(al::HitSensor*, al::HitSensor*); +bool sendMsgFrogHackTrample(al::HitSensor*, al::HitSensor*); +bool sendMsgGhostRecordStart(al::HitSensor*, al::HitSensor*); +bool sendMsgGhostRecordEnd(al::HitSensor*, al::HitSensor*); +bool sendMsgGhostPlay(al::HitSensor*, al::HitSensor*); +bool sendMsgGhostStop(al::HitSensor*, al::HitSensor*); +bool sendMsgGiantWanderBossAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgGiantWanderBossBulletAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgGiantWanderBossBulletPush(al::HitSensor*, al::HitSensor*); +bool sendMsgGhostReverse(al::HitSensor*, al::HitSensor*); +bool sendMsgGhostCancel(al::HitSensor*, al::HitSensor*); +bool sendMsgGrowFlowerSeedDisablePush(al::HitSensor*, al::HitSensor*); +bool sendMsgGrowFlowerSeedNear(al::HitSensor*, al::HitSensor*); +bool sendMsgGrowPlantPush(al::HitSensor*, al::HitSensor*); +bool sendMsgGrowerAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgGrowerWallAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgGunetterAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgGunetterBodyTouch(al::HitSensor*, al::HitSensor*); +bool sendMsgHammerAttackDown(al::HitSensor*, al::HitSensor*); +bool sendMsgHammerAttackSide(al::HitSensor*, al::HitSensor*); +bool sendMsgHammerAttackSideCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgItemAmiiboKoopa(al::HitSensor*, al::HitSensor*); +bool sendMsgIsExistPukupuku(al::HitSensor*, al::HitSensor*); +bool sendMsgJangoAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgJangoRemoveCap(al::HitSensor*, al::HitSensor*); +bool sendMsgKakkuKick(al::HitSensor*, al::HitSensor*); +bool sendMsgKillByBossBattleDemo(al::HitSensor*, al::HitSensor*); +bool sendMsgKillByHackFirstDemo(al::HitSensor*, al::HitSensor*); +bool sendMsgKillByHomeDemo(al::HitSensor*, al::HitSensor*); +bool sendMsgEndHomeDemo(al::HitSensor*, al::HitSensor*); +bool sendMsgKillByMoonRockDemo(al::HitSensor*, al::HitSensor*); +bool sendMsgKillByShineGet(al::HitSensor*, al::HitSensor*); +bool sendMsgKillBySwitchTimer(al::LiveActor*); +bool sendMsgKoopaBindStart(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCapPlayerFocusTarget(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCapPunchFinishL(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCapPunchFinishR(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCapPunchInvincibleL(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCapPunchInvincibleR(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCapPunchKnockBackL(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCapPunchKnockBackR(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCapPunchL(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCapPunchR(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCapSpinAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaCatchKoopaCap(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaDashPunchAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaFire2D(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaFireBallAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaHackDamage(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaHackPunch(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaHackPunchCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaHackTrample(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaInvalidHackPunchFaceToCollision(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaRingBeamInvalidTouch(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaTailAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgKoopaTouchFloor(al::HitSensor*, al::HitSensor*); +bool sendMsgKouraAttack2D(al::HitSensor*, al::HitSensor*); +bool sendMsgKouraItemGet2D(al::HitSensor*, al::HitSensor*); +bool sendMsgLaunchBlow(al::HitSensor*, al::HitSensor*); +bool sendMsgMeganeAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgMeganeHackTrample(al::HitSensor*, al::HitSensor*); +bool sendMsgMofumofuBulletUnexplosion(al::HitSensor*, al::HitSensor*); +bool sendMsgMoonBasementAttackMeteor(al::HitSensor*, al::HitSensor*); +bool sendMsgMoonBasementBreakShockwaveMeteor(al::HitSensor*, al::HitSensor*); +bool sendMsgMoonBasementRockSyncClippingRegist(al::HitSensor*, al::HitSensor*); +bool sendMsgMoonBasementRockSyncClippingInvalidate(al::HitSensor*, al::HitSensor*); +bool sendMsgMoonBasementRockSyncClippingValidate(al::HitSensor*, al::HitSensor*); +bool sendMsgAttachCactusNeedle(al::HitSensor*, al::HitSensor*); +// bool sendMsgCactusNeedleAttack(al::HitSensor*, al::HitSensor*, al::ComboCounter*); +// bool sendMsgCactusNeedleAttackStrong(al::HitSensor*, al::HitSensor*, al::ComboCounter*); +bool sendMsgPlayerBallToss(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCarryCameraSubjectiveStart(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCarryCameraSubjectiveEnd(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCarryShineGetStart(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCarryShineGetEnd(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCapCatch(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCapHipDrop(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCapPush(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCapRecovery(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCapTouchJump(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCapTrample(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerCoinDashGet(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerEyePriorityTarget(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerDisregardHomingAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerDisregardTargetMarker(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerEquipKoopaCap(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerFireBallAttack2D(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerFireBallAttack3D(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerHipDropDemoTrigger(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerHipDropHipDropSwitch(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerItemGet2D(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerJumpTakeOffFloor(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerObjectWallHit(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerObjLeapFrog(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerPenguinAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerPenguinAttackReflect(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerPoleClimbKeep(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerPoleClimbReaction(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerRabbitGet(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerRollingObjHit(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerRollingWallHitDown(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerRollingWallHitMove(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerStartGrabCeil(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerStartWallJump(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerEndGrabCeil(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerSwordAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerTouchFloorJumpCode(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerTrample2D(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerUpperPunch2D(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerObjUpperPunch2D(al::HitSensor*, al::HitSensor*); +bool sendMsgPukupukuDash(al::HitSensor*, al::HitSensor*); +bool sendMsgPukupukuKiss(al::HitSensor*, al::HitSensor*); +bool sendMsgPukupukuRollingAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgPush2D(al::HitSensor*, al::HitSensor*); +bool sendMsgPushToFish(al::HitSensor*, al::HitSensor*); +bool sendMsgPushToMotorcycle(al::HitSensor*, al::HitSensor*); +bool sendMsgPushToPlayer(al::HitSensor*, al::HitSensor*); +bool sendMsgRadishAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgRadishReflect(al::HitSensor*, al::HitSensor*); +bool sendMsgRequestChangeKinokoSuper(al::HitSensor*, al::HitSensor*); +bool sendMsgRequestChangeFireFlower(al::HitSensor*, al::HitSensor*); +bool sendMsgRequestPlayerSandMoon(al::HitSensor*, al::HitSensor*); +bool sendMsgRequestPlayerSnow(al::HitSensor*, al::HitSensor*); +bool sendMsgRequestPlayerWet(al::HitSensor*, al::HitSensor*); +bool sendMsgStartHack(al::HitSensor*, al::HitSensor*); +bool sendMsgSunshineAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgCancelHack(al::HitSensor*, al::HitSensor*); +bool sendMsgCancelHackArea(al::HitSensor*, al::HitSensor*); +bool sendMsgCancelHackByDokan(al::HitSensor*, al::HitSensor*); +bool sendMsgPackunEatStart(al::HitSensor*, al::HitSensor*); +bool sendMsgHackAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgHackAttackKick(al::HitSensor*, al::HitSensor*); +bool sendMsgHackAttackMapObj(al::HitSensor*, al::HitSensor*); +bool sendMsgHackDeathAreaSelfCheck(al::HitSensor*, al::HitSensor*); +bool sendMsgHackDemoEnd(al::HitSensor*, al::HitSensor*); +bool sendMsgHackDemoStart(al::HitSensor*, al::HitSensor*); +bool sendMsgHackInvalidEscape(al::HitSensor*, al::HitSensor*); +bool sendMsgHackInvalidEscapeNoReaction(al::HitSensor*, al::HitSensor*); +bool sendMsgHackMarioCheckpointFlagWarp(al::HitSensor*, al::HitSensor*); +bool sendMsgHackMarioDead(al::HitSensor*, al::HitSensor*); +bool sendMsgHackMarioDemo(al::HitSensor*, al::HitSensor*); +bool sendMsgHackMarioInWater(al::HitSensor*, al::HitSensor*); +bool sendMsgHackMoveRockForestPush(al::HitSensor*, al::HitSensor*); +bool sendMsgHackSelfCeilingCheckMiss(al::HitSensor*, al::HitSensor*); +bool sendMsgHackSyncDamageVisibility(al::HitSensor*, al::HitSensor*); +bool sendMsgWeaponItemGet(al::HitSensor*, al::HitSensor*); +bool sendMsgCapAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgCapAttackCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgCapAttackStayRolling(al::HitSensor*, al::HitSensor*); +bool sendMsgCapAttackStayRollingCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgCapAttackRailMove(al::HitSensor*, al::HitSensor*); +bool sendMsgCapGiantAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgCapReflect(al::HitSensor*, al::HitSensor*); +bool sendMsgCapReflectCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgCapStartLockOn(al::HitSensor*, al::HitSensor*); +bool sendMsgCapKeepLockOn(al::HitSensor*, al::HitSensor*); +bool sendMsgCapCancelLockOn(al::HitSensor*, al::HitSensor*); +bool sendMsgCapHipDrop(al::HitSensor*, al::HitSensor*); +bool sendMsgCapObjHipDrop(al::HitSensor*, al::HitSensor*); +bool sendMsgCapObjHipDropReflect(al::HitSensor*, al::HitSensor*); +bool sendMsgCapIgnoreCancelLockOn(al::HitSensor*, al::HitSensor*); +bool sendMsgCapIgnoreCancelMissReaction(al::HitSensor*, al::HitSensor*); +bool sendMsgCapIgnoreCollisionCheck(al::HitSensor*, al::HitSensor*); +bool sendMsgCapItemGet(al::HitSensor*, al::HitSensor*); +bool sendMsgCapTrampolineAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgCatchBombThrough(al::HitSensor*, al::HitSensor*); +bool sendMsgCheckCarObstacle(al::HitSensor*, al::HitSensor*); +bool sendMsgCheckIsCardboardBox(al::HitSensor*, al::HitSensor*); +bool sendMsgBullHackAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgBullEnemyAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgEnemyAttackStrong(al::HitSensor*, al::HitSensor*); +bool sendMsgEnemyObjBreak(al::HitSensor*, al::HitSensor*); +bool sendMsgWhipAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgNoLimitTouchJump(al::HitSensor*, al::HitSensor*); +bool sendMsgNoticePlayerDamage(al::HitSensor*, al::HitSensor*); +bool sendMsgStatueDrop(al::HitSensor*, al::HitSensor*); +bool sendMsgStatueTrampleReflect(al::HitSensor*, al::HitSensor*); +bool sendMsgStatuePush(al::HitSensor*, al::HitSensor*); +bool sendMsgStatueSnap(al::HitSensor*, al::HitSensor*); +bool sendMsgHitGrowFlowerPot(al::HitSensor*, al::HitSensor*); +bool sendMsgHitGrowPlantPot(al::HitSensor*, al::HitSensor*); +bool sendMsgImplantGrowFlowerSeed(al::HitSensor*, al::HitSensor*); +bool sendMsgIcicleAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgIgnoreMirrorWarp(al::HitSensor*, al::HitSensor*); +bool sendMsgIgnoredByRunawayNpc(al::HitSensor*, al::HitSensor*); +bool sendMsgIgnorePushMotorcycle(al::HitSensor*, al::HitSensor*); +bool sendMsgSandSharkAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgSeedAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgSeedAttackBig(al::HitSensor*, al::HitSensor*); +bool sendMsgSeedAttackHold(al::HitSensor*, al::HitSensor*); +bool sendMsgSeedItemGet(al::HitSensor*, al::HitSensor*); +bool sendMsgSeedReflect(al::HitSensor*, al::HitSensor*); +bool sendMsgSenobiTrample(al::HitSensor*, al::HitSensor*); +bool sendMsgSenobiCancelStretch(al::HitSensor*, al::HitSensor*); +bool sendMsgSenobiPunchBlockTransparent(al::HitSensor*, al::HitSensor*); +bool sendMsgShibakenApproach(al::HitSensor*, al::HitSensor*); +bool sendMsgShibakenKick(al::HitSensor*, al::HitSensor*); +bool sendMsgHackUpperPunch(al::HitSensor*, al::HitSensor*); +bool sendMsgHackObjUpperPunch(al::HitSensor*, al::HitSensor*); +bool sendMsgShineGet(al::HitSensor*, al::HitSensor*); +bool sendMsgShineGet2D(al::HitSensor*, al::HitSensor*); +bool sendMsgSpherePush(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, float); +bool sendMsgSphinxJumpAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgSphinxQuizRouteKill(al::HitSensor*, al::HitSensor*); +bool sendMsgSphinxRideAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgSphinxRideAttackReflect(al::HitSensor*, al::HitSensor*); +bool sendMsgPechoSpot(al::HitSensor*, al::HitSensor*); +bool sendMsgBelowObjBroken(al::HitSensor*, al::HitSensor*); +bool sendMsgBindCollidedGround(al::HitSensor*, al::HitSensor*); +bool sendMsgBindKeepDemoStart(al::HitSensor*, al::HitSensor*); +bool sendMsgBindKeepDemoExecute(al::HitSensor*, al::HitSensor*); +bool sendMsgBindKeepDemoEnd(al::HitSensor*, al::HitSensor*); +bool sendMsgBindRecoveryLife(al::HitSensor*, al::HitSensor*); +bool sendMsgMayorItemReflect(al::HitSensor*, al::HitSensor*); +bool sendMsgMayorItemCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgBlowObjAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgBlowObjAttackReflect(al::HitSensor*, al::HitSensor*); +bool sendMsgConfirmFrailBox(al::HitSensor*, al::HitSensor*); +bool sendMsgConfirmBrokenFrailBox(al::HitSensor*, al::HitSensor*); +bool sendMsgTankLookOn(al::HitSensor*, al::HitSensor*); +bool sendMsgTankKickHack(al::HitSensor*, al::HitSensor*); +bool sendMsgTankKickEnemy(al::HitSensor*, al::HitSensor*); +bool sendMsgTankBullet(al::HitSensor*, al::HitSensor*); +bool sendMsgTankBulletNoReaction(al::HitSensor*, al::HitSensor*); +bool sendMsgTimerAthleticDemoStart(al::LiveActor*); +bool sendMsgRideOnStart(al::HitSensor*, al::HitSensor*); +bool sendMsgRideOnEnd(al::HitSensor*, al::HitSensor*); +bool sendMsgRideOnRelease(al::HitSensor*, al::HitSensor*); +bool sendMsgHipDropTransformTransform(al::HitSensor*, al::HitSensor*); +bool sendMsgHipDropTransformReverse(al::HitSensor*, al::HitSensor*); +bool sendMsgHipDropTransformingUp(al::HitSensor*, al::HitSensor*); +bool sendMsgHipDropTransformingDown(al::HitSensor*, al::HitSensor*); +bool sendMsgHipDropTransformingFinish(al::HitSensor*, al::HitSensor*); +bool sendMsgClearFire(al::HitSensor*, al::HitSensor*); +bool sendMsgCollectAnimalTouchCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgBossKnuckleCounter(al::HitSensor*, al::HitSensor*); +bool sendMsgBossKnuckleFallAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgBossKnuckleHackAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgBossKnuckleKillerAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgBossKnuckleIceConflict(al::HitSensor*, al::HitSensor*); +bool sendMsgBossKnuckleIceFallToMummy(al::HitSensor*, al::HitSensor*); +bool sendMsgSkaterAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgEnableInSaucePan(al::HitSensor*, al::HitSensor*); +bool sendMsgEnableMapCheckPointWarp(al::HitSensor*, al::HitSensor*); +bool sendMsgStartInSaucePan(al::HitSensor*, al::HitSensor*, bool); +bool sendMsgEndInSaucePan(al::HitSensor*, al::HitSensor*); +bool sendMsgLineDancerLink(al::HitSensor*, al::HitSensor*); +bool sendMsgLongPushSensorHit(al::HitSensor*, al::HitSensor*); +bool sendMsgLongPushBoxHit(al::HitSensor*, al::HitSensor*); +bool sendMsgGoldHammerAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgTrashBoxIn(al::HitSensor*, al::HitSensor*); +bool sendMsgTouchDoorDrumn(al::HitSensor*, al::HitSensor*); +bool sendMsgKuribo2DTouch(al::HitSensor*, al::HitSensor*); +bool sendMsgKuriboCollisionDamage(al::HitSensor*, al::HitSensor*); +bool sendMsgKuriboCollisionKill(al::HitSensor*, al::HitSensor*); +bool sendMsgKuriboFlick(al::HitSensor*, al::HitSensor*); +bool sendMsgKuriboTowerOn(al::HitSensor*, al::HitSensor*, uint); +bool sendMsgPartyPopperSoundAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgYokinBallAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgYoshiDirectEat(al::HitSensor*, al::HitSensor*); +bool sendMsgYoshiTongueAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgYoshiTongueEatBind(al::HitSensor*, al::HitSensor*, float*, float*, float*); +bool sendMsgYoshiTongueEatBindCancel(al::HitSensor*, al::HitSensor*); +bool sendMsgYoshiTongueEatBindFinish(al::HitSensor*, al::HitSensor*); +bool sendMsgYoshiTongueEatHomingTarget(al::HitSensor*, al::HitSensor*); +bool sendMsgYukimaruPush(al::HitSensor*, al::HitSensor*); +bool sendMsgPunchMachinePunchStraight(al::HitSensor*, al::HitSensor*); +bool sendMsgPunchMachinePunchHook(al::HitSensor*, al::HitSensor*); +bool sendMsgPunchMachinePunchUpper(al::HitSensor*, al::HitSensor*); +bool sendMsgMorningStarWarpStart(al::HitSensor*, al::HitSensor*); +bool sendMsgMorningStarWarpEnd(al::HitSensor*, al::HitSensor*); +bool sendMsgGemyAim(al::HitSensor*, al::HitSensor*); +bool sendMsgHammerBrosHammerEnemyAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgHammerBrosHammerHackAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgHammerBrosHammerSearch(al::HitSensor*, al::HitSensor*); +bool sendMsgHackBrosContact(al::HitSensor*, al::HitSensor*); +bool sendMsgMotorcycleAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgMotorcycleCollideParkingLot(al::HitSensor*, al::HitSensor*); +bool sendMsgMotorcycleDashAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgMotorcycleDashCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgWanwanEnemyAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgWanwanPush(al::HitSensor*, al::HitSensor*); +bool sendMsgWanwanReboundAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgWanwanBlockAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgWanwanHoleIn(al::HitSensor*, al::HitSensor*); +bool sendMsgWaterRoadIn(al::HitSensor*, al::HitSensor*); +bool sendMsgWaterRoadNear(al::HitSensor*, al::HitSensor*); +bool sendMsgBreedaSlap(al::HitSensor*, al::HitSensor*); +bool sendMsgBreedaPush(al::HitSensor*, al::HitSensor*); +bool sendMsgGamaneBullet(al::HitSensor*, al::HitSensor*); +bool sendMsgGamaneBulletThrough(al::HitSensor*, al::HitSensor*); +bool sendMsgGamaneBulletForCoinFlower(al::HitSensor*, al::HitSensor*); +bool sendMsgVolleyballNpcScareByEnemy(al::HitSensor*, al::HitSensor*); +bool sendMsgRocketFlowerExtension(al::HitSensor*, al::HitSensor*); +bool sendMsgWanderBossCameraRange(al::HitSensor*, al::HitSensor*); +bool sendMsgKuriboGirlAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgKuriboGirlLove(al::HitSensor*, al::HitSensor*); +bool sendMsgKuriboTop(al::HitSensor*, al::HitSensor*); +bool sendMsgTRexAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgTRexAttackCollideBody(al::HitSensor*, al::HitSensor*); +bool sendMsgTRexAttackCollideHead(al::HitSensor*, al::HitSensor*); +bool sendMsgTRexDashAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgTRexScrollPartsBreakWith(al::HitSensor*, al::HitSensor*); +bool sendMsgTsukkunNoTrace(al::HitSensor*, al::HitSensor*); +bool sendMsgTouchFireDrum2D(al::HitSensor*, al::HitSensor*); +bool sendMsgPropellerAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgTankExplosion(al::HitSensor*, al::HitSensor*); +bool sendMsgTankHackTrample(al::HitSensor*, al::HitSensor*); +bool sendMsgUtsuboAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgKillerAttackNoExplode(al::HitSensor*, al::HitSensor*); +bool sendMsgKillerMagnumAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgKillerMagnumHackAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgGabuzouAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgStackerRollingAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgStackerCapBoostAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgIgnoreIgnitionBomb(al::HitSensor*, al::HitSensor*); +bool sendMsgExplosionReflectBomb(al::HitSensor*, al::HitSensor*); +bool sendMsgGolemStampPress(al::HitSensor*, al::HitSensor*); +// bool sendMsgSwitchOnWithSaveRequest(al::LiveActor*, SaveObjInfo*); +bool sendMsgWanwanReboundAttackToCollided(al::LiveActor const*, al::HitSensor*); +bool sendMsgWanwanBlockAttackToCollided(al::LiveActor const*, al::HitSensor*); +bool sendMsgDigPointSmell(al::HitSensor*, al::HitSensor*, DigPoint*); +bool sendMsgMofumofuBodyChainExplode(al::HitSensor*, al::HitSensor*, int); +bool sendMsgMoonBasementRockThroughCollision(al::HitSensor*, al::HitSensor*, bool); +bool sendMsgFishingWait(al::HitSensor*, al::HitSensor*, al::HitSensor*); +bool sendMsgFishingUpImmediately(al::HitSensor*, al::HitSensor*, sead::Matrix34 const&, + sead::Vector3 const&, char const*); +bool sendMsgGunetterPush(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, float); +bool sendMsgTestPunch(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, int, int); +bool sendMsgTestPunchStrong(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, int, int); +bool sendMsgPunchGuard(al::HitSensor*, al::HitSensor*, int, int); +bool sendMsgTsukkunThrust(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, int, bool); +bool sendMsgTsukkunThrustSpin(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, int, + bool); +bool sendMsgTsukkunThrustReflect(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, int, + bool); +bool sendMsgTsukkunThrustCollide(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, int, + bool); +bool sendMsgTsukkunThrustHitReflectCollide(al::HitSensor*, al::HitSensor*, + sead::Vector3 const&, int, bool); +bool sendMsgTsukkunThrustReflectCollide(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, + int, bool); +bool sendMsgTsukkunThrustHole(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, + sead::Vector3 const&); +bool sendMsgTsukkunThroughCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgTsukkunHoldCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgTsukkunForceCancelCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgNetworkShootingShot(al::HitSensor*, al::HitSensor*, int); +bool sendMsgNetworkShootingChargeShot(al::HitSensor*, al::HitSensor*, int); +bool sendMsgRequestPlayerJumpBreakFloor(al::HitSensor*, al::HitSensor*); +bool sendMsgRequestPlayerJump(al::HitSensor*, al::HitSensor*, float); +bool sendMsgRequestPlayerTrampleJump(al::HitSensor*, al::HitSensor*, float); +bool sendMsgRequestPlayerSpinJump(al::HitSensor*, al::HitSensor*, float); +bool sendMsgRequestSphinxJump(al::HitSensor*, al::HitSensor*, float); +bool sendMsgIgnoreTouchTarget(al::HitSensor*, al::HitSensor*); +bool sendMsgIgnoreTouchTarget(al::ScreenPointer*, al::ScreenPointTarget*); +// bool sendMsgInitTouchTargetInfo(al::HitSensor*, al::HitSensor*, TouchTargetInfo*, +// sead::Vector3 const*); +// bool sendMsgInitTouchTargetInfo(al::ScreenPointer*, al::ScreenPointTarget*, TouchTargetInfo*, +// sead::Vector3 const*); +bool sendMsgCollisionImpulse(al::HitSensor*, al::HitSensor*, sead::Vector3*, + sead::Vector3 const&, float, sead::Vector3 const&, + float); +// bool sendMsgWhipHold(al::HitSensor*, al::HitSensor*, WhipTargetInfo*); +// bool sendMsgWhipBind(al::HitSensor*, al::HitSensor*, WhipTargetInfo*); +bool sendMsgWhipThrow(al::HitSensor*, al::HitSensor*, sead::Vector3 const&); +bool sendMsgMagnet(al::HitSensor*, al::HitSensor*, bool); +bool sendMsgMagnetBulletAttack(al::HitSensor*, al::HitSensor*, float); +bool sendMsgDashPanel(al::HitSensor*, al::HitSensor*, int); +bool sendMsgTrampolineCrackJump(al::HitSensor*, al::HitSensor*, float, float); +bool sendMsgCapTouchWall(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, + sead::Vector3 const&); +bool sendMsgCapRethrow(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, + sead::Vector3 const&, sead::Vector3 const&); +bool sendMsgCapRethrowReturnOnly(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, + sead::Vector3 const&, sead::Vector3 const&); +bool sendMsgCapChangeGiant(al::HitSensor*, al::HitSensor*, float, int); +bool sendMsgPackunEatCancel(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, + sead::Vector3 const&); +bool sendMsgPackunEatEnd(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, + sead::Vector3 const&); +bool sendMsgPackunEatStartFollow(al::HitSensor*, al::HitSensor*, sead::Vector3 const*); +bool sendMsgFireBlowerAttack(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, + sead::Vector3 const&, float); +// bool sendMsgPaint(al::HitSensor *,al::HitSensor *,sead::Color4u8 const&,int,int); +bool sendMsgPaintTexture(al::HitSensor*, al::HitSensor*, int, float, int); +// bool sendMsgCheckPaintClear(al::HitSensor *,al::HitSensor *,sead::Color4u8 +// const&,sead::Vector3 const&,int); +bool sendMsgCheckPaintAlpha(al::HitSensor*, al::HitSensor*, sead::Vector3 const&); +bool sendMsgByugoBlow(al::HitSensor*, al::HitSensor*, sead::Vector3 const&); +bool sendMsgHackDirectStageInit(al::HitSensor*, al::HitSensor*, IUsePlayerHack*); +bool sendMsgObjSnapForce(al::HitSensor*, al::HitSensor*, sead::Vector3 const&); +bool sendMsgCapBeamerBeam(al::HitSensor*, al::HitSensor*); +bool sendMsgHosuiAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgHosuiAttackCollide(al::HitSensor*, al::HitSensor*); +bool sendMsgHosuiAttackNoEffect(al::HitSensor*, al::HitSensor*); +bool sendMsgHosuiAttackStrong(al::HitSensor*, al::HitSensor*); +bool sendMsgHosuiTouch(al::HitSensor*, al::HitSensor*); +bool sendMsgHosuiTrample(al::HitSensor*, al::HitSensor*); +bool sendMsgHosuiTrampleReflect(al::HitSensor*, al::HitSensor*); +bool sendMsgHosuiTrampleReflectHigh(al::HitSensor*, al::HitSensor*); +bool sendMsgBubbleAttack(al::HitSensor*, al::HitSensor*); +bool sendMsgBubbleAttackToPecho(al::HitSensor*, al::HitSensor*); +bool sendMsgBubbleReflectH(al::HitSensor*, al::HitSensor*); +bool sendMsgBubbleReflectV(al::HitSensor*, al::HitSensor*); +bool sendMsgBubbleWallTouch(al::HitSensor*, al::HitSensor*); +bool sendMsgBubbleGroundTouchTrigger(al::HitSensor*, al::HitSensor*); +bool sendMsgBubbleLauncherStart(al::HitSensor*, al::HitSensor*); +bool sendMsgSenobiPartsMove(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, float); +bool sendMsgStampTo2D(al::HitSensor*, al::HitSensor*, sead::Vector3 const&); +bool sendMsgAirExplosion(al::HitSensor*, al::HitSensor*, sead::Vector3 const&); +bool sendMsgPushVelocity(al::HitSensor*, al::HitSensor*, sead::Vector3 const&); +bool sendMsgGhostRecordStartOk(al::HitSensor*, al::HitSensor*, char const*); +bool sendMsgSandGeyserRaise(al::HitSensor*, al::HitSensor*, float, float); +bool sendMsgRaceWait(al::LiveActor*); +bool sendMsgRaceStart(al::LiveActor*); +bool sendMsgRaceStop(al::LiveActor*); +bool sendMsgRaceReturnToCourse(al::LiveActor*, sead::Vector3 const&, + sead::Vector3 const&); +bool sendMsgPlayerLookAtPosition(al::HitSensor*, al::HitSensor*, sead::Vector3*); +bool sendMsgTargetMarkerPosition(al::HitSensor*, al::HitSensor*, sead::Vector3*); +bool sendMsgHackBlowJump(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, float); +bool sendMsgGolemStampPushV(al::HitSensor*, al::HitSensor*, float); +bool sendMsgGolemStampPushH(al::HitSensor*, al::HitSensor*, float); +bool sendMsgRequestPlayerWaitAnimDigPoint(al::HitSensor*, al::HitSensor*); +// bool sendMsgEventFlowScareCheck(al::HitSensor*, al::HitSensor*, al::EventFlowExecutor*); +bool sendMsgPlayerItemGetAll(al::HitSensor*, al::HitSensor*); +bool sendMsgPlayerItemGetAll2D(al::HitSensor*, al::HitSensor*); +bool sendMsgTRexAttackAll(al::HitSensor*, al::HitSensor*); +bool sendMsgSeedTouch(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, + sead::Vector3 const&); +bool sendMsgSphinxRideAttackTouchThrough(al::HitSensor*, al::HitSensor*, + sead::Vector3 const&, sead::Vector3 const&); +bool sendMsgSphinxRideAttackTouch(al::HitSensor*, al::HitSensor*, sead::Vector3 const&, + sead::Vector3 const&); +bool sendMsgBlockUpperPunch2D(al::HitSensor*, al::HitSensor*); +bool sendMsgGotogotonOn(al::HitSensor*, al::HitSensor*); +// bool sendMsgGotogotonGetJumpPath(al::HitSensor*, al::HitSensor*, al::ParabolicPath*); +bool sendMsgGotogotonGoalExist(al::HitSensor*, al::HitSensor*); +// bool sendMsgGotogotonGoalMatch(al::HitSensor*, al::HitSensor*, GotogotonMark const*); +bool sendMsgBossMagmaBreathForce(al::HitSensor*, al::HitSensor*, sead::Vector3 const&); +bool sendMsgBossMagmaCatchPlayer(al::HitSensor*, al::HitSensor*); +bool sendMsgBossMagmaReleasePlayer(al::HitSensor*, al::HitSensor*); +bool sendMsgBossMagmaDeadDemoStart(al::HitSensor*, al::HitSensor*); +bool sendMsgBossMagmaDeadDemoEnd(al::HitSensor*, al::HitSensor*, sead::Vector3 const&); +bool sendMsgBossMagmaResetPos(al::HitSensor*, al::HitSensor*, sead::Vector3 const&); +bool sendMsgBossMagmaQueryToBubble(al::HitSensor*, al::HitSensor*); +bool sendMsgCheckFishingTarget(al::HitSensor*, al::HitSensor*, FishingFish const*); +bool sendMsgPushToPlayerAndKillVelocityToTarget(al::LiveActor*, al::HitSensor*, al::HitSensor*); +bool sendMsgPushToPlayerAndKillVelocityToTargetH(al::LiveActor*, al::HitSensor*, al::HitSensor*); +bool sendMsgInitCapTarget(al::HitSensor*, al::HitSensor*, CapTargetInfo const**); +bool sendMsgTransferHack(al::HitSensor*, al::HitSensor*); +bool sendMsgRequestTransferHack(al::HitSensor*, al::HitSensor*); +bool sendMsgInitHack(al::HitSensor*, al::HitSensor*); +bool sendMsgEndHack(al::HitSensor*, al::HitSensor*, HackEndParam const*); +bool sendMsgNpcScareByEnemy(al::HitSensor*, al::HitSensor*, int); +} // namespace rs diff --git a/include/sead/basis/seadNew.h b/include/sead/basis/seadNew.h new file mode 100644 index 0000000..c5b66a0 --- /dev/null +++ b/include/sead/basis/seadNew.h @@ -0,0 +1,70 @@ +#ifndef SEAD_NEW_H_ +#define SEAD_NEW_H_ + +#include +#include + +#include + +namespace sead +{ +class Heap; + +void AllocFailAssert(Heap* heap, size_t size, u32 alignment); + +#ifndef SEAD_DEBUG +inline void AllocFailAssert(Heap*, size_t, u32) {} +#endif +} // namespace sead + +void* operator new(size_t size); +void* operator new[](size_t size); +void* operator new(size_t size, const std::nothrow_t&) noexcept; +void* operator new[](size_t size, const std::nothrow_t&) noexcept; + +void* operator new(size_t size, s32 alignment); +void* operator new[](size_t size, s32 alignment); +void* operator new(size_t size, s32 alignment, const std::nothrow_t&) noexcept; +void* operator new[](size_t size, s32 alignment, const std::nothrow_t&) noexcept; + +void* operator new(size_t size, sead::Heap* heap, const std::nothrow_t&) noexcept; +void* operator new[](size_t size, sead::Heap* heap, const std::nothrow_t&) noexcept; + +void* operator new(size_t size, sead::Heap* heap, s32 alignment = sizeof(void*)); +void* operator new[](size_t size, sead::Heap* heap, s32 alignment = sizeof(void*)); +void* operator new(size_t size, sead::Heap* heap, s32 alignment, const std::nothrow_t&) noexcept; +void* operator new[](size_t size, sead::Heap* heap, s32 alignment, const std::nothrow_t&) noexcept; + +void operator delete(void* ptr) noexcept; +void operator delete[](void* ptr) noexcept; +void operator delete(void* ptr, const std::nothrow_t&) noexcept; +void operator delete[](void* ptr, const std::nothrow_t&) noexcept; + +void operator delete(void* ptr, s32); +void operator delete[](void* ptr, s32); +void operator delete(void* ptr, s32, const std::nothrow_t&) noexcept; +void operator delete[](void* ptr, s32, const std::nothrow_t&) noexcept; + +void operator delete(void* ptr, sead::Heap*, const std::nothrow_t&) noexcept; +void operator delete[](void* ptr, sead::Heap*, const std::nothrow_t&) noexcept; + +void operator delete(void* ptr, sead::Heap*, s32); +void operator delete[](void* ptr, sead::Heap*, s32); +void operator delete(void* ptr, sead::Heap*, s32, const std::nothrow_t&) noexcept; +void operator delete[](void* ptr, sead::Heap*, s32, const std::nothrow_t&) noexcept; + +namespace sead +{ +inline u8* AllocBuffer(size_t size, Heap* heap, s32 alignment) +{ + u8* buffer = new (heap, alignment, std::nothrow) u8[size]; + if (buffer) + return buffer; + +#ifdef SEAD_DEBUG + sead::AllocFailAssert(heap, size, alignment); +#endif + return nullptr; +} +} // namespace sead +#endif // SEAD_NEW_H_ diff --git a/include/sead/basis/seadRawPrint.h b/include/sead/basis/seadRawPrint.h new file mode 100644 index 0000000..979f969 --- /dev/null +++ b/include/sead/basis/seadRawPrint.h @@ -0,0 +1,95 @@ +#pragma once + +#include + +#include + +#ifdef SEAD_DEBUG +#define SEAD_ASSERT_MSG(condition, message, ...) \ + do \ + { \ + if (!(condition)) \ + sead::system::HaltWithDetail(__FILE__, __LINE__, message, ##__VA_ARGS__); \ + } while (0) +#define SEAD_ASSERT(condition) \ + do \ + { \ + if (!(condition)) \ + sead::system::HaltWithDetailNoFormat(__FILE__, __LINE__, #condition); \ + } while (0) +#define SEAD_WARN(message, ...) \ + do \ + sead::system::Warning(__FILE__, __LINE__, message, ##__VA_ARGS__); \ + while (0) +#define SEAD_DEBUG_PRINT(format, ...) \ + do \ + sead::system::Print(format, ##__VA_ARGS__); \ + while (0) +#else +#define SEAD_ASSERT_MSG(condition, message, ...) \ + do \ + { \ + if (false) \ + { \ + static_cast(condition); \ + sead::system::detail::CheckFormat(message, ##__VA_ARGS__); \ + } \ + } while (0) +#define SEAD_ASSERT(condition) \ + do \ + { \ + if (false) \ + static_cast(condition); \ + } while (0) +#define SEAD_WARN(message, ...) \ + do \ + { \ + if (false) \ + sead::system::detail::CheckFormat(message, ##__VA_ARGS__); \ + } while (0) +#define SEAD_DEBUG_PRINT(format, ...) \ + do \ + { \ + if (false) \ + sead::system::detail::CheckFormat(format, ##__VA_ARGS__); \ + } while (0) +#endif + +namespace sead +{ +namespace system +{ +namespace detail +{ +// Dummy function whose only purpose is to trigger a format string check. +#ifdef __GNUC__ +[[maybe_unused]] [[gnu::format(printf, 1, 2)]] +#endif +inline void +CheckFormat(const char*, ...) +{ +} +} // namespace detail + +void Halt(); +#ifdef __GNUC__ +[[gnu::format(printf, 3, 4)]] +#endif +void HaltWithDetail(const char* file, int line, const char* msg, ...); +void HaltWithDetailNoFormat(const char* file, int line, const char* msg); +void DebugBreak(); + +#ifdef __GNUC__ +[[gnu::format(printf, 1, 2)]] +#endif +void Print(const char* format, ...); +void PrintV(const char* format, std::va_list); +void PrintString(const char* format, s32); + +#ifdef __GNUC__ +[[gnu::format(printf, 3, 4)]] +#endif +void Warning(const char* file, int line, const char* msg, ...); +void SetWarningEnable(bool enable); +} // namespace system +} // namespace sead diff --git a/include/sead/basis/seadTypes.h b/include/sead/basis/seadTypes.h new file mode 100644 index 0000000..f007d62 --- /dev/null +++ b/include/sead/basis/seadTypes.h @@ -0,0 +1,27 @@ +#ifndef SEAD_TYPES_H_ +#define SEAD_TYPES_H_ + +#ifdef cafe +#include +#else +#include +#include + +using u8 = std::uint8_t; +using u16 = std::uint16_t; +using u32 = std::uint32_t; +using u64 = std::uint64_t; + +using s8 = std::int8_t; +using s16 = std::int16_t; +using s32 = std::int32_t; +using s64 = std::int64_t; + +using f32 = float; +using f64 = double; + +using char16 = char16_t; +using size_t = std::size_t; +#endif + +#endif // SEAD_NEW_H_ diff --git a/include/sead/camera/PerspectiveProjection.h b/include/sead/camera/PerspectiveProjection.h new file mode 100644 index 0000000..c6d1bff --- /dev/null +++ b/include/sead/camera/PerspectiveProjection.h @@ -0,0 +1,11 @@ +#pragma once + +namespace sead { + class PerspectiveProjection { + public: + float getFovy(); + + unsigned char padding[0xA0]; + float fovy; + }; +} \ No newline at end of file diff --git a/include/sead/codec/seadBase64.h b/include/sead/codec/seadBase64.h new file mode 100644 index 0000000..83acda5 --- /dev/null +++ b/include/sead/codec/seadBase64.h @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace sead +{ +class Base64 +{ +public: + static void encode(char* dst, const void* src, size_t length, bool url_safe); + static bool decode(void* dst, size_t dst_size, const char* src, size_t src_size, + size_t* decoded_size); +}; +} // namespace sead diff --git a/include/sead/codec/seadHashCRC16.h b/include/sead/codec/seadHashCRC16.h new file mode 100644 index 0000000..cc1b006 --- /dev/null +++ b/include/sead/codec/seadHashCRC16.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include + +namespace sead +{ +class HashCRC16 +{ +public: + struct Context + { + u32 hash = 0; + }; + + static u32 calcHash(const void* ptr, u32 size); + static u32 calcHashWithContext(Context* context, const void* ptr, u32 size); + + static u32 calcStringHash(const char* str); + static u32 calcStringHash(const SafeString& str) { return calcStringHash(str.cstr()); } + static u32 calcStringHashWithContext(Context* context, const char* str); + static u32 calcStringHashWithContext(Context* context, const SafeString& str) + { + return calcStringHashWithContext(context, str.cstr()); + } + + static void initialize(); + +private: + static u16 sTable[256]; + static bool sInitialized; +}; +} // namespace sead diff --git a/include/sead/codec/seadHashCRC32.h b/include/sead/codec/seadHashCRC32.h new file mode 100644 index 0000000..1f2675b --- /dev/null +++ b/include/sead/codec/seadHashCRC32.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include + +namespace sead +{ +class HashCRC32 +{ +public: + struct Context + { + u32 hash = -1; + }; + + static u32 calcHash(const void* ptr, u32 size); + static u32 calcHashWithContext(Context* context, const void* ptr, u32 size); + + static u32 calcStringHash(const char* str); + static u32 calcStringHash(const SafeString& str) { return calcStringHash(str.cstr()); } + static u32 calcStringHashWithContext(Context* context, const char* str); + static u32 calcStringHashWithContext(Context* context, const SafeString& str) + { + return calcStringHashWithContext(context, str.cstr()); + } + + static void initialize(); + +private: + static u32 sTable[256]; + static bool sInitialized; +}; +} // namespace sead diff --git a/include/sead/container/seadBuffer.h b/include/sead/container/seadBuffer.h new file mode 100644 index 0000000..eb058e6 --- /dev/null +++ b/include/sead/container/seadBuffer.h @@ -0,0 +1,442 @@ +#ifndef SEAD_BUFFER_H_ +#define SEAD_BUFFER_H_ + +#include +#include + +#include +#include +#include +#include +#include + +namespace sead +{ +class Heap; + +template +class Buffer +{ +public: + Buffer() : mSize(0), mBuffer(NULL) {} + Buffer(s32 size, T* buffer) : mSize(size), mBuffer(buffer) {} + template + Buffer(T (&array)[N]) : Buffer(N, array) + { + } + + Buffer(const Buffer& other) { *this = other; } + + Buffer& operator=(const Buffer& other) + { + mSize = other.mSize; + mBuffer = other.mBuffer; + return *this; + } + + class iterator + { + public: + explicit iterator(T* buffer, s32 index = 0) : mIndex(index), mBuffer(buffer) {} + bool operator==(const iterator& rhs) const + { + return mIndex == rhs.mIndex && mBuffer == rhs.mBuffer; + } + bool operator!=(const iterator& rhs) const { return !operator==(rhs); } + iterator& operator++() + { + ++mIndex; + return *this; + } + T& operator*() const { return mBuffer[mIndex]; } + T* operator->() const { return &mBuffer[mIndex]; } + s32 getIndex() const { return mIndex; } + + private: + s32 mIndex; + T* mBuffer; + }; + + class constIterator + { + public: + explicit constIterator(const T* buffer, s32 index = 0) : mIndex(index), mBuffer(buffer) {} + bool operator==(const constIterator& rhs) const + { + return mIndex == rhs.mIndex && mBuffer == rhs.mBuffer; + } + bool operator!=(const constIterator& rhs) const { return !operator==(rhs); } + constIterator& operator++() + { + ++mIndex; + return *this; + } + const T& operator*() const { return mBuffer[mIndex]; } + const T* operator->() const { return &mBuffer[mIndex]; } + s32 getIndex() const { return mIndex; } + + private: + s32 mIndex; + const T* mBuffer; + }; + + iterator begin() { return iterator(mBuffer); } + iterator begin(s32 idx) + { + if (u32(size()) < u32(idx)) + { + SEAD_ASSERT_MSG(false, "range over [0,%d] : %d", size(), idx); + return end(); + } + return iterator(mBuffer, idx); + } + + constIterator begin() const { return constIterator(mBuffer); } + constIterator begin(s32 idx) const + { + if (u32(size()) < u32(idx)) + { + SEAD_ASSERT_MSG(false, "range over [0,%d] : %d", size(), idx); + return end(); + } + return constIterator(mBuffer, idx); + } + + iterator end() { return iterator(mBuffer, mSize); } + constIterator end() const { return constIterator(mBuffer, mSize); } + + class reverseIterator + { + public: + explicit reverseIterator(T* buffer, s32 index = 0) : mIndex(index), mBuffer(buffer) {} + bool operator==(const reverseIterator& rhs) const { return mIndex == rhs.mIndex; } + bool operator!=(const reverseIterator& rhs) const { return !operator==(rhs); } + reverseIterator& operator++() + { + --mIndex; + return *this; + } + T& operator*() const { return mBuffer[mIndex]; } + T* operator->() const { return &mBuffer[mIndex]; } + s32 getIndex() const { return mIndex; } + + private: + s32 mIndex; + T* mBuffer; + }; + + reverseIterator rbegin() { return reverseIterator(mBuffer, mSize - 1); } + reverseIterator rbegin(s32 index) { return reverseIterator(mBuffer, index); } + reverseIterator rend() { return reverseIterator(mBuffer, -1); } + + void allocBuffer(s32 size, s32 alignment) + { + SEAD_ASSERT(mBuffer == nullptr); + if (size > 0) + { + T* buffer = new (alignment) T[size]; + if (buffer) + { + mSize = size; + mBuffer = buffer; + SEAD_ASSERT_MSG(PtrUtil::isAlignedPow2(mBuffer, sead::Mathi::abs(alignment)), + "don't set alignment for a class with destructor"); + } + } + else + { + SEAD_ASSERT_MSG(false, "size[%d] must be larger than zero", size); + } + } + + void allocBuffer(s32 size, Heap* heap, s32 alignment = sizeof(void*)) + { + SEAD_ASSERT(mBuffer == nullptr); + if (size > 0) + { + T* buffer = new (heap, alignment) T[size]; + if (buffer) + { + mSize = size; + mBuffer = buffer; + SEAD_ASSERT_MSG(PtrUtil::isAlignedPow2(mBuffer, sead::Mathi::abs(alignment)), + "don't set alignment for a class with destructor"); + } + } + else + { + SEAD_ASSERT_MSG(false, "size[%d] must be larger than zero", size); + } + } + + bool tryAllocBuffer(s32 size, s32 alignment = sizeof(void*)) + { + SEAD_ASSERT(mBuffer == nullptr); + if (size > 0) + { + T* buffer = new (alignment, std::nothrow) T[size]; + if (buffer) + { + mSize = size; + mBuffer = buffer; + SEAD_ASSERT_MSG(PtrUtil::isAlignedPow2(mBuffer, sead::Mathi::abs(alignment)), + "don't set alignment for a class with destructor"); + return true; + } + return false; + } + SEAD_ASSERT_MSG(false, "size[%d] must be larger than zero", size); + return false; + } + + bool tryAllocBuffer(s32 size, Heap* heap, s32 alignment = sizeof(void*)) + { + SEAD_ASSERT(mBuffer == nullptr); + if (size > 0) + { + T* buffer = new (heap, alignment, std::nothrow) T[size]; + if (buffer) + { + mSize = size; + mBuffer = buffer; + SEAD_ASSERT_MSG(PtrUtil::isAlignedPow2(mBuffer, sead::Mathi::abs(alignment)), + "don't set alignment for a class with destructor"); + return true; + } + return false; + } + SEAD_ASSERT_MSG(false, "size[%d] must be larger than zero", size); + return false; + } + + inline bool allocBufferAssert(s32 size, Heap* heap, s32 alignment = sizeof(void*)) + { + if (tryAllocBuffer(size, heap, alignment)) + return true; + AllocFailAssert(heap, sizeof(T) * size, alignment); + return false; + } + + void freeBuffer() + { + if (mBuffer) + { + delete[] mBuffer; + mBuffer = nullptr; + mSize = 0; + } + } + + void setBuffer(s32 size, T* bufferptr) + { + if (size < 1) + { + SEAD_ASSERT_MSG(false, "size[%d] must be larger than zero", size); + return; + } + if (!bufferptr) + { + SEAD_ASSERT_MSG(false, "bufferptr is null"); + return; + } + mSize = size; + mBuffer = bufferptr; + } + + bool isBufferReady() const { return mBuffer != nullptr; } + + bool isIndexValid(s32 idx) const { return u32(idx) < u32(mSize); } + + T& operator()(s32 idx) { return *unsafeGet(idx); } + const T& operator()(s32 idx) const { return *unsafeGet(idx); } + + T& operator[](s32 idx) + { + if (u32(mSize) <= u32(idx)) + { + SEAD_ASSERT_MSG(false, "index exceeded [%d/%d]", idx, mSize); + return mBuffer[0]; + } + return mBuffer[idx]; + } + + const T& operator[](s32 idx) const + { + if (u32(mSize) <= u32(idx)) + { + SEAD_ASSERT_MSG(false, "index exceeded [%d/%d]", idx, mSize); + return mBuffer[0]; + } + return mBuffer[idx]; + } + + T* get(s32 idx) + { + if (u32(mSize) <= u32(idx)) + { + SEAD_ASSERT_MSG(false, "index exceeded [%d/%d]", idx, mSize); + return nullptr; + } + return &mBuffer[idx]; + } + + const T* get(s32 idx) const + { + if (u32(mSize) <= u32(idx)) + { + SEAD_ASSERT_MSG(false, "index exceeded [%d/%d]", idx, mSize); + return nullptr; + } + return &mBuffer[idx]; + } + + T* unsafeGet(s32 idx) + { + SEAD_ASSERT_MSG(u32(idx) < u32(mSize), "index exceeded [%d/%d]", idx, mSize); + return &mBuffer[idx]; + } + const T* unsafeGet(s32 idx) const + { + SEAD_ASSERT_MSG(u32(idx) < u32(mSize), "index exceeded [%d/%d]", idx, mSize); + return &mBuffer[idx]; + } + + T& front() { return mBuffer[0]; } + const T& front() const { return mBuffer[0]; } + + T& back() { return mBuffer[mSize - 1]; } + const T& back() const { return mBuffer[mSize - 1]; } + + s32 size() const { return mSize; } + s32 getSize() const { return mSize; } + + T* getBufferPtr() { return mBuffer; } + const T* getBufferPtr() const { return mBuffer; } + + u32 getByteSize() const { return mSize * sizeof(T); } + + void fill(const T& v) + { + for (s32 i = 0; i < mSize; ++i) + mBuffer[i] = v; + } + + using CompareCallback = s32 (*)(const T* lhs, const T* rhs); + + s32 binarySearch(const T& item) const { return binarySearch(item, compareT); } + + s32 binarySearch(const T& item, CompareCallback cmp) const + { + if (mSize == 0) + return -1; + + s32 a = 0; + s32 b = mSize - 1; + while (a < b) + { + const s32 m = (a + b) / 2; + const s32 c = cmp(&mBuffer[m], &item); + if (c == 0) + return m; + if (c < 0) + a = m + 1; + else + b = m; + } + + if (cmp(&mBuffer[a], &item) == 0) + return a; + + return -1; + } + + template + s32 binarySearch(const Key& key, s32 (*cmp)(const T& item, const Key& key)) const + { + if (mSize == 0) + return -1; + + s32 a = 0; + s32 b = mSize - 1; + while (a < b) + { + const s32 m = (a + b) / 2; + const s32 c = cmp(mBuffer[m], key); + if (c == 0) + return m; + if (c < 0) + a = m + 1; + else + b = m; + } + + if (cmp(mBuffer[a], key) == 0) + return a; + + return -1; + } + + template + s32 binarySearchC(CustomCompareCallback cmp) const + { + if (mSize == 0) + return -1; + + s32 a = 0; + s32 b = mSize - 1; + while (a < b) + { + const s32 m = (a + b) / 2; + const s32 c = cmp(mBuffer[m]); + if (c == 0) + return m; + if (c < 0) + a = m + 1; + else + b = m; + } + + if (cmp(mBuffer[a]) == 0) + return a; + + return -1; + } + + /// Sort elements with indices in [start_idx .. end_idx] using heapsort. + void heapSort(s32 start_idx, s32 end_idx) + { + if (start_idx >= mSize || end_idx >= mSize || end_idx - start_idx < 1) + return; + // FIXME: Nintendo implemented heap sort manually without using + std::make_heap(mBuffer + start_idx, mBuffer + end_idx); + std::sort_heap(mBuffer + start_idx, mBuffer + end_idx); + } + + /// Sort elements with indices in [start_idx .. end_idx] using heapsort. + void heapSort(s32 start_idx, s32 end_idx, CompareCallback cmp) + { + if (start_idx >= mSize || end_idx >= mSize || end_idx - start_idx < 1) + return; + // FIXME: Nintendo implemented heap sort manually without using + const auto cmp_ = [cmp](const T& a, const T& b) { return cmp(&a, &b) < 0; }; + std::make_heap(mBuffer + start_idx, mBuffer + end_idx, cmp_); + std::sort_heap(mBuffer + start_idx, mBuffer + end_idx, cmp_); + } + +protected: + static s32 compareT(const T* lhs, const T* rhs) + { + if (*lhs < *rhs) + return -1; + if (*rhs < *lhs) + return 1; + return 0; + } + + s32 mSize; + T* mBuffer; +}; + +} // namespace sead + +#endif // SEAD_BUFFER_H_ diff --git a/include/sead/container/seadFreeList.h b/include/sead/container/seadFreeList.h new file mode 100644 index 0000000..93e2368 --- /dev/null +++ b/include/sead/container/seadFreeList.h @@ -0,0 +1,74 @@ +#pragma once + +#include + +#include "basis/seadRawPrint.h" +#include "basis/seadTypes.h" + +namespace sead +{ +class FreeList +{ +public: + void setWork(void* work, s32 elem_size, s32 num); + void reset(); + + void* alloc(); + void free(void* ptr); + + void* getFree() const { return mFree; } + void* work() const { return mWork; } + + static const size_t cPtrSize = sizeof(void*); + +private: + struct Node + { + Node* nextFree; + }; + + Node* mFree = nullptr; + void* mWork = nullptr; +}; + +inline void FreeList::setWork(void* work, s32 elem_size, s32 num) +{ + SEAD_ASSERT(work); + SEAD_ASSERT(elem_size > 0 && elem_size % cPtrSize == 0); + SEAD_ASSERT(num > 0); + + const s32 idx_multiplier = elem_size / cPtrSize; + void** const ptrs = new (work) void*[num * idx_multiplier]; + + mFree = new (work) Node; + + // Create the linked list. + for (s32 i = 0; i < num - 1; ++i) + new (&ptrs[i * idx_multiplier]) Node{new (&ptrs[(i + 1) * idx_multiplier]) Node}; + + new (&ptrs[(num - 1) * idx_multiplier]) Node{nullptr}; + + mWork = work; +} + +inline void FreeList::reset() +{ + mFree = nullptr; + mWork = nullptr; +} + +inline void* FreeList::alloc() +{ + if (!mFree) + return nullptr; + + void* ptr = mFree; + mFree = mFree->nextFree; + return ptr; +} + +inline void FreeList::free(void* ptr) +{ + mFree = new (ptr) Node{mFree}; +} +} // namespace sead diff --git a/include/sead/container/seadListImpl.h b/include/sead/container/seadListImpl.h new file mode 100644 index 0000000..c78979b --- /dev/null +++ b/include/sead/container/seadListImpl.h @@ -0,0 +1,121 @@ +#ifndef SEAD_LIST_IMPL_H_ +#define SEAD_LIST_IMPL_H_ + +#include + +namespace sead +{ +class Random; + +class ListNode +{ +public: + ListNode* next() const { return mNext; } + ListNode* prev() const { return mPrev; } + bool isLinked() const { return mNext || mPrev; } + +private: + friend class ListImpl; + + void init_() { *this = {}; } + void insertBack_(ListNode* node); + void insertFront_(ListNode* node); + void erase_(); + + ListNode* mPrev = nullptr; + ListNode* mNext = nullptr; +}; + +class ListImpl +{ +public: + __attribute__((always_inline)) ListImpl() : mStartEnd(), mCount(0) + { + mStartEnd.mNext = &mStartEnd; + mStartEnd.mPrev = &mStartEnd; + } + + bool isEmpty() const { return mCount == 0; } + s32 size() const { return mCount; } + + void reverse(); + void shuffle(); + void shuffle(Random* random); + bool checkLinks() const; + +protected: + using CompareCallbackImpl = int (*)(const void*, const void*); + + template + void sort(s32 offset, const ComparePredicate& cmp) + { + this->mergeSort(offset, cmp); + } + + template + void mergeSort(s32 offset, const ComparePredicate& cmp) + { + this->mergeSortImpl_(mStartEnd.mNext, mStartEnd.mPrev, size(), offset, + cmp); + } + + void pushBack(ListNode* item) + { + mStartEnd.insertFront_(item); + ++mCount; + } + + void pushFront(ListNode* item) + { + mStartEnd.insertBack_(item); + ++mCount; + } + + ListNode* popBack(); + ListNode* popFront(); + + void insertBefore(ListNode* node, ListNode* node_to_insert) + { + node->insertFront_(node_to_insert); + ++mCount; + } + + void insertAfter(ListNode* node, ListNode* node_to_insert) + { + node->insertBack_(node_to_insert); + ++mCount; + } + + void erase(ListNode* item) + { + item->erase_(); + --mCount; + } + + ListNode* front() const { return mCount >= 1 ? mStartEnd.mNext : nullptr; } + ListNode* back() const { return mCount >= 1 ? mStartEnd.mPrev : nullptr; } + ListNode* nth(int n) const; + s32 indexOf(const ListNode*) const; + + void swap(ListNode* n1, ListNode* n2); + void moveAfter(ListNode* basis, ListNode* n); + void moveBefore(ListNode* basis, ListNode* n); + + ListNode* find(const void* ptr, s32 offset, CompareCallbackImpl cmp) const; + void uniq(s32 offset, CompareCallbackImpl cmp); + + void clear(); + + // FIXME: this should take an rvalue reference for predicate. + template + static void mergeSortImpl_(ListNode* front, ListNode* back, s32 num, s32 offset, + const ComparePredicate& predicate); + +protected: + ListNode mStartEnd; + s32 mCount; +}; + +} // namespace sead + +#endif // SEAD_LIST_IMPL_H_ diff --git a/include/sead/container/seadObjArray.h b/include/sead/container/seadObjArray.h new file mode 100644 index 0000000..df2b4de --- /dev/null +++ b/include/sead/container/seadObjArray.h @@ -0,0 +1,271 @@ +#pragma once + +#include +#include "basis/seadNew.h" +#include "basis/seadRawPrint.h" +#include "container/seadFreeList.h" +#include "container/seadPtrArray.h" + +namespace sead +{ +/// An ObjArray is a container that allocates elements using a FreeList and also keeps an array of +/// pointers for fast access to each element. +template +class ObjArray : public PtrArrayImpl +{ +public: + ObjArray() = default; + ObjArray(s32 max_num, void* buf) { setBuffer(max_num, buf); } + + void allocBuffer(s32 capacity, Heap* heap, s32 alignment = sizeof(void*)) + { + SEAD_ASSERT(mPtrs == nullptr); + + if (capacity < 1) + { + SEAD_ASSERT_MSG(false, "capacity[%d] must be larger than zero", capacity); + return; + } + + setBuffer(capacity, + new (heap, alignment, std::nothrow) u8[calculateWorkBufferSize(capacity)]); + } + + bool tryAllocBuffer(s32 capacity, Heap* heap, s32 alignment = sizeof(void*)) + { + SEAD_ASSERT(mPtrs == nullptr); + + if (capacity < 1) + { + SEAD_ASSERT_MSG(false, "capacity[%d] must be larger than zero", capacity); + return false; + } + + auto* buf = new (heap, alignment, std::nothrow) u8[calculateWorkBufferSize(capacity)]; + if (!buf) + return false; + + setBuffer(capacity, buf); + return true; + } + + void setBuffer(s32 max_num, void* buf) + { + if (!buf) + { + SEAD_ASSERT_MSG(false, "buf is null"); + return; + } + + mFreeList.setWork(buf, ElementSize, max_num); + PtrArrayImpl::setBuffer(max_num, reinterpret_cast(buf) + ElementSize * max_num); + } + + void freeBuffer() + { + if (!isBufferReady()) + return; + + clear(); + + if (mFreeList.work()) + delete[] static_cast(mFreeList.work()); + + mFreeList.reset(); + mPtrs = nullptr; + mPtrNumMax = 0; + } + + T* at(s32 pos) const { return static_cast(PtrArrayImpl::at(pos)); } + T* unsafeAt(s32 pos) const { return static_cast(PtrArrayImpl::unsafeAt(pos)); } + T* operator()(s32 pos) const { return unsafeAt(pos); } + T* operator[](s32 pos) const { return at(pos); } + + // XXX: Does this use at()? + T* front() const { return at(0); } + T* back() const { return at(mPtrNum - 1); } + + void pushBack(const T& item) + { + if (isFull()) + SEAD_ASSERT_MSG(false, "buffer full."); + else + PtrArrayImpl::pushBack(alloc(item)); + } + + template + T* emplaceBack(Args&&... args) + { + if (isFull()) + { + SEAD_ASSERT_MSG(false, "buffer full."); + return nullptr; + } + T* item = new (mFreeList.alloc()) T(std::forward(args)...); + PtrArrayImpl::pushBack(item); + return item; + } + + void insert(s32 pos, const T& item) { PtrArrayImpl::insert(pos, alloc(item)); } + + void erase(int index) { erase(index, 1); } + + void erase(int index, int count) + { + if (index + count <= size()) + { + for (int i = index; i < index + count; ++i) + { + auto* ptr = unsafeAt(i); + ptr->~T(); + mFreeList.free(ptr); + } + } + PtrArrayImpl::erase(index, count); + } + + void clear() + { + for (s32 i = 0; i < mPtrNum; ++i) + { + auto* ptr = unsafeAt(i); + ptr->~T(); + mFreeList.free(ptr); + } + mPtrNum = 0; + } + + using CompareCallback = s32 (*)(const T*, const T*); + + void sort() { sort(compareT); } + void sort(CompareCallback cmp) { PtrArrayImpl::sort_(cmp); } + void heapSort() { heapSort(compareT); } + void heapSort(CompareCallback cmp) { PtrArrayImpl::heapSort_(cmp); } + + bool equal(const ObjArray& other, CompareCallback cmp) const + { + return PtrArrayImpl::equal(other, cmp); + } + + s32 compare(const ObjArray& other, CompareCallback cmp) const + { + return PtrArrayImpl::compare(other, cmp); + } + + s32 binarySearch(const T* ptr) const { return PtrArrayImpl::binarySearch(ptr, compareT); } + s32 binarySearch(const T* ptr, CompareCallback cmp) const + { + return PtrArrayImpl::binarySearch(ptr, cmp); + } + + bool operator==(const ObjArray& other) const { return equal(other, compareT); } + bool operator!=(const ObjArray& other) const { return !(*this == other); } + bool operator<(const ObjArray& other) const { return compare(other) < 0; } + bool operator<=(const ObjArray& other) const { return compare(other) <= 0; } + bool operator>(const ObjArray& other) const { return compare(other) > 0; } + bool operator>=(const ObjArray& other) const { return compare(other) >= 0; } + + void uniq() { PtrArrayImpl::uniq(compareT); } + void uniq(CompareCallback cmp) { PtrArrayImpl::uniq(cmp); } + + class iterator + { + public: + iterator(T* const* pptr) : mPPtr{pptr} {} + bool operator==(const iterator& other) const { return mPPtr == other.mPPtr; } + bool operator!=(const iterator& other) const { return !(*this == other); } + iterator& operator++() + { + ++mPPtr; + return *this; + } + T& operator*() const { return **mPPtr; } + T* operator->() const { return *mPPtr; } + + private: + T* const* mPPtr; + }; + + iterator begin() const { return iterator(data()); } + iterator end() const { return iterator(data() + mPtrNum); } + + class constIterator + { + public: + constIterator(const T* const* pptr) : mPPtr{pptr} {} + bool operator==(const constIterator& other) const { return mPPtr == other.mPPtr; } + bool operator!=(const constIterator& other) const { return !(*this == other); } + constIterator& operator++() + { + ++mPPtr; + return *this; + } + const T& operator*() const { return **mPPtr; } + const T* operator->() const { return *mPPtr; } + + private: + const T* const* mPPtr; + }; + + constIterator constBegin() const { return constIterator(data()); } + constIterator constEnd() const { return constIterator(data() + mPtrNum); } + + T** data() const { return reinterpret_cast(mPtrs); } + +private: + union Node + { + void* next_node; + T elem; + }; + +public: + static constexpr size_t ElementSize = sizeof(Node); + + static constexpr size_t calculateWorkBufferSize(size_t n) + { + return n * (ElementSize + sizeof(T*)); + } + +protected: + T* alloc(const T& item) + { + void* storage = mFreeList.alloc(); + if (!storage) + return nullptr; + return new (storage) T(item); + } + + static int compareT(const void* a_, const void* b_) + { + const T* a = static_cast(a_); + const T* b = static_cast(b_); + if (*a < *b) + return -1; + if (*b < *a) + return 1; + return 0; + } + + sead::FreeList mFreeList; +}; + +template +class FixedObjArray : public ObjArray +{ +public: + FixedObjArray() : ObjArray(N, &mWork) {} + + // These do not make sense for a *fixed* array. + void setBuffer(s32 ptrNumMax, void* buf) = delete; + void allocBuffer(s32 ptrNumMax, Heap* heap, s32 alignment = sizeof(void*)) = delete; + bool tryAllocBuffer(s32 ptrNumMax, Heap* heap, s32 alignment = sizeof(void*)) = delete; + void freeBuffer() = delete; + +private: + std::aligned_storage_t::calculateWorkBufferSize(N), + std::max(alignof(T), alignof(T*))> + mWork; +}; + +} // namespace sead diff --git a/include/sead/container/seadObjList.h b/include/sead/container/seadObjList.h new file mode 100644 index 0000000..ad719eb --- /dev/null +++ b/include/sead/container/seadObjList.h @@ -0,0 +1,245 @@ +#pragma once + +#include +#include "basis/seadNew.h" +#include "basis/seadRawPrint.h" +#include "basis/seadTypes.h" +#include "container/seadFreeList.h" +#include "container/seadListImpl.h" +#include "prim/seadPtrUtil.h" + +namespace sead +{ +template +class ObjList : public ListImpl +{ +public: + ObjList() = default; + ObjList(s32 max_num, void* buf) { setBuffer(max_num, buf); } + + void allocBuffer(s32 capacity, Heap* heap, s32 alignment = sizeof(void*)) + { + if (capacity < 1) + return; + + setBuffer(capacity, + new (heap, alignment, std::nothrow) u8[calculateWorkBufferSize(capacity)]); + } + + bool tryAllocBuffer(s32 capacity, Heap* heap, s32 alignment = sizeof(void*)) + { + if (capacity < 1) + return false; + + auto* buf = new (heap, alignment, std::nothrow) u8[calculateWorkBufferSize(capacity)]; + if (!buf) + return false; + + setBuffer(capacity, buf); + return true; + } + + void setBuffer(s32 max_num, void* buf) + { + if (!buf) + { + SEAD_ASSERT_MSG(false, "buf is null"); + return; + } + + mFreeList.setWork(buf, ElementSize, max_num); + mMaxNum = max_num; + } + + void freeBuffer() + { + if (!isBufferReady()) + return; + + clear(); + + if (mFreeList.work()) + delete[] static_cast(mFreeList.work()); + + mMaxNum = 0; + mFreeList.reset(); + } + + bool isBufferReady() const { return mFreeList.work() != nullptr; } + + bool isFull() const { return size() >= mMaxNum; } + + T* front() const { return listNodeToObjWithNullCheck(ListImpl::front()); } + T* back() const { return listNodeToObjWithNullCheck(ListImpl::back()); } + + T popBack() + { + auto* item = back(); + if (!item) + return {}; + + T copy = *item; + erase(item); + return copy; + } + + T popFront() + { + auto* item = front(); + if (!item) + return {}; + + T copy = *item; + erase(item); + return copy; + } + + template + T* emplaceBack(Args&&... args) + { + if (isFull()) + { + SEAD_ASSERT_MSG(false, "buffer full."); + return nullptr; + } + Node* item = new (mFreeList.alloc()) Node{T{std::forward(args)...}, {}}; + ListImpl::pushBack(&item->node); + return &item->item; + } + + void erase(T* item) + { + ListImpl::erase(objToListNode(item)); + item->~T(); + mFreeList.free(item); + } + + void clear() + { + ListNode* node = mStartEnd.next(); + while (node != &mStartEnd) + { + // Fetch the next pointer before erasing the item from the linked list. + ListNode* next = node->next(); + ListImpl::erase(node); + + auto* item = listNodeToObj(node); + item->~T(); + mFreeList.free(item); + + node = next; + } + } + + T* prev(const T* obj) const + { + ListNode* prev_node = objToListNode(obj)->prev(); + if (prev_node == &mStartEnd) + return nullptr; + return listNodeToObj(prev_node); + } + + T* next(const T* obj) const + { + ListNode* next_node = objToListNode(obj)->next(); + if (next_node == &mStartEnd) + return nullptr; + return listNodeToObj(next_node); + } + + T* nth(s32 n) const { return listNodeToObjWithNullCheck(ListImpl::nth(n)); } + + s32 indexOf(const T* obj) const { return ListImpl::indexOf(objToListNode(obj)); } + + bool isNodeLinked(const T* obj) const { return objToListNode(obj)->isLinked(); } + + class iterator + { + public: + explicit iterator(T* ptr) : mPtr{ptr} {} + bool operator==(const iterator& other) const { return mPtr == other.mPtr; } + bool operator!=(const iterator& other) const { return !operator==(other); } + iterator& operator++() + { + constexpr auto offset = Node::getListNodeOffset(); + auto* node = static_cast(PtrUtil::addOffset(mPtr, offset))->next(); + mPtr = static_cast(PtrUtil::addOffset(node, -offset)); + return *this; + } + T& operator*() const { return *mPtr; } + T* operator->() const { return mPtr; } + + private: + T* mPtr; + }; + + iterator begin() const { return iterator(listNodeToObj(mStartEnd.next())); } + iterator end() const { return iterator(listNodeToObj(const_cast(&mStartEnd))); } + iterator begin(T* ptr) const { return iterator(ptr); } + + static constexpr size_t calculateWorkBufferSize(size_t n) { return n * ElementSize; } + +private: + struct Node + { + static constexpr auto getListNodeOffset() { return offsetof(Node, node); } + T item; + ListNode node; + }; + static_assert(offsetof(Node, item) == 0, "item must be at offset 0 in Node"); + + ListNode* objToListNode(T* obj) const + { + return static_cast(PtrUtil::addOffset(obj, Node::getListNodeOffset())); + } + + const ListNode* objToListNode(const T* obj) const + { + return static_cast(PtrUtil::addOffset(obj, Node::getListNodeOffset())); + } + + T* listNodeToObj(ListNode* node) const + { + return static_cast(PtrUtil::addOffset(node, -Node::getListNodeOffset())); + } + + const T* listNodeToObj(const ListNode* node) const + { + return static_cast(PtrUtil::addOffset(node, -Node::getListNodeOffset())); + } + + T* listNodeToObjWithNullCheck(ListNode* node) const + { + return node ? listNodeToObj(node) : nullptr; + } + + const T* listNodeToObjWithNullCheck(const ListNode* node) const + { + return node ? listNodeToObj(node) : nullptr; + } + + static constexpr size_t ElementSize = std::max(sizeof(Node), FreeList::cPtrSize); + + sead::FreeList mFreeList; + s32 mMaxNum = 0; +}; + +template +class FixedObjList : public ObjList +{ +public: + FixedObjList() : ObjList(N, &mWork) {} + + // These do not make sense for a *fixed* array. + void setBuffer(s32 ptrNumMax, void* buf) = delete; + void allocBuffer(s32 ptrNumMax, Heap* heap, s32 alignment = sizeof(void*)) = delete; + bool tryAllocBuffer(s32 ptrNumMax, Heap* heap, s32 alignment = sizeof(void*)) = delete; + void freeBuffer() = delete; + +private: + std::aligned_storage_t::calculateWorkBufferSize(N), + std::max(alignof(T), alignof(T*))> + mWork; +}; + +} // namespace sead diff --git a/include/sead/container/seadOffsetList.h b/include/sead/container/seadOffsetList.h new file mode 100644 index 0000000..76ec2cb --- /dev/null +++ b/include/sead/container/seadOffsetList.h @@ -0,0 +1,219 @@ +#ifndef SEAD_OFFSET_LIST_H_ +#define SEAD_OFFSET_LIST_H_ + +#include +#include +#include +#include + +namespace sead +{ +template +class OffsetList : public ListImpl +{ +public: + OffsetList() = default; + + void initOffset(s32 offset) { mOffset = offset; } + + void clear() { ListImpl::clear(); } + + void pushBack(T* item) + { + SEAD_ASSERT(mOffset >= 0); + ListImpl::pushBack(objToListNode(item)); + } + + void pushFront(T* item) + { + SEAD_ASSERT(mOffset >= 0); + ListImpl::pushFront(objToListNode(item)); + } + + T* popBack() { return listNodeToObjWithNullCheck(ListImpl::popBack()); } + + T* popFront() { return listNodeToObjWithNullCheck(ListImpl::popFront()); } + + void insertBefore(const T* obj, T* obj_to_insert) + { + ListImpl::insertBefore(const_cast(objToListNode(obj)), + objToListNode(obj_to_insert)); + } + void insertAfter(const T* obj, T* obj_to_insert) + { + ListImpl::insertAfter(const_cast(objToListNode(obj)), + objToListNode(obj_to_insert)); + } + + void erase(T* item) { ListImpl::erase(objToListNode(item)); } + + T* front() const { return listNodeToObjWithNullCheck(ListImpl::front()); } + + T* back() const { return listNodeToObjWithNullCheck(ListImpl::back()); } + + T* prev(const T* obj) const + { + ListNode* prev_node = objToListNode(obj)->prev(); + if (prev_node == &mStartEnd) + return nullptr; + return listNodeToObj(prev_node); + } + + T* next(const T* obj) const + { + ListNode* next_node = objToListNode(obj)->next(); + if (next_node == &mStartEnd) + return nullptr; + return listNodeToObj(next_node); + } + + T* nth(s32 n) const { return listNodeToObjWithNullCheck(ListImpl::nth(n)); } + + s32 indexOf(const T* obj) const { return ListImpl::indexOf(objToListNode(obj)); } + + bool isNodeLinked(const T* obj) const { return objToListNode(obj)->isLinked(); } + + void swap(T* obj1, T* obj2) { ListImpl::swap(objToListNode(obj1), objToListNode(obj2)); } + void moveAfter(T* basis, T* obj) + { + ListImpl::moveAfter(objToListNode(basis), objToListNode(obj)); + } + void moveBefore(T* basis, T* obj) + { + ListImpl::moveBefore(objToListNode(basis), objToListNode(obj)); + } + + using CompareCallback = int (*)(const T*, const T*); + + void sort() { sort(compareT); } + void sort(CompareCallback cmp) { ListImpl::sort(mOffset, cmp); } + void mergeSort() { mergeSort(compareT); } + void mergeSort(CompareCallback cmp) { ListImpl::mergeSort(mOffset, cmp); } + + T* find(const T* obj) const { return find(obj, compareT); } + T* find(const T* obj, CompareCallback cmp) const + { + return listNodeToObj(ListImpl::find(obj, mOffset, cmp)); + } + + void uniq() { uniq(compareT); } + void uniq(CompareCallback cmp) { ListImpl::uniq(mOffset, cmp); } + + class iterator + { + public: + iterator(T* ptr, s32 offset) : mPtr{ptr}, mOffset{offset} {} + bool operator==(const iterator& other) const { return mPtr == other.mPtr; } + bool operator!=(const iterator& other) const { return !(*this == other); } + iterator& operator++() + { + ListNode* node = static_cast(PtrUtil::addOffset(mPtr, mOffset))->next(); + mPtr = static_cast(PtrUtil::addOffset(node, -mOffset)); + return *this; + } + T& operator*() const { return *mPtr; } + T* operator->() const { return mPtr; } + + private: + T* mPtr; + s32 mOffset; + }; + + iterator begin() const { return iterator(listNodeToObj(mStartEnd.next()), mOffset); } + iterator end() const + { + return iterator(listNodeToObj(const_cast(&mStartEnd)), mOffset); + } + iterator begin(T* ptr) const { return iterator(ptr, mOffset); } + + class robustIterator + { + public: + robustIterator(T* ptr, s32 offset) + : mPtr{ptr}, mNextNode(static_cast(PtrUtil::addOffset(ptr, offset))->next()), + mOffset{offset} + { + } + bool operator==(const robustIterator& other) const { return mPtr == other.mPtr; } + bool operator!=(const robustIterator& other) const { return !operator==(other); } + robustIterator& operator++() + { + mPtr = static_cast(PtrUtil::addOffset(mNextNode, -mOffset)); + mNextNode = mNextNode->next(); + return *this; + } + T& operator*() const { return *mPtr; } + T* operator->() const { return mPtr; } + + private: + T* mPtr; + ListNode* mNextNode; + s32 mOffset; + }; + + robustIterator robustBegin() const + { + return robustIterator(listNodeToObj(mStartEnd.next()), mOffset); + } + + robustIterator robustEnd() const + { + return robustIterator(listNodeToObj(const_cast(&mStartEnd)), mOffset); + } + + robustIterator robustBegin(T* ptr) const { return robustIterator(ptr, mOffset); } + + struct RobustRange + { + auto begin() const { return mList.robustBegin(); } + auto end() const { return mList.robustEnd(); } + const OffsetList& mList; + }; + RobustRange robustRange() const { return {*this}; } + +protected: + static int compareT(const T* lhs, const T* rhs) + { + if (lhs < rhs) + return -1; + if (lhs > rhs) + return 1; + return 0; + } + + ListNode* objToListNode(T* obj) const + { + return static_cast(PtrUtil::addOffset(obj, mOffset)); + } + + const ListNode* objToListNode(const T* obj) const + { + return static_cast(PtrUtil::addOffset(obj, mOffset)); + } + + T* listNodeToObj(ListNode* node) const + { + return static_cast(PtrUtil::addOffset(node, -mOffset)); + } + + const T* listNodeToObj(const ListNode* node) const + { + return static_cast(PtrUtil::addOffset(node, -mOffset)); + } + + T* listNodeToObjWithNullCheck(ListNode* node) const + { + return node ? listNodeToObj(node) : nullptr; + } + + const T* listNodeToObjWithNullCheck(const ListNode* node) const + { + return node ? listNodeToObj(node) : nullptr; + } + + s32 mOffset = -1; +}; + +} // namespace sead + +#endif // SEAD_OFFSET_LIST_H_ diff --git a/include/sead/container/seadOrderedSet.h b/include/sead/container/seadOrderedSet.h new file mode 100644 index 0000000..7093648 --- /dev/null +++ b/include/sead/container/seadOrderedSet.h @@ -0,0 +1,189 @@ +#pragma once + +#include "container/seadTreeMap.h" + +namespace sead +{ +/// Requires Value to have operator< defined +/// This can be specialized, but all specializations must define `compare` as follows. +template +struct OrderedSetItemImpl +{ + OrderedSetItemImpl() = default; + // NOLINTNEXTLINE(google-explicit-constructor) + OrderedSetItemImpl(const Value& value_) : value(value_) {} + OrderedSetItemImpl& operator=(const Value& value_) + { + value = value_; + return *this; + } + + /// Returns -1 if this->value < rhs, 0 if this->value = rhs and 1 if this->value > rhs. + s32 compare(const OrderedSetItemImpl& rhs) const + { + if (value < rhs.value) + return -1; + if (rhs.value < value) + return 1; + return 0; + } + + Value value; +}; + +/// This is essentially std::set. Values are stored in a red-black tree in an order +/// determined by the partial order defined for Value (via operator<). +template +class OrderedSet : public TreeMapImpl> +{ +public: + using MapImpl = TreeMapImpl>; + class Node : public MapImpl::Node + { + public: + Node(OrderedSet* set, const Value& value) : mSet(set) { this->mKey = value; } + + void erase_() override; + + // Values cannot be modified. + const Value& value() const { return this->key().value; } + + private: + friend class OrderedSet; + OrderedSet* mSet; + }; + + /// Clears the set and frees the allocated buffer (if needed). + /// Should only be used if the buffer was allocated using allocBuffer. + void finalize() + { + clear(); + freeBuffer(); + } + + bool allocBuffer(s32 node_max, Heap* heap, s32 alignment = sizeof(void*)); + void setBuffer(s32 node_max, void* buffer); + /// Should only be used if the buffer was allocated using allocBuffer. + void freeBuffer(); + + const Value* insert(const Value& value); + void clear(); + + Node* find(const Value& value) const; + + // Callable must have the signature Value& + template + void forEach(const Callable& delegate) const; + + Node* startIterating() const { return static_cast(MapImpl::startIterating()); } + Node* nextNode(Node* node) const { return static_cast(MapImpl::nextNode(node)); } + +private: + void eraseNodeForClear_(typename MapImpl::Node* node); + + FreeList mFreeList; + s32 mSize = 0; + s32 mCapacity = 0; +}; + +template +inline bool OrderedSet::allocBuffer(s32 node_max, Heap* heap, s32 alignment) +{ + SEAD_ASSERT(mFreeList.work() == nullptr); + if (node_max <= 0) + { + SEAD_ASSERT_MSG(false, "node_max[%d] must be larger than zero", node_max); + AllocFailAssert(heap, node_max * sizeof(Node), alignment); + } + + void* work = AllocBuffer(node_max * sizeof(Node), heap, alignment); + if (!work) + return false; + setBuffer(node_max, work); + return true; +} + +template +inline void OrderedSet::setBuffer(s32 node_max, void* buffer) +{ + mCapacity = node_max; + mFreeList.setWork(buffer, sizeof(Node), node_max); +} + +template +inline void OrderedSet::freeBuffer() +{ + void* buffer = mFreeList.work(); + if (!buffer) + return; + + mSize = 0; + MapImpl::clear(); + ::operator delete[](buffer); + mCapacity = 0; + mFreeList.reset(); +} + +template +inline const Value* OrderedSet::insert(const Value& value) +{ + if (mSize >= mCapacity) + { + if (Node* node = find(value)) + { + node->mKey = value; + return &node->value(); + } + SEAD_ASSERT_MSG(false, "map is full."); + return nullptr; + } + + Node* node = new (mFreeList.alloc()) Node(this, value); + ++mSize; + MapImpl::insert(node); + return &node->value(); +} + +template +inline void OrderedSet::clear() +{ + Delegate1, typename MapImpl::Node*> delegate(this, + &OrderedSet::eraseNodeForClear_); + MapImpl::forEach(delegate); + mSize = 0; + MapImpl::clear(); +} + +template +inline typename OrderedSet::Node* OrderedSet::find(const Value& value) const +{ + return static_cast(MapImpl::find(value)); +} + +template +template +inline void OrderedSet::forEach(const Callable& delegate) const +{ + MapImpl::forEach([&delegate](auto* base_node) { + auto* node = static_cast(base_node); + delegate(node->value()); + }); +} + +template +inline void OrderedSet::eraseNodeForClear_(typename MapImpl::Node* node) +{ + // Note: Nintendo does not call the destructor, which is dangerous... + mFreeList.free(node); +} + +template +inline void OrderedSet::Node::erase_() +{ + OrderedSet* const map = mSet; + void* const this_ = this; + // Note: Nintendo does not call the destructor, which is dangerous... + map->mFreeList.free(this_); + --map->mSize; +} +} // namespace sead diff --git a/include/sead/container/seadPtrArray.h b/include/sead/container/seadPtrArray.h new file mode 100644 index 0000000..f597dfe --- /dev/null +++ b/include/sead/container/seadPtrArray.h @@ -0,0 +1,377 @@ +#ifndef SEAD_PTR_ARRAY_H_ +#define SEAD_PTR_ARRAY_H_ + +#include +#include +#include +#include +#include + +namespace sead +{ +class Heap; +class Random; + +class PtrArrayImpl +{ +public: + PtrArrayImpl() = default; + PtrArrayImpl(s32 ptrNumMax, void* buf) { setBuffer(ptrNumMax, buf); } + + void setBuffer(s32 ptrNumMax, void* buf); + void allocBuffer(s32 ptrNumMax, Heap* heap, s32 alignment = sizeof(void*)); + bool tryAllocBuffer(s32 ptrNumMax, Heap* heap, s32 alignment = sizeof(void*)); + void freeBuffer(); + bool isBufferReady() const { return mPtrs != nullptr; } + + bool isEmpty() const { return mPtrNum == 0; } + bool isFull() const { return mPtrNum >= mPtrNumMax; } + + s32 size() const { return mPtrNum; } + s32 capacity() const { return mPtrNumMax; } + + void erase(s32 position) { erase(position, 1); } + void erase(s32 position, s32 count); + void clear() { mPtrNum = 0; } + + // TODO + void resize(s32 size); + // TODO + void unsafeResize(s32 size); + + void swap(s32 pos1, s32 pos2) + { + auto* ptr = mPtrs[pos1]; + mPtrs[pos1] = mPtrs[pos2]; + mPtrs[pos2] = ptr; + } + void reverse(); + void shuffle() + { + Random random; + shuffle(&random); + } + void shuffle(Random* random); + +protected: + using CompareCallbackImpl = int (*)(const void* a, const void* b); + + void* at(s32 idx) const + { + if (u32(mPtrNum) <= u32(idx)) + { + SEAD_ASSERT_MSG(false, "index exceeded [%d/%d]", idx, mPtrNum); + return nullptr; + } + return mPtrs[idx]; + } + + void* unsafeAt(s32 idx) const { return mPtrs[idx]; } + + // XXX: should this use at()? + void* front() const { return mPtrs[0]; } + void* back() const { return mPtrs[mPtrNum - 1]; } + + void pushBack(void* ptr) + { + if (isFull()) + { + SEAD_ASSERT_MSG(false, "list is full."); + return; + } + // Simplest insert case, so this is implemented directly without using insert(). + mPtrs[mPtrNum] = ptr; + ++mPtrNum; + } + + void pushFront(void* ptr) { insert(0, ptr); } + + void* popBack() { return isEmpty() ? nullptr : mPtrs[--mPtrNum]; } + + void* popFront() + { + if (isEmpty()) + return nullptr; + + void* result = mPtrs[0]; + erase(0); + return result; + } + + void replace(s32 idx, void* ptr) { mPtrs[idx] = ptr; } + + void* find(const void* ptr, CompareCallbackImpl cmp) const + { + for (s32 i = 0; i < mPtrNum; ++i) + { + if (cmp(mPtrs[i], ptr) == 0) + return mPtrs[i]; + } + return nullptr; + } + + s32 search(const void* ptr, CompareCallbackImpl cmp) const + { + for (s32 i = 0; i < mPtrNum; ++i) + { + if (cmp(mPtrs[i], ptr) == 0) + return i; + } + return -1; + } + + bool equal(const PtrArrayImpl& other, CompareCallbackImpl cmp) const + { + if (mPtrNum != other.mPtrNum) + return false; + + for (s32 i = 0; i < mPtrNum; ++i) + { + if (cmp(mPtrs[i], other.mPtrs[i]) != 0) + return false; + } + return true; + } + + s32 indexOf(const void* ptr) const + { + for (s32 i = 0; i < mPtrNum; ++i) + { + if (mPtrs[i] == ptr) + return i; + } + return -1; + } + + void createVacancy(s32 pos, s32 count) + { + if (mPtrNum <= pos) + return; + + MemUtil::copyOverlap(mPtrs + pos + count, mPtrs + pos, + s32(sizeof(void*)) * (mPtrNum - pos)); + } + + void insert(s32 idx, void* ptr); + void insertArray(s32 idx, void* array, s32 array_length, s32 elem_size); + bool checkInsert(s32 idx, s32 num); + + template + void sort_(Compare cmp) + { + // Note: Nintendo did not use + std::sort(mPtrs, mPtrs + size(), [&](const void* a, const void* b) { + return cmp(static_cast(a), static_cast(b)) < 0; + }); + } + + template + void heapSort_(Compare cmp) + { + // Note: Nintendo did not use + const auto less_cmp = [&](const void* a, const void* b) { + return cmp(static_cast(a), static_cast(b)) < 0; + }; + std::make_heap(mPtrs, mPtrs + size(), less_cmp); + std::sort_heap(mPtrs, mPtrs + size(), less_cmp); + } + + void heapSort(CompareCallbackImpl cmp); + + s32 compare(const PtrArrayImpl& other, CompareCallbackImpl cmp) const; + void uniq(CompareCallbackImpl cmp); + + s32 binarySearch(const void* ptr, CompareCallbackImpl cmp) const + { + if (mPtrNum == 0) + return -1; + + s32 a = 0; + s32 b = mPtrNum - 1; + while (a < b) + { + const s32 m = (a + b) / 2; + const s32 c = cmp(mPtrs[m], ptr); + if (c == 0) + return m; + if (c < 0) + a = m + 1; + else + b = m; + } + + if (cmp(mPtrs[a], ptr) == 0) + return a; + + return -1; + } + + s32 mPtrNum = 0; + s32 mPtrNumMax = 0; + void** mPtrs = nullptr; +}; + +template +class PtrArray : public PtrArrayImpl +{ +public: + PtrArray() = default; + PtrArray(s32 ptrNumMax, T** buf) : PtrArrayImpl(ptrNumMax, buf) {} + + T* at(s32 pos) const { return static_cast(PtrArrayImpl::at(pos)); } + T* unsafeAt(s32 pos) const { return static_cast(PtrArrayImpl::unsafeAt(pos)); } + T* operator()(s32 pos) const { return unsafeAt(pos); } + T* operator[](s32 pos) const { return at(pos); } + + // XXX: Does this use at()? + T* front() const { return at(0); } + T* back() const { return at(mPtrNum - 1); } + + void pushBack(T* ptr) { PtrArrayImpl::pushBack(constCast(ptr)); } + void pushFront(T* ptr) { PtrArrayImpl::pushFront(constCast(ptr)); } + + T* popBack() { return static_cast(PtrArrayImpl::popBack()); } + T* popFront() { return static_cast(PtrArrayImpl::popFront()); } + + void insert(s32 pos, T* ptr) { PtrArrayImpl::insert(pos, constCast(ptr)); } + void insert(s32 pos, T* array, s32 count) + { + // XXX: is this right? + PtrArrayImpl::insertArray(pos, constCast(array), count, sizeof(T)); + } + void replace(s32 pos, T* ptr) { PtrArrayImpl::replace(pos, constCast(ptr)); } + + s32 indexOf(const T* ptr) const { return PtrArrayImpl::indexOf(ptr); } + + using CompareCallback = s32 (*)(const T*, const T*); + + void sort() { sort(compareT); } + void sort(CompareCallback cmp) { PtrArrayImpl::sort_(cmp); } + void heapSort() { heapSort(compareT); } + void heapSort(CompareCallback cmp) { PtrArrayImpl::heapSort_(cmp); } + + bool equal(const PtrArray& other, CompareCallback cmp) const + { + return PtrArrayImpl::equal(other, cmp); + } + + s32 compare(const PtrArray& other, CompareCallback cmp) const + { + return PtrArrayImpl::compare(other, cmp); + } + + T* find(const T* ptr) const + { + return PtrArrayImpl::find(ptr, + [](const void* a, const void* b) { return a == b ? 0 : -1; }); + } + T* find(const T* ptr, CompareCallback cmp) const { return PtrArrayImpl::find(ptr, cmp); } + s32 search(const T* ptr) const + { + return PtrArrayImpl::search(ptr, + [](const void* a, const void* b) { return a == b ? 0 : -1; }); + } + s32 search(const T* ptr, CompareCallback cmp) const { return PtrArrayImpl::search(ptr, cmp); } + s32 binarySearch(const T* ptr) const { return PtrArrayImpl::binarySearch(ptr, compareT); } + s32 binarySearch(const T* ptr, CompareCallback cmp) const + { + return PtrArrayImpl::binarySearch(ptr, cmp); + } + + bool operator==(const PtrArray& other) const { return equal(other, compareT); } + bool operator!=(const PtrArray& other) const { return !(*this == other); } + bool operator<(const PtrArray& other) const { return compare(other) < 0; } + bool operator<=(const PtrArray& other) const { return compare(other) <= 0; } + bool operator>(const PtrArray& other) const { return compare(other) > 0; } + bool operator>=(const PtrArray& other) const { return compare(other) >= 0; } + + void uniq() { PtrArrayImpl::uniq(compareT); } + void uniq(CompareCallback cmp) { PtrArrayImpl::uniq(cmp); } + + class iterator + { + public: + iterator(T* const* pptr) : mPPtr{pptr} {} + bool operator==(const iterator& other) const { return mPPtr == other.mPPtr; } + bool operator!=(const iterator& other) const { return !(*this == other); } + iterator& operator++() + { + ++mPPtr; + return *this; + } + T& operator*() const { return **mPPtr; } + T* operator->() const { return *mPPtr; } + + private: + T* const* mPPtr; + }; + + iterator begin() const { return iterator(data()); } + iterator end() const { return iterator(data() + mPtrNum); } + + class constIterator + { + public: + constIterator(const T* const* pptr) : mPPtr{pptr} {} + bool operator==(const constIterator& other) const { return mPPtr == other.mPPtr; } + bool operator!=(const constIterator& other) const { return !(*this == other); } + constIterator& operator++() + { + ++mPPtr; + return *this; + } + const T& operator*() const { return **mPPtr; } + const T* operator->() const { return *mPPtr; } + + private: + const T* const* mPPtr; + }; + + constIterator constBegin() const { return constIterator(data()); } + constIterator constEnd() const { return constIterator(data() + mPtrNum); } + + T** data() const { return reinterpret_cast(mPtrs); } + T** dataBegin() const { return data(); } + T** dataEnd() const { return data() + mPtrNum; } + +protected: + static void* constCast(const T* ptr) + { + // Unfortunately, we need to cast away const because several PtrArrayImpl functions + // only take void* even though the pointed-to object isn't actually modified. + return static_cast(const_cast*>(ptr)); + } + + static int compareT(const void* a_, const void* b_) + { + const T* a = static_cast(a_); + const T* b = static_cast(b_); + if (*a < *b) + return -1; + if (*b < *a) + return 1; + return 0; + } +}; + +template +class FixedPtrArray : public PtrArray +{ +public: + FixedPtrArray() : PtrArray(N, mWork) {} + + // These do not make sense for a *fixed* array. + void setBuffer(s32 ptrNumMax, void* buf) = delete; + void allocBuffer(s32 ptrNumMax, Heap* heap, s32 alignment = sizeof(void*)) = delete; + bool tryAllocBuffer(s32 ptrNumMax, Heap* heap, s32 alignment = sizeof(void*)) = delete; + void freeBuffer() = delete; + +private: + // Nintendo uses an untyped u8[N*sizeof(void*)] buffer. That is undefined behavior, + // so we will not do that. + T* mWork[N]; +}; + +} // namespace sead + +#endif // SEAD_PTR_ARRAY_H_ diff --git a/include/sead/container/seadRingBuffer.h b/include/sead/container/seadRingBuffer.h new file mode 100644 index 0000000..ff9c08f --- /dev/null +++ b/include/sead/container/seadRingBuffer.h @@ -0,0 +1,337 @@ +#pragma once + +#include +#include + +#include +#include +#include +#include +#include + +namespace sead +{ +class Heap; + +template +class RingBuffer +{ +public: + RingBuffer() = default; + RingBuffer(s32 capacity, T* buffer) { setBuffer(capacity, buffer); } + template + explicit RingBuffer(T (&array)[N]) : RingBuffer(N, array) + { + } + + class iterator + { + public: + explicit iterator(RingBuffer* buffer, s32 index = 0) : mIndex(index), mBuffer(buffer) {} + bool operator==(const iterator& rhs) const + { + return mIndex == rhs.mIndex && mBuffer == rhs.mBuffer; + } + bool operator!=(const iterator& rhs) const { return !operator==(rhs); } + iterator& operator++() + { + ++mIndex; + return *this; + } + T& operator*() const { return buffer()(mIndex); } + T* operator->() const { return &buffer()(mIndex); } + s32 getIndex() const { return mIndex; } + + private: + RingBuffer& buffer() const { return *mBuffer; } + + s32 mIndex; + RingBuffer* mBuffer; + }; + + class constIterator + { + public: + explicit constIterator(const RingBuffer* buffer, s32 index = 0) + : mIndex(index), mBuffer(buffer) + { + } + bool operator==(const constIterator& rhs) const + { + return mIndex == rhs.mIndex && mBuffer == rhs.mBuffer; + } + bool operator!=(const constIterator& rhs) const { return !operator==(rhs); } + constIterator& operator++() + { + ++mIndex; + return *this; + } + const T& operator*() const { return buffer()(mIndex); } + const T* operator->() const { return &buffer()(mIndex); } + s32 getIndex() const { return mIndex; } + + private: + const RingBuffer& buffer() const { return *mBuffer; } + + s32 mIndex; + const RingBuffer* mBuffer; + }; + + iterator begin() { return iterator(this); } + constIterator begin() const { return constIterator(this); } + iterator begin(s32 start_idx) { return iterator(this, wrapIndex(start_idx)); } + constIterator begin(s32 start_idx) const { return constIterator(this, wrapIndex(start_idx)); } + iterator end() { return iterator(this, mSize); } + constIterator end() const { return constIterator(this, mSize); } + + void allocBuffer(s32 capacity, s32 alignment) { void(tryAllocBuffer(capacity, alignment)); } + + void allocBuffer(s32 capacity, Heap* heap, s32 alignment = sizeof(void*)) + { + static_cast(tryAllocBuffer(capacity, heap, alignment)); + } + + bool tryAllocBuffer(s32 capacity, s32 alignment = sizeof(void*)) + { + SEAD_ASSERT(mBuffer == nullptr); + if (capacity > 0) + { + T* buffer = new (alignment, std::nothrow) T[capacity]; + if (buffer) + { + mBuffer = buffer; + mHead = mSize = 0; + mCapacity = capacity; + SEAD_ASSERT_MSG(PtrUtil::isAlignedPow2(mBuffer, sead::Mathi::abs(alignment)), + "don't set alignment for a class with destructor"); + return true; + } + return false; + } + SEAD_ASSERT_MSG(false, "numMax[%d] must be larger than zero", capacity); + return false; + } + + bool tryAllocBuffer(s32 capacity, Heap* heap, s32 alignment = sizeof(void*)) + { + SEAD_ASSERT(mBuffer == nullptr); + if (capacity > 0) + { + T* buffer = new (heap, alignment, std::nothrow) T[capacity]; + if (buffer) + { + mBuffer = buffer; + mHead = mSize = 0; + mCapacity = capacity; + SEAD_ASSERT_MSG(PtrUtil::isAlignedPow2(mBuffer, sead::Mathi::abs(alignment)), + "don't set alignment for a class with destructor"); + return true; + } + return false; + } + SEAD_ASSERT_MSG(false, "numMax[%d] must be larger than zero", capacity); + return false; + } + + void allocBufferAssert(s32 size, Heap* heap, s32 alignment = sizeof(void*)) + { + if (!tryAllocBuffer(size, heap, alignment)) + AllocFailAssert(heap, sizeof(T) * size, alignment); + } + + void freeBuffer() + { + if (mBuffer) + { + delete[] mBuffer; + mBuffer = nullptr; + mCapacity = 0; + mHead = 0; + mSize = 0; + } + } + + void setBuffer(s32 capacity, T* bufferptr) + { + if (capacity < 1) + { + SEAD_ASSERT_MSG(false, "numMax[%d] must be larger than zero", capacity); + return; + } + if (!bufferptr) + { + SEAD_ASSERT_MSG(false, "bufferptr is null"); + return; + } + mBuffer = bufferptr; + mHead = mSize = 0; + mCapacity = capacity; + } + + bool isBufferReady() const { return mBuffer != nullptr; } + + T& operator[](s32 idx) + { + if (u32(mSize) <= u32(idx)) + { + SEAD_ASSERT_MSG(false, "index exceeded [%d/%d/%d]", idx, mSize, mCapacity); + return mBuffer[0]; + } + return *unsafeGet(idx); + } + + const T& operator[](s32 idx) const + { + if (u32(mSize) <= u32(idx)) + { + SEAD_ASSERT_MSG(false, "index exceeded [%d/%d/%d]", idx, mSize, mCapacity); + return mBuffer[0]; + } + return *unsafeGet(idx); + } + + T* get(s32 idx) + { + if (u32(mSize) <= u32(idx)) + { + SEAD_ASSERT_MSG(false, "index exceeded [%d/%d/%d]", idx, mSize, mCapacity); + return nullptr; + } + return unsafeGet(idx); + } + + const T* get(s32 idx) const + { + if (u32(mSize) <= u32(idx)) + { + SEAD_ASSERT_MSG(false, "index exceeded [%d/%d/%d]", idx, mSize, mCapacity); + return nullptr; + } + + return unsafeGet(idx); + } + + T& operator()(s32 idx) { return *unsafeGet(idx); } + const T& operator()(s32 idx) const { return *unsafeGet(idx); } + + T* unsafeGet(s32 idx) { return &mBuffer[calcRealIdx(idx)]; } + const T* unsafeGet(s32 idx) const { return &mBuffer[calcRealIdx(idx)]; } + + T& front() { return *unsafeGet(0); } + const T& front() const { return *unsafeGet(0); } + + T& back() + { + if (mSize < 1) + { + SEAD_ASSERT_MSG(false, "no element"); + return mBuffer[0]; + } + return *unsafeGet(mSize - 1); + } + + const T& back() const + { + if (mSize < 1) + { + SEAD_ASSERT_MSG(false, "no element"); + return mBuffer[0]; + } + return *unsafeGet(mSize - 1); + } + + s32 capacity() const { return mCapacity; } + s32 size() const { return mSize; } + + bool empty() const { return mSize == 0; } + explicit operator bool() const { return !empty(); } + + T* data() { return mBuffer; } + const T* data() const { return mBuffer; } + + void forcePushBack(const T& item) + { + if (mSize < mCapacity) + { + pushBack(item); + return; + } + + if (mSize >= 1) + popFront(); + pushBack(item); + } + + bool pushBack(const T& item) + { + if (mSize >= mCapacity) + return false; + *unsafeGet(mSize++) = item; + return true; + } + + void forcePushBackwards(const T& item, u32 offset = 1) + { + mHead = (mHead < 1 ? mCapacity : mHead) - offset; + ++mSize; + *unsafeGet(0) = item; + } + + bool pushBackwards(const T& item) + { + if (mSize >= mCapacity) + return false; + forcePushBackwards(item); + return true; + } + + T popFront() + { + if (mSize >= 1) + { + T item = *unsafeGet(0); + mHead = mHead + 1 < mCapacity ? mHead + 1 : 0; + --mSize; + return item; + } + SEAD_ASSERT_MSG(false, "no element"); + return {}; + } + + void clear() { mHead = mSize = 0; } + +protected: + s32 calcRealIdx(s32 idx) const + { + s32 real_idx = mHead + idx; + if (real_idx >= mCapacity) + real_idx -= mCapacity; + return real_idx; + } + + s32 wrapIndex(s32 idx) const { return u32(idx) > u32(mSize) ? 0 : idx; } + + T* mBuffer = nullptr; + s32 mCapacity = 0; + s32 mHead = 0; + s32 mSize = 0; +}; + +template +class FixedRingBuffer : public RingBuffer +{ +public: + FixedRingBuffer() { RingBuffer::setBuffer(N, mData); } + + void allocBuffer(s32 capacity, s32 alignment) = delete; + void allocBuffer(s32 capacity, Heap* heap, s32 alignment) = delete; + bool tryAllocBuffer(s32 capacity, s32 alignment) = delete; + bool tryAllocBuffer(s32 capacity, Heap* heap, s32 alignment) = delete; + void allocBufferAssert(s32 size, Heap* heap, s32 alignment) = delete; + void freeBuffer() = delete; + void setBuffer(s32 capacity, T* bufferptr) = delete; + +private: + T mData[N]; +}; +} // namespace sead diff --git a/include/sead/container/seadSafeArray.h b/include/sead/container/seadSafeArray.h new file mode 100644 index 0000000..2de1d8e --- /dev/null +++ b/include/sead/container/seadSafeArray.h @@ -0,0 +1,158 @@ +#pragma once + +#include +#include +#include +#include + +namespace sead +{ +/// A lightweight std::array like wrapper for a C style array. +template +class SafeArray +{ +public: + T mBuffer[N]; + + T& operator[](s32 idx) + { + if (u32(idx) < N) + return mBuffer[idx]; +#ifdef MATCHING_HACK_NX_CLANG + // Force __LINE__ to be an odd number that cannot be encoded as an immediate for ORR. + // Otherwise, LLVM's register coalescer can get rid of too many register copies, + // which messes up register allocation. +#line 44 +#endif + SEAD_ASSERT_MSG(false, "range over [0, %d) : %d", N, idx); + return mBuffer[0]; + } + + const T& operator[](s32 idx) const + { + if (u32(idx) < N) + return mBuffer[idx]; +#ifdef MATCHING_HACK_NX_CLANG + // Force __LINE__ to be an even number that can be encoded as an immediate for ORR. + // Otherwise, LLVM's register coalescer can fail to get rid of some register copies, + // which messes up register allocation. +#line 59 +#endif + SEAD_ASSERT_MSG(false, "range over [0, %d) : %d", N, idx); + return mBuffer[0]; + } + + T& operator()(s32 idx) { return mBuffer[idx]; } + const T& operator()(s32 idx) const { return mBuffer[idx]; } + + T& front() { return mBuffer[0]; } + const T& front() const { return mBuffer[0]; } + T& back() { return mBuffer[N - 1]; } + const T& back() const { return mBuffer[N - 1]; } + + int size() const { return N; } + u32 getByteSize() const { return N * sizeof(T); } + + T* getBufferPtr() { return mBuffer; } + const T* getBufferPtr() const { return mBuffer; } + + void fill(const T& value) + { + for (s32 i = 0; i < N; ++i) + mBuffer[i] = value; + } + + class iterator + { + public: + iterator(T* buffer, s32 idx) : mBuffer(buffer), mIdx(idx) {} + bool operator==(const iterator& rhs) const + { + return mBuffer == rhs.mBuffer && mIdx == rhs.mIdx; + } + bool operator!=(const iterator& rhs) const { return !(*this == rhs); } + iterator& operator++() + { + ++mIdx; + return *this; + } + iterator& operator--() + { + --mIdx; + return *this; + } + T* operator->() const { return &mBuffer[mIdx]; } + T& operator*() const { return mBuffer[mIdx]; } + + private: + T* mBuffer; + s32 mIdx; + }; + + iterator begin() { return iterator(mBuffer, 0); } + iterator end() { return iterator(mBuffer, N); } + + class constIterator + { + public: + constIterator(const T* buffer, s32 idx) : mBuffer(buffer), mIdx(idx) {} + bool operator==(const constIterator& rhs) const + { + return mBuffer == rhs.mBuffer && mIdx == rhs.mIdx; + } + bool operator!=(const constIterator& rhs) const { return !(*this == rhs); } + constIterator& operator++() + { + ++mIdx; + return *this; + } + constIterator& operator--() + { + --mIdx; + return *this; + } + const T* operator->() const { return &mBuffer[mIdx]; } + const T& operator*() const { return mBuffer[mIdx]; } + + private: + const T* mBuffer; + s32 mIdx; + }; + + constIterator constBegin() const { return constIterator(mBuffer, 0); } + constIterator constEnd() const { return constIterator(mBuffer, N); } + + constIterator begin() const { return constIterator(mBuffer, 0); } + constIterator end() const { return constIterator(mBuffer, N); } +}; + +namespace detail +{ +// From https://en.cppreference.com/w/cpp/container/array/to_array +template +constexpr SafeArray, N> to_array_impl(T (&a)[N], std::index_sequence) +{ + return {{a[I]...}}; +} + +template +constexpr SafeArray, N> to_array_impl(T(&&a)[N], std::index_sequence) +{ + return {{std::move(a[I])...}}; +} +} // namespace detail + +// Implementation of C++20 std::to_array for sead::SafeArray. +template +constexpr sead::SafeArray, N> toArray(T (&a)[N]) +{ + return detail::to_array_impl(a, std::make_index_sequence{}); +} + +// Implementation of C++20 std::to_array for sead::SafeArray. +template +constexpr sead::SafeArray, N> toArray(T(&&a)[N]) +{ + return detail::to_array_impl(std::move(a), std::make_index_sequence{}); +} +} // namespace sead diff --git a/include/sead/container/seadStrTreeMap.h b/include/sead/container/seadStrTreeMap.h new file mode 100644 index 0000000..e74ac80 --- /dev/null +++ b/include/sead/container/seadStrTreeMap.h @@ -0,0 +1,171 @@ +#pragma once + +#include "basis/seadTypes.h" +#include "container/seadFreeList.h" +#include "container/seadTreeMap.h" +#include "prim/seadDelegate.h" +#include "prim/seadSafeString.h" + +namespace sead +{ +/// Sorted associative container with fixed-length string keys. +/// This is essentially std::map +template +class StrTreeMap : public TreeMapImpl +{ +public: + using MapImpl = TreeMapImpl; + class Node : public MapImpl::Node + { + public: + Node(StrTreeMap* map, const SafeString& key, const Value& value) : mValue(value), mMap(map) + { + BufferedSafeString buffer(mKeyData, MaxKeyLength + 1); + buffer.copy(key); + this->mKey = buffer; + } + + void erase_() override; + + Value& value() { return mValue; } + const Value& value() const { return mValue; } + + private: + friend class StrTreeMap; + + Value mValue; + StrTreeMap* mMap; + char mKeyData[MaxKeyLength + 1]; + }; + + ~StrTreeMap(); + + void allocBuffer(s32 node_max, Heap* heap, s32 alignment = sizeof(void*)); + void setBuffer(s32 node_max, void* buffer); + void freeBuffer(); + + Value* insert(const SafeString& key, const Value& value); + void clear(); + + Node* find(const SafeString& key) const; + + // Callable must have the signature Key&, Value& + template + void forEach(const Callable& delegate) const; + +private: + void eraseNodeForClear_(typename MapImpl::Node* node); + + FreeList mFreeList; + s32 mSize = 0; + s32 mCapacity = 0; +}; + +template +inline void StrTreeMap::Node::erase_() +{ + StrTreeMap* const map = mMap; + void* const this_ = this; + // Note: Nintendo does not call the destructor, which is dangerous... + map->mFreeList.free(this_); + --map->mSize; +} + +template +inline StrTreeMap::~StrTreeMap() +{ + void* work = mFreeList.work(); + if (!work) + return; + + clear(); + freeBuffer(); +} + +template +inline void StrTreeMap::allocBuffer(s32 node_max, Heap* heap, s32 alignment) +{ + SEAD_ASSERT(mFreeList.work() == nullptr); + if (node_max <= 0) + { + SEAD_ASSERT_MSG(false, "node_max[%d] must be larger than zero", node_max); + AllocFailAssert(heap, node_max * sizeof(Node), alignment); + } + + void* work = AllocBuffer(node_max * sizeof(Node), heap, alignment); + if (work) + setBuffer(node_max, work); +} + +template +inline void StrTreeMap::setBuffer(s32 node_max, void* buffer) +{ + mCapacity = node_max; + mFreeList.setWork(buffer, sizeof(Node), node_max); +} + +template +inline void StrTreeMap::freeBuffer() +{ + void* buffer = mFreeList.work(); + if (!buffer) + return; + + ::operator delete[](buffer); + mCapacity = 0; + mFreeList.reset(); +} + +template +inline Value* StrTreeMap::insert(const SafeString& key, const Value& value) +{ + if (mSize >= mCapacity) + { + if (Node* node = find(key)) + { + node->value() = value; + return &node->value(); + } + SEAD_ASSERT_MSG(false, "map is full."); + return nullptr; + } + + Node* node = new (mFreeList.alloc()) Node(this, key, value); + ++mSize; + MapImpl::insert(node); + return &node->value(); +} + +template +inline void StrTreeMap::clear() +{ + Delegate1, typename MapImpl::Node*> delegate( + this, &StrTreeMap::eraseNodeForClear_); + MapImpl::forEach(delegate); + mSize = 0; + MapImpl::clear(); +} + +template +inline typename StrTreeMap::Node* StrTreeMap::find(const SafeString& key) const +{ + return static_cast(MapImpl::find(key)); +} + +template +template +inline void StrTreeMap::forEach(const Callable& delegate) const +{ + MapImpl::forEach([&delegate](auto* base_node) { + auto* node = static_cast(base_node); + delegate(node->key(), node->value()); + }); +} + +template +inline void StrTreeMap::eraseNodeForClear_(typename MapImpl::Node* node) +{ + // Note: Nintendo does not call the destructor, which is dangerous... + mFreeList.free(node); +} +} // namespace sead diff --git a/include/sead/container/seadTList.h b/include/sead/container/seadTList.h new file mode 100644 index 0000000..0dbf908 --- /dev/null +++ b/include/sead/container/seadTList.h @@ -0,0 +1,206 @@ +#ifndef SEAD_TLIST_H_ +#define SEAD_TLIST_H_ + +#include + +namespace sead +{ +template +class TListNode; + +template +class TList : public ListImpl +{ +public: + using CompareCallback = int (*)(const T*, const T*); + + TList() : ListImpl() {} + + void pushBack(TListNode* item) + { + item->erase(); + item->mList = this; + ListImpl::pushBack(item); + } + + void pushFront(TListNode* item) + { + item->erase(); + item->mList = this; + ListImpl::pushFront(item); + } + + TListNode* popBack() { return static_cast*>(ListImpl::popBack()); } + TListNode* popFront() { return static_cast*>(ListImpl::popFront()); } + + void insertBefore(TListNode* node, TListNode* node_to_insert) + { + ListImpl::insertBefore(node, node_to_insert); + } + + void insertAfter(TListNode* node, TListNode* node_to_insert) + { + ListImpl::insertAfter(node, node_to_insert); + } + + void erase(TListNode* item) + { + if (!item->mList) + return; + item->mList = nullptr; + ListImpl::erase(item); + } + + TListNode* front() const { return static_cast*>(ListImpl::front()); } + TListNode* back() const { return static_cast*>(ListImpl::back()); } + TListNode* nth(int n) const { return static_cast*>(ListImpl::nth(n)); } + s32 indexOf(const TListNode* node) const { return ListImpl::indexOf(node); } + + void swap(TListNode* n1, TListNode* n2) { ListImpl::swap(n1, n2); } + void moveAfter(TListNode* basis, TListNode* n) { ListImpl::moveAfter(basis, n); } + void moveBefore(TListNode* basis, TListNode* n) { ListImpl::moveBefore(basis, n); } + + void sort(s32 offset, CompareCallback cmp) { ListImpl::sort(offset, cmp); } + void mergeSort(s32 offset, CompareCallback cmp) { ListImpl::mergeSort(offset, cmp); } + + TListNode* find(const void* ptr, s32 offset, CompareCallback cmp) const + { + return static_cast*>(ListImpl::find(ptr, offset, cmp)); + } + void uniq(s32 offset, CompareCallback cmp) { ListImpl::uniq(offset, cmp); } + void clear() { ListImpl::clear(); } + + TListNode* prev(const TListNode* node) const + { + auto prev_node = static_cast*>(node->prev()); + if (prev_node == &mStartEnd) + return nullptr; + return prev_node; + } + + TListNode* next(const TListNode* node) const + { + auto next_node = static_cast*>(node->next()); + if (next_node == &mStartEnd) + return nullptr; + return next_node; + } + + class iterator + { + public: + iterator(TListNode* ptr) : mPtr(ptr) {} + + iterator& operator++() + { + mPtr = static_cast*>(mPtr->next()); + return *this; + } + + iterator& operator--() + { + mPtr = static_cast*>(mPtr->prev()); + return *this; + } + + T& operator*() const { return mPtr->mData; } + T* operator->() const { return &mPtr->mData; } + + friend bool operator==(iterator it1, iterator it2) { return it1.mPtr == it2.mPtr; } + friend bool operator!=(iterator it1, iterator it2) { return !(it1 == it2); } + + private: + TListNode* mPtr; + }; + + iterator begin() const { return iterator(static_cast*>(mStartEnd.next())); } + + iterator end() const + { + return iterator(static_cast*>(const_cast(&mStartEnd))); + } + + class robustIterator + { + public: + robustIterator(TListNode* ptr) : mPtr(ptr) + { + mPtrNext = static_cast*>(mPtr->next()); + } + + robustIterator& operator++() + { + mPtr = mPtrNext; + mPtrNext = static_cast*>(mPtrNext->next()); + return *this; + } + + T& operator*() const { return mPtr->mData; } + T* operator->() const { return &mPtr->mData; } + + friend bool operator==(robustIterator it1, robustIterator it2) + { + return it1.mPtr == it2.mPtr; + } + friend bool operator!=(robustIterator it1, robustIterator it2) { return !(it1 == it2); } + + private: + TListNode* mPtr; + TListNode* mPtrNext; + }; + + robustIterator robustBegin() const + { + return robustIterator(static_cast*>(mStartEnd.next())); + } + + robustIterator robustEnd() const + { + return robustIterator(static_cast*>(const_cast(&mStartEnd))); + } + + struct RobustRange + { + auto begin() const { return mList.robustBegin(); } + auto end() const { return mList.robustEnd(); } + const TList& mList; + }; + RobustRange robustRange() const { return {*this}; } + +private: + static int compareT(const T* a, const T* b) + { + if (*a < *b) + return -1; + if (*a > *b) + return 1; + return 0; + } +}; + +template +class TListNode : public ListNode +{ +public: + TListNode() : ListNode() + { + mData = nullptr; + mList = NULL; + } + + TListNode(T data) : ListNode(), mData(data), mList(nullptr) {} + + void erase() + { + TList* list = mList; + if (list != NULL) + list->erase(this); + } + + T mData; + TList* mList; +}; + +} // namespace sead + +#endif // SEAD_TLIST_H_ diff --git a/include/sead/container/seadTreeMap.h b/include/sead/container/seadTreeMap.h new file mode 100644 index 0000000..c6d7c77 --- /dev/null +++ b/include/sead/container/seadTreeMap.h @@ -0,0 +1,584 @@ +#pragma once + +#include "basis/seadRawPrint.h" +#include "container/seadFreeList.h" +#include "prim/seadBitUtil.h" +#include "prim/seadDelegate.h" +#include "prim/seadSafeString.h" + +namespace sead +{ +template +class TreeMapNode; + +/// Sorted associative container, implemented using a left-leaning red-black tree. +/// For an explanation of the algorithm, see https://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf +template +class TreeMapImpl +{ +public: + using Node = TreeMapNode; + + void insert(Node* node); + void erase(const Key& key); + void clear(); + + Node* find(const Key& key) const { return find(mRoot, key); } + + template + void forEach(const Callable& callable) const + { + if (mRoot) + forEach(mRoot, callable); + } + + Node* startIterating() const + { + if (!mRoot) + return nullptr; + return startIterating(mRoot); + } + + Node* nextNode(Node* node) const + { + if (!node) + return nullptr; + + // If there is a right child node, explore that branch first. + if (node->mRight) + { + node->mRight->setParent(node); + return startIterating(node->mRight); + } + + // Otherwise, walk back up to the node P from which we reached this node + // by following P's left child pointer. + while (auto* const parent = node->getParent()) + { + if (parent->mLeft == node) + return parent; + node = parent; + } + return nullptr; + } + +protected: + /// Returns the left most child of a given node, marking each node with its parent + /// along the way. + static Node* startIterating(Node* node) + { + while (node->mLeft) + { + node->mLeft->setParent(node); + node = node->mLeft; + } + return node; + } + + Node* insert(Node* root, Node* node); + Node* erase(Node* root, const Key& key); + Node* find(Node* root, const Key& key) const; + + static inline Node* rotateLeft(Node* node); + static inline Node* rotateRight(Node* node); + static inline Node* moveRedLeft(Node* node); + static inline Node* moveRedRight(Node* node); + static Node* findMin(Node* node); + static Node* eraseMin(Node* node); + static inline Node* fixUp(Node* node); + static bool isRed(const Node* node) { return node && node->isRed(); } + static inline void flipColors(Node* node); + + template + static void forEach(Node* start, const Callable& callable); + + Node* mRoot = nullptr; +}; + +/// Requires Key to have a compare() member function, which returns -1 if lhs < rhs, 0 if lhs = rhs +/// and 1 if lhs > rhs. +template +class TreeMapNode +{ +public: + TreeMapNode() + { + mLeft = mRight = nullptr; + mColorAndPtr = 0; + } + + virtual ~TreeMapNode() = default; + virtual void erase_() = 0; + + const Key& key() const { return mKey; } + +protected: + friend class TreeMapImpl; + + enum class Color + { + Red = 0, + Black = 1, + }; + + void flipColor() { BitUtil::bitCastWrite(mColorAndPtr ^ 1u, &mColorAndPtr); } + void setColor(Color color) { mColorAndPtr = uintptr_t(color); } + + void setParent(TreeMapNode* parent) { mColorAndPtr = (mColorAndPtr & 1) | uintptr_t(parent); } + /// @warning Only valid if setParent has been called! + TreeMapNode* getParent() const { return reinterpret_cast(mColorAndPtr & ~1); } + + bool isRed() const { return (mColorAndPtr & 1u) == bool(Color::Red); } + + TreeMapNode* mLeft; + TreeMapNode* mRight; + uintptr_t mColorAndPtr; + Key mKey; +}; + +/// Requires Key to have operator< defined +/// This can be specialized, but all specializations must define `compare` and `key` as follows. +template +struct TreeMapKeyImpl +{ + TreeMapKeyImpl() = default; + TreeMapKeyImpl(const Key& key_) : key(key_) {} + TreeMapKeyImpl& operator=(const Key& key_) + { + key = key_; + return *this; + } + + /// Returns -1 if mKey < rhs, 0 if mKey = rhs and 1 if mKey > rhs. + s32 compare(const TreeMapKeyImpl& rhs) const + { + if (key < rhs.key) + return -1; + if (rhs.key < key) + return 1; + return 0; + } + + Key key; +}; + +/// Sorted associative container. +/// This is essentially std::map +template +class TreeMap : public TreeMapImpl> +{ +public: + using MapImpl = TreeMapImpl>; + class Node : public MapImpl::Node + { + public: + Node(TreeMap* map, const Key& key, const Value& value) : mValue(value), mMap(map) + { + this->mKey = key; + } + + void erase_() override; + + Value& value() { return mValue; } + const Value& value() const { return mValue; } + + private: + friend class TreeMap; + + Value mValue; + TreeMap* mMap; + }; + + ~TreeMap(); + + void allocBuffer(s32 node_max, Heap* heap, s32 alignment = sizeof(void*)); + void setBuffer(s32 node_max, void* buffer); + void freeBuffer(); + + Value* insert(const Key& key, const Value& value); + void clear(); + + Node* find(const Key& key) const; + + // Callable must have the signature Key&, Value& + template + void forEach(const Callable& delegate) const; + + Node* startIterating() const { return static_cast(MapImpl::startIterating()); } + Node* nextNode(Node* node) const { return static_cast(MapImpl::nextNode(node)); } + +private: + void eraseNodeForClear_(typename MapImpl::Node* node); + + FreeList mFreeList; + s32 mSize = 0; + s32 mCapacity = 0; +}; + +template +class IntrusiveTreeMap : public TreeMapImpl +{ +public: + using MapImpl = TreeMapImpl; + + Node* find(const Key& key) const { return static_cast(MapImpl::find(key)); } + + // Callable must have the signature Node* + template + void forEach(const Callable& delegate) const + { + MapImpl::forEach([delegate](auto* base_node) { + auto* node = static_cast(base_node); + delegate(node); + }); + } + + Node* startIterating() const { return static_cast(MapImpl::startIterating()); } + Node* nextNode(Node* node) const { return static_cast(MapImpl::nextNode(node)); } +}; + +template +inline void TreeMapImpl::insert(Node* node) +{ + mRoot = insert(mRoot, node); + mRoot->setColor(Node::Color::Black); +} + +template +inline TreeMapNode* TreeMapImpl::insert(Node* root, Node* node) +{ + if (!root) + { + node->mLeft = node->mRight = nullptr; + node->setColor(Node::Color::Red); + return node; + } + + const s32 cmp = node->key().compare(root->key()); + + if (cmp < 0) + { + root->mLeft = insert(root->mLeft, node); + } + else if (cmp > 0) + { + root->mRight = insert(root->mRight, node); + } + else if (root != node) + { + node->mRight = root->mRight; + node->mLeft = root->mLeft; + node->mColorAndPtr = root->mColorAndPtr; + root->erase_(); + root = node; + } + + if (isRed(root->mRight) && !isRed(root->mLeft)) + root = rotateLeft(root); + + if (isRed(root->mLeft) && isRed(root->mLeft->mLeft)) + root = rotateRight(root); + + if (isRed(root->mLeft) && isRed(root->mRight)) + flipColors(root); + + return root; +} + +template +inline void TreeMapImpl::erase(const Key& key) +{ + mRoot = erase(mRoot, key); + if (mRoot) + mRoot->setColor(Node::Color::Black); +} + +template +inline TreeMapNode* TreeMapImpl::erase(Node* root, const Key& key) +{ + if (key.compare(root->key()) < 0) + { + if (!isRed(root->mLeft) && !isRed(root->mLeft->mLeft)) + root = moveRedLeft(root); + root->mLeft = erase(root->mLeft, key); + } + else + { + if (isRed(root->mLeft)) + root = rotateRight(root); + + if (key.compare(root->key()) == 0 && !root->mRight) + { + root->erase_(); + return nullptr; + } + + if (!isRed(root->mRight) && !isRed(root->mRight->mLeft)) + root = moveRedRight(root); + + if (key.compare(root->key()) == 0) + { + Node* const min_node = findMin(root->mRight); + + Node* target = root->mRight; + if (root->mRight) + target = find(root->mRight, min_node->key()); + + target->mRight = eraseMin(root->mRight); + target->mLeft = root->mLeft; + target->mColorAndPtr = root->mColorAndPtr; + root->erase_(); + root = target; + } + else + { + root->mRight = erase(root->mRight, key); + } + } + return fixUp(root); +} + +template +inline void TreeMapImpl::clear() +{ + mRoot = nullptr; +} + +template +inline TreeMapNode* TreeMapImpl::find(Node* root, const Key& key) const +{ + Node* node = root; + while (node) + { + const s32 cmp = key.compare(node->key()); + if (cmp < 0) + node = node->mLeft; + else if (cmp > 0) + node = node->mRight; + else + return node; + } + + return nullptr; +} + +template +template +inline void TreeMapImpl::forEach(Node* start, const Callable& callable) +{ + Node* i = start; + do + { + Node* node = i; + if (i->mLeft) + forEach(i->mLeft, callable); + i = i->mRight; + callable(node); + } while (i); +} + +template +inline TreeMapNode* TreeMapImpl::rotateLeft(Node* node) +{ + TreeMapNode* j = node->mRight; + node->mRight = j->mLeft; + j->mLeft = node; + j->mColorAndPtr = node->mColorAndPtr; + node->setColor(Node::Color::Red); + return j; +} + +template +inline TreeMapNode* TreeMapImpl::rotateRight(Node* node) +{ + TreeMapNode* j = node->mLeft; + node->mLeft = j->mRight; + j->mRight = node; + j->mColorAndPtr = node->mColorAndPtr; + node->setColor(Node::Color::Red); + return j; +} + +// NON_MATCHING: this version matches the LLRB tree implementation and is better optimized; +// there is a useless store to node->mRight in the original version +template +inline TreeMapNode* TreeMapImpl::moveRedLeft(Node* node) +{ + flipColors(node); + if (isRed(node->mRight->mLeft)) + { + node->mRight = rotateRight(node->mRight); + node = rotateLeft(node); + flipColors(node); + } + return node; +} + +template +inline TreeMapNode* TreeMapImpl::moveRedRight(Node* node) +{ + flipColors(node); + if (isRed(node->mLeft->mLeft)) + { + node = rotateRight(node); + flipColors(node); + } + return node; +} + +template +inline TreeMapNode* TreeMapImpl::findMin(Node* node) +{ + while (node->mLeft) + node = node->mLeft; + return node; +} + +// NON_MATCHING: this version matches the LLRB tree implementation and is better optimized +template +inline TreeMapNode* TreeMapImpl::eraseMin(Node* node) +{ + if (!node->mLeft) + return nullptr; + + if (!isRed(node->mLeft) && !isRed(node->mLeft->mLeft)) + node = moveRedLeft(node); + + node->mLeft = eraseMin(node->mLeft); +#ifdef MATCHING_HACK_NX_CLANG + asm(""); +#endif + return fixUp(node); +} + +template +inline TreeMapNode* TreeMapImpl::fixUp(Node* node) +{ + if (isRed(node->mRight)) + node = rotateLeft(node); + + if (isRed(node->mLeft) && isRed(node->mLeft->mLeft)) + node = rotateRight(node); + + if (isRed(node->mLeft) && isRed(node->mRight)) + flipColors(node); + + return node; +} + +template +inline void TreeMapImpl::flipColors(Node* node) +{ + node->flipColor(); + node->mLeft->flipColor(); + node->mRight->flipColor(); +} + +template +inline void TreeMap::Node::erase_() +{ + TreeMap* const map = mMap; + void* const this_ = this; + // Note: Nintendo does not call the destructor, which is dangerous... + map->mFreeList.free(this_); + --map->mSize; +} + +template +inline TreeMap::~TreeMap() +{ + void* work = mFreeList.work(); + if (!work) + return; + + clear(); + freeBuffer(); +} + +template +inline void TreeMap::allocBuffer(s32 node_max, Heap* heap, s32 alignment) +{ + SEAD_ASSERT(mFreeList.work() == nullptr); + if (node_max <= 0) + { + SEAD_ASSERT_MSG(false, "node_max[%d] must be larger than zero", node_max); + AllocFailAssert(heap, node_max * sizeof(Node), alignment); + } + + void* work = AllocBuffer(node_max * sizeof(Node), heap, alignment); + if (work) + setBuffer(node_max, work); +} + +template +inline void TreeMap::setBuffer(s32 node_max, void* buffer) +{ + mCapacity = node_max; + mFreeList.setWork(buffer, sizeof(Node), node_max); +} + +template +inline void TreeMap::freeBuffer() +{ + void* buffer = mFreeList.work(); + if (!buffer) + return; + + ::operator delete[](buffer); + mCapacity = 0; + mFreeList.reset(); +} + +template +inline Value* TreeMap::insert(const Key& key, const Value& value) +{ + if (mSize >= mCapacity) + { + if (Node* node = find(key)) + { + node->value() = value; + return &node->value(); + } + SEAD_ASSERT_MSG(false, "map is full."); + return nullptr; + } + + Node* node = new (mFreeList.alloc()) Node(this, key, value); + ++mSize; + MapImpl::insert(node); + return &node->value(); +} + +template +inline void TreeMap::clear() +{ + Delegate1, typename MapImpl::Node*> delegate(this, + &TreeMap::eraseNodeForClear_); + MapImpl::forEach(delegate); + mSize = 0; + MapImpl::clear(); +} + +template +inline typename TreeMap::Node* TreeMap::find(const Key& key) const +{ + return static_cast(MapImpl::find(key)); +} + +template +template +inline void TreeMap::forEach(const Callable& delegate) const +{ + MapImpl::forEach([&delegate](auto* base_node) { + auto* node = static_cast(base_node); + delegate(node->key(), node->value()); + }); +} + +template +inline void TreeMap::eraseNodeForClear_(typename MapImpl::Node* node) +{ + // Note: Nintendo does not call the destructor, which is dangerous... + mFreeList.free(node); +} +} // namespace sead diff --git a/include/sead/container/seadTreeNode.h b/include/sead/container/seadTreeNode.h new file mode 100644 index 0000000..1233dcf --- /dev/null +++ b/include/sead/container/seadTreeNode.h @@ -0,0 +1,64 @@ +#ifndef SEAD_TREENODE_H_ +#define SEAD_TREENODE_H_ + +#include + +namespace sead +{ +class TreeNode +{ +public: + TreeNode(); + + void clearLinks(); + s32 countChildren() const; + void detachAll(); + void detachSubTree(); + TreeNode* findRoot(); + const TreeNode* findRoot() const; + void insertAfterSelf(TreeNode* node); + void insertBeforeSelf(TreeNode* node); + void pushBackChild(TreeNode* node); + void pushBackSibling(TreeNode* node); + void pushFrontChild(TreeNode* node); + +protected: + void clearChildLinksRecursively_(); + + TreeNode* mParent; + TreeNode* mChild; + TreeNode* mNext; + TreeNode* mPrev; +}; + +template +class TTreeNode : public TreeNode +{ +public: + TTreeNode() = default; + explicit TTreeNode(T data) : mData(data) {} + + T& value() { return mData; } + const T& value() const { return mData; } + + TTreeNode* parent() const { return static_cast(mParent); } + TTreeNode* child() const { return static_cast(mChild); } + TTreeNode* next() const { return static_cast(mNext); } + TTreeNode* prev() const { return static_cast(mPrev); } + TTreeNode* findRoot() { return static_cast(TreeNode::findRoot()); } + const TTreeNode* findRoot() const { return static_cast(TreeNode::findRoot()); } + void insertAfterSelf(TTreeNode* node) { TreeNode::insertAfterSelf(node); } + void insertBeforeSelf(TTreeNode* node) { TreeNode::insertBeforeSelf(node); } + void pushBackChild(TTreeNode* node) { TreeNode::pushBackChild(node); } + void pushBackSibling(TTreeNode* node) { TreeNode::pushBackSibling(node); } + void pushFrontChild(TTreeNode* node) { TreeNode::pushFrontChild(node); } + + // TODO: probably iterators + +protected: + T mData; +}; + +} // namespace sead + +#endif // SEAD_TREENODE_H_ diff --git a/include/sead/controller/seadController.h b/include/sead/controller/seadController.h new file mode 100644 index 0000000..6247bac --- /dev/null +++ b/include/sead/controller/seadController.h @@ -0,0 +1,50 @@ +#pragma once + +#include "container/seadOffsetList.h" +#include "controller/seadControllerBase.h" + +namespace sead +{ +class ControllerMgr; +class ControllerAddon; + +namespace ControllerDefine +{ +enum AddonId : int +{ +}; +enum ControllerId : int +{ + _15 = 15, + _16 = 16 +}; +enum DeviceId : int +{ +}; + +} // namespace ControllerDefine + +class Controller : public ControllerBase +{ + SEAD_RTTI_OVERRIDE(Controller, ControllerBase) +public: + Controller(ControllerMgr*); + virtual ~Controller(); + virtual void calc(); + virtual bool isConnected(); + ControllerAddon* getAddonByOrder(ControllerDefine::AddonId, int); + ControllerAddon* getAddon(ControllerDefine::AddonId); + +protected: + virtual void calcImpl_() = 0; + virtual bool isIdle_(); + virtual void setIdle_(); + +private: + int mControllerId; + ControllerMgr* mMgr; + OffsetList mAddonList; + OffsetList _160; // unknown type +}; + +} // namespace sead diff --git a/include/sead/controller/seadControllerBase.h b/include/sead/controller/seadControllerBase.h new file mode 100644 index 0000000..9d78f9d --- /dev/null +++ b/include/sead/controller/seadControllerBase.h @@ -0,0 +1,68 @@ +#pragma once + +#include "math/seadBoundBox.h" +#include "math/seadVector.h" +#include "prim/seadBitFlag.h" +#include "prim/seadRuntimeTypeInfo.h" + +namespace sead +{ +class ControllerBase +{ + SEAD_RTTI_BASE(ControllerBase) +public: + ControllerBase(int, int, int, int); + + void setRightStickCrossThreshold(float, float); + void setPointerBound(const BoundBox2f& bound); + void setPadRepeat(u32, u8, u8); + void setLeftStickCrossThreshold(float, float); + // unknown return type + u32 getPadHoldCount(int) const; + + BitFlag32 getButtonsTrigger() const { return mButtonsTrigger; } + BitFlag32 getButtonsRelease() const { return mButtonsRelease; } + BitFlag32 getButtonsRepeat() const { return mButtonsRepeat; } + BitFlag32 getButtonsHold() const { return mButtonsHold; } + const Vector2f& getTouchScreenPos() const { return mTouchScreenPos; } + const Vector2f& getLeftJoy() const { return mLeftJoy; } + const Vector2f& getRightJoy() const { return mRightJoy; } + +protected: + void updateDerivativeParams_(u32, bool); + void setPointerWithBound_(bool, bool, const Vector2f& bound); + void setIdleBase_(); + bool isIdleBase_(); + // unknown return type + u32 getStickHold_(u32, const Vector2f&, float, float, int); + // unknown return type + u32 createStickCrossMask_(); + +private: + BitFlag32 mButtonsTrigger; + BitFlag32 mButtonsRelease; + BitFlag32 mButtonsRepeat; + unsigned int mFlags; + int _18; + int _1c; + BoundBox2f mPointerBound; + int mPadHoldCounts[32]; + char _b0[32]; + char _d0[32]; + float mLeftStickThresholdX; + float mRightStickThresholdX; + float mLeftStickThresholdY; + float mRightStickThresholdY; + int _100; + int _104; + int _108; + int _10c; + unsigned int mIdleCounter; + sead::BitFlag32 mButtonsHold; + Vector2f mTouchScreenPos; + Vector2f mLeftJoy; + Vector2f mRightJoy; + Vector2f _130; +}; + +} // namespace sead diff --git a/include/sead/controller/seadControllerMgr.h b/include/sead/controller/seadControllerMgr.h new file mode 100644 index 0000000..c7108f5 --- /dev/null +++ b/include/sead/controller/seadControllerMgr.h @@ -0,0 +1,45 @@ +#pragma once + +#include "container/seadOffsetList.h" +#include "container/seadPtrArray.h" +#include "controller/seadController.h" +#include "framework/seadCalculateTask.h" +#include "framework/seadTaskMgr.h" +#include "heap/seadDisposer.h" + +namespace sead +{ +class Controller; +class NinJoyNpadDevice; + +class ControllerMgr : public CalculateTask +{ + SEAD_TASK_SINGLETON(ControllerMgr) +public: + explicit ControllerMgr(const TaskConstructArg& arg); + ControllerMgr(); + + void calc() override; + void finalize(); + void finalizeDefault(); + int findControllerPort(const Controller* controller); + NinJoyNpadDevice* getControlDevice(ControllerDefine::DeviceId device_id); + // unknown return type + void* getControllerAddon(int, ControllerDefine::AddonId addon_id); + // unknown return type + void* getControllerAddonByOrder(int, ControllerDefine::AddonId addon_id, int); + Controller* getControllerByOrder(ControllerDefine::ControllerId controller_id, int); + // unknown return type, probably inherited from TaskBase + void* getFramework(); + void initialize(int, Heap* heap); + void initializeDefault(Heap* heap); + void prepare() override; + + Controller* getController(int port) { return mArray[port]; } + +private: + OffsetList mList; + PtrArray mArray; +}; + +} // namespace sead diff --git a/include/sead/devenv/seadAssertConfig.h b/include/sead/devenv/seadAssertConfig.h new file mode 100644 index 0000000..257e868 --- /dev/null +++ b/include/sead/devenv/seadAssertConfig.h @@ -0,0 +1,22 @@ +#pragma once + +#include "prim/seadDelegate.h" +#include "prim/seadDelegateEventSlot.h" + +namespace sead +{ +class AssertConfig +{ +public: + using AssertEvent = DelegateEvent; + + static void registerCallback(AssertEvent::Slot& slot); + static void unregisterCallback(AssertEvent::Slot& slot); + static void registerFinalCallback(IDelegate1* cb); + static void execCallbacks(const char* assertMessage); + +private: + static AssertEvent sAssertEvent; + static IDelegate1* sFinalCallback; +}; +} // namespace sead diff --git a/include/sead/devenv/seadDebugFontMgrNvn.h b/include/sead/devenv/seadDebugFontMgrNvn.h new file mode 100644 index 0000000..2da5df6 --- /dev/null +++ b/include/sead/devenv/seadDebugFontMgrNvn.h @@ -0,0 +1,73 @@ +#pragma once + +// #include "sead/heap/seadHeap.h" +#include "seadFontBase.h" +#include "types.h" + +namespace sead { + + struct Heap; + struct DrawContext; + + class DebugFontMgrNvn : public FontBase { + public: + DebugFontMgrNvn(void); + + static DebugFontMgrNvn *sInstance; + + void initialize(sead::Heap *, const char *, const char*, unsigned int); + void initializeFromBinary(sead::Heap *, void *, unsigned long, void *, unsigned long, unsigned int); + static sead::DebugFontMgrNvn *createInstance(sead::Heap *); + void swapUniformBlockBuffer(void); + void begin(sead::DrawContext *) const; + void end(sead::DrawContext *) const; + + float getHeight(void) const { + return 16.f; + }; + float getWidth(void) const { + return 8.f; + }; + float getCharWidth(char16_t) const { + return 8.f; + }; + int getMaxDrawNum(void) const { + return 0x80; + }; + int getEncoding(void) const { + return 2; + }; + + }; + + class DebugFontMgrJis1Nvn : public FontBase { + public: + DebugFontMgrJis1Nvn(void); + + static DebugFontMgrJis1Nvn *sInstance; + + void initialize(sead::Heap *, const char *, const char *, const char *, unsigned int); + void initializeFromBinary(sead::Heap *,void *, ulong,void *, ulong,void const*, uint); + static sead::DebugFontMgrJis1Nvn *createInstance(sead::Heap *); + void swapUniformBlockBuffer(void); + void begin(sead::DrawContext *) const; + void end(sead::DrawContext *) const; + + float getHeight(void) const { + return 16.f; + }; + float getWidth(void) const { + return 8.f; + }; + + float getCharWidth(char16_t) const; + + int getMaxDrawNum(void) const { + return 0x80; + }; + int getEncoding(void) const { + return 2; + }; + + }; +} \ No newline at end of file diff --git a/include/sead/devenv/seadEnvUtil.h b/include/sead/devenv/seadEnvUtil.h new file mode 100644 index 0000000..2e7a9d9 --- /dev/null +++ b/include/sead/devenv/seadEnvUtil.h @@ -0,0 +1,18 @@ +#pragma once + +#include "prim/seadEnum.h" +#include "prim/seadSafeString.h" + +namespace sead +{ +SEAD_ENUM(RegionLanguageID, JPja, USen, USes, USfr, USpt, EUen, EUes, EUfr, EUde, EUit, EUpt, EUnl, EUru, KRko, CNzh, TWzh) + +class EnvUtil +{ +public: + static const SafeString& getRomType(); + static RegionLanguageID getRegionLanguage(); + static s32 getEnvironmentVariable(BufferedSafeString* out, const SafeString& variable); + static s32 resolveEnvronmentVariable(BufferedSafeString* out, const SafeString& str); +}; +} // namespace sead diff --git a/include/sead/devenv/seadFontBase.h b/include/sead/devenv/seadFontBase.h new file mode 100644 index 0000000..bf85989 --- /dev/null +++ b/include/sead/devenv/seadFontBase.h @@ -0,0 +1,8 @@ +#pragma once + +namespace sead +{ + class FontBase { + // no clue whats in this + }; +} // namespace sead diff --git a/include/sead/devenv/seadGameConfig.h b/include/sead/devenv/seadGameConfig.h new file mode 100644 index 0000000..78b0b24 --- /dev/null +++ b/include/sead/devenv/seadGameConfig.h @@ -0,0 +1,24 @@ +#pragma once + +#include "heap/seadDisposer.h" +#include "hostio/seadHostIONode.h" +#include "prim/seadSafeString.h" + +namespace sead +{ +class GameConfig : public hostio::Node +{ + SEAD_SINGLETON_DISPOSER(GameConfig) + GameConfig(); + virtual ~GameConfig(); + + static const SafeString cNodeName; + +protected: + struct FileWriteCallback + { + virtual ~FileWriteCallback(); + virtual void save(); + }; +}; +} // namespace sead diff --git a/include/sead/devenv/seadStackTrace.h b/include/sead/devenv/seadStackTrace.h new file mode 100644 index 0000000..35d88c7 --- /dev/null +++ b/include/sead/devenv/seadStackTrace.h @@ -0,0 +1,55 @@ +#pragma once + +#include "basis/seadTypes.h" +#include "container/seadSafeArray.h" + +namespace sead +{ +class StackTraceBase +{ +public: + StackTraceBase(); + virtual ~StackTraceBase() = default; + + virtual uintptr_t get(s32 index) const = 0; + virtual s32 size() const = 0; + + void trace(const void*); + +protected: + virtual void clear_() = 0; + virtual void push_(uintptr_t addr) = 0; + virtual bool isFull_() = 0; +}; + +template +class StackTrace : public StackTraceBase +{ +public: + ~StackTrace() override = default; + + uintptr_t get(s32 index) const override + { + if (index >= mSize) + return 0; + return mBuffer[index]; + } + + s32 size() const override { return mSize; } + +protected: + void clear_() override { mSize = 0; } + + void push_(uintptr_t addr) override + { + mBuffer[mSize] = addr; + ++mSize; + } + + bool isFull_() override { return mSize >= mBuffer.size(); } + +private: + SafeArray mBuffer{}; + s32 mSize{}; +}; +} // namespace sead diff --git a/include/sead/filedevice/cafe/seadCafeFSAFileDeviceCafe.h b/include/sead/filedevice/cafe/seadCafeFSAFileDeviceCafe.h new file mode 100644 index 0000000..13f8f35 --- /dev/null +++ b/include/sead/filedevice/cafe/seadCafeFSAFileDeviceCafe.h @@ -0,0 +1,65 @@ +#ifndef SEAD_CAFE_FSA_FILEDEVICE_H_ +#define SEAD_CAFE_FSA_FILEDEVICE_H_ + +#include + +#include +#include +#include +#include + +namespace sead +{ +class CafeFSAFileDevice : public FileDevice +{ + SEAD_RTTI_OVERRIDE(CafeFSAFileDevice, FileDevice) + +public: + CafeFSAFileDevice(const SafeString& name, const SafeString& devicePath); + virtual ~CafeFSAFileDevice() {} + + virtual bool doIsAvailable_() const; + virtual FileDevice* doOpen_(FileHandle* handle, const SafeString& path, FileOpenFlag flag); + virtual bool doClose_(FileHandle* handle); + virtual bool doRead_(u32* bytesRead, FileHandle* handle, u8* outBuffer, u32 bytesToRead); + virtual bool doWrite_(u32* bytesWritten, FileHandle* handle, const u8* inBuffer, + u32 bytesToWrite); + virtual bool doSeek_(FileHandle* handle, s32 offset, SeekOrigin origin); + virtual bool doGetCurrentSeekPos_(u32* seekPos, FileHandle* handle); + virtual bool doGetFileSize_(u32* fileSize, const SafeString& path); + virtual bool doGetFileSize_(u32* fileSize, FileHandle* handle); + virtual bool doIsExistFile_(bool* exists, const SafeString& path); + virtual bool doIsExistDirectory_(bool* exists, const SafeString& path); + virtual FileDevice* doOpenDirectory_(DirectoryHandle* handle, const SafeString& path); + virtual bool doCloseDirectory_(DirectoryHandle* handle); + virtual bool doReadDirectory_(u32* entriesRead, DirectoryHandle* handle, + DirectoryEntry* entries, u32 entriesToRead); + virtual bool doMakeDirectory_(const SafeString& path, u32); + virtual s32 doGetLastRawError_() const; + virtual void doResolvePath_(BufferedSafeString* out, const SafeString& path) const; + virtual void formatPathForFSA_(BufferedSafeString* out, const SafeString& path) const; + + FSClient* getUsableFSClient_() const; + FSFileHandle* getFileHandleInner_(FileHandle* handle); + FSDirHandle* getDirHandleInner_(DirectoryHandle* handle); + + const char* devicePath; + FSStatus status; + FSRetFlag openErrHandling; + FSRetFlag closeErrHandling; + FSRetFlag readErrHandling; + FSClient* client; +}; + +class CafeContentFileDevice : public CafeFSAFileDevice +{ + SEAD_RTTI_OVERRIDE(CafeContentFileDevice, CafeFSAFileDevice) + +public: + CafeContentFileDevice(); + virtual ~CafeContentFileDevice() {} +}; + +} // namespace sead + +#endif // SEAD_CAFE_FSA_FILEDEVICE_H_ diff --git a/include/sead/filedevice/nin/seadNinAocFileDeviceNin.h b/include/sead/filedevice/nin/seadNinAocFileDeviceNin.h new file mode 100644 index 0000000..85da708 --- /dev/null +++ b/include/sead/filedevice/nin/seadNinAocFileDeviceNin.h @@ -0,0 +1,14 @@ +#pragma once + +#include "filedevice/nin/seadNinFileDeviceBaseNin.h" + +namespace sead +{ +class NinAocFileDevice : public NinFileDeviceBase +{ + SEAD_RTTI_OVERRIDE(NinAocFileDevice, NinFileDeviceBase) + +public: + explicit NinAocFileDevice(const SafeString& mount); +}; +} // namespace sead diff --git a/include/sead/filedevice/nin/seadNinContentFileDeviceNin.h b/include/sead/filedevice/nin/seadNinContentFileDeviceNin.h new file mode 100644 index 0000000..1f4c7e3 --- /dev/null +++ b/include/sead/filedevice/nin/seadNinContentFileDeviceNin.h @@ -0,0 +1,14 @@ +#pragma once + +#include "filedevice/nin/seadNinFileDeviceBaseNin.h" + +namespace sead +{ +class NinContentFileDevice : public NinFileDeviceBase +{ + SEAD_RTTI_OVERRIDE(NinContentFileDevice, NinFileDeviceBase) + +public: + NinContentFileDevice(); +}; +} // namespace sead diff --git a/include/sead/filedevice/nin/seadNinFileDeviceBaseNin.h b/include/sead/filedevice/nin/seadNinFileDeviceBaseNin.h new file mode 100644 index 0000000..80650f4 --- /dev/null +++ b/include/sead/filedevice/nin/seadNinFileDeviceBaseNin.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include "filedevice/seadFileDevice.h" +#include "prim/seadSafeString.h" + +namespace sead +{ +class NinFileDeviceBase : public FileDevice +{ + SEAD_RTTI_OVERRIDE(NinFileDeviceBase, FileDevice) + +public: + NinFileDeviceBase(const SafeString& name, const SafeString& mount_point); + +protected: + struct FileHandleInner; + struct DirectoryHandleInner; + + bool doIsAvailable_() const override; + FileDevice* doOpen_(FileHandle* handle, const SafeString& path, FileOpenFlag flag) override; + bool doClose_(FileHandle* handle) override; + bool doFlush_(FileHandle* handle) override; + bool doRemove_(const SafeString& path) override; + bool doRead_(u32* bytesRead, FileHandle* handle, u8* outBuffer, u32 bytesToRead) override; + bool doWrite_(u32* bytesWritten, FileHandle* handle, const u8* inBuffer, + u32 bytesToWrite) override; + bool doSeek_(FileHandle* handle, s32 offset, SeekOrigin origin) override; + bool doGetCurrentSeekPos_(u32* seekPos, FileHandle* handle) override; + bool doGetFileSize_(u32* fileSize, const SafeString& path) override; + bool doGetFileSize_(u32* fileSize, FileHandle* handle) override; + bool doIsExistFile_(bool* exists, const SafeString& path) override; + bool doIsExistDirectory_(bool* exists, const SafeString& path) override; + FileDevice* doOpenDirectory_(DirectoryHandle* handle, const SafeString& path) override; + bool doCloseDirectory_(DirectoryHandle* handle) override; + bool doReadDirectory_(u32* entriesRead, DirectoryHandle* handle, DirectoryEntry* entries, + u32 entriesToRead) override; + bool doMakeDirectory_(const SafeString& path, u32 u_32) override; + s32 doGetLastRawError_() const override; + void doResolvePath_(BufferedSafeString* out, const SafeString& path) const override; + + virtual bool formatPathForFS_(BufferedSafeString* out, const SafeString& path) const; + + FileHandleInner* getFileHandleInner_(HandleBase* handle, bool construct = false) const; + DirectoryHandleInner* getDirectoryHandleInner_(HandleBase* handle, + bool construct = false) const; + + nn::Result mLastError = nn::ResultSuccess{}; + SafeString mMountPoint; +}; +} // namespace sead diff --git a/include/sead/filedevice/nin/seadNinHostIOFileDevice.h b/include/sead/filedevice/nin/seadNinHostIOFileDevice.h new file mode 100644 index 0000000..baca488 --- /dev/null +++ b/include/sead/filedevice/nin/seadNinHostIOFileDevice.h @@ -0,0 +1,17 @@ +#pragma once + +#include "filedevice/nin/seadNinFileDeviceBaseNin.h" + +namespace sead +{ +class NinHostIOFileDevice : public NinFileDeviceBase +{ + SEAD_RTTI_OVERRIDE(NinHostIOFileDevice, NinFileDeviceBase) + +public: + NinHostIOFileDevice(); + + bool doIsAvailable_() const override; + bool formatPathForFS_(BufferedSafeString* out, const SafeString& path) const override; +}; +} // namespace sead diff --git a/include/sead/filedevice/nin/seadNinSDFileDeviceNin.h b/include/sead/filedevice/nin/seadNinSDFileDeviceNin.h new file mode 100644 index 0000000..7362ccd --- /dev/null +++ b/include/sead/filedevice/nin/seadNinSDFileDeviceNin.h @@ -0,0 +1,16 @@ +#pragma once + +#include "filedevice/nin/seadNinFileDeviceBaseNin.h" + +namespace sead +{ +class NinSDFileDevice : public NinFileDeviceBase +{ + SEAD_RTTI_OVERRIDE(NinSDFileDevice, NinFileDeviceBase) + +public: + NinSDFileDevice(); + + bool doIsAvailable_() const override; +}; +} // namespace sead diff --git a/include/sead/filedevice/nin/seadNinSaveFileDeviceNin.h b/include/sead/filedevice/nin/seadNinSaveFileDeviceNin.h new file mode 100644 index 0000000..e36daac --- /dev/null +++ b/include/sead/filedevice/nin/seadNinSaveFileDeviceNin.h @@ -0,0 +1,15 @@ +#pragma once + +#include "filedevice/nin/seadNinFileDeviceBaseNin.h" + +namespace sead +{ +class NinSaveFileDevice : public NinFileDeviceBase +{ + SEAD_RTTI_OVERRIDE(NinSaveFileDevice, NinFileDeviceBase) + +public: + explicit NinSaveFileDevice(const SafeString& mount); + bool tryCommit(); +}; +} // namespace sead diff --git a/include/sead/filedevice/seadArchiveFileDevice.h b/include/sead/filedevice/seadArchiveFileDevice.h new file mode 100644 index 0000000..4758e33 --- /dev/null +++ b/include/sead/filedevice/seadArchiveFileDevice.h @@ -0,0 +1,55 @@ +#pragma once + +#include "filedevice/seadFileDevice.h" + +namespace sead +{ +class ArchiveRes; + +class ArchiveFileDevice : public FileDevice +{ + SEAD_RTTI_OVERRIDE(ArchiveFileDevice, FileDevice) +public: + explicit ArchiveFileDevice(ArchiveRes* archive_res); + ~ArchiveFileDevice() override = default; + + u8* tryLoadWithEntryID(s32 id, LoadArg& arg); + FileDevice* tryOpenWithEntryID(FileHandle* handle, s32 id, FileOpenFlag flag, u32 div_size); + s32 tryConvertPathToEntryID(const SafeString& path); + bool setCurrentDirectory(const SafeString& dir); + +protected: + struct ArchiveFileHandle; + + bool doIsAvailable_() const override { return true; } + u8* doLoad_(LoadArg& arg) override; + FileDevice* doOpen_(FileHandle* handle, const SafeString& path, FileOpenFlag flag) override; + bool doClose_(FileHandle* handle) override; + bool doFlush_(FileHandle* handle) override; + bool doRemove_(const SafeString& str) override; + bool doRead_(u32* bytesRead, FileHandle* handle, u8* outBuffer, u32 bytesToRead) override; + bool doWrite_(u32*, FileHandle*, const u8*, u32) override { return false; } + bool doSeek_(FileHandle* handle, s32 offset, SeekOrigin origin) override; + bool doGetCurrentSeekPos_(u32* seekPos, FileHandle* handle) override; + bool doGetFileSize_(u32* fileSize, const SafeString& path) override; + bool doGetFileSize_(u32* fileSize, FileHandle* handle) override; + bool doIsExistFile_(bool* exists, const SafeString& path) override; + bool doIsExistDirectory_(bool* exists, const SafeString& path) override; + FileDevice* doOpenDirectory_(DirectoryHandle* handle, const SafeString& path) override; + bool doCloseDirectory_(DirectoryHandle* handle) override; + bool doReadDirectory_(u32* entriesRead, DirectoryHandle* handle, DirectoryEntry* entry, + u32 entriesToRead) override; + bool doMakeDirectory_(const SafeString& path, u32 u_32) override; + s32 doGetLastRawError_() const override; + + virtual u8* doLoadWithEntryID_(s32 id, LoadArg& arg); + virtual FileDevice* doOpenWithEntryID_(FileHandle* handle, s32 id, FileOpenFlag flag); + virtual s32 doConvertPathToEntryID_(const SafeString& path); + virtual bool doSetCurrentDirectory_(const SafeString& path); + + ArchiveFileHandle* getArchiveFileHandle_(FileHandle* handle) const; + ArchiveFileHandle* constructArchiveFileHandle_(FileHandle* handle) const; + + ArchiveRes* mArchive; +}; +} // namespace sead diff --git a/include/sead/filedevice/seadFileDevice.h b/include/sead/filedevice/seadFileDevice.h new file mode 100644 index 0000000..79d0226 --- /dev/null +++ b/include/sead/filedevice/seadFileDevice.h @@ -0,0 +1,419 @@ +#ifndef SEAD_FILEDEVICE_H_ +#define SEAD_FILEDEVICE_H_ + +#include +#include +#include +#include +#include +#include +#include + +namespace sead +{ +class FileDevice; + +using HandleBuffer = SafeArray; + +class HandleBase +{ +public: + HandleBase() = default; + HandleBase(const HandleBase&) = delete; + HandleBase& operator=(const HandleBase&) = delete; + virtual ~HandleBase() = default; + + FileDevice* getDevice() const { return mDevice; } + FileDevice* getOriginalDevice() const { return mOriginalDevice; } + bool isOpened() const { return mOriginalDevice != nullptr; } + +protected: + friend class FileDevice; + + FileDevice* mDevice = nullptr; + FileDevice* mOriginalDevice = nullptr; + HandleBuffer mHandleBuffer{}; +}; + +class FileHandle; +class DirectoryHandle; +struct DirectoryEntry; + +class FileDevice : public TListNode, public IDisposer +{ + SEAD_RTTI_BASE(FileDevice) + +public: + enum FileOpenFlag + { + cFileOpenFlag_ReadOnly = 0, // r + cFileOpenFlag_WriteOnly = 1, // w + cFileOpenFlag_ReadWrite = 2, // r+ + cFileOpenFlag_Create = 3 // w+ + }; + + enum SeekOrigin + { + cSeekOrigin_Begin = 0, + cSeekOrigin_Current = 1, + cSeekOrigin_End = 2 + }; + + struct LoadArg + { + SafeString path; + u8* buffer = nullptr; + u32 buffer_size = 0; + Heap* heap = nullptr; + s32 alignment = 0; + s32 buffer_size_alignment = 0; + /// Read chunk size + u32 div_size = 0; + bool assert_on_alloc_fail = true; + bool check_read_entire_file = true; + u32 read_size = 0; + u32 roundup_size = 0; + bool need_unload = false; + }; + + struct SaveArg + { + SafeString path = ""; + const u8* buffer = nullptr; + u32 buffer_size = 0; + u32 write_size = 0; + }; + +public: + FileDevice() : TListNode(this), IDisposer(), mDriveName(), mPermission(true) {} + + explicit FileDevice(const SafeString& name) + : TListNode(this), IDisposer(), mDriveName(), mPermission(true) + { + setDriveName(name); + } + + ~FileDevice() override; + + const SafeString& getDriveName() const { return mDriveName; } + void setDriveName(const SafeString& name) + { +#ifdef SEAD_DEBUG + if (name.include(':')) + SEAD_WARN("drive name should not include ':'. (in %s)", name.cstr()); +#endif + mDriveName = name; + } + + bool hasPermission() const { return mPermission; } + void setHasPermission(bool perm) { mPermission = perm; } + + bool isAvailable() const; + + u8* tryLoad(LoadArg& arg); + + bool save(SaveArg& arg) + { + if (!trySave(arg)) + { + SEAD_ASSERT_MSG(false, "file save error"); + return false; + } + return true; + } + bool trySave(SaveArg& arg); + + FileDevice* open(FileHandle* handle, const SafeString& path, FileOpenFlag flag, u32 divSize = 0) + { + auto* device = tryOpen(handle, path, flag, divSize); + if (!device) + { + SEAD_ASSERT_MSG(false, "file open error"); + return nullptr; + } + return device; + } + FileDevice* tryOpen(FileHandle* handle, const SafeString& path, FileOpenFlag flag, + u32 divSize = 0); + + bool close(FileHandle* handle) + { + if (!tryClose(handle)) + { + SEAD_ASSERT_MSG(false, "file close error"); + return false; + } + return true; + } + bool tryClose(FileHandle* handle); + + bool flush(FileHandle* handle) + { + if (!tryFlush(handle)) + { + SEAD_ASSERT_MSG(false, "file flush error"); + return false; + } + return true; + } + bool tryFlush(FileHandle* handle); + + bool remove(const SafeString& str) + { + if (!tryRemove(str)) + { + SEAD_ASSERT_MSG(false, "file remove error"); + return false; + } + return true; + } + bool tryRemove(const SafeString& str); + + u32 read(FileHandle* handle, u8* data, u32 size) + { + u32 bytes_read = 0; + if (!tryRead(&bytes_read, handle, data, size)) + SEAD_ASSERT_MSG(false, "file read error"); + return bytes_read; + } + bool tryRead(u32* bytesRead, FileHandle* handle, u8* outBuffer, u32 bytesToRead); + + u32 write(FileHandle* handle, const u8* data, u32 size) + { + u32 bytes_written = 0; + if (!tryWrite(&bytes_written, handle, data, size)) + SEAD_ASSERT_MSG(false, "file write error"); + return bytes_written; + } + bool tryWrite(u32* bytesWritten, FileHandle* handle, const u8* inBuffer, u32 bytesToWrite); + + bool seek(FileHandle* handle, s32 offset, SeekOrigin origin) + { + if (!trySeek(handle, offset, origin)) + { + SEAD_ASSERT_MSG(false, "file seek error"); + return false; + } + return true; + } + bool trySeek(FileHandle* handle, s32 offset, SeekOrigin origin); + + u32 getCurrentSeekPos(FileHandle* handle) + { + u32 seek_pos = 0; + if (!tryGetCurrentSeekPos(&seek_pos, handle)) + SEAD_ASSERT_MSG(false, "tryGetCurrentSeekPos error"); + return seek_pos; + } + bool tryGetCurrentSeekPos(u32* seekPos, FileHandle* handle); + + u32 getFileSize(const SafeString& path) + { + u32 file_size = 0; + if (!tryGetFileSize(&file_size, path)) + SEAD_ASSERT_MSG(false, "tryGetFileSize error"); + return file_size; + } + bool tryGetFileSize(u32* fileSize, const SafeString& path); + + u32 getFileSize(FileHandle* handle) + { + u32 file_size = 0; + if (!tryGetFileSize(&file_size, handle)) + SEAD_ASSERT_MSG(false, "tryGetFileSize error"); + return file_size; + } + bool tryGetFileSize(u32* size, FileHandle* handle); + + bool isExistFile(const SafeString& path) + { + bool exists = false; + if (!tryIsExistFile(&exists, path)) + SEAD_ASSERT_MSG(false, "tryIsExistFile error"); + return exists; + } + bool tryIsExistFile(bool* exists, const SafeString& path); + + bool isExistDirectory(const SafeString& path) + { + bool exists = false; + if (!tryIsExistDirectory(&exists, path)) + SEAD_ASSERT_MSG(false, "isExistDirectory failed"); + return exists; + } + bool tryIsExistDirectory(bool* exists, const SafeString& path); + + FileDevice* openDirectory(DirectoryHandle* handle, const SafeString& path) + { + auto* device = tryOpenDirectory(handle, path); + if (!device) + { + SEAD_ASSERT_MSG(false, "directory open error"); + return nullptr; + } + return device; + } + FileDevice* tryOpenDirectory(DirectoryHandle* handle, const SafeString& path); + + bool closeDirectory(DirectoryHandle* handle) + { + if (!tryCloseDirectory(handle)) + { + SEAD_ASSERT_MSG(false, "directory close error"); + return false; + } + return true; + } + bool tryCloseDirectory(DirectoryHandle* handle); + + u32 readDirectory(DirectoryHandle* handle, DirectoryEntry* entries, u32 num_entries) + { + u32 entries_read = 0; + if (!tryReadDirectory(&entries_read, handle, entries, num_entries)) + SEAD_ASSERT_MSG(false, "directory read error"); + return entries_read; + } + bool tryReadDirectory(u32* entriesRead, DirectoryHandle* handle, DirectoryEntry* entries, + + u32 entriesToRead); + + bool makeDirectory(const SafeString& path, u32 x) + { + if (!tryMakeDirectory(path, x)) + { + SEAD_ASSERT_MSG(false, "directory make error"); + return false; + } + return true; + } + bool tryMakeDirectory(const SafeString& path, u32); + + bool makeDirectoryWithParent(const SafeString& path, u32 x) + { + if (!tryMakeDirectoryWithParent(path, x)) + { + SEAD_ASSERT_MSG(false, "directory make with parent error"); + return false; + } + return true; + } + bool tryMakeDirectoryWithParent(const SafeString& path, u32); + + s32 getLastRawError() const; + + virtual void traceFilePath(const SafeString& path) const; + virtual void traceDirectoryPath(const SafeString& path) const; + virtual void resolveFilePath(BufferedSafeString* out, const SafeString& path) const; + virtual void resolveDirectoryPath(BufferedSafeString* out, const SafeString& path) const; + virtual bool isMatchDevice_(const HandleBase* handle) const; + +#ifdef SWITCH + static const s32 cBufferMinAlignment = 0x20; +#else + static const s32 cBufferMinAlignment = 0x40; +#endif + +protected: + virtual bool doIsAvailable_() const = 0; + virtual u8* doLoad_(LoadArg& arg); + virtual bool doSave_(SaveArg& arg); + virtual FileDevice* doOpen_(FileHandle* handle, const SafeString& path, FileOpenFlag flag) = 0; + virtual bool doClose_(FileHandle* handle) = 0; + virtual bool doFlush_(FileHandle* handle) = 0; + virtual bool doRemove_(const SafeString& str) = 0; + virtual bool doRead_(u32* bytesRead, FileHandle* handle, u8* outBuffer, u32 bytesToRead) = 0; + virtual bool doWrite_(u32* bytesWritten, FileHandle* handle, const u8* inBuffer, + u32 bytesToWrite) = 0; + virtual bool doSeek_(FileHandle* handle, s32 offset, SeekOrigin origin) = 0; + virtual bool doGetCurrentSeekPos_(u32* seekPos, FileHandle* handle) = 0; + virtual bool doGetFileSize_(u32* fileSize, const SafeString& path) = 0; + virtual bool doGetFileSize_(u32* fileSize, FileHandle* handle) = 0; + virtual bool doIsExistFile_(bool* exists, const SafeString& path) = 0; + virtual bool doIsExistDirectory_(bool* exists, const SafeString& path) = 0; + virtual FileDevice* doOpenDirectory_(DirectoryHandle* handle, const SafeString& path) = 0; + virtual bool doCloseDirectory_(DirectoryHandle* handle) = 0; + virtual bool doReadDirectory_(u32* entriesRead, DirectoryHandle* handle, + DirectoryEntry* entries, u32 entriesToRead) = 0; + virtual bool doMakeDirectory_(const SafeString& path, u32) = 0; + virtual s32 doGetLastRawError_() const = 0; + virtual void doTracePath_(const SafeString& path) const; + virtual void doResolvePath_(BufferedSafeString* out, const SafeString& path) const; + + void setFileHandleDivSize_(FileHandle* handle, u32 divSize) const; + void setHandleBaseFileDevice_(HandleBase* handle, FileDevice* device) const; + void setHandleBaseOriginalFileDevice_(HandleBase* handle, FileDevice* device) const; + HandleBuffer& getHandleBaseHandleBuffer_(HandleBase* handle) const; + + FixedSafeString<32> mDriveName; + bool mPermission; +}; + +class FileHandle : public HandleBase +{ +public: + FileHandle() : HandleBase(), mDivSize(0) {} + + virtual ~FileHandle() + { + FileDevice* _device = mOriginalDevice; + if (_device != NULL) + _device->tryClose(this); + } + + bool close(); + bool tryClose(); + + bool flush(); + bool tryFlush(); + + u32 read(u8* outBuffer, u32 bytesToRead); + bool tryRead(u32* actual_size, u8* data, u32 size); + + u32 write(const u8* data, u32 size); + bool tryWrite(u32* actual_size, const u8* data, u32 size); + + bool seek(s32 offset, FileDevice::SeekOrigin origin); + bool trySeek(s32 offset, FileDevice::SeekOrigin origin); + u32 getCurrentSeekPos(); + bool tryGetCurrentSeekPos(u32* pos); + + u32 getFileSize(); + bool tryGetFileSize(u32* size); + + u32 getDivSize() const { return mDivSize; } + +protected: + friend class FileDevice; + + s32 mDivSize; +}; + +class DirectoryHandle : public HandleBase +{ +public: + DirectoryHandle() : HandleBase() {} + + virtual ~DirectoryHandle() + { + FileDevice* _device = mOriginalDevice; + if (_device != NULL) + _device->tryCloseDirectory(this); + } + + bool close(); + bool tryClose(); + u32 read(DirectoryEntry* entries, u32 count); + bool tryRead(u32* actual_count, DirectoryEntry* entries, u32 count); +}; + +struct DirectoryEntry +{ + DirectoryEntry() : name(), is_directory(false) {} + + FixedSafeString<256> name; + bool is_directory; +}; + +} // namespace sead + +#endif // SEAD_FILEDEVICE_H_ diff --git a/include/sead/filedevice/seadFileDeviceMgr.h b/include/sead/filedevice/seadFileDeviceMgr.h new file mode 100644 index 0000000..89c2ece --- /dev/null +++ b/include/sead/filedevice/seadFileDeviceMgr.h @@ -0,0 +1,81 @@ +#ifndef SEAD_FILEDEVICEMGR_H_ +#define SEAD_FILEDEVICEMGR_H_ + +#ifdef cafe +#include +#endif // cafe + +#include +#include +#include +#include +#include +#include + +namespace sead +{ +class FileDeviceMgr +{ + SEAD_SINGLETON_DISPOSER(FileDeviceMgr) + FileDeviceMgr(); + ~FileDeviceMgr(); + +public: + void traceFilePath(const SafeString& path) const; + void traceDirectoryPath(const SafeString& path) const; + void resolveFilePath(BufferedSafeString* out, const SafeString& path) const; + void resolveDirectoryPath(BufferedSafeString* out, const SafeString& path) const; + + void mount(FileDevice* device, const SafeString& name = SafeString::cEmptyString); + void unmount(FileDevice* device); + void unmount(const SafeString& name); + FileDevice* findDeviceFromPath(const SafeString& path, BufferedSafeString* pathNoDrive) const; + FileDevice* findDevice(const SafeString& name) const; + + FileDevice* tryOpen(FileHandle* handle, const SafeString& path, FileDevice::FileOpenFlag flag, + u32 divSize); + FileDevice* tryOpenDirectory(DirectoryHandle* handle, const SafeString& path); + + u8* tryLoad(FileDevice::LoadArg& arg); + void unload(u8* data); + bool trySave(FileDevice::SaveArg& arg); + + void mountSaveDataForDebug(Heap* heap); + void unmountSaveDataForDebug(); + + FileDevice* getMainFileDevice() const { return mMainFileDevice; } + FileDevice* getDefaultFileDevice() const { return mDefaultFileDevice; } + void setDefaultFileDevice(FileDevice* device) { mDefaultFileDevice = device; } + +#ifdef NNSDK + bool hasMountedHost() const { return mMountedHost; } + bool hasMountedSd() const { return mMountedSd; } +#endif + +private: + typedef TList DeviceList; + + void mount_(Heap* heap); + void unmount_(); + + DeviceList mDeviceList{}; + FileDevice* mDefaultFileDevice = nullptr; + MainFileDevice* mMainFileDevice = nullptr; + +#ifdef cafe + static void stateChangeCallback_(FSClient* client, FSVolumeState state, void* context); + + FSClient client; + u8 _1724[128]; + u8 _17A4[128]; + u32 _1824; +#elif defined(NNSDK) + u8* mRomCache = nullptr; + bool mMountedHost = false; + bool mMountedSd = false; +#endif +}; + +} // namespace sead + +#endif // SEAD_FILEDEVICEMGR_H_ diff --git a/include/sead/filedevice/seadMainFileDevice.h b/include/sead/filedevice/seadMainFileDevice.h new file mode 100644 index 0000000..0acf826 --- /dev/null +++ b/include/sead/filedevice/seadMainFileDevice.h @@ -0,0 +1,112 @@ +#ifndef SEAD_MAIN_FILEDEVICE_H_ +#define SEAD_MAIN_FILEDEVICE_H_ + +#include +#include +#include +#include + +namespace sead +{ +class MainFileDevice : public FileDevice +{ + SEAD_RTTI_OVERRIDE(MainFileDevice, FileDevice) + +public: + explicit MainFileDevice(Heap* heap); + ~MainFileDevice() override; + + void traceFilePath(const SafeString& path) const override; + void traceDirectoryPath(const SafeString& path) const override; + void resolveFilePath(BufferedSafeString* out, const SafeString& path) const override; + void resolveDirectoryPath(BufferedSafeString* out, const SafeString& path) const override; + +protected: + bool doIsAvailable_() const override { return mFileDevice->isAvailable(); } + + FileDevice* doOpen_(FileHandle* handle, const SafeString& path, FileOpenFlag flag) override + { + return mFileDevice->tryOpen(handle, path, flag, handle->getDivSize()); + } + + bool doClose_(FileHandle* handle) override { return mFileDevice->tryClose(handle); } + + bool doFlush_(FileHandle* handle) override { return mFileDevice->tryFlush(handle); } + + bool doRemove_(const SafeString& str) override { return mFileDevice->tryRemove(str); } + + bool doRead_(u32* bytesRead, FileHandle* handle, u8* outBuffer, u32 bytesToRead) override + { + return mFileDevice->tryRead(bytesRead, handle, outBuffer, bytesToRead); + } + + bool doWrite_(u32* bytesWritten, FileHandle* handle, const u8* inBuffer, + u32 bytesToWrite) override + { + return mFileDevice->tryWrite(bytesWritten, handle, inBuffer, bytesToWrite); + } + + bool doSeek_(FileHandle* handle, s32 offset, SeekOrigin origin) override + { + return mFileDevice->trySeek(handle, offset, origin); + } + + bool doGetCurrentSeekPos_(u32* seekPos, FileHandle* handle) override + { + return mFileDevice->tryGetCurrentSeekPos(seekPos, handle); + } + + bool doGetFileSize_(u32* fileSize, const SafeString& path) override + { + return mFileDevice->tryGetFileSize(fileSize, path); + } + + bool doGetFileSize_(u32* fileSize, FileHandle* handle) override + { + return mFileDevice->tryGetFileSize(fileSize, handle); + } + + bool doIsExistFile_(bool* exists, const SafeString& path) override + { + return mFileDevice->tryIsExistFile(exists, path); + } + + bool doIsExistDirectory_(bool* exists, const SafeString& path) override + { + return mFileDevice->tryIsExistDirectory(exists, path); + } + + FileDevice* doOpenDirectory_(DirectoryHandle* handle, const SafeString& path) override + { + return mFileDevice->tryOpenDirectory(handle, path); + } + + bool doCloseDirectory_(DirectoryHandle* handle) override + { + return mFileDevice->tryCloseDirectory(handle); + } + + bool doReadDirectory_(u32* entriesRead, DirectoryHandle* handle, DirectoryEntry* entries, + u32 entriesToRead) override + { + return mFileDevice->tryReadDirectory(entriesRead, handle, entries, entriesToRead); + } + + bool doMakeDirectory_(const SafeString& path, u32 x) override + { + return mFileDevice->tryMakeDirectory(path, x); + } + + s32 doGetLastRawError_() const override { return mFileDevice->getLastRawError(); } + + bool isMatchDevice_(const HandleBase* handle) const override + { + return mFileDevice->isMatchDevice_(handle); + } + + FileDevice* mFileDevice; +}; + +} // namespace sead + +#endif // SEAD_MAIN_FILEDEVICE_H_ diff --git a/include/sead/filedevice/seadPath.h b/include/sead/filedevice/seadPath.h new file mode 100644 index 0000000..e54ad18 --- /dev/null +++ b/include/sead/filedevice/seadPath.h @@ -0,0 +1,22 @@ +#ifndef SEAD_PATH_H_ +#define SEAD_PATH_H_ + +#include + +namespace sead +{ +class Path +{ +public: + static bool getDriveName(BufferedSafeString* drive_name, const SafeString& path); + static void getPathExceptDrive(BufferedSafeString* out, const SafeString& path); + static bool getExt(BufferedSafeString* ext, const SafeString& path); + static bool getFileName(BufferedSafeString* name, const SafeString& path); + static bool getBaseFileName(BufferedSafeString* name, const SafeString& path); + static bool getDirectoryName(BufferedSafeString* name, const SafeString& path); + static void join(BufferedSafeString* out, const char* path1, const char* path2); + static void changeDelimiter(BufferedSafeString* out, char delimiter); +}; +} // namespace sead + +#endif // SEAD_PATH_H_ diff --git a/include/sead/framework/seadCalculateTask.h b/include/sead/framework/seadCalculateTask.h new file mode 100644 index 0000000..91e8012 --- /dev/null +++ b/include/sead/framework/seadCalculateTask.h @@ -0,0 +1,32 @@ +#pragma once + +#include "framework/seadMethodTree.h" +#include "framework/seadTaskBase.h" + +namespace sead +{ +class CalculateTask : public TaskBase +{ + SEAD_RTTI_OVERRIDE(CalculateTask, TaskBase) +public: + explicit CalculateTask(const TaskConstructArg& arg); + CalculateTask(const TaskConstructArg& arg, const char* name); + ~CalculateTask() override; + void pauseCalc(bool b) override; + void pauseDraw(bool b) override; + void pauseCalcRec(bool b) override; + void pauseDrawRec(bool b) override; + void pauseCalcChild(bool b) override; + void pauseDrawChild(bool b) override; + void attachCalcImpl() override; + void attachDrawImpl() override; + void detachCalcImpl() override; + void detachDrawImpl() override; + const RuntimeTypeInfo::Interface* getCorrespondingMethodTreeMgrTypeInfo() const override; + MethodTreeNode* getMethodTreeNode(s32 method_type) override; + virtual void calc() {} + +protected: + MethodTreeNode mCalcNode{nullptr}; +}; +} // namespace sead diff --git a/include/sead/framework/seadFramework.h b/include/sead/framework/seadFramework.h new file mode 100644 index 0000000..37344ff --- /dev/null +++ b/include/sead/framework/seadFramework.h @@ -0,0 +1,91 @@ +#ifndef SEAD_FRAMEWORK_H_ +#define SEAD_FRAMEWORK_H_ + +//#include +#include +//#include +//#include +//#include +//#include +#include +#include +#include +#include