s32 nuContGBPakFwrite(NUContPakFile *handle, u16 address, u8 *buffer, u16 size)
handle GB Pak control structure (shared with Controller Pak structure)
address Game Boy Game Pak address
buffer data buffer
size byte size
Writes data to a high-performance Game Boy Game Pak
Writes "size" bytes of data from the "buffer" to the specified "address" in the Game Boy Game Pak.
This function can write data even when the Game Boy Game Pak's CPU address and the write size are not multiples of 32. After the data is written, it checks the status. Furthermore, it checks the address, and if access is to a RAM area in MBC1,2,3 it enables access and then writes the data. After access it write-protects the area.
If not a multiple of 32, then 32 bytes of data are read into the buffer, and after changing the data in the buffer, the buffer contents are written to the Game Boy Game Pak. It also internally checks the connector and turns the power ON.
Since power for the Game Boy Game Pak is not turned on as part of the function before writing, please perform reading or writing after turning power ON and checking the Game Boy Game Pak ID. Also, this function does not turn the power off, so if you are not going to perform a read/write operation after this function, please turn the power OFF with the nuContGBPakPower function.
Since this function uses osGbpakCheckConnector() it only supports game paks with MBC 1,2,3 or which do not use a memory controller.
|PFS_ERR_NOPACK||Nothing is inserted in the specified Controller.|
|PFS_ERR_DEVICE||Some device other than a GB Pak is inserted in the Controller.|
|PFS_ERR_CONTRFAIL||Data transfer with Controller has failed. Either the Controller is not connected properly, or there may be some problem with the GB Pak or the Controller connector.|
|PFS_ERR_NO_GBCART||Game Boy Game Pak is not inserted in the GB Pak.|
|PFS_ERR_NEW_GBCART||Game Boy Game Pak has been removed and reinserted.|