public function initLCD()
{
$this->transparentCutoff = Settings::$colorize || $this->cGBC ? 32 : 4;
if (count($this->weaveLookup) == 0) {
//Setup the image decoding lookup table:
$this->weaveLookup = $this->getTypedArray(256, 0, 'uint16');
for ($i_ = 0x1; $i_ <= 0xff; ++$i_) {
for ($d_ = 0; $d_ < 0x8; ++$d_) {
$this->weaveLookup[$i_] += ($i_ >> $d_ & 1) << $d_ * 2;
}
}
}
$this->width = 160;
$this->height = 144;
//Get a CanvasPixelArray buffer:
//Create a white screen
if ($this->drawContext->colorEnabled) {
$this->canvasBuffer = array_fill(0, 4 * $this->width * $this->height, 255);
$address = $this->pixelCount;
$address2 = $this->rgbCount;
while ($address > 0) {
$this->frameBuffer[--$address] = 0xffffff;
$this->canvasBuffer[$address2 -= 4] = 0xff;
$this->canvasBuffer[$address2 + 1] = 0xff;
$this->canvasBuffer[$address2 + 2] = 0xff;
$this->canvasBuffer[$address2 + 3] = 0xff;
}
} else {
$this->canvasBuffer = array_fill(0, 4 * $this->width * $this->height, false);
$this->frameBuffer = array_fill(0, $this->pixelCount, 0xffffff);
}
$this->drawContext->draw($this->canvasBuffer);
}