forked from Martmists-GH/BDSP_rombase
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworked the way to activate features
- Loading branch information
1 parent
c3e476f
commit 917d9f1
Showing
16 changed files
with
486 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#pragma once | ||
|
||
static constexpr const char* FEATURES[] = { | ||
"Ability Changes", | ||
"Alt Starters", | ||
"Area/Zone Codes", | ||
"Badge Check", | ||
"New Poké Balls", | ||
"Battle Escape Flag", | ||
"Battle Revolver", | ||
"Battle Camera Fix", | ||
"Color Variations", | ||
"Commands", | ||
"Encounter Slots", | ||
"EV/IV in Summary", | ||
"Evolution Methods", | ||
"Extended TM Learnsets", | ||
"Form Change Held Items", | ||
"Gender Neutral Boutique", | ||
"Hidden Power UI", | ||
"Language Select", | ||
"Level Cap", | ||
"NPC Collision Audio", | ||
"Outfit Neutral UI", | ||
"Party Context Menu", | ||
"Poké Radar Fixes", | ||
"Two-Button Pokétch", | ||
"Relearn TMs", | ||
"Controls Remap", | ||
"New Settings", | ||
"Shiny Rates", | ||
"Sound Encounters", | ||
"Swarm Forms", | ||
"Turn Counter", | ||
"Underground Forms", | ||
"Wild Forms", | ||
"Wild Held Item Rates", | ||
}; | ||
|
||
constexpr int FEATURE_COUNT = sizeof(FEATURES) / sizeof(FEATURES[0]); | ||
|
||
static constexpr const char* DEBUG_FEATURES[] = { | ||
"Battle Bundles in UI", | ||
"Boutique Models", | ||
"IL2CPP Logging", | ||
"PokemonInfo Logging", | ||
"Unity Logging", | ||
}; | ||
|
||
constexpr int DEBUG_FEATURE_COUNT = sizeof(DEBUG_FEATURES) / sizeof(DEBUG_FEATURES[0]); | ||
|
||
static constexpr const char* ITEM_FEATURES[] = { | ||
"Ability Patch", | ||
"Everlasting Candies", | ||
"Exp. Share", | ||
"Infinite TMs", | ||
"Leek", | ||
"Infinite Repel", | ||
}; | ||
|
||
constexpr int ITEM_FEATURE_COUNT = sizeof(ITEM_FEATURES) / sizeof(ITEM_FEATURES[0]); | ||
|
||
static constexpr const char* KEY_ITEM_FEATURES[] = { | ||
"Clothing Trunk", | ||
"Incense Burner", | ||
"Infinite Repel", | ||
}; | ||
|
||
constexpr int KEY_ITEM_FEATURE_COUNT = sizeof(KEY_ITEM_FEATURES) / sizeof(KEY_ITEM_FEATURES[0]); | ||
|
||
|
||
static constexpr const char* SMALL_PATCH_FEATURES[] = { | ||
"Affection Toggle", | ||
"Global Exp. Share Toggle", | ||
"Catch Rate Fix", | ||
}; | ||
|
||
constexpr int SMALL_PATCH_FEATURE_COUNT = sizeof(SMALL_PATCH_FEATURES) / sizeof(SMALL_PATCH_FEATURES[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#include "features/activated_features.h" | ||
|
||
#include "data/features.h" | ||
|
||
static bool ACTIVATED_FEATURES[FEATURE_COUNT]; | ||
static bool ACTIVATED_DEBUG_FEATURES[DEBUG_FEATURE_COUNT]; | ||
static bool ACTIVATED_ITEM_FEATURES[ITEM_FEATURE_COUNT]; | ||
static bool ACTIVATED_KEY_ITEM_FEATURES[KEY_ITEM_FEATURE_COUNT]; | ||
static bool ACTIVATED_SMALL_PATCH_FEATURES[SMALL_PATCH_FEATURE_COUNT]; | ||
|
||
void DisableFeatures() | ||
{ | ||
for (bool & i : ACTIVATED_FEATURES) | ||
i = false; | ||
} | ||
|
||
void DisableDebugFeatures() | ||
{ | ||
for (bool & i : ACTIVATED_DEBUG_FEATURES) | ||
i = false; | ||
} | ||
|
||
void DisableItemFeatures() | ||
{ | ||
for (bool & i : ACTIVATED_ITEM_FEATURES) | ||
i = false; | ||
} | ||
|
||
void DisableKeyItemFeatures() | ||
{ | ||
for (bool & i : ACTIVATED_KEY_ITEM_FEATURES) | ||
i = false; | ||
} | ||
|
||
void DisableSmallPatchFeatures() | ||
{ | ||
for (bool & i : ACTIVATED_SMALL_PATCH_FEATURES) | ||
i = false; | ||
} | ||
|
||
void SetActivatedFeature(int feature) | ||
{ | ||
ACTIVATED_FEATURES[feature] = true; | ||
} | ||
|
||
void SetActivatedDebugFeature(int feature) | ||
{ | ||
ACTIVATED_DEBUG_FEATURES[feature] = true; | ||
} | ||
|
||
void SetActivatedItemFeature(int feature) | ||
{ | ||
ACTIVATED_ITEM_FEATURES[feature] = true; | ||
} | ||
|
||
void SetActivatedKeyItemFeature(int feature) | ||
{ | ||
ACTIVATED_KEY_ITEM_FEATURES[feature] = true; | ||
} | ||
|
||
void SetActivatedSmallPatchFeature(int feature) | ||
{ | ||
ACTIVATED_SMALL_PATCH_FEATURES[feature] = true; | ||
} | ||
|
||
bool IsActivatedFeature(int feature) | ||
{ | ||
return ACTIVATED_FEATURES[feature]; | ||
} | ||
|
||
bool IsActivatedDebugFeature(int feature) | ||
{ | ||
return ACTIVATED_DEBUG_FEATURES[feature]; | ||
} | ||
|
||
bool IsActivatedItemFeature(int feature) | ||
{ | ||
return ACTIVATED_ITEM_FEATURES[feature]; | ||
} | ||
|
||
bool IsActivatedKeyItemFeature(int feature) | ||
{ | ||
return ACTIVATED_KEY_ITEM_FEATURES[feature]; | ||
} | ||
|
||
bool IsActivatedSmallPatchFeature(int feature) | ||
{ | ||
return ACTIVATED_SMALL_PATCH_FEATURES[feature]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
|
||
// Disables all features. | ||
void DisableFeatures(); | ||
|
||
// Disables all debug features. | ||
void DisableDebugFeatures(); | ||
|
||
// Disables all items. | ||
void DisableItemFeatures(); | ||
|
||
// Disables all key items. | ||
void DisableKeyItemFeatures(); | ||
|
||
// Disables all small patches. | ||
void DisableSmallPatchFeatures(); | ||
|
||
|
||
// Activate a given feature. | ||
void SetActivatedFeature(int feature); | ||
|
||
// Activate a given debug feature. | ||
void SetActivatedDebugFeature(int feature); | ||
|
||
// Activate a given item. | ||
void SetActivatedItemFeature(int feature); | ||
|
||
// Activate a given key item. | ||
void SetActivatedKeyItemFeature(int feature); | ||
|
||
// Activate a given small patch. | ||
void SetActivatedSmallPatchFeature(int feature); | ||
|
||
|
||
// Check if a given feature is enabled. | ||
bool IsActivatedFeature(int feature); | ||
|
||
// Check if a given debug feature is enabled. | ||
bool IsActivatedDebugFeature(int feature); | ||
|
||
// Check if a given item is enabled. | ||
bool IsActivatedItemFeature(int feature); | ||
|
||
// Check if a given key item is enabled. | ||
bool IsActivatedKeyItemFeature(int feature); | ||
|
||
// Check if a given small patch is enabled. | ||
bool IsActivatedSmallPatchFeature(int feature); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
#include "data/features.h" | ||
#include "data/utils.h" | ||
|
||
#include "features/activated_features.h" | ||
#include "features/debug/debug.h" | ||
|
||
void exl_debug_features_main() { | ||
exl_battle_bundles_in_ui_main(); | ||
exl_boutique_model_main(); | ||
//exl_il2cpp_log_main(); | ||
exl_pokemoninfo_hooks_main(); | ||
//exl_unity_log_main(); | ||
if (IsActivatedDebugFeature(array_index(DEBUG_FEATURES, "Battle Bundles in UI"))) | ||
exl_battle_bundles_in_ui_main(); | ||
if (IsActivatedDebugFeature(array_index(DEBUG_FEATURES, "Boutique Models"))) | ||
exl_boutique_model_main(); | ||
if (IsActivatedDebugFeature(array_index(DEBUG_FEATURES, "IL2CPP Logging"))) | ||
exl_il2cpp_log_main(); | ||
if (IsActivatedDebugFeature(array_index(DEBUG_FEATURES, "PokemonInfo Logging"))) | ||
exl_pokemoninfo_hooks_main(); | ||
if (IsActivatedDebugFeature(array_index(DEBUG_FEATURES, "Unity Logging"))) | ||
exl_unity_log_main(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,17 @@ | ||
#include "exlaunch.hpp" | ||
#include "externals/Dpr/UI/UIBag.h" | ||
|
||
HOOK_DEFINE_REPLACE(SkipTMBreak) { | ||
HOOK_DEFINE_REPLACE(UseWazaMachine_SkipTMBreak) { | ||
static void Callback(Dpr::UI::UIBag::__c__DisplayClass134_0* __this) { | ||
// Return to UseWazaMachine proc | ||
// Skip the text that mentions single-use TMs | ||
__this->_UseWazaMachine_b__3(0); | ||
} | ||
}; | ||
|
||
HOOK_DEFINE_REPLACE(DoNothing) { | ||
static void Callback() { } | ||
}; | ||
|
||
void exl_tms_main() { | ||
SkipTMBreak::InstallAtOffset(0x01be0d40); | ||
|
||
DoNothing::InstallAtOffset(0x01be1220); // Dpr.UI.UIBag.<>c__DisplayClass134_0$$<UseWazaMachine>b__5 | ||
DoNothing::InstallAtOffset(0x01be1460); // Dpr.UI.UIBag.<>c__DisplayClass134_0$$<UseWazaMachine>b__6 | ||
void exl_items_infinite_tms_main() { | ||
UseWazaMachine_SkipTMBreak::InstallAtOffset(0x01be0d40); | ||
|
||
// Skip closing of text popup for reusing | ||
// Skip Dpr.UI.UIMsgWindowController$$CloseMsgWindow call in _UseWazaMachine_b__3 | ||
exl::patch::CodePatcher p(0x01be0fec); | ||
p.WriteInst(exl::armv8::inst::Nop()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,48 @@ | ||
#include "externals/ItemWork.h" | ||
|
||
#include "data/features.h" | ||
#include "data/items.h" | ||
#include "data/utils.h" | ||
|
||
#include "features/activated_features.h" | ||
#include "features/items/items.h" | ||
|
||
HOOK_DEFINE_INLINE(Infinite_Items) { | ||
static void Callback(exl::hook::nx64::InlineCtx* ctx) { | ||
auto itemno = (int32_t)ctx->W[0]; | ||
auto num = (int32_t)ctx->W[1]; | ||
|
||
if (IsActivatedItemFeature(array_index(ITEM_FEATURES, "Everlasting Candies"))) { | ||
if (itemno == array_index(ITEMS, "Everlasting Candy")) { | ||
ctx->W[0] = 0; | ||
return; | ||
} | ||
} | ||
|
||
if (IsActivatedItemFeature(array_index(ITEM_FEATURES, "Infinite TMs"))) { | ||
if (ItemWork::IsWazaMachine(itemno)) { | ||
ctx->W[0] = 0; | ||
return; | ||
} | ||
} | ||
|
||
ctx->W[0] = (uint32_t)ItemWork::SubItem(itemno, num); | ||
} | ||
}; | ||
|
||
void exl_items_changes_main() { | ||
exl_items_ability_patch_main(); | ||
exl_items_everlasting_candies_main(); | ||
exl_items_leek_main(); | ||
if (IsActivatedItemFeature(array_index(ITEM_FEATURES, "Ability Patch"))) | ||
exl_items_ability_patch_main(); | ||
if (IsActivatedItemFeature(array_index(ITEM_FEATURES, "Everlasting Candies"))) | ||
exl_items_everlasting_candies_main(); | ||
if (IsActivatedItemFeature(array_index(ITEM_FEATURES, "Exp. Share"))) | ||
exl_items_exp_share_main(); | ||
if (IsActivatedItemFeature(array_index(ITEM_FEATURES, "Infinite TMs"))) | ||
exl_items_infinite_tms_main(); | ||
if (IsActivatedItemFeature(array_index(ITEM_FEATURES, "Leek"))) | ||
exl_items_leek_main(); | ||
if (IsActivatedItemFeature(array_index(ITEM_FEATURES, "Infinite Repel"))) | ||
exl_items_repel_main(); | ||
|
||
Infinite_Items::InstallAtOffset(0x0185eb8c); | ||
}; |
Oops, something went wrong.