Skip to content

Commit

Permalink
Install NodePose and ScoreSyncStateManager in AppInstaller, keep orig…
Browse files Browse the repository at this point in the history
…inal intact
  • Loading branch information
michael-r-elp authored Aug 30, 2024
1 parent e010565 commit d54b4dc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Hooks/MainSystemBinderHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "Zenject/ConcreteIdBinderNonGeneric.hpp"
#include "Zenject/FromBinderNonGeneric.hpp"
#include "Objects/MpEntitlementChecker.hpp"
#include "NodePoseSyncState/MpNodePoseSyncStateManager.hpp"
#include "ScoreSyncState/MpScoreSyncStateManager.hpp"
// #include "NodePoseSyncState/MpNodePoseSyncStateManager.hpp"
// #include "ScoreSyncState/MpScoreSyncStateManager.hpp"

MAKE_AUTO_HOOK_ORIG_MATCH(MainSystemInit_InstallBindings, &::GlobalNamespace::MainSystemInit::InstallBindings, void, GlobalNamespace::MainSystemInit* self, Zenject::DiContainer* container, bool isRunningFromTests) {
MainSystemInit_InstallBindings(self, container, isRunningFromTests);
Expand All @@ -23,17 +23,17 @@ MAKE_AUTO_HOOK_ORIG_MATCH(MainSystemInit_InstallBindings, &::GlobalNamespace::Ma
auto toarray = Lapiz::ArrayUtils::TypeArray<MultiplayerCore::Objects::MpEntitlementChecker*>();
container->Bind(reinterpret_cast<::System::Collections::Generic::IEnumerable_1<System::Type*>*>(bindarray.convert()))->To(reinterpret_cast<::System::Collections::Generic::IEnumerable_1<System::Type*>*>(toarray.convert()))->FromNewComponentOnRoot()->AsSingle()->NonLazy();

container->Unbind<GlobalNamespace::NodePoseSyncStateManager*>();
container->Unbind<GlobalNamespace::INodePoseSyncStateManager*>();
// container->Unbind<GlobalNamespace::NodePoseSyncStateManager*>();
// container->Unbind<GlobalNamespace::INodePoseSyncStateManager*>();

bindarray = Lapiz::ArrayUtils::TypeArray<MultiplayerCore::NodePoseSyncState::MpNodePoseSyncStateManager*, GlobalNamespace::NodePoseSyncStateManager*, GlobalNamespace::INodePoseSyncStateManager*, Zenject::IInitializable*, System::IDisposable*>();
toarray = Lapiz::ArrayUtils::TypeArray<MultiplayerCore::NodePoseSyncState::MpNodePoseSyncStateManager*>();
container->Bind(reinterpret_cast<::System::Collections::Generic::IEnumerable_1<System::Type*>*>(bindarray.convert()))->To(reinterpret_cast<::System::Collections::Generic::IEnumerable_1<System::Type*>*>(toarray.convert()))->FromNewComponentOnRoot()->AsSingle();
// bindarray = Lapiz::ArrayUtils::TypeArray<MultiplayerCore::NodePoseSyncState::MpNodePoseSyncStateManager*, GlobalNamespace::NodePoseSyncStateManager*, GlobalNamespace::INodePoseSyncStateManager*, Zenject::IInitializable*, System::IDisposable*>();
// toarray = Lapiz::ArrayUtils::TypeArray<MultiplayerCore::NodePoseSyncState::MpNodePoseSyncStateManager*>();
// container->Bind(reinterpret_cast<::System::Collections::Generic::IEnumerable_1<System::Type*>*>(bindarray.convert()))->To(reinterpret_cast<::System::Collections::Generic::IEnumerable_1<System::Type*>*>(toarray.convert()))->FromNewComponentOnRoot()->AsSingle();

container->Unbind<GlobalNamespace::ScoreSyncStateManager*>();
container->Unbind<GlobalNamespace::IScoreSyncStateManager*>();
// container->Unbind<GlobalNamespace::ScoreSyncStateManager*>();
// container->Unbind<GlobalNamespace::IScoreSyncStateManager*>();

bindarray = Lapiz::ArrayUtils::TypeArray<MultiplayerCore::ScoreSyncState::MpScoreSyncStateManager*, GlobalNamespace::ScoreSyncStateManager*, GlobalNamespace::IScoreSyncStateManager*, Zenject::IInitializable*, System::IDisposable*>();
toarray = Lapiz::ArrayUtils::TypeArray<MultiplayerCore::ScoreSyncState::MpScoreSyncStateManager*>();
container->Bind(reinterpret_cast<::System::Collections::Generic::IEnumerable_1<System::Type*>*>(bindarray.convert()))->To(reinterpret_cast<::System::Collections::Generic::IEnumerable_1<System::Type*>*>(toarray.convert()))->FromNewComponentOnRoot()->AsSingle();
// bindarray = Lapiz::ArrayUtils::TypeArray<MultiplayerCore::ScoreSyncState::MpScoreSyncStateManager*, GlobalNamespace::ScoreSyncStateManager*, GlobalNamespace::IScoreSyncStateManager*, Zenject::IInitializable*, System::IDisposable*>();
// toarray = Lapiz::ArrayUtils::TypeArray<MultiplayerCore::ScoreSyncState::MpScoreSyncStateManager*>();
// container->Bind(reinterpret_cast<::System::Collections::Generic::IEnumerable_1<System::Type*>*>(bindarray.convert()))->To(reinterpret_cast<::System::Collections::Generic::IEnumerable_1<System::Type*>*>(toarray.convert()))->FromNewComponentOnRoot()->AsSingle();
}
3 changes: 3 additions & 0 deletions src/Installers/MpAppInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "Patchers/PlayerCountPatcher.hpp"
#include "Repositories/MpStatusRepository.hpp"
#include "NodePoseSyncState/MpNodePoseSyncStateManager.hpp"
#include "ScoreSyncState/MpScoreSyncStateManager.hpp"

#include "Zenject/DiContainer.hpp"
#include "Zenject/FromBinderNonGeneric.hpp"
Expand All @@ -23,6 +24,7 @@ using namespace MultiplayerCore::Patchers;
using namespace MultiplayerCore::Beatmaps::Providers;
using namespace MultiplayerCore::Repositories;
using namespace MultiplayerCore::NodePoseSyncState;
using namespace MultiplayerCore::ScoreSyncState;

namespace MultiplayerCore::Installers {
void MpAppInstaller::InstallBindings() {
Expand All @@ -33,6 +35,7 @@ namespace MultiplayerCore::Installers {
// player stuff
container->BindInterfacesAndSelfTo<MpPlayerManager*>()->AsSingle();
container->BindInterfacesAndSelfTo<MpNodePoseSyncStateManager*>()->AsSingle();
container->BindInterfacesAndSelfTo<MpScoreSyncStateManager*>()->AsSingle();

// beatmap stuff
container->Bind<MpLevelDownloader*>()->ToSelf()->AsSingle();
Expand Down

0 comments on commit d54b4dc

Please sign in to comment.