Finish decompress function.

master
sigonasr2 5 months ago
parent 65a4872b06
commit 45efe714d5
  1. 11
      EarthboundBattleBackgrounds/EarthboundBattleBackgrounds/main.cpp

@ -115,6 +115,7 @@ struct Rom{
std::vector<uint16_t>blockOutput;
blockOutput.resize(size);
decompressBlock(ptr,blockOutput);
return blockOutput;
}
private:
void decompressBlock(uint32_t ptrStart,std::vector<uint16_t>&block){
@ -167,10 +168,11 @@ struct Rom{
while(len--!=0)block[bpos++]=Rom::reversedBytes[block[bpos2++]&0xFF];
}break;
case UNKNOWN_1:{
if(bpos+2*len>maxLength||bpos<0)return;
while(len--!=0)block[bpos++]=block[bpos2--];
}break;
case UNKNOWN_2:{
return;
}break;
}
}
@ -232,8 +234,9 @@ struct Rom{
std::vector<uint16_t>graphicsData;
std::vector<Tile>tiles;
BackgroundGraphics(std::string_view data,uint16_t index,byte bpp){
DataBlock graphicsPointer{data,0xD7A1U+index*4U};
graphicsPointer.decompress();
DataBlock graphicsPtr{data,0xD7A1U+index*4U};
DataBlock loadGraphicsPtr{data,snesToHex(graphicsPtr.readInt32())};
graphicsData=loadGraphicsPtr.decompress();
}
};
std::string data;

Loading…
Cancel
Save