mirror of
https://github.com/sanni/cartreader.git
synced 2024-12-25 04:21:53 +01:00
Fix Progressbar and Erase while flashing GB cart
This commit is contained in:
parent
a46358954f
commit
ca70b9febd
@ -743,7 +743,7 @@ void readROM_GB() {
|
|||||||
|
|
||||||
//Initialize progress bar
|
//Initialize progress bar
|
||||||
uint32_t processedProgressBar = 0;
|
uint32_t processedProgressBar = 0;
|
||||||
uint32_t totalProgressBar = (uint32_t)(romBanks - 2);
|
uint32_t totalProgressBar = (uint32_t)(romBanks) * 16384;
|
||||||
draw_progressbar(0, totalProgressBar);
|
draw_progressbar(0, totalProgressBar);
|
||||||
|
|
||||||
for (word currBank = 1; currBank < romBanks; currBank++) {
|
for (word currBank = 1; currBank < romBanks; currBank++) {
|
||||||
@ -776,11 +776,10 @@ void readROM_GB() {
|
|||||||
}
|
}
|
||||||
myFile.write(sdBuffer, 512);
|
myFile.write(sdBuffer, 512);
|
||||||
romAddress += 512;
|
romAddress += 512;
|
||||||
}
|
processedProgressBar += 512;
|
||||||
|
|
||||||
processedProgressBar += 1;
|
|
||||||
draw_progressbar(processedProgressBar, totalProgressBar);
|
draw_progressbar(processedProgressBar, totalProgressBar);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Close the file:
|
// Close the file:
|
||||||
myFile.close();
|
myFile.close();
|
||||||
@ -1176,17 +1175,14 @@ void writeFlash29F_GB(byte MBC, boolean flashErase) {
|
|||||||
|
|
||||||
// Set data pins to input
|
// Set data pins to input
|
||||||
dataIn_GB();
|
dataIn_GB();
|
||||||
|
// Read the status register
|
||||||
// Set OE/RD(PH6) LOW
|
byte statusReg = readByte_GB(0);
|
||||||
PORTH &= ~(1 << 6);
|
|
||||||
|
|
||||||
// After a completed erase D7 will output 1
|
// After a completed erase D7 will output 1
|
||||||
while ((PINC & 0x80) != 0x80) {
|
while ((statusReg & 0x80) != 0x80) {
|
||||||
|
// Update Status
|
||||||
|
statusReg = readByte_GB(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch OE/RD(PH6) to HIGH
|
|
||||||
PORTH |= (1 << 6);
|
|
||||||
|
|
||||||
// Blankcheck
|
// Blankcheck
|
||||||
println_Msg(F("Blankcheck"));
|
println_Msg(F("Blankcheck"));
|
||||||
display_Update();
|
display_Update();
|
||||||
@ -1228,7 +1224,7 @@ void writeFlash29F_GB(byte MBC, boolean flashErase) {
|
|||||||
|
|
||||||
//Initialize progress bar
|
//Initialize progress bar
|
||||||
uint32_t processedProgressBar = 0;
|
uint32_t processedProgressBar = 0;
|
||||||
uint32_t totalProgressBar = (uint32_t)(romBanks - 2);
|
uint32_t totalProgressBar = (uint32_t)(romBanks) * 16384;
|
||||||
draw_progressbar(0, totalProgressBar);
|
draw_progressbar(0, totalProgressBar);
|
||||||
|
|
||||||
for (int currBank = 0; currBank < romBanks; currBank++) {
|
for (int currBank = 0; currBank < romBanks; currBank++) {
|
||||||
@ -1271,11 +1267,11 @@ void writeFlash29F_GB(byte MBC, boolean flashErase) {
|
|||||||
dataOut();
|
dataOut();
|
||||||
}
|
}
|
||||||
currAddr += 512;
|
currAddr += 512;
|
||||||
}
|
processedProgressBar += 512;
|
||||||
processedProgressBar += 1;
|
|
||||||
draw_progressbar(processedProgressBar, totalProgressBar);
|
draw_progressbar(processedProgressBar, totalProgressBar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if (MBC == 5) {
|
else if (MBC == 5) {
|
||||||
println_Msg(F("Writing flash MBC5"));
|
println_Msg(F("Writing flash MBC5"));
|
||||||
@ -1286,7 +1282,7 @@ void writeFlash29F_GB(byte MBC, boolean flashErase) {
|
|||||||
|
|
||||||
//Initialize progress bar
|
//Initialize progress bar
|
||||||
uint32_t processedProgressBar = 0;
|
uint32_t processedProgressBar = 0;
|
||||||
uint32_t totalProgressBar = (uint32_t)(romBanks - 2);
|
uint32_t totalProgressBar = (uint32_t)(romBanks) * 16384;
|
||||||
draw_progressbar(0, totalProgressBar);
|
draw_progressbar(0, totalProgressBar);
|
||||||
|
|
||||||
for (int currBank = 0; currBank < romBanks; currBank++) {
|
for (int currBank = 0; currBank < romBanks; currBank++) {
|
||||||
@ -1325,11 +1321,11 @@ void writeFlash29F_GB(byte MBC, boolean flashErase) {
|
|||||||
// Set data pins to output
|
// Set data pins to output
|
||||||
dataOut();
|
dataOut();
|
||||||
}
|
}
|
||||||
}
|
processedProgressBar += 512;
|
||||||
processedProgressBar += 1;
|
|
||||||
draw_progressbar(processedProgressBar, totalProgressBar);
|
draw_progressbar(processedProgressBar, totalProgressBar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set data pins to input again
|
// Set data pins to input again
|
||||||
dataIn_GB();
|
dataIn_GB();
|
||||||
|
Loading…
Reference in New Issue
Block a user