|
|
|
@ -162,15 +162,15 @@ struct Rom{ |
|
|
|
|
while(len--!=0)block[bpos++]=tmp++; |
|
|
|
|
}break; |
|
|
|
|
case REPEAT_PREVIOUS_DATA:{ |
|
|
|
|
if(bpos+2*len>maxLength||bpos<0)return; |
|
|
|
|
if(bpos2+len>maxLength||bpos2<0)return; |
|
|
|
|
for(int i:std::views::iota(0,len))block[bpos++]=block[bpos2+i]; |
|
|
|
|
}break; |
|
|
|
|
case REVERSE_BITS:{ |
|
|
|
|
if(bpos+2*len>maxLength||bpos<0)return; |
|
|
|
|
if(bpos2+len>maxLength||bpos2<0)return; |
|
|
|
|
while(len--!=0)block[bpos++]=Rom::reversedBytes[block[bpos2++]&0xFF]; |
|
|
|
|
}break; |
|
|
|
|
case UNKNOWN_1:{ |
|
|
|
|
if(bpos+2*len>maxLength||bpos<0)return; |
|
|
|
|
if(bpos2-len+1<0)return; |
|
|
|
|
while(len--!=0)block[bpos++]=block[bpos2--]; |
|
|
|
|
}break; |
|
|
|
|
case UNKNOWN_2:{ |
|
|
|
@ -224,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 r{((clr16>>10)&31)*8U}; |
|
|
|
|
uint8_t b{((clr16>>10)&31)*8U}; |
|
|
|
|
uint8_t g{((clr16>>5)&31)*8U}; |
|
|
|
|
uint8_t b{(clr16&31)*8U}; |
|
|
|
|
uint8_t r{(clr16&31)*8U}; |
|
|
|
|
colors.emplace_back(r,g,b); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|