Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
ifdef EVERYTHING
Browse files Browse the repository at this point in the history
  • Loading branch information
Prevter committed Apr 21, 2024
1 parent 72c9551 commit 39a682a
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/geode/hooks/CCDrawNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace openhack::hooks {
// Fix border width being negative (robtop made a mirror portal bug)
borderWidth = abs(borderWidth);

hacks::Hitboxes::modifyDraw((gui::Color &) fillColor, borderWidth, (gui::Color &) borderColor);
ON_WINDOWS(hacks::Hitboxes::modifyDraw((gui::Color &) fillColor, borderWidth, (gui::Color &) borderColor);)
return cocos2d::CCDrawNode::drawPolygon(vertex, count, fillColor, borderWidth, borderColor);
}

Expand All @@ -19,7 +19,7 @@ namespace openhack::hooks {
// Fix border width being negative (robtop made a mirror portal bug)
borderWidth = abs(borderWidth);

hacks::Hitboxes::modifyDraw((gui::Color &) color, borderWidth, (gui::Color &) borderColor);
ON_WINDOWS(hacks::Hitboxes::modifyDraw((gui::Color &) color, borderWidth, (gui::Color &) borderColor);)
return cocos2d::CCDrawNode::drawCircle(position, radius, color, borderWidth, borderColor, segments);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/geode/hooks/CCScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace openhack::hooks {
struct CCSchedulerHook : geode::Modify<CCSchedulerHook, cocos2d::CCScheduler> {
void update(float dt) {
hacks::SpeedHack::update(&dt);
ON_WINDOWS(hacks::SpeedHack::update(&dt);)
cocos2d::CCScheduler::update(dt);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/geode/hooks/EditorUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace openhack::hooks {
struct EditorUIHook : geode::Modify<EditorUIHook, EditorUI> {
void onPlaytest(cocos2d::CCObject* sender) {
EditorUI::onPlaytest(sender);
hacks::HideTriggers::onPlaytest();
ON_WINDOWS(hacks::HideTriggers::onPlaytest();)
}
};
}
4 changes: 2 additions & 2 deletions src/geode/hooks/GJBaseGameLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace openhack::hooks::GJBaseGameLayerHook {
namespace openhack::hooks {
struct GJBaseGameLayerHook2 : geode::Modify<GJBaseGameLayerHook2, GJBaseGameLayer> {
void update(float dt) {
hacks::FrameStepper::gameUpdate(&dt);
ON_WINDOWS(hacks::Display::schedulerUpdate(dt, [&](float dt) {
ON_WINDOWS(hacks::FrameStepper::gameUpdate(&dt);
hacks::Display::schedulerUpdate(dt, [&](float dt) {
GJBaseGameLayer::update(dt);
});)
ON_ANDROID(GJBaseGameLayer::update(dt);)
Expand Down
4 changes: 2 additions & 2 deletions src/geode/hooks/GameStatsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ namespace openhack::hooks {
struct GameStatsManagerHook : geode::Modify<GameStatsManagerHook, GameStatsManager> {
bool isItemUnlocked(UnlockType a, int b) {
bool value = GameStatsManager::isItemUnlocked(a, b);
bool musicUnlocker = config::get("hack.level.music", false);
ON_WINDOWS(bool musicUnlocker = config::get("hack.level.music", false);

if (musicUnlocker && a == UnlockType::GJItem && b == 17)
return true;
return true;)

return value;
}
Expand Down
4 changes: 2 additions & 2 deletions src/geode/hooks/LevelEditorLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ namespace openhack::hooks {
struct LevelEditorLayerHook : geode::Modify<LevelEditorLayerHook, LevelEditorLayer> {
void onStopPlaytest() {
LevelEditorLayer::onStopPlaytest();
hacks::HideTriggers::onStopPlaytest();
ON_WINDOWS(hacks::HideTriggers::onStopPlaytest();)
}

void updateVisibility(float dt) {
LevelEditorLayer::updateVisibility(dt);
hacks::HideTriggers::updateVisibility();
ON_WINDOWS(hacks::HideTriggers::updateVisibility();)
}
};
}
2 changes: 1 addition & 1 deletion src/geode/hooks/MainGameLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace openhack::hooks::MenuGameLayerHook {

struct MenuGameLayerHook2 : geode::Modify<MenuGameLayerHook2, MenuGameLayer> {
void update(float dt) {
// hacks::MenuGameplay::menuUpdate(reinterpret_cast<gd::PlayerObject *>(m_playerObject));
ON_WINDOWS(hacks::MenuGameplay::menuUpdate(reinterpret_cast<gd::PlayerObject *>(m_playerObject));)
MenuGameLayer::update(dt);
}
};
Expand Down
36 changes: 18 additions & 18 deletions src/geode/hooks/PlayLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,58 +17,58 @@
namespace openhack::hooks {
struct PlayLayerHook : geode::Modify<PlayLayerHook, PlayLayer> {
bool init(GJGameLevel *level, bool useReplay, bool dontCreateObjects) {
hacks::Display::playLayerInit(reinterpret_cast<gd::GJGameLevel *>(level));
ON_WINDOWS(hacks::Display::playLayerInit(reinterpret_cast<gd::GJGameLevel *>(level));
hacks::AutoPickupCoins::initLevel();
hacks::StartPosSwitcher::initLevel();
hacks::Labels::playLayerInit();
hacks::SmartStartPos::initLevel();
hacks::SmartStartPos::initLevel();)

if (!PlayLayer::init(level, useReplay, dontCreateObjects))
return false;

hacks::StartPosSwitcher::lateInitLevel();
ON_WINDOWS(hacks::StartPosSwitcher::lateInitLevel();
hacks::Labels::playLayerLateInit();
config::setGlobal("discord_rpc.levelTime", std::time(nullptr));
config::setGlobal("discord_rpc.levelTime", std::time(nullptr));)
return true;
}

void resetLevel() {
hacks::NoclipLimit::resetLevel();
hacks::Labels::beforeResetLevel();
ON_WINDOWS(hacks::NoclipLimit::resetLevel();
hacks::Labels::beforeResetLevel();)
PlayLayer::resetLevel();
hacks::Hitboxes::resetLevel();
ON_WINDOWS(hacks::Hitboxes::resetLevel();
hacks::InstantComplete::resetLevel();
hacks::Display::playLayerReset();
hacks::AutoPickupCoins::resetLevel();
hacks::StartPosSwitcher::resetLevel();
hacks::Zephyrus::PlayLayerResetLevel();
hacks::RandomSeed::resetLevel();)
config::setGlobal("fromPercent", getCurrentPercentInt());
ON_WINDOWS(hacks::Zephyrus::PlayLayerResetLevel();)
hacks::RandomSeed::resetLevel();
}

void addObject(GameObject *object) {
PlayLayer::addObject(object);
hacks::AutoPickupCoins::addObject(reinterpret_cast<gd::GameObject *>(object));
ON_WINDOWS(hacks::AutoPickupCoins::addObject(reinterpret_cast<gd::GameObject *>(object));
hacks::StartPosSwitcher::addObject(reinterpret_cast<gd::GameObject *>(object));
hacks::SmartStartPos::addObject(reinterpret_cast<gd::GameObject *>(object));
hacks::SmartStartPos::addObject(reinterpret_cast<gd::GameObject *>(object));)
}

void destroyPlayer(PlayerObject* player, GameObject* object) {
hacks::NoclipLimit::destroyPlayer(reinterpret_cast<gd::GameObject *>(object));
ON_WINDOWS(hacks::NoclipLimit::destroyPlayer(reinterpret_cast<gd::GameObject *>(object));)
PlayLayer::destroyPlayer(player, object);
hacks::NoclipLimit::postDestroyPlayer();
hacks::Hitboxes::destroyPlayer();
ON_WINDOWS(hacks::NoclipLimit::postDestroyPlayer();
hacks::Hitboxes::destroyPlayer();)
}

void postUpdate(float dt) {
PlayLayer::postUpdate(dt);
hacks::Hitboxes::postUpdate();
hacks::AccuratePercentage::postUpdate();
ON_WINDOWS(hacks::Hitboxes::postUpdate();
hacks::AccuratePercentage::postUpdate();)
}

void fullReset() {
PlayLayer::fullReset();
hacks::Hitboxes::fullReset();
ON_WINDOWS(hacks::Hitboxes::fullReset();)
}

void playEndAnimationToPos(cocos2d::CCPoint pos) {
Expand All @@ -82,7 +82,7 @@ namespace openhack::hooks {
}

void onQuit() {
hacks::AutoSave::onLevelQuit();
ON_WINDOWS(hacks::AutoSave::onLevelQuit();)
PlayLayer::onQuit();
}
};
Expand Down
8 changes: 4 additions & 4 deletions src/geode/hooks/PlayerObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
namespace openhack::hooks {
struct PlayerObjectHook : geode::Modify<PlayerObjectHook, PlayerObject> {
void pushButton(PlayerButton btn) {
ON_WINDOWS(hacks::Zephyrus::PlayerObjectPushButton(reinterpret_cast<gd::PlayerObject*>(this), static_cast<int>(btn));)
hacks::Labels::pushButton(reinterpret_cast<gd::PlayerObject*>(this));
ON_WINDOWS(hacks::Zephyrus::PlayerObjectPushButton(reinterpret_cast<gd::PlayerObject*>(this), static_cast<int>(btn));
hacks::Labels::pushButton(reinterpret_cast<gd::PlayerObject*>(this));)
PlayerObject::pushButton(btn);
}

void releaseButton(PlayerButton btn) {
ON_WINDOWS(hacks::Zephyrus::PlayerObjectReleaseButton(reinterpret_cast<gd::PlayerObject*>(this), static_cast<int>(btn));)
hacks::Labels::releaseButton(reinterpret_cast<gd::PlayerObject*>(this));
ON_WINDOWS(hacks::Zephyrus::PlayerObjectReleaseButton(reinterpret_cast<gd::PlayerObject*>(this), static_cast<int>(btn));
hacks::Labels::releaseButton(reinterpret_cast<gd::PlayerObject*>(this));)
PlayerObject::releaseButton(btn);
}
};
Expand Down
4 changes: 4 additions & 0 deletions src/shared/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace openhack::menu {
}

inline void updateCursorState() {
#ifdef PLATFORM_WINDOWS
bool canShowInLevel = true;
if (auto *playLayer = gd::PlayLayer::get()) {
canShowInLevel = playLayer->m_hasCompletedLevel() ||
Expand All @@ -60,6 +61,7 @@ namespace openhack::menu {
if (config::get<bool>("hack.click_tp.enabled", false)) return;
}
gd::cocos2d::CCEGLView::sharedOpenGLView()->showCursor(isOpened || canShowInLevel);
#endif
}

void toggle() {
Expand Down Expand Up @@ -286,6 +288,8 @@ namespace openhack::menu {

isInitialized = true;

// toggle the menu on android for testing
ON_ANDROID(toggle();)
}

uint8_t firstRunState = 0;
Expand Down

0 comments on commit 39a682a

Please sign in to comment.