Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The fans in the Mistralton City gym of Black 2 will probably cause much grief
- for Twitch Plays Pokemon.
- The fans have three speeds:
- - Slow: runs for 120 frames (2 seconds)
- - Medium: louder, runs for 120 frames (another 2 seconds)
- - Fast: sends unprotected player flying back
- Thus the unmodified fan interval is 240 frames (4 seconds).
- There is a counter which increments once every 2 frames, located at 0231B3F0.
- It is 16 bit. That memory location does appear to be used for other things.
- Here is the function which determines fan speed:
- 021E:F184 2878 CMP R0, #78
- 021E:F186 D301 BCC #21EF18C
- 021E:F188 2002 MOV R0, #2
- 021E:F18A 4770 BX LR
- 021E:F18C 283C CMP R0, #3C
- 021E:F18E D301 BCC #21EF194
- 021E:F190 2001 MOV R0, #1
- 021E:F192 4770 BX LR
- 021E:F194 2000 MOV R0, #0
- 021E:F196 4770 BX LR
- This function returns 0 (corresponds to low fan speed), 1 (corresponds
- to medium fan speed) or 2 (corresponds to high fan speed) depending on its
- argument. The thresholds are 0x3c (60) and 0x78 (120).
- The time spent at each speed can be modified by adjusting the thresholds.
- Unfourtunately, Thumb-mode instruction encoding doesn't allow immediate
- operands to be higher than 0xff (8.5 seconds), which may not be enough.
- Here is a replacement function I came up with (note: function must be less
- than 20 bytes):
- 021E:F184 XXXX LSR R0, R0, #YY
- 021E:F186 2802 CMP R0, #2
- 021E:F188 D300 BCC #21EF18C
- 021E:F18A 2002 MOV R0, #2
- 021E:F18C 4770 BX LR
- This uses shifts to divide, and clamps the result to 2. The values
- for XXXX and YY are:
- - XXXX = 0940, YY = 06: fan interval = 128 frames (2.13 seconds)
- - XXXX = 0980, YY = 07: fan interval = 256 frames (4.27 seconds ~ original)
- - XXXX = 09C0, YY = 08: fan interval = 512 frames (8.53 seconds)
- - XXXX = 0A00, YY = 09: fan interval = 1024 frames (17.1 seconds)
- - XXXX = 0A40, YY = 10: fan interval = 2048 frames (34.1 seconds)
- - XXXX = 0A80, YY = 11: fan interval = 4096 frames (68.3 seconds)
- - XXXX = 0AC0, YY = 12: fan interval = 8192 frames (137 seconds)
- Here is an action replay code for this:
- 521EF174 63206B60
- 121EF184 0000XXXX
- 121EF186 00002802
- 121EF188 0000D300
- 121EF18A 00002002
- 121EF18C 00004770
- D0000000 00000000
- The "521EF174 63206B60" and "D0000000 00000000" make this code conditional.
- This is required because Pokemon Black 2 uses dynamically-loaded code
- overlays, and unconditional writing will cause the game to freeze in battles.
- The "63206B60" is unrelated code from the same overlay.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement