GBA e-Reader: Fix bitmap short strip scanning

This commit is contained in:
Vicki Pfau 2021-03-30 23:47:50 -07:00
parent 2e0c245e2d
commit 39751aac97
3 changed files with 9 additions and 3 deletions

View File

@ -6,6 +6,7 @@ Emulation fixes:
Other fixes: Other fixes:
- GBA: Fix non-USA 1.0 FireRed misdetecting as a ROM hack (fixes mgba.io/i/2100) - GBA: Fix non-USA 1.0 FireRed misdetecting as a ROM hack (fixes mgba.io/i/2100)
- GBA: Fix crash when ROM loading fails - GBA: Fix crash when ROM loading fails
- GBA e-Reader: Fix bitmap short strip scanning
- GBA Video: Fix mode 5 frame 1 caching (fixes mgba.io/i/2075) - GBA Video: Fix mode 5 frame 1 caching (fixes mgba.io/i/2075)
Misc: Misc:
- GBA: Default-enable VBA bug compat for Ruby and Emerald ROM hacks - GBA: Default-enable VBA bug compat for Ruby and Emerald ROM hacks

View File

@ -370,6 +370,11 @@ void GBAHardwareEReaderScan(struct GBACartridgeHardware* hw, const void* data, s
// Bitmap sizes // Bitmap sizes
case 5456: case 5456:
bitmap = true; bitmap = true;
blocks = 124;
break;
case 3520:
bitmap = true;
blocks = 80;
break; break;
default: default:
return; return;
@ -380,9 +385,9 @@ void GBAHardwareEReaderScan(struct GBACartridgeHardware* hw, const void* data, s
if (bitmap) { if (bitmap) {
size_t x; size_t x;
for (i = 0; i < 40; ++i) { for (i = 0; i < 40; ++i) {
const uint8_t* line = &cdata[(i + 2) * 124]; const uint8_t* line = &cdata[(i + 2) * blocks];
uint8_t* origin = &hw->eReaderDots[EREADER_DOTCODE_STRIDE * i + 200]; uint8_t* origin = &hw->eReaderDots[EREADER_DOTCODE_STRIDE * i + 200];
for (x = 0; x < 124; ++x) { for (x = 0; x < blocks; ++x) {
uint8_t byte = line[x]; uint8_t byte = line[x];
if (x == 123) { if (x == 123) {
byte &= 0xE0; byte &= 0xE0;

View File

@ -799,7 +799,7 @@ void CoreController::scanCard(const QString& path) {
QFile file(path); QFile file(path);
file.open(QIODevice::ReadOnly); file.open(QIODevice::ReadOnly);
m_eReaderData = file.read(2912); m_eReaderData = file.read(2912);
} else if (image.size() == QSize(989, 44)) { } else if (image.size() == QSize(989, 44) || image.size() == QSize(639, 44)) {
const uchar* bits = image.constBits(); const uchar* bits = image.constBits();
size_t size; size_t size;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))