Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-Host Multi-Game #344

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions Common/PokemonSV/PokemonSV_MultiHostTable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* Pokemon SV - Multi-Host Table
*
* From: https://github.com/PokemonAutomation/Arduino-Source
*
*/

#ifndef PokemonAutomation_PokemonSwSh_MultiHostTableOption_H
#define PokemonAutomation_PokemonSwSh_MultiHostTableOption_H

#include "Common/Cpp/Options/BooleanCheckBoxOption.h"
#include "Common/Cpp/Options/SimpleIntegerOption.h"
#include "Common/Cpp/Options/TimeExpressionOption.h"
#include "Common/Cpp/Options/EnumDropdownOption.h"
#include "Common/Cpp/Options/EditableTableOption.h"
#include "Common/NintendoSwitch/NintendoSwitch_ControllerDefs.h"
#include "Common/NintendoSwitch/NintendoSwitch_SlotDatabase.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonSV{


class MultiHostSlot : public EditableTableRow{
public:
MultiHostSlot()
: game_slot(GameSlot_Database(), LockWhileRunning::LOCKED, 1)
, user_slot(UserSlot_Database(), LockWhileRunning::LOCKED, 1)
, post_raid_delay(LockWhileRunning::LOCKED, TICKS_PER_SECOND, "0 * TICKS_PER_SECOND")
{
PA_ADD_OPTION(game_slot);
PA_ADD_OPTION(user_slot);
PA_ADD_OPTION(post_raid_delay);
}



virtual std::unique_ptr<EditableTableRow> clone() const override{
std::unique_ptr<MultiHostSlot> ret(new MultiHostSlot());
ret->game_slot.set_value(game_slot.current_value());
ret->user_slot.set_value(user_slot.current_value());
ret->post_raid_delay.set(post_raid_delay.current_text());
return ret;
}

public:
IntegerEnumDropdownCell game_slot;
IntegerEnumDropdownCell user_slot;
TimeExpressionCell<uint16_t> post_raid_delay;
};



class MultiHostTable : public EditableTableOption{
public:
MultiHostTable()
: EditableTableOption("<b>Game List:</b>", LockWhileRunning::LOCKED)
{}
std::vector<std::unique_ptr<MultiHostSlot>> copy_snapshot() const{
return EditableTableOption::copy_snapshot<MultiHostSlot>();
}
virtual std::vector<std::string> make_header() const override{
return std::vector<std::string>{
"Game",
"User",
"Post Raid Delay",
};
}
virtual std::unique_ptr<EditableTableRow> make_row() const override{
return std::unique_ptr<EditableTableRow>(new MultiHostSlot());
}
};






}
}
}
#endif
3 changes: 3 additions & 0 deletions SerialPrograms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ file(GLOB MAIN_SOURCES
../Common/PokemonSwSh/PokemonSwSh_Protocol_EggRoutines.h
../Common/PokemonSwSh/PokemonSwSh_Protocol_GameEntry.h
../Common/PokemonSwSh/PokemonSwSh_Protocol_Misc.h
../Common/PokemonSV/PokemonSV_MultiHostTable.h
../Common/Qt/AutoHeightTable.cpp
../Common/Qt/AutoHeightTable.h
../Common/Qt/AutoWidthLineEdit.cpp
Expand Down Expand Up @@ -1423,6 +1424,8 @@ file(GLOB MAIN_SOURCES
Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.h
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.h
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost-MultiGame.cpp
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost-MultiGame.h
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHostLobbyWaiter.cpp
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHostLobbyWaiter.h
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHostTools.cpp
Expand Down
5 changes: 4 additions & 1 deletion SerialPrograms/SerialPrograms.pro
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ SOURCES += \
Source/PokemonSV/Programs/ShinyHunting/PokemonSV_LetsGoTools.cpp \
Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp \
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp \
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost-MultiGame.cpp \
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHostLobbyWaiter.cpp \
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHostTools.cpp \
Source/PokemonSV/Programs/TeraRaids/PokemonSV_JoinTracker.cpp \
Expand Down Expand Up @@ -1090,6 +1091,7 @@ HEADERS += \
../Common/PokemonSwSh/PokemonSwSh_Protocol_EggRoutines.h \
../Common/PokemonSwSh/PokemonSwSh_Protocol_GameEntry.h \
../Common/PokemonSwSh/PokemonSwSh_Protocol_Misc.h \
../Common/PokemonSV/PokemonSV_MultiHostTable.h \
../Common/Qt/AutoHeightTable.h \
../Common/Qt/AutoWidthLineEdit.h \
../Common/Qt/CodeValidator.h \
Expand Down Expand Up @@ -1736,6 +1738,7 @@ HEADERS += \
Source/PokemonSV/Programs/ShinyHunting/PokemonSV_LetsGoTools.h \
Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.h \
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.h \
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost-MultiGame.h \
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHostLobbyWaiter.h \
Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHostTools.h \
Source/PokemonSV/Programs/TeraRaids/PokemonSV_JoinTracker.h \
Expand Down Expand Up @@ -1961,7 +1964,7 @@ HEADERS += \
Source/ZeldaTotK/Programs/ZeldaTotK_BowItemDuper.h \
Source/ZeldaTotK/Programs/ZeldaTotK_MineruItemDuper.h \
Source/ZeldaTotK/Programs/ZeldaTotK_ParaglideItemDuper.h \
Source/ZeldaTotK/Programs/ZeldaTotK_SurfItemDuper.h \
pifopi marked this conversation as resolved.
Show resolved Hide resolved
Source/ZeldaTotK/Programs/ZeldaTotK_SurfItemDuper.h
Source/ZeldaTotK/Programs/ZeldaTotK_WeaponDuper.h


Expand Down
Loading