Skip to content

Commit

Permalink
Change registers to arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Jan 12, 2024
1 parent 172197f commit b33fc3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/vendor/libqboy/gbgpu.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "gbgpu.h"
#include <cstring>

gbgpu::gbgpu(z80mmu *mmu) {
this->mmu = mmu;
Expand All @@ -10,7 +11,7 @@ void gbgpu::reset() {
modeclock = 0;
line = 0;
scanlinetransfered = false;
registers.resize(_GBGPU_VREGSIZE, 0);
std::fill(registers, registers+_GBGPU_VREGSIZE, 0);

for (int i = 0; i < 4; ++i) {
pallete_bg[i] = pallete_obj0[i] = pallete_obj1[i] = 255;
Expand Down Expand Up @@ -152,7 +153,7 @@ quint8 gbgpu::linecmp() {
}

void gbgpu::preprocessram() {
std::vector<quint8> newregisters(_GBGPU_VREGSIZE, 0);
quint8 newregisters[_GBGPU_VREGSIZE] = {0};

for (int i = 0; i < _GBGPU_VREGSIZE; ++i) {
newregisters[i] = mmu->readbyte(_GBGPU_VREGBASE + i);
Expand Down Expand Up @@ -199,8 +200,7 @@ void gbgpu::preprocessram() {
}
}
}

registers = newregisters;
std::memcpy(&registers, &newregisters, _GBGPU_VREGSIZE);
oldmode = mode;
oldline = line;
}
Expand Down
2 changes: 1 addition & 1 deletion src/vendor/libqboy/gbgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class gbgpu {
bool updated;

quint8 pallete_bg[4], pallete_obj0[4], pallete_obj1[4];
std::vector<quint8> registers;
quint8 registers[_GBGPU_VREGSIZE];

bool lcd_on();
bool bg_on();
Expand Down

0 comments on commit b33fc3c

Please sign in to comment.