mirror of https://github.com/pret/pokeemerald.git
Page:
Add In‐Cart Rumble
Pages
Ability Switcher via special
Add A PokeVial Item
Add Ability to Avoid Battle Damage in Debug Menu
Add Ability to Swap Bikes Whenever
Add Choice Specs Scarf hold item effects
Add Description Submenu
Add Difficulty Mode
Add In‐Cart Rumble
Add Nuzlocke Challenge
Add PC Access in PokeNav
Add Physical Special Split
Add Sleep Mode
Add Thief Ball
Add a EV IV Stat Editor UI
Add a debug menu
Adding Multi region Support
Adding Support for Connectivity with Other Hacks Whilst Maintaining Connectivity with Vanilla
Adding Time Based Encounters
Adding Walking Animations to All NPCs
Adding a New Trainer Class
Adding a New Trainer Front Picture
Adding a Pokémon Type & Disabling the Mystery Type
Adding new event object or overworld sprites
All Trees Permanently Get Cut
Allow All Pokemon to Evolve Without Trading
Allow Both Latios and Latias Appear.
Allow Feebas to be caught on any Valid Fishing Spot in Route 119 rather than only Three
Allow Jumping Over Ledges with Acro Bike
Allow Move Relearner to Teach Moves that Pre Evolutions Know
Allow Running From Trainer Battles
Allow running indoors
Amulet Coin Effects If Anyone In Party is Holding It
Automatically make the keyboard switch to lowercase after the first character
Better White Out Money Calculation
Button Press to Skip Copyright Screen
Chain Fishing
Change Enemy Trainer Parties Depending on Difficulty
Change Someone's PC to Lanette's PC from the Start of the Game
Change Starter Pokémon
Change Time Based Evolution Times
Change initial PC items
Changing the Battle Music Depending on the Opponent
Colored stats by nature in summary screen
Converting to FR Tilesets
Custom Battle Mugshots
Custom Border Dimensions
Debugging using gdb (Windows, WSL2, Visual Studio Code mGBA)
Debugging using printf
Disable Bag Use In Battle
Disable Catching Pokemon
Disable Pokémon animation on Birch's intro Pokémon
Disabling Union Room check when entering Pokémon Centers
Dynamic Trade Names
Dynamic overworld palette system
Enable the Reset RTC Feature
Enable trade with FRLG without beating the game
Expanding The Metatile Count
Extra save space with three lines of code
Faster HP Drain
Feature Branches
Fish Will Now Always Get on Hook
Fix AI's Switch In Battle
Fix Snow Weather
Fixing the aspect ratio of the Pokémon logo on the title screen
Forcing Battle Animations for Major Battles
Full Screen Start Menu by Archie and Mudskip
Gen 6 Exp Share
Gen 6 style Exp. Share Alternative Option
Get Match Calls Only If Caller Wants a Rematch
Get Rid of Battery Run Dry Error Message
Get Rid of Pokemon Disobeying You
Holding Select Allows For A Second Register Item
Home
How the Game Works
How to Support Savefile Backwards Compatibility
How to add a new Pokémon species
How to add a new ability
How to add a new region map
How to create a new regular trainer battle
How to delete a map
Implement Missing Text Function RESET_FONT
Implementing Catch EXP
Implementing ipatix's High Quality Audio Mixer
Implementing the “textcolor” script command from FRLG and give object events their own text colour
Improve Partner Battle Code
Improve the Loading of Battle Terrain
Improving the WaitForVBlank function
Increase money limit
Infinite TM usage
Instead of Asking to Stop learning a New Move, You'll be Asked to Continue Learning
Item Automatically Goes to PC if Bag is Full
Keep the Camera from Making Waves
LGPE Style Bonus Premier Balls
Learn moves upon evolution
List Menu Text Coloring
Make Cleanse Tag Avoid All Wild Encounters and Usable If Held By Anyone in Your Party; Make PokeDoll Do the Same for Trainers Seeing You
Make Daycare Faster at Leveling Pokémon
Make Key Items That Cannot Be Used In The Field Not Show A Use or Register Option
Make L Button Be Turbo A When L=A Option Is Set
Make Ledge Jumps Check Collision
Make Move Relearner Teach Egg Moves With A Flag
Make Multiple Secret Bases
Make Norman's Slaking Have Ability Intimidate
Make Pokemon Not Heal When Going into PC
Make Pokemon that Require a Fateful Encounter to be Legal to Always Be Set to Legal
Make space for EWRAM Data for Summary screen
Make the Bag Able to Hold 120 Items Instead of 30
Make the Person in the Intro Match the the Save File
Map Based Trainer Battle Music
Move Item
Multipage Options Menu
Name Rater Allows Traded Pokemon to be Renamed
New Birch's Briefcase With Fully Custom Starters by Archie and Mudskip
New Custom Menu Border Themes (Basic)
New Main Menu UI With Mugshot by Archie and Mudskip
New Options Plus ‐ Multipage Options Menu with Faster Text, HP‐EXP Bar Speeds and Metric
Nickname your Pokémon from the party menu
Not showing dex entries until getting the Pokédex
Omnidirectional Jump
Optimization ‐ Remove Expensive and Redundant `BuildColorMaps()` Function
Option to Skip Copyright and Intro
Overview: Items and their Effects
Overview: The Party Menu
Overview∶ The Game Loop
Overview∶ The Task System
Per Shop\Mart Item Prices
Plural Giveitem
Pokecenters Disregard Eggs
Prompt for reusing Repels
Push B in wild battle moves to Run
Push B to Toggle Running Shoes
Pushing B When Asked To Stop Learning Move Will Cancel Teaching The Move
Quickly Run from a Battle by Holding Right While the Wild Pokémon's Name Appears
Raise Odds of Catching a Pokemon by Pressing B When the Ball Shakes
Random Info, Tips, and Tricks
Reflections
Remove 'Select' Sound From Specific Map Events
Remove Warp Fadescreen
Remove badge boosts
Remove the backup save file
Remove the extra save confirmation
Remove the functionally redundant move grammar tables
Repeated Field Medicine Use
Reuse filler save space for Variables and Flags
Revert Brendan May Sprites to Ruby Sapphire
Set Metatile IDs From Another Map
Set Up Item Balls on a Map Without Needing New Scripts
Shifting to Pokémon Already in Battle Exits the Shift Menu
Shiny Creation With a Flag
Shop Items By Badge Count
Show IVs EVs in Summary Screen
Show Species That You're Switching For in the Party Menu
Show Type Effectiveness In Battle Using Pre Existing Function and Disable in Option Menu
Show a throbber animation while the game is saving
Shuckle makes Berry Juice
Something doesn't work I need help etc.
Spawn Invisible Player
Speedy Nurse Joy
Spinda Second Frame Spot Addition
Stair Warps
Supplementary Scripting Macros
Surfing Dismount Ground Effects
Temporarily Replace Player or Enemy Party Pokemon
The Basics of Scripting
Toggle Trainer Sight
Trainer Backsprite Editing
Trainer Class Based Poké Balls
Trainer Scripts
Trainers No Longer Spin to Face You Right As You Pass Them
Trigger Map Scripts By Flag
Triple layer metatiles
Tutorials
Tweaking the count of health beeps
Uniquely Shuffle Array
Update Sitrus Berry's effect to Gen 4 standard
Use HMs Without Any Pokemon in your Party Knowing Them
Useful Modding Tools
Useful Scripting Specials
Why You Should (Almost) Always Be Using 32‐Bit Variables in Your Code
Why should I use this over binary hacking
0
Add In‐Cart Rumble
voloved edited this page 2023-11-14 17:55:59 -05:00
By devolov. Credit to Citrus Bolt. Also Credit to Evan Bowman.
Goal: Allow the GBA to rumble during certain field moves, sound effects, you mon fainting, and when the ball shakes when attempting to catch.
----------------------------- include/gba/io_reg.h -----------------------------
index 64075c092..c948ea6a8 100644
@@ -776,5 +776,9 @@
#define WAITCNT_AGB (0 << 15)
#define WAITCNT_CGB (1 << 15)
+#define GPIO_PORT_DATA (*(vu16 *)0x80000C4)
+#define GPIO_PORT_DIRECTION (*(vu16 *)0x80000C6)
+#define GPIO_PORT_READ_ENABLE (*(vu16 *)0x80000C8)
+
#endif // GUARD_GBA_IO_REG_H
------------------------------- include/global.h -------------------------------
index da7eabb8a..e6ee34c2b 100644
@@ -499,9 +499,10 @@ struct SaveBlock2
u16 optionsBattleSceneOff:1; // whether battle animations are disabled
u16 regionMapZoom:1; // whether the map is zoomed in
/*0x18*/ struct Pokedex pokedex;
/*0x90*/ u16 lastUsedBall;
- /*0x92*/ u8 filler_90[0x6];
+ /*0x92*/ u8 optionsRumble; // Set this to true to allow rumbling
+ /*0x93*/ u8 filler_90[0x5];
/*0x98*/ struct Time localTimeOffset;
/*0xA0*/ struct Time lastBerryTreeUpdate;
/*0xA8*/ u32 gcnLinkFlags; // Read by Pokemon Colosseum/XD
/*0xAC*/ u32 encryptionKey;
------------------------------- include/rumble.h -------------------------------
new file mode 100755
index 000000000..90c2b8852
@@ -0,0 +1,18 @@
+#ifndef GUARD_RUMBLE_H
+#define GUARD_RUMBLE_H
+
+enum{
+ RUMBLE_TYPE_OFF,
+ RUMBLE_TYPE_CONT,
+ RUMBLE_TYPE_TIMED
+};
+
+void RumbleFrameUpdate();
+bool32 SetTimedRumble(u8 deciseconds);
+bool32 RumbleStart(void);
+bool32 RumbleStop(void);
+u32 GetRumbleState(void);
+
+
+#endif // GUARD_RUMBLE_H
+
--------------------------- src/battle_anim_throw.c ---------------------------
index a23a03d97..36e2b32a6 100755
@@ -18,8 +18,9 @@
#include "task.h"
#include "trig.h"
#include "util.h"
#include "data.h"
+#include "rumble.h"
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/songs.h"
#include "constants/rgb.h"
@@ -1137,8 +1138,9 @@ static void SpriteCB_Ball_Wobble(struct Sprite *sprite)
StartSpriteAffineAnim(sprite, BALL_ROTATE_RIGHT);
gBattleSpritesDataPtr->animationData->ballSubpx = 0;
sprite->callback = SpriteCB_Ball_Wobble_Step;
PlaySE(SE_BALL);
+ RumbleStart();
}
}
#undef sTimer
@@ -1299,8 +1301,10 @@ static void SpriteCB_Ball_Wobble_Step(struct Sprite *sprite)
else
StartSpriteAffineAnim(sprite, BALL_ROTATE_RIGHT);
PlaySE(SE_BALL);
+ RumbleStart();
}
break;
}
}
@@ -1344,8 +1348,9 @@ static void SpriteCB_Ball_Capture_Step(struct Sprite *sprite)
sprite->sTimer++;
if (sprite->sTimer == 40)
{
PlaySE(SE_RG_BALL_CLICK);
+ SetTimedRumble(1);
BlendPalettes(0x10000 << sprite->oam.paletteNum, 6, RGB(0, 0, 0));
MakeCaptureStars(sprite);
}
else if (sprite->sTimer == 60)
------------------------- src/battle_script_commands.c -------------------------
index dadbddd07..00f0e1f15 100644
@@ -55,8 +55,9 @@
#include "constants/trainers.h"
#include "constants/flags.h"
#include "constants/battle.h"
#include "debug.h"
+#include "rumble.h"
extern const u8 *const gBattleScriptsForMoveEffects[];
#define DEFENDER_IS_PROTECTED ((gProtectStructs[gBattlerTarget].protected) && (gBattleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED))
@@ -3374,8 +3375,9 @@ static void Cmd_tryfaintmon(void)
BattleScriptPush(gBattlescriptCurrInstr + 7);
gBattlescriptCurrInstr = BS_ptr;
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
+ SetTimedRumble(10);
gHitMarker |= HITMARKER_PLAYER_FAINTED;
if (gBattleResults.playerFaintCounter < 255)
gBattleResults.playerFaintCounter++;
AdjustFriendshipOnBattleFaint(gActiveBattler);
-------------------------- src/field_player_avatar.c --------------------------
index aee08e54b..d19d16f85 100644
@@ -20,8 +20,9 @@
#include "strings.h"
#include "task.h"
#include "tv.h"
#include "wild_encounter.h"
+#include "rumble.h"
#include "constants/abilities.h"
#include "constants/event_objects.h"
#include "constants/event_object_movement.h"
#include "constants/field_effects.h"
@@ -1566,8 +1567,9 @@ static bool8 PushBoulder_Move(struct Task *task, struct ObjectEvent *player, str
gFieldEffectArguments[2] = boulder->previousElevation;
gFieldEffectArguments[3] = gSprites[boulder->spriteId].oam.priority;
FieldEffectStart(FLDEFF_DUST);
PlaySE(SE_M_STRENGTH);
+ RumbleStart();
task->tState++;
}
return FALSE;
}
@@ -1643,8 +1645,9 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct Objec
task->data[1] = objectEvent->movementDirection;
gPlayerAvatar.preventStep = TRUE;
LockPlayerFieldControls();
PlaySE(SE_WARP_IN);
+ RumbleStart();
return TRUE;
}
static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct ObjectEvent *objectEvent)
------------------------------- src/fldeff_cut.c -------------------------------
index 0fd9263e5..952bd4c65 100644
@@ -16,8 +16,9 @@
#include "sound.h"
#include "sprite.h"
#include "task.h"
#include "trig.h"
+#include "rumble.h"
#include "constants/abilities.h"
#include "constants/event_objects.h"
#include "constants/field_effects.h"
#include "constants/songs.h"
@@ -318,8 +319,9 @@ bool8 FldEff_CutGrass(void)
s16 x, y;
u8 i = 0;
PlaySE(SE_M_CUT);
+ RumbleStart();
PlayerGetDestCoords(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y);
for (i = 0; i < CUT_HYPER_AREA; i++)
{
if (sHyperCutTiles[i] == TRUE)
@@ -641,7 +643,8 @@ void FixLongGrassMetatilesWindowBottom(s16 x, s16 y)
static void StartCutTreeFieldEffect(void)
{
PlaySE(SE_M_CUT);
+ RumbleStart();
FieldEffectActiveListRemove(FLDEFF_USE_CUT_ON_TREE);
ScriptContext_Enable();
}
---------------------------- src/fldeff_rocksmash.c ----------------------------
index 99314b6ac..b5db48251 100644
@@ -12,8 +12,9 @@
#include "script.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
+#include "rumble.h"
#include "constants/event_object_movement.h"
#include "constants/event_objects.h"
#include "constants/field_effects.h"
#include "constants/map_types.h"
@@ -163,7 +164,8 @@ bool8 FldEff_UseRockSmash(void)
// The actual rock smashing is handled by EventScript_SmashRock, so this function does very little
static void FieldMove_RockSmash(void)
{
PlaySE(SE_M_ROCK_THROW);
+ RumbleStart();
FieldEffectActiveListRemove(FLDEFF_USE_ROCK_SMASH);
ScriptContext_Enable();
}
---------------------------------- src/m4a.c ----------------------------------
index 7774d09cb..68e5aea0e 100644
@@ -1,6 +1,8 @@
#include <string.h>
#include "gba/m4a_internal.h"
+#include "rumble.h"
+#include "constants/songs.h"
extern const u8 gCgb3Vol[];
#define BSS_CODE __attribute__((section(".bss.code")))
@@ -110,8 +112,29 @@ void m4aSongNumStart(u16 n)
const struct Song *songTable = gSongTable;
const struct Song *song = &songTable[n];
const struct MusicPlayer *mplay = &mplayTable[song->ms];
+ switch (n)
+ {
+ case SE_LEDGE:
+ case SE_BIKE_BELL:
+ case SE_BIKE_HOP:
+ case SE_ICE_BREAK:
+ case SE_ICE_CRACK:
+ case SE_TRUCK_MOVE:
+ case SE_TRUCK_STOP:
+ case SE_TRUCK_UNLOAD:
+ case SE_TRUCK_DOOR:
+ case SE_ITEMFINDER:
+ case SE_BREAKABLE_DOOR:
+ case SE_FIELD_POISON:
+ case SE_M_SELF_DESTRUCT:
+ case SE_M_EXPLOSION:
+ case SE_RG_SS_ANNE_HORN:
+ case SE_POKENAV_CALL:
+ RumbleStart();
+ }
+
MPlayStart(mplay->info, song->header);
}
void m4aSongNumStartOrChange(u16 n)
---------------------------------- src/main.c ----------------------------------
index e7a7003ae..33aa7c4bc 100644
@@ -25,8 +25,9 @@
#include "trainer_hill.h"
#include "constants/rgb.h"
#include "palette.h"
#include "event_data.h"
+#include "rumble.h"
static void VBlankIntr(void);
static void HBlankIntr(void);
static void VCountIntr(void);
@@ -130,8 +131,11 @@ void AgbMain()
#endif
#endif
for (;;)
{
+ if (gSaveBlock2Ptr->optionsRumble)
+ RumbleFrameUpdate();
+
ReadKeys();
if (gSoftResetDisabled == FALSE
&& JOY_HELD_RAW(A_BUTTON)
@@ -390,8 +394,11 @@ static void VBlankIntr(void)
Random();
UpdateWirelessStatusIndicatorSprite();
+ if (!IsSEPlaying())
+ RumbleStop();
+
INTR_CHECK |= INTR_FLAG_VBLANK;
gMain.intrCheck |= INTR_FLAG_VBLANK;
}
--------------------------------- src/rumble.c ---------------------------------
new file mode 100755
index 000000000..aea07424d
@@ -0,0 +1,69 @@
+#include "global.h"
+#include "rumble.h"
+#include "main.h"
+#include "sound.h"
+
+static EWRAM_DATA u32 sRumbleState = 0;
+static EWRAM_DATA u8 sRumbleType = RUMBLE_TYPE_OFF;
+static EWRAM_DATA u32 stopRumbleVblankCounter = 0;
+
+static u16 const sNintendoHandshakeData[] = {0x494E, 0x544E, 0x4E45, 0x4F44, 0x8000};
+static void SetRumbleState(u32 state);
+
+enum {
+ RUMBLE_ON = 0x40000026,
+ RUMBLE_OFF = 0x40000004,
+ RUMBLE_HARD_STOP = 0x40000015
+};
+
+void RumbleFrameUpdate()
+{
+ REG_SIOCNT &= ~1;
+ REG_SIOCNT |= SIO_START;
+ if(gMain.vblankCounter1 == stopRumbleVblankCounter && sRumbleType == RUMBLE_TYPE_TIMED)
+ SetRumbleState(RUMBLE_OFF);
+}
+
+static void SetRumbleState(u32 state)
+{
+ sRumbleState = state;
+ if (sRumbleState != RUMBLE_ON)
+ sRumbleType = RUMBLE_TYPE_OFF;
+
+ if (gSaveBlock2Ptr->optionsRumble) {
+ GPIO_PORT_DIRECTION = 1 << 3;
+ GPIO_PORT_DATA = (sRumbleState == RUMBLE_ON) << 3;
+ }
+}
+
+bool32 RumbleStart(void)
+{
+ if (sRumbleType == RUMBLE_TYPE_TIMED)
+ return FALSE;
+ sRumbleType = RUMBLE_TYPE_CONT;
+ SetRumbleState(RUMBLE_ON);
+ return TRUE;
+}
+
+bool32 RumbleStop(void)
+{
+ if (sRumbleType != RUMBLE_TYPE_CONT)
+ return FALSE;
+ SetRumbleState(RUMBLE_OFF);
+ return TRUE;
+}
+
+bool32 SetTimedRumble(u8 deciseconds)
+{
+ if (sRumbleType == RUMBLE_TYPE_CONT)
+ return FALSE;
+ sRumbleType = RUMBLE_TYPE_TIMED;
+ stopRumbleVblankCounter = gMain.vblankCounter1 + (6 * deciseconds);
+ SetRumbleState(RUMBLE_ON);
+ return TRUE;
+}
+
+u32 GetRumbleState(void)
+{
+ return sRumbleState;
+}
+
--------------------------------- src/siirtc.c ---------------------------------
index 0e598f717..b658b9e77 100644
@@ -59,12 +59,8 @@
#define DIR_2_OUT 4
#define DIR_ALL_IN (DIR_0_IN | DIR_1_IN | DIR_2_IN)
#define DIR_ALL_OUT (DIR_0_OUT | DIR_1_OUT | DIR_2_OUT)
-#define GPIO_PORT_DATA (*(vu16 *)0x80000C4)
-#define GPIO_PORT_DIRECTION (*(vu16 *)0x80000C6)
-#define GPIO_PORT_READ_ENABLE (*(vu16 *)0x80000C8)
-
extern vu16 GPIOPortDirection;
static u16 sDummy; // unused variable
static bool8 sLocked;
-------------------------------- sym_ewram.txt --------------------------------
index b7513dba9..afdd24a9d 100644
@@ -151,4 +151,5 @@
.include "src/debug.o"
.include "src/battle_controller_player.o"
.include "src/mugshot.o"
.include "src/tm_case.o"
+ .include "src/rumble.o"