rename actor, fix merge conflicts, update readme

This commit is contained in:
CraftyBoss
2021-12-12 23:29:18 -08:00
parent d50f603c89
commit 3363b93851
15 changed files with 849 additions and 180 deletions
+3 -1
View File
@@ -7,6 +7,8 @@ S2VER ?= 100
S2VERSTR ?= 1.0.0
S2ROMTYPE ?= US
IP ?= 0.0.0.0 # Put Switch IP Here (for make send)
USER ?= user # Put username here (for make send)
PASS ?= name # put password here (for make send)
PROJNAME ?= StarlightBase
@@ -30,7 +32,7 @@ starlight_patch_$(S2VER)/*.ips: patches/*.slpatch patches/configs/$(S2VER).confi
# NOTE: Make sure you configure sendPatch.py to use your login for ftp servers!
send: all
python3.8 scripts/sendPatch.py $(IP) $(PROJNAME)
python3.8 scripts/sendPatch.py $(IP) $(PROJNAME) $(USER) $(PASS)
clean:
$(MAKE) clean -f MakefileNSO
+12
View File
@@ -14,6 +14,18 @@ The changes in this fork are made incrementally & intentionally, with the goal o
- Python 3
- The [Keystone-Engine](https://www.keystone-engine.org/) Python Module
## Configuration and Setup
Before Building, you should make sure that the default things for the project is properly setup.
For the TCP Logger, you can define `GLOBALDEBUGIP` to set the IP address used for connecting the socket to a server hosted on your local machine.
In the makefile, you can set `IP`, `USER`, and `PASS` to their respective values in order to automatically send builds to an FTP server hosted on a modded switch. Then, whenever you run `make send` you'll build the project and immediately send to the switch.
Creating a custom actor is straight forward thankfully, and there is an example actor in this repository if you wish to start from one already proven working. To add more custom actors, firs you'll need to create the custom actors header and c++ files in their respective folders. Then, create a class that extends `al::LiveActor` and implement the virtual functions used in the example actor. You can then define nerves by using the `NERVE_IMPL` and `NERVE_HEADER` macros used in the [OdysseyDecomp](https://github.com/MonsterDruide1/OdysseyDecomp) project, which I included here for easy nerve defines. Then, after creating your actor, navigate to `al/factory/ActorFactoryEntries100.h` and add in the name of your class, as well as its creation function (do this by simply using al::createCustomActor&ltType&gt in the second parameter for factory entries) to the static table of actor creators.
Once you've handled most of the code for the custom actor, you can either copy an existing object archive from SMO and edit it to your liking, or create an entirely new archive, so long as the archive contains the minimum Init bymls required for an actor (most of the time its InitModel.byml, InitPose.byml, InitClipping.byml, InitExecutor.byml, and InitMaterialLight.byml), and a BFRES model if your actor needs it. Once done, save the archive, and add your custom actor to a stage you wish to have the actor in. From there everything should work and you'll have a custom actor working in Odyssey!
## Building
Build has only been tested on WSL2 running Ubuntu 20.04.1.
+3 -1
View File
@@ -69,7 +69,9 @@ namespace al
} // namespace al
static al::FactoryEntry<al::createActor> actorEntries[] = {
{"DeathBlockBrick", &al::createCustomActor<cal::DeathBlockBrick>},
// CUSTOM ACTOR ENTRIES HERE
{"BlockShine", &al::createCustomActor<ca::BlockShine>},
// VANILLA ACTOR ENTRIES
{"AchievementNpc", &al::createActorFunction<class AchievementNpc>},
{"AirBubble", &al::createActorFunction<class AirBubble>},
{"AirBubbleGenerator", &al::createActorFunction<class AirBubbleGenerator>},
File diff suppressed because it is too large Load Diff
+1
View File
@@ -1,6 +1,7 @@
#pragma once
#include "SendMsg.h"
#include "IsMsg.h"
namespace al
{
+7 -1
View File
@@ -130,10 +130,16 @@ namespace al
char const *getActionName(al::LiveActor const *);
char const *getActionFrame(al::LiveActor const *);
float getActionFrame(al::LiveActor const *);
int getActionFrameMax(al::LiveActor const *);
bool isActionEnd(al::LiveActor const *);
// setters
void setActionFrameRate(al::LiveActor *, float);
void setTransY(al::LiveActor *, float);
void setTrans(al::LiveActor *, sead::Vector3f const &);
+10 -6
View File
@@ -4,13 +4,13 @@
#include "al/util/NerveUtil.h"
#include "logger.hpp"
// cal = custom actor libray
namespace cal
// ca = custom actor(s)
namespace ca
{
class DeathBlockBrick : public al::LiveActor
class BlockShine : public al::LiveActor
{
public:
DeathBlockBrick(const char *name);
BlockShine(const char *name);
virtual void init(al::ActorInitInfo const &) override;
virtual void initAfterPlacement(void) override;
virtual bool receiveMsg(const al::SensorMsg *message, al::HitSensor *source, al::HitSensor *target) override;
@@ -18,13 +18,17 @@ namespace cal
virtual void control(void) override;
void exeWait();
void exeReaction();
void exeReactionHipDrop();
void exeDead();
};
namespace
{
NERVE_HEADER(DeathBlockBrick, Wait)
NERVE_HEADER(DeathBlockBrick, Dead)
NERVE_HEADER(BlockShine, Wait)
NERVE_HEADER(BlockShine, Dead)
NERVE_HEADER(BlockShine, Reaction)
NERVE_HEADER(BlockShine, ReactionHipDrop)
}
}
+3 -15
View File
@@ -1,10 +1,6 @@
[version=100, target=main]
StageScene::control+18:
BL stageSceneHook
<<<<<<< HEAD
=======
>>>>>>> d9f97d1785079d0fc96363d314c2b13c6bd6c5f2
4C8648: // hook to the init of a stage to modify certain conditions (we also have access to SceneInitInfo)
BL stageInitHook
@@ -13,7 +9,6 @@ StageScene::control+18:
BL tryInitSocket
B59E28: // sead::system::print
B seadPrintHook
<<<<<<< HEAD
5359DC:
MOV X0, X19 // move GameSystem to arg register
BL setupDebugMenu
@@ -26,19 +21,12 @@ B59E28: // sead::system::print
//50E89C:
// BL threadInit
=======
>>>>>>> d9f97d1785079d0fc96363d314c2b13c6bd6c5f2
//4C8958:
// BL initDebugListHook
<<<<<<< HEAD
1B3F0C: // disables call to open HTML viewer during first time odyssey flight
NOP
=======
50E89C:
BL threadInit
>>>>>>> d9f97d1785079d0fc96363d314c2b13c6bd6c5f2
1F2A2C: // patches checkpoint system to always allow warping
MOV W0, #1
@@ -55,6 +43,6 @@ B59E28: // sead::system::print
RET
// Snapshot Button Disabling
576FB8: // rs::isTriggerSnapShotMode
MOV X0, #0
RET
//576FB8: // rs::isTriggerSnapShotMode
// MOV X0, #0
// RET
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4 -11
View File
@@ -37,10 +37,9 @@ if '.' not in consoleIP:
consolePort = 5000
if len(sys.argv) < 2:
projName = 'StarlightBase'
else:
projName = sys.argv[1]
projName = sys.argv[2]
username = sys.argv[3]
password = sys.argv[4]
curDir = os.curdir
@@ -49,7 +48,7 @@ ftp = FTP()
print(f'Connecting to {consoleIP}... ', end='')
ftp.connect(consoleIP, consolePort)
print('logging into server...', end='')
ftp.login('username','password') # put username and password in here
ftp.login(username, password)
print('Connected!')
patchDirectories = []
@@ -74,9 +73,6 @@ for patchDir in patchDirectories:
sdPath = f'/atmosphere/exefs_patches/{projName}/{file}'
print(f'Sending "{sdPath}" to {consoleIP}.')
ftp.storbinary(f'STOR {sdPath}', open(fullPath, 'rb'))
if isNeedOtherSwitch:
print(f'Sending "{sdPath}" to {altSwitchIP}.')
otherftp.storbinary(f'STOR {sdPath}', open(fullPath, 'rb'))
ensuredirectory(ftp, '/atmosphere', 'contents')
ensuredirectory(ftp, '/atmosphere/contents', '0100000000010000')
@@ -88,6 +84,3 @@ if os.path.isfile(binaryPath):
sdPath = f'/atmosphere/contents/0100000000010000/exefs/subsdk1'
print(f'Sending "{sdPath}" to {consoleIP}.')
ftp.storbinary(f'STOR {sdPath}', open(binaryPath, 'rb'))
if isNeedOtherSwitch:
print(f'Sending "{sdPath}" to {altSwitchIP}.')
otherftp.storbinary(f'STOR {sdPath}', open(binaryPath, 'rb'))
+48 -14
View File
@@ -1,10 +1,10 @@
#include "customLiveActor.hpp"
namespace cal
namespace ca
{
DeathBlockBrick::DeathBlockBrick(const char *name) : al::LiveActor(name) {}
BlockShine::BlockShine(const char *name) : al::LiveActor(name) {}
void DeathBlockBrick::init(al::ActorInitInfo const &info)
void BlockShine::init(al::ActorInitInfo const &info)
{
al::initMapPartsActor(this, info, nullptr);
@@ -14,28 +14,34 @@ namespace cal
this->makeActorAlive();
}
void DeathBlockBrick::initAfterPlacement(void)
void BlockShine::initAfterPlacement(void)
{
return;
}
bool DeathBlockBrick::receiveMsg(const al::SensorMsg *message, al::HitSensor *source, al::HitSensor *target)
bool BlockShine::receiveMsg(const al::SensorMsg *message, al::HitSensor *source, al::HitSensor *target)
{
if (al::isSensorPlayerAttack(target))
if (rs::isMsgUpperPunchAll(message))
{
// do something
al::setNerve(this, &nrvReaction);
return true;
}
else if (rs::isMsgPlayerAndCapHipDropAll(message))
{
al::setNerve(this, &nrvReactionHipDrop);
return true;
}
return false;
}
bool DeathBlockBrick::attackSensor(al::HitSensor *target, al::HitSensor *source)
bool BlockShine::attackSensor(al::HitSensor *target, al::HitSensor *source)
{
return false;
}
void DeathBlockBrick::control(void) { return; }
void BlockShine::control(void) { return; }
void DeathBlockBrick::exeWait()
void BlockShine::exeWait()
{
if (al::isFirstStep(this))
{
@@ -43,18 +49,46 @@ namespace cal
}
}
void DeathBlockBrick::exeDead()
void BlockShine::exeReaction()
{
if (al::isFirstStep(this))
{
// do something
al::startAction(this, "Reaction");
al::setActionFrameRate(this, 0.6);
}
else if (al::isActionEnd(this))
{
al::setNerve(this, &nrvDead);
}
}
void BlockShine::exeReactionHipDrop()
{
if (al::isFirstStep(this))
{
al::startAction(this, "ReactionHipDrop");
al::setActionFrameRate(this, 0.6);
}
else if (al::isActionEnd(this))
{
al::setNerve(this, &nrvDead);
}
}
void BlockShine::exeDead()
{
if (al::isFirstStep(this))
{
this->kill();
}
}
namespace
{
NERVE_IMPL(DeathBlockBrick, Wait)
NERVE_IMPL(DeathBlockBrick, Dead)
NERVE_IMPL(BlockShine, Wait)
NERVE_IMPL(BlockShine, Reaction)
NERVE_IMPL(BlockShine, ReactionHipDrop)
NERVE_IMPL(BlockShine, Dead)
} // namespace
} // namespace cal
-73
View File
@@ -2,7 +2,6 @@
Logger *gLogger;
<<<<<<< HEAD
void Logger::init()
{
in_addr hostAddress = {0};
@@ -93,77 +92,5 @@ bool Logger::pingSocket()
void tryInitSocket()
{
__asm("STR X20, [X8,#0x18]");
// note that this uses a different port, because running the debug logger must use a different server that only accepts strings instead of packets (im lazy like that)
gLogger = new Logger(GLOBALDEBUGIP, 3080, "MainLogger"); // PLACE LOCAL PC IP ADDRESS HERE
=======
void Logger::init() {
in_addr hostAddress = { 0 };
sockaddr serverAddress = { 0 };
if (this->socket_log_state != SOCKET_LOG_UNINITIALIZED)
return;
nn::nifm::Initialize();
nn::nifm::SubmitNetworkRequest();
while (nn::nifm::IsNetworkRequestOnHold()) { }
if (!nn::nifm::IsNetworkAvailable()) {
this->socket_log_state = SOCKET_LOG_UNAVAILABLE;
return;
}
// nn::socket::Initialize(socket_data_pool, 0x600000, 0x20000, 14);
if ((this->socket_log_socket = nn::socket::Socket(2, 1, 0)) < 0) {
this->socket_log_state = SOCKET_LOG_UNAVAILABLE;
return;
}
nn::socket::InetAton(this->sock_ip, &hostAddress);
serverAddress.address = hostAddress;
serverAddress.port = nn::socket::InetHtons(this->port);
serverAddress.family = 2;
if (nn::socket::Connect(this->socket_log_socket, &serverAddress, sizeof(serverAddress)) != 0) {
this->socket_log_state = SOCKET_LOG_UNAVAILABLE;
return;
}
this->socket_log_state = SOCKET_LOG_CONNECTED;
}
void Logger::LOG(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
char buf[0x500];
if (nn::util::VSNPrintf(buf, sizeof(buf), fmt, args) > 0) {
char prefix[0x100];
nn::util::SNPrintf(prefix, sizeof(prefix), "[%s] %s", this->sockName, buf);
socket_log(prefix);
}
va_end(args);
}
void Logger::LOG(const char *fmt, va_list args) { // impl for replacing seads system::print
char buf[0x500];
if (nn::util::VSNPrintf(buf, sizeof(buf), fmt, args) > 0) {
socket_log(buf);
}
>>>>>>> d9f97d1785079d0fc96363d314c2b13c6bd6c5f2
}
s32 Logger::READ(char *out) {
return this->socket_read_char(out);
}
void tryInitSocket() {
__asm("STR X20, [X8,#0x18]");
//gLogger = new Logger("10.0.0.224", 1337, "MainLogger"); // Home IP
gLogger = new Logger("192.168.1.75", 1337, "MainLogger"); // Apartment IP
}
+36 -58
View File
@@ -8,185 +8,163 @@ namespace sead
{
namespace system
{
void* NewImpl(Heap* heap, size_t size, s32 alignment, bool abortOnFailure);
void DeleteImpl(void* ptr);
} // namespace system
} // namespace sead
void *NewImpl(Heap *heap, size_t size, s32 alignment, bool abortOnFailure);
void DeleteImpl(void *ptr);
} // namespace system
} // namespace sead
// operator new(size_t)
void* operator new(size_t size)
void *operator new(size_t size)
{
return sead::system::NewImpl(nullptr, size, 8, true);
}
void* operator new[](size_t size)
void *operator new[](size_t size)
{
return sead::system::NewImpl(nullptr, size, 8, true);
}
<<<<<<< HEAD
void* operator new(size_t size, const std::nothrow_t&) noexcept
void *operator new(size_t size, const std::nothrow_t &) noexcept
{
return sead::system::NewImpl(nullptr, size, 8, false);
}
void* operator new[](size_t size, const std::nothrow_t&) noexcept
void *operator new[](size_t size, const std::nothrow_t &) noexcept
{
return sead::system::NewImpl(nullptr, size, 8, false);
}
=======
>>>>>>> d9f97d1785079d0fc96363d314c2b13c6bd6c5f2
// operator new(size_t, s32 alignment)
void* operator new(size_t size, s32 alignment)
void *operator new(size_t size, s32 alignment)
{
return sead::system::NewImpl(nullptr, size, alignment, true);
}
void* operator new[](size_t size, s32 alignment)
void *operator new[](size_t size, s32 alignment)
{
return sead::system::NewImpl(nullptr, size, alignment, true);
}
<<<<<<< HEAD
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
{
return sead::system::NewImpl(nullptr, size, alignment, false);
}
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
{
return sead::system::NewImpl(nullptr, size, alignment, false);
}
=======
>>>>>>> d9f97d1785079d0fc96363d314c2b13c6bd6c5f2
// operator new(size_t, sead::Heap*, s32 alignment)
void* operator new(size_t size, sead::Heap* heap, s32 alignment)
void *operator new(size_t size, sead::Heap *heap, s32 alignment)
{
return sead::system::NewImpl(heap, size, alignment, true);
}
void* operator new[](size_t size, sead::Heap* heap, s32 alignment)
void *operator new[](size_t size, sead::Heap *heap, s32 alignment)
{
return sead::system::NewImpl(heap, size, alignment, true);
}
<<<<<<< HEAD
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
{
return sead::system::NewImpl(heap, size, alignment, false);
}
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
{
return sead::system::NewImpl(heap, size, alignment, false);
}
// operator new(size_t, sead::Heap*, const std::nothrow_t&)
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
{
return sead::system::NewImpl(heap, size, 8, false);
}
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
{
return sead::system::NewImpl(heap, size, 8, false);
}
=======
// operator new(size_t, sead::Heap*, const std::nothrow_t&)
>>>>>>> d9f97d1785079d0fc96363d314c2b13c6bd6c5f2
// operator delete(void*)
void operator delete(void* ptr) noexcept
void operator delete(void *ptr) noexcept
{
sead::system::DeleteImpl(ptr);
}
void operator delete[](void* ptr) noexcept
void operator delete[](void *ptr) noexcept
{
sead::system::DeleteImpl(ptr);
}
<<<<<<< HEAD
void operator delete(void* ptr, const std::nothrow_t&) noexcept
void operator delete(void *ptr, const std::nothrow_t &) noexcept
{
sead::system::DeleteImpl(ptr);
}
void operator delete[](void* ptr, const std::nothrow_t&) noexcept
void operator delete[](void *ptr, const std::nothrow_t &) noexcept
{
sead::system::DeleteImpl(ptr);
}
=======
>>>>>>> d9f97d1785079d0fc96363d314c2b13c6bd6c5f2
// operator delete(void*, s32)
void operator delete(void* ptr, s32)
void operator delete(void *ptr, s32)
{
sead::system::DeleteImpl(ptr);
}
void operator delete[](void* ptr, s32)
void operator delete[](void *ptr, s32)
{
sead::system::DeleteImpl(ptr);
}
<<<<<<< HEAD
void operator delete(void* ptr, s32, const std::nothrow_t&) noexcept
void operator delete(void *ptr, s32, const std::nothrow_t &) noexcept
{
sead::system::DeleteImpl(ptr);
}
void operator delete[](void* ptr, s32, const std::nothrow_t&) noexcept
void operator delete[](void *ptr, s32, const std::nothrow_t &) noexcept
{
sead::system::DeleteImpl(ptr);
}
// operator delete(void*, sead::Heap*, const std::nothrow_t&)
void operator delete(void* ptr, sead::Heap*, const std::nothrow_t&) noexcept
void operator delete(void *ptr, sead::Heap *, const std::nothrow_t &) noexcept
{
sead::system::DeleteImpl(ptr);
}
void operator delete[](void* ptr, sead::Heap*, const std::nothrow_t&) noexcept
void operator delete[](void *ptr, sead::Heap *, const std::nothrow_t &) noexcept
{
sead::system::DeleteImpl(ptr);
}
=======
// operator delete(void*, sead::Heap*, const std::nothrow_t&)
>>>>>>> d9f97d1785079d0fc96363d314c2b13c6bd6c5f2
// operator delete(void*, sead::Heap*, s32)
void operator delete(void* ptr, sead::Heap*, s32)
void operator delete(void *ptr, sead::Heap *, s32)
{
sead::system::DeleteImpl(ptr);
}
void operator delete[](void* ptr, sead::Heap*, s32)
{
sead::system::DeleteImpl(ptr);
<<<<<<< HEAD
}
void operator delete(void* ptr, sead::Heap*, s32, const std::nothrow_t&) noexcept
void operator delete[](void *ptr, sead::Heap *, s32)
{
sead::system::DeleteImpl(ptr);
}
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
{
sead::system::DeleteImpl(ptr);
}
void operator delete[](void *ptr, sead::Heap *, s32, const std::nothrow_t &) noexcept
{
sead::system::DeleteImpl(ptr);
=======
>>>>>>> d9f97d1785079d0fc96363d314c2b13c6bd6c5f2
}