Gets status of the N64 Transfer Pak
#include <ultra64.h> /* ultra64.h */ s32 osGbpakGetStatus(OSPfs *pfs, u8 *status);
The osGbpakGetStatus function is used to detect the status of the N64 Transfer Pak.
OSPfs structure pfs must be initialized first with osGbpakInit function.
The detected result is returned to status. Determines the status according to whether the following bits are set.
This bit indicates that a Game Boy Game Pak is inserted. It is returned when a Game Boy Game Pak is inserted into the N64 Transfer Pak.
This bit indicates that removal of a Game Boy Game Pak has been detected. It is returned once the Game Boy Game Pak has been removed.
When there is a Game Boy Game Pak in the N64 Transfer Pak and the osGbpakGetStatus or osGbpakReadId function is called, this bit becomes 0.
This bit indicates the state of power supply to the Game Boy Game Pak. When this bit is 1, power is ON; when this bit is 0, power is OFF.
Note that this only checks for power on the software side, and does not confirm that the hardware has a stable power supply. The status of the latter cannot be checked on the software side. For details, please refer to osGbpakPower.
This bit indicates that the Reset signal has been detected. When the Game Boy Game Pak is reset, this bit becomes 1. If either the osGbpakGetStatus or the osGbpakReadId function is called when a Game Boy Game Pak is inserted, this bit returns to 0. Since this bit becomes 1 when the power is turned on, you need to clear it back to 0 after the power is turned on by calling the osGbpakGetStatus or the osGbpakReadId function so the bit status can be used to detect a Reset signal.
Return value is an error code. If the function terminates normally, a value of 0 is returned. If an error occurs, one of the following error codes is returned:
Nothing is inserted in the specified Controller.
A device other than the N64 Transfer Pak is inserted in the Controller.
Data transfers with the Controller have failed. The Controller may not be connected correctly, or there may be some problem with the N64 Transfer Pak or the Controller connector.
No Game Boy Game Pak is inserted in the N64 Transfer Pak.
A Game Boy Game Pak has been removed and reinserted. A different Game Boy Game Pak may have been inserted.
If you remove and reinsert a Game Boy Game Pak and then reset N64, the flag for insertion and removal of the Game Boy Game Pak will remain up. Therefore you need to be careful, because a PFS_ERR_NEW_GBCART error will be returned if osGbpakInit and then osGbpakGetStatus are executed after resetting N64. If osGbpakReadId is called instead of osGbpakGetStatus, the PFS_ERR_NEW_GBCART error will not be issued. Thus, osGbpakReadId should be used to check the status of the N64 Transfer Pak after initialization.
osGbpakInit, osGbpakPower, osGbpakReadWrite, osGbpakReadId, and osGbpakCheckConnector
1998/10/29 Added OS_GBPAK_RSTB_DETECTION to the detected statuses
1999/04/30 Changed format