Skip to content

Commit

Permalink
Merge pull request #61 from speyejack/main
Browse files Browse the repository at this point in the history
Release v1.4.0
  • Loading branch information
speyejack authored Sep 27, 2023
2 parents cdac0a8 + ca5cef2 commit ad79fe1
Show file tree
Hide file tree
Showing 20 changed files with 430 additions and 183 deletions.
6 changes: 3 additions & 3 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ inputs:
required : false
default : ''
emu:
description : 'what system the build is for: Switch, Ryujinx or yuzu'
description : 'what system the build is for: Switch or Emulators'
required : false
default : 'Switch'

Expand Down Expand Up @@ -62,9 +62,9 @@ runs:
;
cp -r ./romfs/ ./starlight_patch_100/atmosphere/contents/0100000000010000/.
-
name : Yuzu
name : Emulators
shell : bash
if : ${{ inputs.emu == 'yuzu' }}
if : ${{ inputs.emu == 'Emulators' }}
run: |
cd ./starlight_patch_100/
mkdir ./SMOO/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
build:
strategy:
matrix:
emu : [ Switch, Ryujinx, yuzu ]
emu : [ Switch, Emulators ]
runs-on: ubuntu-latest
steps:
-
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ jobs:
build:
strategy:
matrix:
emu : [ Switch, Ryujinx, yuzu ]
emu : [ Switch, Emulators ]
runs-on: ubuntu-latest
outputs:
filename1: ${{ steps.set-output.outputs.filename-Switch }}
filename2: ${{ steps.set-output.outputs.filename-Ryujinx }}
filename3: ${{ steps.set-output.outputs.filename-yuzu }}
filename2: ${{ steps.set-output.outputs.filename-Emulators }}
steps:
-
name : Checkout
Expand Down Expand Up @@ -73,19 +72,12 @@ jobs:
upload_url : ${{ steps.release.outputs.upload_url }}
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
-
name : Attach build artifacts to release (Ryujinx)
name : Attach build artifacts to release (Emulators)
uses : ./.github/actions/attach
with:
filename : ${{ needs.build.outputs.filename2 }}
upload_url : ${{ steps.release.outputs.upload_url }}
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
-
name : Attach build artifacts to release (yuzu)
uses : ./.github/actions/attach
with:
filename : ${{ needs.build.outputs.filename3 }}
upload_url : ${{ steps.release.outputs.upload_url }}
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}

move:
needs: attach
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ jobs:
build:
strategy:
matrix:
emu : [ Switch, Ryujinx, yuzu ]
emu : [ Switch, Emulators ]
runs-on: ubuntu-latest
outputs:
filename1: ${{ steps.set-output.outputs.filename-Switch }}
filename2: ${{ steps.set-output.outputs.filename-Ryujinx }}
filename3: ${{ steps.set-output.outputs.filename-yuzu }}
filename2: ${{ steps.set-output.outputs.filename-Emulators }}
steps:
-
name : Checkout
Expand Down Expand Up @@ -60,16 +59,9 @@ jobs:
upload_url : ${{ steps.release.outputs.upload_url }}
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
-
name : Attach build artifacts to release (Ryujinx)
name : Attach build artifacts to release (Emulators)
uses : ./.github/actions/attach
with:
filename : ${{ needs.build.outputs.filename2 }}
upload_url : ${{ steps.release.outputs.upload_url }}
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
-
name : Attach build artifacts to release (yuzu)
uses : ./.github/actions/attach
with:
filename : ${{ needs.build.outputs.filename3 }}
upload_url : ${{ steps.release.outputs.upload_url }}
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ emu:
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)
python3 scripts/sendPatch.py $(IP) $(PROJNAME)

log: all
python3.8 scripts/tcpServer.py $(SERVERIP)
python3 scripts/tcpServer.py $(SERVERIP)

