Pokémon FireRed/LeafGreen predefined functions list: Difference between revisions

From Glitch City Wiki
Jump to navigation Jump to search
Content added Content deleted
>Ryccardo
(...and then you find out a relevant website with half of the job already done...)
>Ryccardo
(might as well advance the article)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Template:Stub}}
{{Template:Stub}}


==Introduction==
''All function numbers are hexadecimal.''

''All function and variable numbers in this article are hexadecimal.''

All functions technically have a return value (which is ignored of they are called with the '''special''' (0x25) script opcode, or stored in a variable like LASTRESULT if called with '''special2''' (0x26)), although not all of them return a meaningful value and output instead 0x9F69 (or 0xADC1 for stubbed out ones); for the purpose of this article they will be segregated.

Regardless of how they are called, all functions are unsandboxed and can freely read or write memory; indeed, a fair number of them does accept and/or return parameters at a fixed location (usually a subset of [https://github.com/pret/pokefirered/blob/master/include/constants/vars.h temporary variables], chiefly the 8004-8006 range). It's also not uncommon for them to directly read or write the game's state.


==Void functions==
==Void functions==
Called with the '''special''' (0x25) script opcode, they do not return a value (but can of course work directly on memory anyway).


*000 heals the entire team
*000 heals the entire team
Line 11: Line 16:
*0C4 display Trainer Tower records (with 8004 = 1)
*0C4 display Trainer Tower records (with 8004 = 1)
*0F6 check for DLC trainer availability?
*0F6 check for DLC trainer availability?
*110 start ending sequence (saving and displaying current team into Hall of Fame, player/rival/Oak walking out of League, credits, soft reset)
*163 register Pokémon with index number stored in 8004 as seen
*163 register Pokémon with index number stored in 8004 as seen
*173 unlock information in Fame Checker (variable 8004: character [0-?]; 8005: fact number [0-5?])
*173 unlock information in Fame Checker (variable 8004: character [0-?]; 8005: fact number [0-5?])
*174 unlock information in Fame Checker (difference with 173 unknown)
*174 unlock character in Fame Checker (variable 8004: character [0-?]; 8005: "seen" = hearsay [1] or "caught" = interacted with [2])
*182 unknown, used in Saffron Pokémon Center map script
*182 unknown, used in Saffron Pokémon Center map script
*187 unknown, used by {the imitating girl in Saffron}, Pokémart workers, etc
*187 unknown, used by {the imitating girl in Saffron}, Pokémart workers, etc
Line 19: Line 25:
*199 used after 01F to cancel multiplayer link setup
*199 used after 01F to cancel multiplayer link setup
*1A6 display Dodrio's Berry Picking minigame records
*1A6 display Dodrio's Berry Picking minigame records
*1B9 clear [https://forums.glitchcity.info/index.php?topic=8847.0 a range of flags (A4 up to AC), all initially enabled and used as the hide/show status of Lorelei's dolls, proportionally to 1/20th rounded down of the number of Hall of Fame entries; used in Lorelei's house map script].


==Int functions==
==Int functions==
Called with the '''special2''' (0x26) script opcode, they can also return a value into a variable, typically but not necessarily the intended-for-temporary-use LASTRESULT.


*084 get number of Pokémon in party
*084 get number of Pokémon in party
Line 29: Line 35:
*165 check whether current Box is full
*165 check whether current Box is full
*16A check whether wireless adapter is ready
*16A check whether wireless adapter is ready
*17C check whether Pokémon with index number equal to variable 8004 is in team
*180 check whether Mystery Gift deliveryman should be visible
*180 check whether Mystery Gift deliveryman should be visible


Line 34: Line 41:
[https://www.pokecommunity.com/showthread.php?t=184273 Article on PokeCommunity]
[https://www.pokecommunity.com/showthread.php?t=184273 Article on PokeCommunity]


[[Category:Databases]]
[[Category:Reference documents]]

Latest revision as of 11:13, 29 July 2019

This article or section is a stub. You can help Glitch City Wiki by expanding it.

Introduction

All function and variable numbers in this article are hexadecimal.

All functions technically have a return value (which is ignored of they are called with the special (0x25) script opcode, or stored in a variable like LASTRESULT if called with special2 (0x26)), although not all of them return a meaningful value and output instead 0x9F69 (or 0xADC1 for stubbed out ones); for the purpose of this article they will be segregated.

Regardless of how they are called, all functions are unsandboxed and can freely read or write memory; indeed, a fair number of them does accept and/or return parameters at a fixed location (usually a subset of temporary variables, chiefly the 8004-8006 range). It's also not uncommon for them to directly read or write the game's state.

Void functions

  • 000 heals the entire team
  • 01F used immediately before 199 to cancel multiplayer link setup
  • 077 load Heracross's size record in the 3rd string buffer
  • 0C4 display Trainer Tower records (with 8004 = 1)
  • 0F6 check for DLC trainer availability?
  • 110 start ending sequence (saving and displaying current team into Hall of Fame, player/rival/Oak walking out of League, credits, soft reset)
  • 163 register Pokémon with index number stored in 8004 as seen
  • 173 unlock information in Fame Checker (variable 8004: character [0-?]; 8005: fact number [0-5?])
  • 174 unlock character in Fame Checker (variable 8004: character [0-?]; 8005: "seen" = hearsay [1] or "caught" = interacted with [2])
  • 182 unknown, used in Saffron Pokémon Center map script
  • 187 unknown, used by {the imitating girl in Saffron}, Pokémart workers, etc
  • 195 display Pokémon Jump minigame records
  • 199 used after 01F to cancel multiplayer link setup
  • 1A6 display Dodrio's Berry Picking minigame records
  • 1B9 clear a range of flags (A4 up to AC), all initially enabled and used as the hide/show status of Lorelei's dolls, proportionally to 1/20th rounded down of the number of Hall of Fame entries; used in Lorelei's house map script.

Int functions

  • 084 get number of Pokémon in party
  • 0D4 stores number of caught species in variable 8006
  • 1AE check for illegal Pokémon?
  • 153 check for Pokémon holding DLC berries (illegal to trade)
  • 165 check whether current Box is full
  • 16A check whether wireless adapter is ready
  • 17C check whether Pokémon with index number equal to variable 8004 is in team
  • 180 check whether Mystery Gift deliveryman should be visible

See also

Article on PokeCommunity