Fix some debugging and typo in decompression.

master
sigonasr2 5 months ago
parent 6db778d6a8
commit 5f0a728fd8
  1. 9
      EarthboundBattleBackgrounds/EarthboundBattleBackgrounds/main.cpp
  2. BIN
      EarthboundBattleBackgrounds/x64/Debug/EarthboundBattleBackgrounds.exe

@ -128,7 +128,7 @@ struct Rom{
while(data[pos]!=0xFF){
if (pos >= data.length())return;
int commandType{data[pos]>>5};
int len{data[pos]&0x1F+1};
int len{(data[pos]&0x1F)+1};
if(commandType==7){
commandType=(int(data[pos])&0x1C)>>2;
len=((int(data[pos])&3)<<8)+int(data[pos+1])+1;
@ -155,6 +155,7 @@ struct Rom{
block[bpos++]=data[pos];
block[bpos++]=data[pos+1];
}
pos+=2;
}break;
case INCREMENTAL_SEQUENCE:{
tmp=data[pos++];
@ -223,9 +224,9 @@ struct Rom{
if(bpp!=2&&bpp!=4)throw std::invalid_argument{std::format("Palette Error: Incorrect color depth specified. Must be 2 or 4, provided {}",bpp)};
for(uint8_t i:std::views::iota(0,pow(2,bpp))){
uint16_t clr16{dataBlock.readShort()};
uint8_t b{((clr16>>10)&31)*8U};
uint8_t r{((clr16>>10)&31)*8U};
uint8_t g{((clr16>>5)&31)*8U};
uint8_t r{(clr16&31)*8U};
uint8_t b{(clr16&31)*8U};
colors.emplace_back(r,g,b);
}
}
@ -344,7 +345,7 @@ public:
bool OnUserUpdate(float fElapsedTime) override
{
//PaletteDisplayTest();
PaletteDisplayTest();
GraphicsDisplayTest();
return true;
}

Loading…
Cancel
Save