Merge remote-tracking branch 'origin/feature/add-support-for-localized-versions' into feature/add-japanese-distribution-pokemon

This commit is contained in:
Philippe Symons 2024-12-12 12:18:00 +01:00
commit 3aab06c977
2 changed files with 20 additions and 0 deletions

View File

@ -229,6 +229,12 @@ public:
* Don't forget to call finishSave() after using this function!
*/
void setEventFlag(uint16_t flagNumber, bool enabled);
/**
* @brief This function will change an SRAM field to let gen 2 games prompt you
* to reconfigure the game clock
*/
void resetRTC();
protected:
private:
IRomReader &romReader_;

View File

@ -863,4 +863,18 @@ void Gen2GameReader::setEventFlag(uint16_t flagNumber, bool enabled)
}
saveManager_.writeByte(resultVal);
}
void Gen2GameReader::resetRTC()
{
// The game checks bit 7 on the sRTCStatusFlags field in SRAM
// this is set when the game detects wrong RTC register values.
// In order to let the game prompt to reconfigure the RTC clock, we just have to set this bit
// Based on sRTCStatusFlags, RecordRTCStatus, .set_bit_7 in
// https://github.com/pret/pokecrystal
// https://github.com/pret/pokegold
const uint8_t rtcStatusFieldValue = 0xC0;
saveManager_.seekToBankOffset(0, 0xC60);
saveManager_.writeByte(rtcStatusFieldValue);
}