mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-23 21:19:16 +01:00
Fix bug in N64 controller functions
This commit is contained in:
parent
3500d4684e
commit
38bc8a59e5
@ -798,6 +798,11 @@ void get_button()
|
|||||||
0x01
|
0x01
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Empty buffer
|
||||||
|
for (word i = 0; i < 265; i++) {
|
||||||
|
N64_raw_dump[i] = 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
// don't want interrupts getting in the way
|
// don't want interrupts getting in the way
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
// send those 3 bytes
|
// send those 3 bytes
|
||||||
@ -1965,6 +1970,11 @@ void checkController() {
|
|||||||
// Send status command
|
// Send status command
|
||||||
unsigned char command[] = {0x0};
|
unsigned char command[] = {0x0};
|
||||||
|
|
||||||
|
// Empty buffer
|
||||||
|
for (word i = 0; i < 265; i++) {
|
||||||
|
N64_raw_dump[i] = 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
// don't want interrupts getting in the way
|
// don't want interrupts getting in the way
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
N64_send(command, 1);
|
N64_send(command, 1);
|
||||||
@ -2015,6 +2025,11 @@ byte readBlock(word myAddress) {
|
|||||||
unsigned char addressHigh[] = {(unsigned char)(myAddressCRC >> 8)};
|
unsigned char addressHigh[] = {(unsigned char)(myAddressCRC >> 8)};
|
||||||
unsigned char addressLow[] = {(unsigned char)(myAddressCRC & 0xff)};
|
unsigned char addressLow[] = {(unsigned char)(myAddressCRC & 0xff)};
|
||||||
|
|
||||||
|
// Empty buffer
|
||||||
|
for (word i = 0; i < 265; i++) {
|
||||||
|
N64_raw_dump[i] = 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
// don't want interrupts getting in the way
|
// don't want interrupts getting in the way
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
// send those 3 bytes
|
// send those 3 bytes
|
||||||
@ -2122,17 +2137,17 @@ void readMPK() {
|
|||||||
println_Msg(fileName);
|
println_Msg(fileName);
|
||||||
display_Update();
|
display_Update();
|
||||||
|
|
||||||
//Initialize progress bar
|
|
||||||
uint32_t processedProgressBar = 0;
|
|
||||||
uint32_t totalProgressBar = (uint32_t)(0x7FFF);
|
|
||||||
draw_progressbar(0, totalProgressBar);
|
|
||||||
|
|
||||||
// Dummy write because first write to file takes 1 second and messes up timing
|
// Dummy write because first write to file takes 1 second and messes up timing
|
||||||
blinkLED();
|
blinkLED();
|
||||||
myFile.write(0xFF);
|
myFile.write(0xFF);
|
||||||
myFile.rewind();
|
myFile.rewind();
|
||||||
blinkLED();
|
blinkLED();
|
||||||
|
|
||||||
|
//Initialize progress bar
|
||||||
|
uint32_t processedProgressBar = 0;
|
||||||
|
uint32_t totalProgressBar = (uint32_t)(0x7FFF);
|
||||||
|
draw_progressbar(0, totalProgressBar);
|
||||||
|
|
||||||
// Controller paks, which all have 32kB of space, are mapped between 0x0000 – 0x7FFF
|
// Controller paks, which all have 32kB of space, are mapped between 0x0000 – 0x7FFF
|
||||||
// Read 512 byte into sdBuffer
|
// Read 512 byte into sdBuffer
|
||||||
for (word currSdBuffer = 0x0000; currSdBuffer < 0x8000; currSdBuffer += 512) {
|
for (word currSdBuffer = 0x0000; currSdBuffer < 0x8000; currSdBuffer += 512) {
|
||||||
@ -2409,7 +2424,7 @@ void verifyMPK() {
|
|||||||
// Close the file:
|
// Close the file:
|
||||||
myFile.close();
|
myFile.close();
|
||||||
if (writeErrors == 0) {
|
if (writeErrors == 0) {
|
||||||
println_Msg(F("OK"));
|
println_Msg(F("Written successfully"));
|
||||||
display_Update();
|
display_Update();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user