sendlog: all
python3.8 scripts/sendPatch.py $(IP) $(PROJNAME) $(USER) $(PASS)
python3.8 scripts/tcpServer.py $(SERVERIP)
python3 scripts/sendPatch.py $(IP) $(PROJNAME) $(USER) $(PASS)
python3 scripts/tcpServer.py $(SERVERIP)

clean:
$(MAKE) clean -f MakefileNSO
@rm -fr starlight_patch_*
@rm -fr starlight_patch_*
68 changes: 25 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,63 +10,45 @@ Welcome to the official repository for the Super Mario Odyssey Online mod! Have
* 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
## Installation and Usage
For the typical installation along with how to setup and use muliplayer/hide and seek, please visit the [Super Mario Odyssey Online website](https://smoo.it).

* 1.0
<details>

## Installation Tutorial
<summary>Developer build instructions</summary>

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!
### Building Prerequisites

1. Download the latest mod build from either [Gamebanana](https://gamebanana.com/mods/384214) 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.)
- [devkitPro](https://devkitpro.org/)
- Python 3
- The [Keystone-Engine](https://www.keystone-engine.org/) Python Module

## 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).
### Building

## 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
Build has only been tested on WSL2 running Ubuntu 20.04.1.

## Building Prerequisites
Just run:
```
DEVKITPRO={path_to_devkitpro} make
```

- [devkitPro](https://devkitpro.org/)
- Python 3
- The [Keystone-Engine](https://www.keystone-engine.org/) Python Module
On Ubuntu (and other Debian-based systems), devkitPro will be installed to `/opt/devkitpro` by default:

## Building
```
DEVKITPRO=/opt/devkitpro/ make
```

Build has only been tested on WSL2 running Ubuntu 20.04.1.
### Installing (Atmosphère)

Just run:
```
DEVKITPRO={path_to_devkitpro} make
```
After a successful build, simply transfer the `atmosphere` folder located inside `starlight_patch_100` to the root of your switch's SD card.
</details>

On Ubuntu (and other Debian-based systems), devkitPro will be installed to `/opt/devkitpro` by default:
## Troubleshooting

```
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.
The [Super Mario Odyssey Online website](https://smoo.it) has a FAQ section that should solve many issues.
However, for any further questions or help not covered by the site, please visit the [CraftyBoss Community Discord Server](discord.gg/jYCueK2BqD) and ask in the `help`/`help-2` channel.

---

Expand Down
4 changes: 2 additions & 2 deletions include/game/System/GameSystemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ namespace al {
al::GameDrawInfo *mDrawInfo; // 0x38 from Application::sInstance + 0x30
ProjectNfpDirector *mProjNfpDirector; // 0x48
al::HtmlViewer *mHtmlViewer; // 0x50
ApplicationMessageReceiver *mMessageReciever; // 0x58
ApplicationMessageReceiver *mMessageReceiver; // 0x58
al::WaveVibrationHolder *mWaveVibrationHolder; // 0x60
void *gap2;
};
}
}
12 changes: 12 additions & 0 deletions include/nn/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

#include "../types.h"

struct pollfd
{
s32 fd;
s16 events;
s16 revents;
};

struct in_addr
{
Expand Down Expand Up @@ -38,13 +44,19 @@ 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 SendTo(s32 socket, const void* data, ulong dataLen, s32 flags, const struct sockaddr* to, u32 toLen);
s32 Recv(s32 socket, void* out, ulong outLen, s32 flags);
s32 RecvFrom(s32 socket, void* out, ulong outLen, s32 flags, struct sockaddr* from, u32* fromLen);

s32 GetSockName(s32 socket, struct sockaddr* name, u32* dataLen);
u16 InetHtons(u16 val);
u16 InetNtohs(u16 val);
s32 InetAton(const char* addressStr, in_addr* addressOut);

struct hostent* GetHostByName(const char* name);

u32 GetLastErrno();
s32 Bind(s32 fd, sockaddr* addr, u32 addrlen);
s32 Poll(struct pollfd* fd, u64 addr, s32 timeout);

} }
7 changes: 7 additions & 0 deletions include/packets/HolePunchPacket.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include "Packet.h"

struct PACKED HolePunch : Packet {
HolePunch() : Packet() {this->mType = PacketType::HOLEPUNCH; mPacketSize = sizeof(HolePunch) - sizeof(Packet);};
};
10 changes: 8 additions & 2 deletions include/packets/Packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ enum PacketType : short {
CAPTUREINF,
CHANGESTAGE,
CMD,
UDPINIT,
HOLEPUNCH,
End // end of enum for bounds checking
};

Expand All @@ -43,7 +45,9 @@ USED static const char *packetNames[] = {
"Moon Collection",
"Capture Info",
"Change Stage",
"Server Command"
"Server Command",
"Udp Initialization",
"Hole punch",
};

enum SenderType {
Expand Down Expand Up @@ -83,4 +87,6 @@ struct PACKED Packet {
#include "packets/CaptureInf.h"
#include "packets/HackCapInf.h"
#include "packets/ChangeStagePacket.h"
#include "packets/InitPacket.h"
#include "packets/InitPacket.h"
#include "packets/UdpPacket.h"
#include "packets/HolePunchPacket.h"
8 changes: 8 additions & 0 deletions include/packets/UdpPacket.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

#include "Packet.h"

struct PACKED UdpInit : Packet {
UdpInit() : Packet() {this->mType = PacketType::UDPINIT; mPacketSize = sizeof(UdpInit) - sizeof(Packet);};
u16 port = 0;
};
4 changes: 3 additions & 1 deletion include/server/Client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ class Client {
void updateTagInfo(TagInf *packet);
void updateCaptureInfo(CaptureInf* packet);
void sendToStage(ChangeStagePacket* packet);
void sendUdpHolePunch();
void sendUdpInit();
void disconnectPlayer(PlayerDC *packet);

PuppetInfo* findPuppetInfo(const nn::account::Uid& id, bool isFindAvailable);
Expand All @@ -214,7 +216,7 @@ class Client {

// --- Server Syncing Members ---

// array of shine IDs for checking if multiple shines have been collected in quick sucession, all moons within the players stage that match the ID will be deleted
// array of shine IDs for checking if multiple shines have been collected in quick succession, all moons within the players stage that match the ID will be deleted
sead::SafeArray<int, 128> curCollectedShines;
int collectedShineCount = 0;

Expand Down
16 changes: 15 additions & 1 deletion include/server/SocketClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ class SocketClient : public SocketBase {

bool startThreads();
void endThreads();
void waitForThreads();

bool send(Packet* packet);
bool recv();

bool queuePacket(Packet *packet);
void trySendQueue();
bool trySendQueue();

void sendFunc();
void recvFunc();
Expand All @@ -46,6 +47,10 @@ class SocketClient : public SocketBase {
void printPacket(Packet* packet);
bool isConnected() { return socket_log_state == SOCKET_LOG_CONNECTED; }

u16 getLocalUdpPort();
s32 setPeerUdpPort(u16 port);
const char* getUdpStateChar();

u32 getSendCount() { return mSendQueue.getCount(); }
u32 getSendMaxCount() { return mSendQueue.getMaxCount(); }

Expand All @@ -67,11 +72,20 @@ class SocketClient : public SocketBase {

sead::MessageQueue mRecvQueue;
sead::MessageQueue mSendQueue;
char* recvBuf = nullptr;

int maxBufSize = 100;
bool mIsFirstConnect = true;
bool mPacketQueueOpen = true;
int pollTime = 0;


bool mHasRecvUdp;
s32 mUdpSocket;
sockaddr mUdpAddress;

bool recvTcp();
bool recvUdp();

/**
* @param str a string containing an IPv4 address or a hostname that can be resolved via DNS
Expand Down
Loading

0 comments on commit ad79fe1

Please sign in to comment.