Skip to content

Commit

Permalink
Merge pull request #16 from Amethyst-szs/dev
Browse files Browse the repository at this point in the history
Version 1.2 release, merging dev into stable
  • Loading branch information
Amethyst-szs committed Apr 6, 2023
2 parents 27e8c42 + 4183bfe commit d64c8dc
Show file tree
Hide file tree
Showing 30 changed files with 472 additions and 116 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"tuple": "cpp",
"utility": "cpp",
"atomic": "cpp",
"cstdarg": "cpp"
"cstdarg": "cpp",
"xlocinfo": "cpp",
"xstring": "cpp"
},
"cmake.configureOnOpen": false,
"C_Cpp.errorSquiggles": "Enabled"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FTP_IP ?= 192.168.0.9 # put console IP here
FTP_IP ?= 192.168.0.24 # put console IP here
.PHONY: all clean

all:
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ LunaKit is a development tool / modification of Super Mario Odyssey designed to
![Gameplay 2](https://user-images.githubusercontent.com/62185604/220535575-e94cbda0-a6bf-49fd-ac5f-8bfa92da732f.jpg)

## How to use:

### Installation on switch
- Install Atmosphere and SMO V1.0.0
- Remove any previous mods that would cause conflicts
- Download newest build from [releases](https://github.com/Amethyst-szs/smo-lunakit/releases/)
- Drag and drop the included `atmosphere` and `LunaKit` folders onto the root of your SD card

### Installation on [Ryujinx](https://ryujinx.org/)
- Download newest build from [releases](https://github.com/Amethyst-szs/smo-lunakit/releases/)
- Drag and drop the included `atmosphere` and `LunaKit` folders onto the root of the [emulated SD card](https://github.com/Ryujinx/Ryujinx/wiki/Ryujinx-Setup-&-Configuration-Guide#managing-mods)

### Installation on Yuzu is NOT actively supported.

### Controls:
- Open the interface by holding ZR + R and tapping L
- Hide windows by pressing L-Stick
Expand Down
31 changes: 1 addition & 30 deletions src/al/scene/Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,14 @@

namespace al {
class StageResourceKeeper;

class LiveActorKit;

class LayoutKit;

class SceneStopCtrl;

class SceneMsgCtrl;

class ScreenCoverCtrl;

class AudioDirector;

class AudioKeeper;

class NerveKeeper;

class GraphicsInitArg;

#define GETTER(type, name, field, suffix) type name() suffix { \
Expand All @@ -37,61 +28,41 @@ namespace al {

#define GETTER_NOIMPL(type, name, suffix) type name() suffix;


class Scene : public al::NerveExecutor,
public al::IUseAudioKeeper,
public al::IUseCamera,
public al::IUseSceneObjHolder {
public:
Scene(const char *name);

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();

GETTER_NOIMPL(AudioKeeper*, getAudioKeeper, const override);

GETTER_NOIMPL(SceneObjHolder*, getSceneObjHolder, const override);

GETTER_NOIMPL(CameraDirector*, getCameraDirector, const override);

GETTER(LayoutKit*, getLayoutKit, mLayoutKit, const);

GETTER(SceneStopCtrl*, getSceneStopCtrl, mSceneStopCtrl, const);

GETTER(SceneMsgCtrl*, getSceneMsgCtrl, mSceneMsgCtrl, const);

void initializeAsync(const al::SceneInitInfo &);

void initDrawSystemInfo(const al::SceneInitInfo &);

void initSceneObjHolder(al::SceneObjHolder *);

void initAndLoadStageResource(const char *, int);

void initLiveActorKit(const al::SceneInitInfo &, int, int, int);

void initLiveActorKitWithGraphics(const al::GraphicsInitArg &, const al::SceneInitInfo &, int, int, int);

void initLayoutKit(const al::SceneInitInfo &);

void initSceneStopCtrl();

void initSceneMsgCtrl();

void initScreenCoverCtrl();

void endInit(const al::ActorInitInfo &);

// private:
Expand Down
4 changes: 4 additions & 0 deletions src/al/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ namespace al {

int getPlayerControllerPort(int);

PlayerActorBase* getPlayerActor(al::LiveActor const*, int);

PlayerActorBase* tryGetPlayerActor(al::PlayerHolder const*, int);

char const *getActionName(al::LiveActor const *);

char const *getActionFrame(al::LiveActor const *);
Expand Down
2 changes: 1 addition & 1 deletion src/game/HakoniwaSequence/HakoniwaSequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class HakoniwaSequence : public al::Sequence {
al::LayoutKit* mLytKit; // 0xF8
bool mYBalls;
sead::FixedSafeString<0x80> stageName;
int scenarioNum;
uint scenarioNum;
al::ScreenCaptureExecutor* mScreenCapExecutor;
al::WipeHolder* mWipeHolder;
bool mMissEnd;
Expand Down
50 changes: 40 additions & 10 deletions src/helpers/GetHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ bool isInScene()
{
al::Sequence* curSequence = GameSystemFunction::getGameSystem()->mCurSequence;
if (curSequence && al::isEqualString(curSequence->getName().cstr(), "HakoniwaSequence")) {
auto gameSeq = (HakoniwaSequence*)curSequence;
auto curScene = gameSeq->curScene;
auto curScene = curSequence->mCurrentScene;

return curScene && curScene->mIsAlive;
}
Expand Down Expand Up @@ -54,20 +53,30 @@ HakoniwaSequence* tryGetHakoniwaSequence()
al::Scene* tryGetScene()
{
al::Sequence* curSequence = GameSystemFunction::getGameSystem()->mCurSequence;

if (curSequence && al::isEqualString(curSequence->getName().cstr(), "HakoniwaSequence")) {
auto gameSeq = (HakoniwaSequence*)curSequence;
auto curScene = gameSeq->curScene;
auto curScene = curSequence->mCurrentScene;

if (curScene && curScene->mIsAlive)
return gameSeq->curScene;
return curScene;
}

return nullptr;
}

al::Scene* tryGetScene(al::Sequence* curSequence)
{
auto curScene = curSequence->mCurrentScene;

if (curScene && curScene->mIsAlive)
return curScene;

return nullptr;
}

al::Scene* tryGetScene(HakoniwaSequence* curSequence)
{
auto curScene = curSequence->curScene;
auto curScene = curSequence->mCurrentScene;

if (curScene && curScene->mIsAlive)
return curScene;
Expand Down Expand Up @@ -149,7 +158,14 @@ PlayerActorBase* tryGetPlayerActor()
auto curScene = gameSeq->curScene;

if (curScene && curScene->mIsAlive) {
PlayerActorBase* playerBase = rs::getPlayerActor(curScene);
if(!isInStageScene(curScene))
return nullptr;

al::PlayerHolder* pHolder = al::getScenePlayerHolder(curScene);
if(!pHolder)
return nullptr;

PlayerActorBase* playerBase = al::tryGetPlayerActor(pHolder, 0);
return playerBase;
}
}
Expand All @@ -162,16 +178,30 @@ PlayerActorBase* tryGetPlayerActor(HakoniwaSequence* curSequence)
auto curScene = curSequence->curScene;

if (curScene && curScene->mIsAlive) {
PlayerActorBase* playerBase = rs::getPlayerActor(curScene);
if(!isInStageScene(curScene))
return nullptr;

al::PlayerHolder* pHolder = al::getScenePlayerHolder(curScene);
if(!pHolder)
return nullptr;

PlayerActorBase* playerBase = al::tryGetPlayerActor(pHolder, 0);
return playerBase;
}

return nullptr;
}

PlayerActorBase* tryGetPlayerActor(al::Scene* scene)
PlayerActorBase* tryGetPlayerActor(StageScene* scene)
{
PlayerActorBase* playerBase = rs::getPlayerActor(scene);
if(!isInStageScene(scene))
return nullptr;

al::PlayerHolder* pHolder = al::getScenePlayerHolder(scene);
if(!pHolder)
return nullptr;

PlayerActorBase* playerBase = al::tryGetPlayerActor(pHolder, 0);
return playerBase;
}

Expand Down
4 changes: 3 additions & 1 deletion src/helpers/GetHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "al/nerve/NerveKeeper.h"
#include "al/nerve/NerveStateBase.h"
#include "al/nerve/NerveStateCtrl.h"
#include "al/util.hpp"

#include "game/System/GameSystem.h"
#include "game/System/Application.h"
Expand All @@ -29,6 +30,7 @@ al::Sequence* tryGetSequence();
HakoniwaSequence* tryGetHakoniwaSequence();

al::Scene* tryGetScene();
al::Scene* tryGetScene(al::Sequence* curSequence);
al::Scene* tryGetScene(HakoniwaSequence* curSequence);
StageScene* tryGetStageScene();
StageScene* tryGetStageScene(HakoniwaSequence* curSequence);
Expand All @@ -42,7 +44,7 @@ GameDataHolderAccessor* tryGetGameDataHolderAccess(StageScene* scene);

PlayerActorBase* tryGetPlayerActor();
PlayerActorBase* tryGetPlayerActor(HakoniwaSequence* curSequence);
PlayerActorBase* tryGetPlayerActor(al::Scene* scene);
PlayerActorBase* tryGetPlayerActor(StageScene* scene);
PlayerActorHakoniwa* tryGetPlayerActorHakoniwa();
PlayerActorHakoniwa* tryGetPlayerActorHakoniwa(HakoniwaSequence* curSequence);
PlayerActorHakoniwa* tryGetPlayerActorHakoniwa(StageScene* scene);
74 changes: 74 additions & 0 deletions src/helpers/ImGuiHelper.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include "helpers/ImGuiHelper.h"

void ImGuiHelper::drawVector3Drag(const char* prefixName, const char* tooltip, sead::Vector3f* vec, float speed, float limit)
{
if(!vec)
return;

const char* symbols = "XYZ";
sead::FixedSafeString<0xf> sliderName(prefixName);

ImGui::BeginGroup();

for(uint i = 0; i < strlen(symbols); i++) {
sliderName.append(symbols[i]);
ImGui::DragFloat(sliderName.cstr(), &vec->e[i], speed, -limit, limit, "%.2f", ImGuiSliderFlags_NoRoundToFormat);
sliderName.chop(1);
}

ImGui::EndGroup();

if(ImGui::IsItemHovered())
ImGui::SetTooltip(tooltip);

ImGui::Separator();
}

void ImGuiHelper::drawVector3Slide(const char* prefixName, const char* tooltip, sead::Vector3f* vec, float limit, bool isNormalize)
{
if(!vec)
return;

const char* symbols = "XYZ";
sead::FixedSafeString<0xf> sliderName(prefixName);

ImGui::BeginGroup();

for(uint i = 0; i < strlen(symbols); i++) {
sliderName.append(symbols[i]);
ImGui::SliderFloat(sliderName.cstr(), &vec->e[i], -limit, limit, "%.2f", ImGuiSliderFlags_NoRoundToFormat);
sliderName.chop(1);
}

if(isNormalize)
vec->normalize();

ImGui::EndGroup();

if(ImGui::IsItemHovered())
ImGui::SetTooltip(tooltip);

ImGui::Separator();
}

void ImGuiHelper::drawQuat(const char* tooltip, sead::Quatf* quat)
{
if(!quat)
return;

ImGui::BeginGroup();

ImGui::DragFloat("QW", &quat->w, 0.05f, 0.f, 0.f, "%.2f", ImGuiSliderFlags_NoRoundToFormat);
ImGui::SliderFloat("QX", &quat->x, -1.f, 1.f, "%.3f", ImGuiSliderFlags_NoRoundToFormat);
ImGui::SliderFloat("QY", &quat->y, -1.f, 1.f, "%.3f", ImGuiSliderFlags_NoRoundToFormat);
ImGui::SliderFloat("QZ", &quat->z, -1.f, 1.f, "%.3f", ImGuiSliderFlags_NoRoundToFormat);

// quat->normalize();

ImGui::EndGroup();

if(ImGui::IsItemHovered())
ImGui::SetTooltip(tooltip);

ImGui::Separator();
}
15 changes: 15 additions & 0 deletions src/helpers/ImGuiHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "imgui.h"

#include "sead/prim/seadSafeString.h"
#include "sead/math/seadVector.h"
#include "sead/math/seadQuat.h"

namespace ImGuiHelper {

// Vector editors
void drawVector3Drag(const char* prefixName, const char* tooltip, sead::Vector3f* vec, float speed, float limit);
void drawVector3Slide(const char* prefixName, const char* tooltip, sead::Vector3f* vec, float limit, bool isNormalize);

// Quaternion editors
void drawQuat(const char* tooltip, sead::Quatf* quat);
};
21 changes: 21 additions & 0 deletions src/logger/LoadLogger.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "LoadLogger.hpp"
#include "devgui/DevGuiManager.h"
#include "lib.hpp"
#include "nifm.h"
#include "socket.h"
#include "util.h"

void LoadLog::pushTextToVector(const char* text) {
sead::DateTime currentTime = sead::DateTime(0);
sead::CalendarTime calendarTime;
char temp[256];

currentTime.setNow();
currentTime.getCalendarTime(&calendarTime);

if (mTextLines.size() > mMaxListSize)
mTextLines.erase(mTextLines.begin());
snprintf(temp, sizeof(temp), "%02d:%02d:%02d | %s", calendarTime.getHour(), calendarTime.getMinute(), calendarTime.getSecond(), text);

mTextLines.push_back(strdup(temp));
}
Loading

0 comments on commit d64c8dc

Please sign in to comment.