diff --git a/source/screens/EepromScreen.cpp b/source/screens/EepromScreen.cpp index 6f8add1..ba38738 100644 --- a/source/screens/EepromScreen.cpp +++ b/source/screens/EepromScreen.cpp @@ -12,13 +12,13 @@ namespace { -bool WriteFile(const uint8_t *source, const std::string& dstPath) +bool WriteFile(const void *source, const std::string& dstPath) { FILE* outf = fopen(dstPath.c_str(), "wb"); if (!outf) { return false; } - if (fwrite(source, 1, 4096, outf) != 0) { // DRC EEPROM size up until "DEADBABE" string appears to be 5E0h bytes, unless you dump the 2nd DRC. What the hell does it add..? + if (fwrite(&source, 1, 4096, outf) != 0) { // DRC EEPROM size up until "DEADBABE" string appears to be 5E0h bytes, unless you dump the 2nd DRC. What the hell does it add..? fclose(outf); return false; } @@ -43,7 +43,7 @@ void EepromScreen::Draw() } case STATE_DONE: { Gfx::Print(Gfx::SCREEN_WIDTH / 2, Gfx::SCREEN_HEIGHT / 2, 64, Gfx::COLOR_TEXT, - Utils::sprintf("Saved to eeprom.bin\nPress B"), + Utils::sprintf("Saved to eeprom0.bin\nPress B"), Gfx::ALIGN_CENTER); break; } @@ -62,9 +62,9 @@ bool EepromScreen::Update(VPADStatus& input) // This is the core logic part { case STATE_DUMP: { CCRCDCEepromData readout0; - uint8_t readoutarray0[0x304]; + //uint8_t readoutarray0[0x304]; CCRCDCEepromData readout1; // If a 2nd DRC is present, we will write this - uint8_t readoutarray1[0x304]; + //uint8_t readoutarray1[0x304]; // Read EEPROM if(CCRCDCPerGetUicEeprom(CCR_CDC_DESTINATION_DRC0, &readout0) != 0){ mErrorString = "Read failed!"; @@ -73,20 +73,20 @@ bool EepromScreen::Update(VPADStatus& input) // This is the core logic part } // Write to SD card // Convert to uint8_t so that this can be processed by fwrite - uint8_t versionarray0[4]; - for (int i=0; i<4 ;++i) - versionarray0[i] = ((uint8_t*)&readout0.version)[3-i]; - memcpy(&readoutarray0[0], versionarray0, 4); - memcpy(&readoutarray0[4], readout0.data, 0x300); - WriteFile(readoutarray0, "/vol/external01/eeprom0.bin"); + //uint8_t versionarray0[4]; + //for (int i=0; i<4 ;++i) + // versionarray0[i] = ((uint8_t*)&readout0.version)[3-i]; + //memcpy(&readoutarray0[0], versionarray0, 4); + //memcpy(&readoutarray0[4], readout0.data, 0x300); + WriteFile(&readout0, "/vol/external01/eeprom0.bin"); // If we read the DRC1 EEPROM if(CCRCDCPerGetUicEeprom(CCR_CDC_DESTINATION_DRC1, &readout1) == 0){ - uint8_t versionarray1[4]; - for (int i=0; i<4 ;++i) - versionarray1[i] = ((uint8_t*)&readout1.version)[3-i]; - memcpy(&readoutarray1[0], versionarray1, 4); - memcpy(&readoutarray1[4], readout1.data, 0x300); - WriteFile(readoutarray1, "/vol/external01/eeprom1.bin"); + //uint8_t versionarray1[4]; + //for (int i=0; i<4 ;++i) + // versionarray1[i] = ((uint8_t*)&readout1.version)[3-i]; + //memcpy(&readoutarray1[0], versionarray1, 4); + //memcpy(&readoutarray1[4], readout1.data, 0x300); + WriteFile(&readout1, "/vol/external01/eeprom1.bin"); } mState = STATE_DONE; break;