Cxbx-reloaded: Complete EEPROM handling

Created on 27 Feb 2017  路  5Comments  路  Source: Cxbx-Reloaded/Cxbx-Reloaded

Now https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/pull/191 is merged, the following steps must still be taken :

  • move EEPROM related code (EEPROMInfo) into a self-contained source code file
  • extend the GUI with EEPROM configuration options (see https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues/35 )
  • update checksums of all EEPROM sections when values are changed
  • read and write the EEPROM from a "EEPROM.bin" file (using a memory-mapped file would be simplest)
  • when "EEPROM.bin" is missing, call EmuInitializeDefaultEEPROM()
  • fix all TODO's in ExSaveNonVolatileSetting() :

    • TODO : Only allow writing to factory section contents when running in DEVKIT mode, otherwise, nil the info pointer.

    • TODO : Make EEPROM-access thread-safe

    • TODO : When writing to the factory settings section (thus in DEVKIT mode), set XboxFactoryGameRegion to FactorySettings.GameRegion, so XC_FACTORY_GAME_REGION will reflect the factory settings.

    • TODO : For each section being accessed, recalculate it's checksum

enhancement kernel

Most helpful comment

PR #925 adds:

  • Calculate eeprom Section CRC checksum on write (Checksum2/3 in the User and Factory settings). Checksum CRCs are also re-calculated on boot.
  • Run data checksum on eeprom read to ensure section data is correct.
  • Add plumbing for thread safety in eeprom reads/writes (throws an exception right now due to the current thread returning null).

If ExQueryNonVolatileSetting returns STATUS_DEVICE_DATA_ERROR, that means the checksum calculated for the section being accessed did not equal 0xFFFFFFFF. Because the section CRCs are recalculated at boot and on every call to ExSaveNonVolatileSetting, it should not be possible for this check to fail. However, if it does, please try restarting Cxbx-Reloaded. If that does not work, try deleting your EEPROM.bin so that it will be re-generated.

All 5 comments

PR https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/pull/215 fixes :

  • read and write the EEPROM from a "EEPROM.bin" file
  • when "EEPROM.bin" is missing, call EmuInitializeDefaultEEPROM()

https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/pull/217/commits/8ceca49e6fa4b0a98a17de0595543962a3d44cb7 fixes :

  • move EEPROM related code (EEPROMInfo) into a self-contained source code file

PR #925 adds:

  • Calculate eeprom Section CRC checksum on write (Checksum2/3 in the User and Factory settings). Checksum CRCs are also re-calculated on boot.
  • Run data checksum on eeprom read to ensure section data is correct.
  • Add plumbing for thread safety in eeprom reads/writes (throws an exception right now due to the current thread returning null).

If ExQueryNonVolatileSetting returns STATUS_DEVICE_DATA_ERROR, that means the checksum calculated for the section being accessed did not equal 0xFFFFFFFF. Because the section CRCs are recalculated at boot and on every call to ExSaveNonVolatileSetting, it should not be possible for this check to fail. However, if it does, please try restarting Cxbx-Reloaded. If that does not work, try deleting your EEPROM.bin so that it will be re-generated.

According to @ergo720, pull request #1016 fixes all of the above mentioned issues, except for the GUI.

@ergo720 implemented the GUI in this pull request : https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/pull/1089

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PatrickvL picture PatrickvL  路  3Comments

PatrickvL picture PatrickvL  路  3Comments

PatrickvL picture PatrickvL  路  4Comments

PatrickvL picture PatrickvL  路  3Comments

LukeUsher picture LukeUsher  路  4Comments