code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
package { import com.logosware.event.QRreaderEvent; import com.logosware.utils.QRcode.GetQRimage; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.events.TimerEvent; import flash.external.ExternalInterface; import flash.filters.ColorMatrixFilter; import flash.media.Camera; import flash.media.Video; import flash.utils.Timer; public class Qrread extends Sprite { private var qrImage:GetQRimage; private var camera:Camera; private var cameraView:Sprite; private var video:Video = new Video(SRC_SIZE, SRC_SIZE); private var cameraTimer:Timer = new Timer(2000); private var redBorder:Sprite = new Sprite(); private var container:Sprite = new Sprite();; private const SRC_SIZE:int = 320; public function Qrread() { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; cameraTimer.addEventListener(TimerEvent.TIMER, getCamera); cameraTimer.start(); getCamera(); } private function getCamera(e:TimerEvent = null): void { camera = Camera.getCamera(); if(camera != null) { cameraTimer.stop(); start(); } } private function start(): void { cameraView = buildCameraView(); qrImage = new GetQRimage(video); qrImage.addEventListener(QRreaderEvent.QR_IMAGE_READ_COMPLETE, qrImageReadCompleteHandler); addEventListener(Event.ENTER_FRAME, enterFrameHandler); container.addChild(cameraView); addChild(container); } private function buildCameraView(): Sprite { camera.setQuality(0, 100); camera.setMode(SRC_SIZE, SRC_SIZE, 24, true ); video.attachCamera( camera ); video.smoothing = true; redBorder.graphics.lineStyle(2, 0xFF0000); redBorder.graphics.drawPath(Vector.<int>([1,2,2,1,2,2,1,2,2,1,2,2]), Vector.<Number>([30,60,30,30,60,30,290,60,290,30,260,30,30,260,30,290,60,290,290,260,290,290,260,290])); var view:Sprite = new Sprite(); var holder:Sprite = new Sprite(); holder.addChild(video); view.addChild(holder); view.addChild(redBorder); return view; } private function getVideoFilters(): Array { var m:Array = [-1,0,0,0,255,0,-1,0,0,255,0,0,-1,0,255,0,0,0,1,0]; var f:ColorMatrixFilter = new ColorMatrixFilter(m); return [f]; } private function enterFrameHandler(e:Event): void { if(camera.currentFPS > 0) { qrImage.process(); } } private function qrImageReadCompleteHandler(e:QRreaderEvent): void { var result:Array = e.data; if(ExternalInterface.available) { ExternalInterface.call("decode", result); } } } }
123912029-ssiagu
qrread/src/Qrread.as
ActionScript
gpl2
2,663
/************************************************************************** * LOGOSWARE Class Library. * * Copyright 2009 (c) LOGOSWARE (http://www.logosware.com) All rights reserved. * * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************/ package com.logosware.utils.QRcode { import com.logosware.utils.QRcode.GFstatic; /** * GF(2^4)を扱うためのクラス **/ public class G4Num { private var _vector:uint; private var _power:int; /** * コンストラクタ * @param power 指数 **/ public function G4Num(power:int) { setPower( power ); } /** * 指数を指定する * @param power 指数 **/ public function setPower( power:int ):void { _power = power; if ( _power < 0 ) { _vector = 0; } else { _power %= 15; _vector = GFstatic._power2vector_4[_power]; } } /** * 整数値を指定する * @param vector 整数値 **/ public function setVector( vector:uint ):void { _vector = vector; _power = GFstatic._vector2power_4[_vector]; } /** * 整数値を取得する * @param 整数値 **/ public function getVector():uint { return _vector; } /** * 指数を取得する * @param 指数 **/ public function getPower():int { return _power; } /** * 足し算を行う。整数値同士のxorを取る。 * @param other 足す対象となるG4Numインスタンス * @param 計算結果 **/ public function plus( other:G4Num ):G4Num { var newVector:uint = _vector ^ other.getVector(); return new G4Num( GFstatic._vector2power_4[ newVector ] ); } /** * 乗算を行う。指数同士の足し算を行う。 * @param other かける対象となるG4Numインスタンス * @param 計算結果 **/ public function multiply( other:G4Num ):G4Num { if ( (_power == -1) || (other.getPower() == -1 ) ) { return new G4Num( -1 ); } else { return new G4Num( _power + other.getPower() ); } } } }
123912029-ssiagu
qrread/src/com/logosware/utils/QRcode/G4Num.as
ActionScript
gpl2
2,781
/************************************************************************** * LOGOSWARE Class Library. * * Copyright 2009 (c) LOGOSWARE (http://www.logosware.com) All rights reserved. * * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************/ package com.logosware.utils.QRcode { /** * ガロア体GF(2^w) w=4, 8 の計算に用いる定数 */ public class GFstatic { /** * GF(2^4)計算用定数. * _power2vector_4[指数] = 整数値 のように使います */ public static var _power2vector_4:Array = [ 1, 2, 4, 8, 3, 6, 12, 11, 5, 10, 7, 14, 15, 13, 9, 1 ]; /** * GF(2^4)計算用定数. * _power2vector_4[整数値] = 指数 のように使います */ public static var _vector2power_4:Array = [ -1, 0, 1, 4, 2, 8, 5, 10, 3, 14, 9, 7, 6, 13, 11, 12 ]; /** * GF(2^8)計算用定数. * _power2vector_8[指数] = 整数値 のように使います */ public static var _power2vector_8:Array = [ 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, 253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, 217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, 230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, 227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 1 ]; /** * GF(2^8)計算用定数. * _power2vector_8[整数] = 指数 のように使います */ public static var _vector2power_8:Array = [ -1, 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, 242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175 ]; } }
123912029-ssiagu
qrread/src/com/logosware/utils/QRcode/GFstatic.as
AngelScript
gpl2
4,409
/************************************************************************** * LOGOSWARE Class Library. * * Copyright 2009 (c) LOGOSWARE (http://www.logosware.com) All rights reserved. * * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************/ package com.logosware.utils.QRcode { import com.logosware.utils.QRcode.GFstatic; /** * GF(2^8)を扱うためのクラス **/ public class G8Num { private var _vector:uint; private var _power:int; /** * コンストラクタ * @param power 指数 **/ public function G8Num(power:int) { setPower( power ); } /** * 指数を指定する * @param power 指数 **/ public function setPower( power:int ):void { _power = power; if ( _power < 0 ) { _vector = 0; } else { _power %= 255; _vector = GFstatic._power2vector_8[_power]; } } /** * 整数値を指定する * @param vector 整数値 **/ public function setVector( vector:uint ):void { _vector = vector; _power = GFstatic._vector2power_8[_vector]; } /** * 整数値を取得する * @param 整数値 **/ public function getVector():uint { return _vector; } /** * 指数を取得する * @param 指数 **/ public function getPower():int { return _power; } /** * 足し算を行う。整数値同士のxorを取る。 * @param other 足す対象となるG4Numインスタンス * @param 計算結果 **/ public function plus( other:G8Num ):G8Num { var newVector:uint = _vector ^ other.getVector(); return new G8Num( GFstatic._vector2power_8[ newVector ] ); } /** * 乗算を行う。指数同士の足し算を行う。 * @param other かける対象となるG4Numインスタンス * @param 計算結果 **/ public function multiply( other:G8Num ):G8Num { if ( (_power < 0) || (other.getPower() < 0 ) ) { return new G8Num( -1 ); } else { return new G8Num( _power + other.getPower() ); } } /** * 逆数を計算して得る。元のインスタンスは変化しない。 * @param 計算結果 **/ public function inverse():G8Num { return new G8Num( 255 - getPower() ); } } }
123912029-ssiagu
qrread/src/com/logosware/utils/QRcode/G8Num.as
ActionScript
gpl2
2,985
/************************************************************************** * LOGOSWARE Class Library. * * Copyright 2009 (c) LOGOSWARE (http://www.logosware.com) All rights reserved. * * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************/ package com.logosware.utils.QRcode { import com.logosware.utils.LabelingClass; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.BlendMode; import flash.display.DisplayObject; import flash.display.Loader; import flash.display.Sprite; import flash.filters.BlurFilter; import flash.filters.ColorMatrixFilter; import flash.filters.ConvolutionFilter; import flash.geom.ColorTransform; import flash.geom.Matrix; import flash.geom.Point; import flash.geom.Rectangle; import flash.utils.getTimer; /** * @author UENO Kenichi */ public class QRCodeDetecter extends Sprite { private var image:DisplayObject; private var bd:BitmapData; private var bd2:BitmapData; private var threshold:uint = 0xFF888888; private var grayConst:Array = [ 0.3, 0.59, 0.11, 0, 0, 0.3, 0.59, 0.11, 0, 0, 0.3, 0.59, 0.11, 0, 0, 0, 0, 0, 0, 255 ]; /** * 画像からQRコードを見つけ出します * @param imageSource */ public function QRCodeDetecter(imageSource:DisplayObject) { image = imageSource; bd = new BitmapData(image.width, image.height, true, 0x0); bd2 = new BitmapData(image.width, image.height, true, 0x0); // debug code /* var bmp:Bitmap = new Bitmap( bd ); image.parent.addChild( bmp ); bmp.x = image.width; */ } /** * 見つかったQRコードの位置情報を返します * @return マーカー配列 * [ * { * image:BitmapData, * borderColors:[ * 0: uint color of topleft marker * 1: uint color of topright marker * 2: uint color of bottomleft marker * ], * originalLocation:[ * 0: Rectangle of topleft marker * 1: Rectangle of topright marker * 2: Rectangle of bottomleft marker * ] * } * ... * ] */ public function detect():Array { var ret:Array = []; bd.lock(); bd.draw(image); // グレー化 bd.applyFilter(bd, bd.rect, new Point(), new ColorMatrixFilter(grayConst)); bd.applyFilter(bd, bd.rect, new Point(), new ConvolutionFilter(5, 5, [ 0, -1, -1, -1, 0, -1, -1, -2, -1, -1, -1, -2, 25, -2, -1, -1, -1, -2, -1, -1, 0, -1, -1, -1, 0 ])); bd.applyFilter(bd, bd.rect, new Point(), new BlurFilter(3, 3)); // 二値化 bd.threshold(bd, bd.rect, new Point(), ">", threshold, 0xFFFFFFFF, 0x0000FF00); bd.threshold(bd, bd.rect, new Point(), "!=", 0xFFFFFFFF, 0xFF000000); // ラベリング var LabelingObj:LabelingClass = new LabelingClass(); LabelingObj.Labeling( bd, 10, 0xFF88FFFE, true ); // ラベリング実行 var pickedRects:Array = LabelingObj.getRects(); var pickedColor:Array = LabelingObj.getColors(); LabelingObj = null; // マーカー候補の矩形を取得 var borders:Array = _searchBorders( bd, pickedRects, pickedColor ); // 直角の位置にあるコードを検索 var codes:Array = _searchCode( borders ); // 適切な角度で切り抜き var images:Array = _clipCodes( bd, codes ); for ( var i:int = 0; i < images.length; i++ ) { ret.push( { image:images[i], borderColors:[codes[i][0].borderColor, codes[i][1].borderColor, codes[i][2].borderColor], originalLocation:[codes[i][0].borderRect, codes[i][1].borderRect, codes[i][2].borderRect] } ); } bd.unlock(); return ret; } private function _clipCodes( bd:BitmapData, codes:Array):Array { var ret:Array = []; for ( var i:int = 0; i < codes.length; i++ ) { var marker1:Rectangle = codes[i][0].borderRect; // top left var marker2:Rectangle = codes[i][1].borderRect; // top right var marker3:Rectangle = codes[i][2].borderRect; // bottom left var vector12:Point = marker2.topLeft.subtract( marker1.topLeft ); // vector: top left -> top right var vector13:Point = marker3.topLeft.subtract( marker1.topLeft ); // vector: top left -> bottom left var theta:Number = -Math.atan2( vector12.y, vector12.x ); // 平面状の回転角 var matrix:Matrix = new Matrix(); var d:Number = (0.5 * marker1.width) / (Math.abs(Math.cos( theta )) + Math.abs(Math.sin( theta ) ) ); // マーカーの一辺の長さの半分 matrix.translate( -(marker1.topLeft.x + marker1.width * 0.5), -(marker1.topLeft.y + marker1.height * 0.5) ); matrix.rotate( theta ); matrix.translate( 20 + d, 20 + d ); var matrix2:Matrix = new Matrix(); matrix2.rotate( theta ); var vector13r:Point = matrix2.transformPoint( vector13 ); matrix2 = new Matrix(1.0, 0, -vector13r.x/vector13r.y, vector12.length / vector13r.y ); matrix.concat( matrix2 ); var len:Number = ( vector12.length + 2 * d ); // QRコードの一辺の長さ var bd2:BitmapData = new BitmapData( 40 + len, 40 + len ); bd2.draw( bd, matrix ); ret.push( bd2 ); } return ret; } /** * マーカーの候補をピックアップする * @param bmp ラベリング済みの画像 * @param rectArray 矩形情報 * @param colorArray 矩形の色情報 * @return 候補の配列 */ private function _searchBorders(bmp:BitmapData, rectArray:Array, colorArray:Array):Array { function isMarker( ary:Array ):Boolean { var c:Number = 0.75; var ave:Number = (ary[0] + ary[1] + ary[2] + ary[3] + ary[4]) / 7; return( ary[0] > ((1.0-c)*ave) && ary[0] < ((1.0+c)*ave) && ary[1] > ((1.0-c)*ave) && ary[1] < ((1.0+c)*ave) && ary[2] > ((3.0-c)*ave) && ary[2] < ((3.0+c)*ave) && ary[3] > ((1.0-c)*ave) && ary[3] < ((1.0+c)*ave) && ary[4] > ((1.0-c) * ave) && ary[4] < ((1.0+c) * ave) ); } var retArray:Array = []; for ( var i:int = 0; i < rectArray.length; i++ ) { var count:int = 0; var target:Number = 0; var tempRect:Rectangle = rectArray[i];// 外側 if( colorArray[i] != bmp.getPixel( rectArray[i].topLeft.x + rectArray[i].width*0.5, rectArray[i].topLeft.y + rectArray[i].height*0.5) ){ var oldFlg:uint = 0; var tempFlg:uint = 0; var index:int = -1; var countArray:Array = [0.0, 0.0, 0.0, 0.0, 0.0]; var j:int; var constNum:Number; // 横方向 constNum = rectArray[i].topLeft.y + rectArray[i].height*0.5; for ( j = 0; j < rectArray[i].width; j++ ){ tempFlg = (bmp.getPixel( rectArray[i].topLeft.x + j, constNum ) == 0xFFFFFF)?0:1; if( (index == -1) && (tempFlg == 0) ){ //go next } else { if( tempFlg != oldFlg ){ index++; oldFlg = tempFlg; if( index >= 5 ){ break; } } countArray[index]++; } } if ( isMarker(countArray) ) { // 縦方向 countArray = [0.0, 0.0, 0.0, 0.0, 0.0]; oldFlg = tempFlg = 0; index = -1; constNum = rectArray[i].topLeft.x + rectArray[i].width*0.5; for ( j = 0; j < rectArray[i].width; j++ ) { tempFlg = (bmp.getPixel( constNum, rectArray[i].topLeft.y + j ) == 0xFFFFFF)?0:1; if( (index == -1) && (tempFlg == 0) ){ //go next } else { if( tempFlg != oldFlg ){ index++; oldFlg = tempFlg; if( index >= 5 ){ break; } } countArray[index]++; } } if ( isMarker(countArray) ) { retArray.push( {borderColor:colorArray[i], borderRect:rectArray[i]} ); } } } } return retArray; } /** * 直角関係にあるマーカーを探します * @param borders 候補の配列 * @return */ private function _searchCode( borders:Array ):Array { function isNear( p1:Point, p2:Point, d:Number ):Boolean { return( (p1.x + d) > p2.x && (p1.x - d) < p2.x && (p1.y + d) > p2.y && (p1.y - d) < p2.y ); } var ret:Array = []; var loop:int = borders.length; for ( var i:int = 0; i < (loop-2); i++ ) { for ( var j:int = i + 1; j < (loop-1); j++ ) { var vec:Point = borders[i].borderRect.topLeft.subtract( borders[j].borderRect.topLeft ); for ( var k:int = j + 1; k < loop; k++ ) { if( isNear( borders[k].borderRect.topLeft, new Point( borders[i].borderRect.topLeft.x + vec.y, borders[i].borderRect.topLeft.y - vec.x ), 0.125 * vec.length )) ret.push( [borders[i], borders[j], borders[k]] ); else if ( isNear( borders[k].borderRect.topLeft, new Point( borders[i].borderRect.topLeft.x - vec.y, borders[i].borderRect.topLeft.y + vec.x ), 0.125 * vec.length )) ret.push( [borders[i], borders[k], borders[j]] ); else if ( isNear( borders[k].borderRect.topLeft, new Point( borders[j].borderRect.topLeft.x + vec.y, borders[j].borderRect.topLeft.y - vec.x ), 0.125 * vec.length )) ret.push( [borders[j], borders[k], borders[i]] ); else if ( isNear( borders[k].borderRect.topLeft, new Point( borders[j].borderRect.topLeft.x - vec.y, borders[j].borderRect.topLeft.y + vec.x ), 0.125 * vec.length )) ret.push( [borders[j], borders[i], borders[k]] ); } } } return ret; } } }
123912029-ssiagu
qrread/src/com/logosware/utils/QRcode/QRCodeDetecter.as
AngelScript
gpl2
10,241
/************************************************************************** * LOGOSWARE Class Library. * * Copyright 2009 (c) LOGOSWARE (http://www.logosware.com) All rights reserved. * * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************/ package com.logosware.utils.QRcode { import com.logosware.event.QRreaderEvent; import com.logosware.utils.LabelingClass; import flash.display.*; import flash.events.EventDispatcher; import flash.filters.ColorMatrixFilter; import flash.filters.ConvolutionFilter; import flash.geom.*; import flash.utils.ByteArray; /** * 主にカメラ画像からQRコードを切り出すためのクラスです. * 画像上にあるVersion 1~10のQRコードを0,1からなる2次元配列に整形して返します * @author Kenichi UENO **/ public class GetQRimage extends EventDispatcher { private var _wid:uint = 320; private var _hgt:uint = 240; private var _minVersion:uint = 1; // サポートする最低バージョン private var _maxVersion:uint = 10; // サポートする最高バージョン private var _imageSource:DisplayObject = new Sprite(); private var _resultImage:BitmapData = new BitmapData(1, 1); private var _resultArray:Array = []; private var _results:Array = [ _resultImage, _resultArray ]; private const _origin:Point = new Point(0, 0); private var detecter:QRCodeDetecter; /** * コンストラクタ. * @param tempMC QRコード描画元のSpriteインスタンス **/ public function GetQRimage(source:DisplayObject) { _imageSource = source; detecter = new QRCodeDetecter(_imageSource); } /** * 読み取りを実行します * @eventType QRreaderEvent.QR_IMAGE_READ_COMPLETE */ public function process():void { var QRCodes:Array = detecter.detect(); for ( var i:int = 0; i < QRCodes.length; i++ ) { var bmpData:BitmapData = QRCodes[i].image; var colors:Array = QRCodes[i].borderColors; // バージョンの取得 var qrInfo:Object = _getVersion( bmpData, colors[0], colors[1], colors[2] ); if ( qrInfo.version > 0 ) { // グリッドの結果を取得 _results = _getGrid( bmpData, qrInfo ); _resultImage = _results[0]; _resultArray = _results[1]; // グリッド中でもマーカー確認 var checkBmp:BitmapData = new BitmapData( _resultImage.width, _resultImage.height ); checkBmp.applyFilter(_resultImage,_resultImage.rect,_origin,new ConvolutionFilter(7, 7, [1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1],33)); if ( (checkBmp.getPixel(7, 7) == 0) && (checkBmp.getPixel(checkBmp.width - 8, 7) == 0) && (checkBmp.getPixel(7, checkBmp.height - 8) == 0) ) { dispatchEvent( new QRreaderEvent( QRreaderEvent.QR_IMAGE_READ_COMPLETE, _resultImage, _resultArray ) ); } else { } } } // process終了 } /** * QRコードのビット情報を二次元配列化する * @param bmpData 画像 * @param qrInfo QRコード情報オブジェクト * @param ビットパターン配列 */ private function _getGrid( bmpData:BitmapData, qrInfo:Object ):Array { var __resultBmp:BitmapData = new BitmapData( 8 + qrInfo.version * 4 + 17, 8 + qrInfo.version * 4 + 17 ); var __resultArray:Array = new Array( qrInfo.version * 4 + 17 ); var __i:uint; var __thisColor:uint; var __tlCenter:Object = { x:qrInfo.topLeftRect.topLeft.x + 0.5 * ( qrInfo.topLeftRect.width ), y:qrInfo.topLeftRect.topLeft.y + 0.5 * ( qrInfo.topLeftRect.height ) }; var __trCenter:Object = { x:qrInfo.topRightRect.topLeft.x + 0.5 * ( qrInfo.topRightRect.width ), y:qrInfo.topRightRect.topLeft.y + 0.5 * ( qrInfo.topRightRect.height ) }; var __blCenter:Object = { x:qrInfo.bottomLeftRect.topLeft.x + 0.5 * ( qrInfo.bottomLeftRect.width ), y:qrInfo.bottomLeftRect.topLeft.y + 0.5 * ( qrInfo.bottomLeftRect.height ) }; for( __i = 0; __i < (qrInfo.version*4+17); __i++ ){ __resultArray[__i] = new Array( qrInfo.version * 4 + 17 ); } __i = 0; __thisColor = 0; while ( __thisColor != 0xFFFFFF ) { __i++; __thisColor = bmpData.getPixel( qrInfo.topRightRect.topLeft.x + __i, qrInfo.bottomLeftRect.topLeft.y + __i ); } bmpData.floodFill( qrInfo.topRightRect.topLeft.x + __i, qrInfo.bottomLeftRect.topLeft.y + __i, 0xFFCCFFFF ); var __bottomRightRect:Rectangle = bmpData.getColorBoundsRect( 0xFFFFFFFF, 0xFFCCFFFF ); bmpData.floodFill( qrInfo.topRightRect.topLeft.x + __i, qrInfo.bottomLeftRect.topLeft.y + __i, 0xFFFFFFFF ); var __brCenter:Object = { x:__bottomRightRect.topLeft.x + 0.5 * ( __bottomRightRect.width ), y:__bottomRightRect.topLeft.y + 0.5 * ( __bottomRightRect.height ) }; if( qrInfo.version == 1 ){ __brCenter.x = __blCenter.x + (__trCenter.x - __tlCenter.x) * 11.0 / 14.0; __brCenter.y = __trCenter.y + (__blCenter.y - __tlCenter.y) * 11.0 / 14.0; } var __tempNum1:Number = ( qrInfo.version * 4.0 + 17 - 10 ); //QRコード上の、左上マーカー中心から右「下」マーカー中心までのx座標の差 (ver5なら27) var __tempNum2:Number = ( qrInfo.version * 4.0 + 17 - 7 ); //QRコード上の、左上マーカー中心から右「上」マーカー中心までのx座標の差 (ver5なら30) var __blTop:Object = { x: qrInfo.bottomLeftRect.topLeft.x + qrInfo.bottomLeftRect.width*0.5, y: qrInfo.bottomLeftRect.topLeft.y + qrInfo.bottomLeftRect.height/14.0 }; var __trLeft:Object = { x: qrInfo.topRightRect.topLeft.x + qrInfo.topRightRect.width / 14.0, y: qrInfo.topRightRect.topLeft.y + qrInfo.topRightRect.height * 0.5 }; var __sum:Number = 0.0; var __num:Number = 0.0; for ( __i = __blTop.y - qrInfo.cellSize; __i <= __blTop.y + qrInfo.cellSize; __i++ ) { if ( bmpData.getPixel( __blTop.x, __i ) != 0xFFFFFF ) { __sum += __i; __num++; } } __blTop.y = 0.5 * (__blTop.y + __sum / __num); var __a3:Number = ( __tlCenter.y - __trLeft.y) / ( __tlCenter.x - __trLeft.x); var __a30:Number = ( __blTop.y - __brCenter.y) / ( __blTop.x - __brCenter.x); var __b3:Number = __trLeft.y - __a3 * __trLeft.x; var __b30:Number = __brCenter.y - __a30 * __brCenter.x; var __startX3:Number = __tlCenter.x + ( __trLeft.x - __tlCenter.x ) * ( -3.0 / __tempNum1 ); var __startX30:Number = __blTop.x + ( __brCenter.x - __blTop.x ) * ( -3.0 / __tempNum1 ); var __startY3:Number = __tlCenter.y + ( __trLeft.y - __tlCenter.y ) * ( -3.0 / __tempNum1 ); var __startY30:Number = __blTop.y + ( __brCenter.y - __blTop.y ) * ( -3.0 / __tempNum1 ); var __end3:Number = __trLeft.x + ( __trLeft.x - __tlCenter.x ) * ( 6.0 / __tempNum1 ); var __end30:Number = __brCenter.x + ( __brCenter.x - __blTop.x ) * ( 6.0 / __tempNum1 ); var __loopConst:uint = (__resultBmp.width - 8 ); var __loopConst2:uint = __loopConst - 1; var __a:Array = new Array( __loopConst ); var __b:Array = new Array( __loopConst ); var __startX:Array = new Array( __loopConst ); var __startY:Array = new Array( __loopConst ); var __endX:Array = new Array( __loopConst ); for ( __i = 0; __i < __loopConst; __i++ ) { __a[__i] = (( __a30 - __a3 ) / __tempNum1) * ( __i - 3 ) + __a3; __startX[__i] = (( __startX30 - __startX3 ) / __tempNum1) * ( __i - 3 ) + __startX3; __startY[__i] = (( __startY30 - __startY3 ) / __tempNum1) * ( __i - 3 ) + __startY3; __endX[__i] = (( __end30 - __end3 ) / __tempNum1) * ( __i - 3 ) + __end3; __b[__i] = __startY[__i] - __a[__i] * __startX[__i]; } for ( var __y:Number = 0; __y < __loopConst; __y++ ) { var __y2:Number = __y - 3; for ( var __x:Number = 0; __x < __loopConst; __x++ ) { var __x2:Number = __x - 3; if ( (bmpData.getPixel( __startX[__y] + ( __endX[__y] - __startX[__y] ) * ( __x / __loopConst2 ), __a[__y] * (__startX[__y] + ( __endX[__y] - __startX[__y] ) * ( __x / __loopConst2 )) + __b[__y] ) & 0xFF0000) < 0xFF0000) { __resultBmp.setPixel( 4 + __x, 4 + __y, 0 ); __resultArray[__y][__x] = 1; } } } return [__resultBmp, __resultArray]; } /** * QRコードのバージョンを判別する * @param bmp 画像 * @param QRコード情報オブジェクト */ private function _getVersion( bmp:BitmapData, tlColor:uint, trColor:uint, blColor:uint ):Object { var i:uint; var thisColor:uint; bmp.lock(); var topLeftRect:Rectangle = bmp.getColorBoundsRect( 0xFFFFFFFF, tlColor ); var topRightRect:Rectangle = bmp.getColorBoundsRect( 0xFFFFFFFF, trColor ); var bottomLeftRect:Rectangle = bmp.getColorBoundsRect( 0xFFFFFFFF, blColor ); var startTopLeft:Point = new Point( 26, topLeftRect.topLeft.y + topLeftRect.height ); var numX:uint = 0; var tempX:uint; var oldP:uint; var whiteNum:uint = 0; for ( var j:int = -8; j <= 0; j++ ) { tempX = 0; var whiteArray:Array = []; var tempArray:ByteArray = bmp.getPixels( new Rectangle( startTopLeft.x, startTopLeft.y + j, bmp.width - 52, 1 ) ); var startColor:uint = tempArray[1]; var endColor:uint = tempArray[4*(bmp.width-26-1)+1]; if ( ( startColor != 0xFF ) && ( endColor != 0xFF ) ) { oldP = startColor; for ( i = 1; i < (bmp.width - 24); i++ ) { var tempColor:uint = tempArray[4*i+1]; if ( tempColor != oldP ) { tempX ++; oldP = tempColor; } if ( tempColor == 0xFF ) { whiteNum++; } else { if ( whiteNum > 0 ) { whiteArray.push( [whiteNum] ); whiteNum = 0; } } } var sum:Number = 0; // 妥当性のチェック 白いマスが全部同じくらいのサイズだったらOK for ( var k:uint = 0; k < whiteArray.length; k++ ) { sum += Number( whiteArray[k] ); } var average:Number = sum / whiteArray.length; var error:uint = 0; for ( k = 0; k < whiteArray.length; k++ ) { if ( ! ((whiteArray[k] > (average * 0.5)) && (whiteArray[k] < (average * 1.5)) ) ) { error++; } } if ( (numX < tempX) && (error == 0) ) { numX = tempX; } } } numX = Math.floor( ( ( numX - 3 ) - 6 ) * 0.25 ) + 1; startTopLeft = new Point( topLeftRect.topLeft.x + topLeftRect.width, 26 ); var numY:uint = 0; whiteNum = 0; for ( j = -8; j <= 0; j++ ) { tempX = 0; whiteArray = []; tempArray = bmp.getPixels( new Rectangle( startTopLeft.x + j, startTopLeft.y, 1, bmp.height - 52 ) ); startColor = tempArray[1]; endColor = tempArray[4*(bmp.height-26-1)+1]; if ( ( startColor != 0xFF ) && ( endColor != 0xFF ) ) { oldP = startColor; for ( i = 1; i < (bmp.height - 24); i++ ) { tempColor = tempArray[4*i+1]; if ( tempColor != oldP ) { tempX ++; oldP = tempColor; } if ( tempColor == 0xFF ) { whiteNum++; } else { if ( whiteNum > 0 ) { whiteArray.push( [whiteNum] ); whiteNum = 0; } } } sum = 0; // 妥当性のチェック 白いマスが全部同じくらいのサイズだったらOK for ( k = 0; k < whiteArray.length; k++ ) { sum += Number( whiteArray[k] ); } average = sum / whiteArray.length; error = 0; for ( k = 0; k < whiteArray.length; k++ ) { if ( ! ((whiteArray[k] > (average * 0.5)) && (whiteArray[k] < (average * 1.5)) ) ) { error++; } } if ( (numY < tempX) && (error == 0) ) { numY = tempX; } } } numY = Math.floor( ( ( numY - 3 ) - 6 ) * 0.25 ) + 1; if ( (numX == numY) && (numX >= _minVersion) && (numX <= _maxVersion ) ) { // trace("numX"); } else { numX = 0; } bmp.unlock(); return {cellSize:(topRightRect.x + topRightRect.width - topLeftRect.x) / (numX * 4 + 17), version:numX, topLeftRect: topLeftRect, topRightRect:topRightRect, bottomLeftRect: bottomLeftRect}; } /** * 画像中央付近の明るさを使って白と黒の閾値を計算する * @param bmp 画像 * @param 閾値 */ private function _getThreshold( bmp:BitmapData ):uint { var rect:Rectangle = new Rectangle( bmp.width * 0.5, 0, 1, bmp.height ); var bmp_check:BitmapData = new BitmapData( 1, bmp.height ); bmp_check.copyPixels(bmp, rect, new Point(0, 0)); bmp_check.lock(); var tempArray:ByteArray = bmp_check.getPixels( bmp_check.rect ); var sum:Number = 0.0; for ( var i:uint = 0; i < bmp.height; i++ ) { sum += tempArray[4*i+3]; // 緑成分で判定 } sum /= bmp.height; return uint(0xFF000000 + 0x00010101 * Math.round(sum)); } /** * 画像をグレースケール化する * @param bmp_src 元の画像 * @param bmp_dst 結果格納先の画像 * @param rect 適用範囲指定 * @param point 適用原点指定 * @param constnum 明るさ補正 **/ private function _toGray( bmp_src:BitmapData, bmp_dst:BitmapData, rect:Rectangle, point:Point, constnum:Number = 2.5 ):void { var conGray:Array = [constnum*0.3, constnum*0.59, constnum*0.11]; var cmfGray:ColorMatrixFilter = new ColorMatrixFilter( [conGray[0], conGray[1], conGray[2], 0, 0, conGray[0], conGray[1], conGray[2], 0, 0, conGray[0], conGray[1],conGray[2], 0, 0, 0, 0, 0, 0, 255] ); bmp_dst.applyFilter( bmp_src, rect, point, cmfGray ); } /** * 画像を2値化する * @param bmp 2値化する画像 * @param threshold 閾値 **/ private function _binalization( bmp:BitmapData, threshold:uint = 0xFFFFFFFF ):void { bmp.threshold(bmp, bmp.rect, new Point(0, 0), "<", threshold, 0xFF000000, 0xFFFFFFFF ); bmp.threshold(bmp, bmp.rect, new Point(0, 0), ">=", threshold, 0xFFFFFFFF, 0xFFFFFFFF ); } /** * 境界上の点をピックアップする * @param bmp 元画像 * @param rect 対象画像位置 * @param color 対象色 * @param devide 分割個数 * @param 点情報 **/ private function _getBorderPoints(bmp:BitmapData, rect:Rectangle, color:uint, divide:uint):Array { var tempX:uint; var tempY:uint; var tempBmpX:BitmapData = new BitmapData( rect.width, 1); var tempBmpY:BitmapData = new BitmapData( 1, rect.height ); var tempRect2:Rectangle; var tempPoint:Point; var loopCount:uint = divide; var borderPoints:Array = new Array(); for (var j:uint = 0; j <= loopCount; j++ ) { tempX = ( (rect.width-1) * j ) / loopCount + rect.topLeft.x; tempY = ( (rect.height-1) * j ) / loopCount + rect.topLeft.y; tempBmpX.copyPixels( bmp, new Rectangle(rect.topLeft.x, tempY, rect.width, 1), new Point(0,0) ); tempBmpY.copyPixels( bmp, new Rectangle(tempX, rect.topLeft.y, 1, rect.height), new Point(0,0) ); // 横線スキャン tempRect2 = tempBmpY.getColorBoundsRect( 0xFFFFFFFF, color ); tempPoint = new Point( tempX + tempRect2.topLeft.x, rect.topLeft.y + tempRect2.topLeft.y ); borderPoints.push( tempPoint ); tempPoint = new Point( tempX + tempRect2.topLeft.x + tempRect2.width, rect.topLeft.y + tempRect2.topLeft.y + tempRect2.height ); borderPoints.push( tempPoint ); // 縦線スキャン tempRect2 = tempBmpX.getColorBoundsRect( 0xFFFFFFFF, color ); tempPoint = new Point( rect.topLeft.x + tempRect2.topLeft.x, tempY + tempRect2.topLeft.y ); borderPoints.push( tempPoint ); tempPoint = new Point( rect.topLeft.x + tempRect2.topLeft.x + tempRect2.width, tempY + tempRect2.topLeft.y + tempRect2.height ); borderPoints.push( tempPoint ); } return borderPoints; } } } import flash.geom.Point;
123912029-ssiagu
qrread/src/com/logosware/utils/QRcode/GetQRimage.as
AngelScript
gpl2
16,684
/************************************************************************** * LOGOSWARE Class Library. * * Copyright 2009 (c) LOGOSWARE (http://www.logosware.com) All rights reserved. * * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************/ package com.logosware.utils.QRcode { import com.logosware.event.QRdecoderEvent; import flash.events.EventDispatcher; import flash.system.System; import flash.text.TextField; import flash.utils.unescapeMultiByte; /** * QRコードをデコードして文字列を抽出するクラスです * @author Kenichi UENO **/ public class QRdecode extends EventDispatcher { private var _xorPattern:Array = [1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0]; private var _fixed:Array; private var _qr:Array; // private var _textObj:TextField = new TextField(); private var _qrVersion:uint = 5; public function QRdecode() { } /** * 解析したいQRコードを格納する関数 * @param qr QRコードのビットパターン二次元配列 */ public function setQR( qr:Array ):void { _qr = qr; _qrVersion = (qr.length - 17) * 0.25; } /** * setQRで格納したQRコードのデコードを行う関数 * @param retObj 結果イベントに含ませたいオブジェクト * @eventType QRdecoderEvent.QR_DECODE_COMPLETE */ public function startDecode(retObj:Object = null):void { // 形式情報の読み出し var dataArray:Array; var unmaskedQR:Array; var wordArray:Array; var trueWordArray:Array; var result:Array; var resultFlg:uint; var resultStr:String; var qrSize:uint = _qrVersion * 4 + 17; dataArray = _decode15_5(); // マスク処理の解除 unmaskedQR = _unmask( dataArray ); // 機能領域の計算 _makeFixed(); // データ読み出し wordArray = _getWords( unmaskedQR ); // リードソロモン trueWordArray = _ReedSolomon( wordArray, dataArray ); //データコード語復号 result = _readData( trueWordArray ); resultFlg = result[0]; if ( resultFlg ) { resultStr = result[1]; // _textObj.appendText( "読み取り成功!\n" + resultStr ); dispatchEvent( new QRdecoderEvent( QRdecoderEvent.QR_DECODE_COMPLETE, resultStr, [retObj] ) ); } } /** * リードソロモンで8bitずつ読み取る関数 */ private function _RS8bit( __dataArray:Array, __codeNum:uint, __errorNum:uint, __snum:uint ):void { var __i:uint; var __j:uint; var __index:uint; var __dataLength:uint = __dataArray.length; var __Snum:uint = __errorNum; var __a:Array; // 誤り位置計算用変数 var __e:Array; // 誤り位置 var __S:Array = new Array(__Snum); // シンドローム var __s:Array = new Array(__snum); // 誤り位置変数 var __tempNum1:G8Num; var __tempNum2:G8Num; // シンドローム配列初期化 for ( __j = 0; __j < __Snum; __j++ ) { __S[__j] = new G8Num(-1); } for ( __i = 0; __i < __dataLength; __i++ ) { __tempNum1 = new G8Num(0); __tempNum1.setVector( __dataArray[__dataLength - 1 - __i] ); for ( __j = 0; __j < __Snum; __j++ ) { __S[__j] = __S[__j].plus( __tempNum1.multiply(new G8Num( __i * __j )) ); } } __j = 0; for ( __i = 0; __i < __Snum; __i++ ) { if( __S[__i].getPower() != -1 ){ __j++; } } if( __j == 0 ){ // 100%エラーなし return; } // エラーあるかも for ( __i = __snum; __i > 0; __i-- ){ if( _calcDet( __S, __i ) != 0 ){ break; } } __snum = __i; __a = new Array(__snum); // 誤り訂正位置変数の計算 for (__i = 0; __i < __snum; __i++) { __a[__i] = new Array(__snum+1); for (__j = 0; __j <= __snum; __j++ ) { __a[__i][__j] = new G8Num( __S[__i+__j].getPower() ); } } for ( __i = 0; __i < __snum; __i++ ){ _reduceToLU( __a, __i ); } for (__i = 0; __i < __snum; __i++) { for ( __j = 0; __j < __snum; __j++ ) { if (__a[__i][__j].getPower() != -1) { __s[__snum-1-__j] = __a[__i][__snum]; } } } //__aは再利用 __e = new Array( __snum ); __index = 0; for ( __i = 0; __i < __dataLength; __i++ ) { __tempNum1 = new G8Num( __i * __snum ); for ( __j = __snum - 1; __j >= 1; __j-- ) { __tempNum2 = new G8Num( __i * __j ); __tempNum1 = __tempNum1.plus( __tempNum2.multiply( __s[__snum-1-__j] ) ); } __tempNum1 = __tempNum1.plus( __s[__snum-1] ); if ( __tempNum1.getPower() < 0 ) { __e[__index] = __dataLength - 1 - __i; for( __j = 0; __j < __snum; __j++ ){ __a[__j][__index] = new G8Num(__i * __j); } __a[__index][__snum] = new G8Num( __S[__index].getPower() ); __index++; } } for ( __i = 0; __i < __snum; __i++ ){ _reduceToLU( __a, __i ); } for ( __i = 0; __i < __snum; __i++ ){ for ( __j = 0; __j < __snum; __j++ ){ if( __a[__i][__j].getPower() == 0 ){ __dataArray[__e[__j]] = __dataArray[__e[__j]] ^ (__a[__i][__snum].getVector() ); } } } } /** * 行列式を計算する * @param 行列 * @param 行列サイズ **/ private function _calcDet( __Dat:Array, __size:uint ):int { var __i:uint; var __j:uint; var __k:uint; var __doing:uint = 0; var __result:G8Num = new G8Num(0); var __tempNum:G8Num; var __todo:Array = new Array( __size ); var __temp:Array = new Array( __size ); for( __j = 0; __j < __size; __j++ ){ __todo[__j] = 1; __temp[__j] = new Array( __size ); for ( __i = 0; __i < __size; __i++ ){ __temp[__j][__i] = new G8Num( __Dat[__i+__j].getPower() ); } } //三角行列にする while( __doing < __size ){ // 一列ずつ、つぶす for( __i = 0; __i < __size; __i++ ){ if( __todo[__i] == 1 ){ if( __temp[__i][__doing].getPower() >= 0 ){ __result.multiply( __temp[__i][__doing] ); __tempNum = __temp[__i][__doing].inverse(); //自身の列の頭を1に for( __j = __doing; __j < __size; __j++ ){ __temp[__i][__j] = __temp[__i][__j].multiply( __tempNum ); } //その他の列を全部引き算 for( __k = 0; __k < __size; __k++ ){ if( (__k != __i) && (__todo[__k] == 1) && (__temp[__k][__doing].getPower() >= 0) ){ __tempNum = new G8Num(__temp[__k][__doing].getPower() ); for( __j = __doing; __j < __size; __j++ ){ __temp[__k][__j] = __temp[__k][__j].plus( __tempNum.multiply( __temp[__i][__j] ) ); } } } __todo[__i] = 0; break; } } } if( __i == __size ){ return 0; } __doing++; } return __result.getVector(); } /** * 下三角行列を作る */ private function _reduceToLU(__a:Array, __num:uint ):void { var __i:uint; var __j:uint; var __it:uint; var __flg:uint; var __snum:uint = __a.length; var __tempNum:G8Num; for ( __i = 0; __i < __snum; __i++ ) { __flg = 0; if ( __a[__i][__num].getPower() != -1 ) { __flg = 1; for ( __j = 0; __j < __num; __j++ ) { if ( __a[__i][__j].getPower() != -1 ) { __flg = 0; } } } if ( __flg ) { __it = __i; __i = __snum; } } __tempNum = __a[__it][__num].inverse(); for ( __j = __num; __j <= __snum; __j++ ) { __a[__it][__j] = __a[__it][__j].multiply( __tempNum ); } for ( __i = 0; __i < __snum; __i++ ) { if ( (__i != __it) && (__a[__i][__num].getPower != -1 ) ) { __tempNum = new G8Num( __a[__i][__num].getPower() ); for ( __j = __num; __j <= __snum; __j++ ) { __a[__i][__j] = __a[__i][__j].plus( __a[__it][__j].multiply( __tempNum ) ); } } } } /** * バイナリを文字列に変換する * @param バイナリデータ */ private function _readData ( __dataCode:Array ):Array { var __num2alphabet:Array = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", " ", "$", "%", "*", "+", "-", ".", "/", ":" ]; var __verMode:uint; var __stringBits:Array = [[10,9,8,8],[12,11,16,10],[14,13,16,12]]; var __result:String = ""; var __dataBin:Array; var __i:uint; var __mode:String; var __num:uint; var __tempNum:uint; var __tempNum2:uint; var __tempStr:String; var __isSuccess:uint = 1; if( _qrVersion < 10 ){ __verMode = 0; } else if( _qrVersion < 27 ) { __verMode = 1; } else if( _qrVersion < 41 ) { __verMode = 2; } __dataBin = _Hex2Bin( __dataCode ); //どんどん読み取り while( __dataBin.length > 0 ){ __mode = _readNstr( __dataBin, 4 ); switch( __mode ) { case "0001": // 数字 __num = _readNnumber( __dataBin, __stringBits[__verMode][0] ); // 10: バージョンに依存 for ( __i = 0; __i < __num; __i += 3 ) { if ( (__num - __i) == 2 ) { __tempNum = _readNnumber( __dataBin, 7 ); __result += String("00"+__tempNum).substr(-2,2); } else if( (__num - __i) == 1 ) { __tempNum = _readNnumber( __dataBin, 4 ); __result += String("0"+__tempNum).substr(-1,1); } else { __tempNum = _readNnumber( __dataBin, 10 ); __result += String("000"+__tempNum).substr(-3,3); } } break; case "0010": // 英数字 __num = _readNnumber( __dataBin, __stringBits[__verMode][1] ); // 9: バージョンに依存 for ( __i = 0; __i < __num; __i += 2 ) { if ( (__num - __i) > 1 ) { __tempNum = _readNnumber( __dataBin, 11 ); __result += __num2alphabet[ Math.floor(__tempNum / 45) ] + __num2alphabet[ __tempNum % 45 ]; } else { __tempNum = _readNnumber( __dataBin, 6 ); __result += __num2alphabet[ __tempNum ]; } } break; case "0100": // 8 bit Byte __num = _readNnumber( __dataBin, __stringBits[__verMode][2] ); // 8: バージョンに依存 __tempStr = ""; for ( __i = 0; __i < __num; __i ++ ) { __tempNum = _readNnumber( __dataBin, 8 ); // __result += String.fromCharCode(__tempNum); __tempStr += "%"+_Hex2String(__tempNum); } System.useCodePage = true; __result += unescapeMultiByte( __tempStr ); break; case "1000": // 漢字 __num = _readNnumber( __dataBin, __stringBits[__verMode][3] ); // 8: バージョンに依存 for ( __i = 0; __i < __num; __i ++ ) { __tempNum = _readNnumber( __dataBin, 13 ); __tempNum2 = Math.floor(__tempNum / 0xC0 ); __tempNum2 += ( __tempNum2 <= 0x1E )?0x81:0xC1; __tempNum %= 0xC0; __tempNum += 0x40; System.useCodePage = true; __result += unescapeMultiByte( "%"+_Hex2String(__tempNum2)+"%"+_Hex2String(__tempNum) ); // __result += "("+_Hex2String(__tempNum2)+_Hex2String(__tempNum)+")"; } break; case "0000": case "000": case "00": case "0": __tempNum = _readNnumber( __dataBin, __dataBin.length ); //正常終了 break; default: //未対応 __isSuccess = 0; __result += "***未対応の形式を検出しました。"; continue; break; } } return [__isSuccess, __result]; } /** * 32ビットのデータを文字に直す * @param バイナリデータ */ private function _Hex2String( __hex:uint ):String { var __tempNum:uint = __hex >> 4; var __tempNum2:uint = __hex & 0xF; return String.fromCharCode( __tempNum+48 + uint(__tempNum>9)*7 )+String.fromCharCode( __tempNum2+48 + uint(__tempNum2>9)*7 ); } /** * N文字分の文字列を読み込む * @param バイナリデータ * @param データ長 */ private function _readNstr( __bin:Array, __length:uint ):String { var __i:uint; var __retStr:String = ""; if ( __bin.length < __length ) { __length = __bin.length; } for ( __i = 0; __i < __length; __i++ ) { __retStr += __bin[0]? "1":"0"; __bin.shift(); } return __retStr; } /** * N文字分の数字を読み込む * @param バイナリデータ * @param データ長 */ private function _readNnumber( __bin:Array, __length:uint ):uint { var __i:uint; var __retNum:uint = 0; for ( __i = 0; __i < __length; __i++ ) { __retNum <<= 1; __retNum += __bin[0]; __bin.shift(); } return __retNum; } /** * 16進数の配列を2進数の配列に直す * @param 16進数パターン */ private function _Hex2Bin( __hex:Array ):Array { var __i:uint; var __index:uint; var __loopCount:uint = __hex.length; var __retArray:Array = new Array( __loopCount * 8 ); for ( __i = 0; __i < __loopCount; __i++ ) { __retArray[__index++] = (__hex[__i]>>7) & 1; __retArray[__index++] = (__hex[__i]>>6) & 1; __retArray[__index++] = (__hex[__i]>>5) & 1; __retArray[__index++] = (__hex[__i]>>4) & 1; __retArray[__index++] = (__hex[__i]>>3) & 1; __retArray[__index++] = (__hex[__i]>>2) & 1; __retArray[__index++] = (__hex[__i]>>1) & 1; __retArray[__index++] = (__hex[__i]>>0) & 1; } return __retArray; } /** * リードソロモン解析 * @param 解析データ * @param 形式情報 */ private function _ReedSolomon( __data:Array, __type:Array ):Array { var __RSblock:Array; var __retArray:Array = []; var __dataNum:Array; var __errorNum:Array; var __i:uint; var __loopCount:uint; var __j:uint; var __loopCount2:uint; var __index:uint = 0; var __correctNum:uint = 0; switch( _qrVersion ) { case 1: switch( (__type[0] << 1) + (__type[1] << 0) ) { case 0: // M __RSblock = new Array(1); __dataNum = [16]; __errorNum = [10]; break; case 1: // L __RSblock = new Array(1); __dataNum = [19]; __errorNum = [7]; break; case 2: // H __RSblock = new Array(1); __dataNum = [9]; __errorNum = [17]; break; case 3: // Q __RSblock = new Array(1); __dataNum = [13]; __errorNum = [13]; break; } break; case 2: switch( (__type[0] << 1) + (__type[1] << 0) ) { case 0: // M __RSblock = new Array(1); __dataNum = [28]; __errorNum = [16]; break; case 1: // L __RSblock = new Array(1); __dataNum = [34]; __errorNum = [10]; break; case 2: // H __RSblock = new Array(1); __dataNum = [16]; __errorNum = [28]; break; case 3: // Q __RSblock = new Array(1); __dataNum = [22]; __errorNum = [22]; break; } break; case 3: switch( (__type[0] << 1) + (__type[1] << 0) ) { case 0: // M __RSblock = new Array(1); __dataNum = [44]; __errorNum = [26]; break; case 1: // L __RSblock = new Array(1); __dataNum = [55]; __errorNum = [15]; break; case 2: // H __RSblock = new Array(2); __dataNum = [13,13]; __errorNum = [22,22]; break; case 3: // Q __RSblock = new Array(1); __dataNum = [17,17]; __errorNum = [18,18]; break; } break; case 4: switch( (__type[0] << 1) + (__type[1] << 0) ) { case 0: // M __RSblock = new Array(2); __dataNum = [32,32]; __errorNum = [18,18]; break; case 1: // L __RSblock = new Array(1); __dataNum = [80]; __errorNum = [20]; break; case 2: // H __RSblock = new Array(4); __dataNum = [9,9,9,9]; __errorNum = [16,16,16,16]; break; case 3: // Q __RSblock = new Array(2); __dataNum = [24,24]; __errorNum = [26,26]; break; } break; case 5: switch( (__type[0] << 1) + (__type[1] << 0) ) { case 0: // M __RSblock = new Array(2); __dataNum = [43, 43]; __errorNum = [24, 24]; break; case 1: // L __RSblock = new Array(1); __dataNum = [108]; __errorNum = [26]; break; case 2: // H __RSblock = new Array(4); __dataNum = [11, 11, 12, 12]; __errorNum = [22, 22, 22, 22]; break; case 3: // Q __RSblock = new Array(4); __dataNum = [15, 15, 16, 16]; __errorNum = [18, 18,18,18]; break; } break; case 6: switch( (__type[0] << 1) + (__type[1] << 0) ) { case 0: // M __RSblock = new Array(4); __dataNum = [27, 27, 27, 27]; __errorNum = [16, 16, 16, 16]; break; case 1: // L __RSblock = new Array(2); __dataNum = [68, 68]; __errorNum = [18, 18]; break; case 2: // H __RSblock = new Array(4); __dataNum = [15, 15, 15, 15]; __errorNum = [28, 28, 28, 28]; break; case 3: // Q __RSblock = new Array(4); __dataNum = [19, 19, 19, 19]; __errorNum = [24, 24, 24, 24]; break; } break; case 7: switch( (__type[0] << 1) + (__type[1] << 0) ) { case 0: // M __RSblock = new Array(4); __dataNum = [31, 31, 31, 31]; __errorNum = [18, 18, 18, 18]; break; case 1: // L __RSblock = new Array(2); __dataNum = [78, 78]; __errorNum = [20, 20]; break; case 2: // H __RSblock = new Array(5); __dataNum = [13,13,13,13,14]; __errorNum = [26,26,26,26,26]; break; case 3: // Q __RSblock = new Array(6); __dataNum = [14,14,15,15,15,15]; __errorNum = [18,18,18,18,18,18]; break; } break; case 8: switch( (__type[0] << 1) + (__type[1] << 0) ) { case 0: // M __RSblock = new Array(4); __dataNum = [38, 38, 39, 39]; __errorNum = [22, 22, 22, 22]; break; case 1: // L __RSblock = new Array(2); __dataNum = [97, 97]; __errorNum = [24, 24]; break; case 2: // H __RSblock = new Array(6); __dataNum = [14, 14, 14, 14, 15, 15]; __errorNum = [26, 26, 26, 26, 26, 26]; break; case 3: // Q __RSblock = new Array(6); __dataNum = [18, 18, 18, 18, 19, 19]; __errorNum = [22, 22, 22, 22, 22, 22]; break; } break; case 9: switch( (__type[0] << 1) + (__type[1] << 0) ) { case 0: // M __RSblock = new Array(5); __dataNum = [36, 36, 36, 37, 37]; __errorNum = [22, 22, 22, 22, 22]; break; case 1: // L __RSblock = new Array(2); __dataNum = [116, 116]; __errorNum = [30, 30]; break; case 2: // H __RSblock = new Array(8); __dataNum = [12, 12, 12, 12, 13, 13, 13, 13]; __errorNum = [24, 24, 24, 24, 24, 24, 24, 24]; break; case 3: // Q __RSblock = new Array(8); __dataNum = [16, 16, 16, 16, 17, 17, 17, 17]; __errorNum = [20, 20, 20, 20, 20, 20, 20, 20]; break; } break; case 10: switch( (__type[0] << 1) + (__type[1] << 0) ) { case 0: // M __RSblock = new Array(5); __dataNum = [43, 43, 43, 43, 44]; __errorNum = [26, 26, 26, 26, 26]; break; case 1: // L __RSblock = new Array(4); __dataNum = [68, 68, 69, 69]; __errorNum = [18, 18, 18, 18]; break; case 2: // H __RSblock = new Array(8); __dataNum = [15, 15, 15, 15, 15, 15, 16, 16]; __errorNum = [28, 28, 28, 28, 28, 28, 28, 28]; break; case 3: // Q __RSblock = new Array(8); __dataNum = [19, 19, 19, 19, 19, 19, 20, 20]; __errorNum = [24, 24, 24, 24, 24, 24, 24, 24]; break; } break; default: //trace( _qrVersion + ", " + (__type[0] << 1) + (__type[1] << 0) ); return []; break } __loopCount = __RSblock.length; for ( __i = 0; __i < __loopCount; __i++) { __RSblock[__i] = new Array(); } __loopCount2 = __dataNum[__loopCount-1]; for ( __j = 0; __j < __loopCount2; __j++) { for ( __i = 0; __i < __loopCount; __i++) { // ここに条件をいれないといけない気がする。 j < datanum とか if( __j < __dataNum[__i] ){ __RSblock[__i].push( [ _readByteData(__data[__index++]) ] ); } } } __correctNum = __errorNum[0] * 0.5; if( _qrVersion == 1 ){ switch( (__type[0] << 1) + (__type[1] << 0) ){ case 0: __correctNum = 4; break; case 1: __correctNum = 2; break; case 2: __correctNum = 8; break; case 3: __correctNum = 6; break; } } if( (_qrVersion == 2) && ( ( (__type[0] << 1) + (__type[1] << 0) ) == 1 ) ){ __correctNum = 4; } if( (_qrVersion == 3) && ( ( (__type[0] << 1) + (__type[1] << 0) ) == 1 ) ){ __correctNum = 7; } __loopCount2 = __errorNum[0]; // 全部同じなので[0] for ( __j = 0; __j < __loopCount2; __j++) { for ( __i = 0; __i < __loopCount; __i++) { __RSblock[__i].push( [ _readByteData(__data[__index++]) ] ); } } //誤り訂正 for ( __i = 0; __i < __loopCount; __i++ ) { _RS8bit( __RSblock[__i], __dataNum[__i], __errorNum[__i], __correctNum ); } //データ再配置 for ( __i = 0; __i < __loopCount; __i++) { __loopCount2 = __dataNum[__i]; for ( __j = 0; __j < __loopCount2; __j++) { __retArray.push(__RSblock[__i][__j]); } } return __retArray; } /** * 1バイト分の情報を読み込む * @param 情報ビット列 */ private function _readByteData( __byte:Array ):uint { return (__byte[0] << 7) + (__byte[1] << 6) + (__byte[2] << 5) + (__byte[3] << 4) + (__byte[4] << 3) + (__byte[5] << 2) + (__byte[6] << 1) + (__byte[7] << 0) ; } /** * 情報のバイト列を読み取る * @param QRコードビットパターン */ private function _getWords( __qr:Array ):Array { var __checkArray:Array = []; var __cordNum:Array = [ 26, 44, 70, 100, 134, 172, 196, 242, 292, 346, 404, 466, 532, 581, 655, 733, 815, 901, 991, 1085, 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185, 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706 ]; // バージョン1~40までの総コード語数 var __retArray:Array = new Array( __cordNum[_qrVersion - 1] ); var __i:uint; // var __j:uint; var __loopCount:uint = __retArray.length; var __x:uint = _qrVersion*4 + 16; var __y:uint = _qrVersion*4 + 16; var __len:uint; var __toUp:uint = 1; var __toLeft:uint = 1; var __index:uint = 0; for ( __i = 0; __i < __loopCount; __i++ ) { __retArray[__i] = new Array(8); __checkArray[__i] = new Array(8); // for( __j = 0; __j < 8; __j++ ){ // __checkArray[__i][__j] = new Array(2); // } } for ( __i = 0; __i < __loopCount; __i++ ) { for ( __len = 0; __len < 8; __len++ ) { while ( _isFixed(__x, __y) ) { if ( __x == 6 ){ __x--; } if ( __toLeft ) { __x--; __toLeft = 0; } else { __toLeft = 1; if ( __toUp ) { if ( __y == 0 ) { __x--; __toUp = 0; } else { __x++; __y--; } } else { if ( __y == (_qrVersion*4+16) ) { __x--; __toUp = 1; } else { __x++; __y++; } } } } _fixed[__y][__x] = 1; __retArray[__index][__len] = __qr[__y][__x]; __checkArray[__index][__len] = [__x, __y]; } __index++; } return __retArray; } /** * QRコードのマスクを解除する関数 * @param 形式情報 */ private function _unmask( __typeData:Array ):Array { var __qrSize:uint = _qrVersion * 4 + 17; var __retArray:Array = new Array(__qrSize); var __i:uint; var __j:uint; for ( __j = 0; __j < __qrSize; __j++ ) { __retArray[__j] = new Array(__qrSize); } switch( (__typeData[2]<<2)+(__typeData[3]<<1)+(__typeData[4]) ) { case 0: //(i+j)mod2==0 for ( __j = 0; __j < __qrSize; __j++ ) { for ( __i = 0; __i < __qrSize; __i++ ) { __retArray[__i][__j] = _getQR(__j, __i) ^ int( ( (__i + __j) % 2) == 0 ); } } break; case 1: // i mod2==0 for ( __j = 0; __j < __qrSize; __j++ ) { for ( __i = 0; __i < __qrSize; __i++ ) { __retArray[__i][__j] = _getQR(__j, __i) ^ int( ( __i % 2) == 0 ); } } break; case 2: //j mod3==0 for ( __j = 0; __j < __qrSize; __j++ ) { for ( __i = 0; __i < __qrSize; __i++ ) { __retArray[__i][__j] = _getQR(__j, __i) ^ int( ( __j % 3) == 0 ); } } break; case 3: //(i+j)mod3==0 for ( __j = 0; __j < __qrSize; __j++ ) { for ( __i = 0; __i < __qrSize; __i++ ) { __retArray[__i][__j] = _getQR(__j, __i) ^ int( ( (__i + __j) % 3) == 0 ); } } break; case 4: //((idiv2)+(jdiv3))mod2==0 for ( __j = 0; __j < __qrSize; __j++ ) { for ( __i = 0; __i < __qrSize; __i++ ) { __retArray[__i][__j] = _getQR(__j, __i) ^ int( ( (Math.floor(__i*0.5) + Math.floor(__j/3.0)) % 2) == 0 ); } } break; case 5: //((ij)mod2+(ij)mod3)==0 for ( __j = 0; __j < __qrSize; __j++ ) { for ( __i = 0; __i < __qrSize; __i++ ) { __retArray[__i][__j] = _getQR(__j, __i) ^ int( ( ( (__i*__j) % 2 ) + ((__i*__j) % 3 ) ) == 0 ); } } break; case 6: //((ij)mod2+(ij)mod3)mod2==0 for ( __j = 0; __j < __qrSize; __j++ ) { for ( __i = 0; __i < __qrSize; __i++ ) { __retArray[__i][__j] = _getQR(__j, __i) ^ int( ( ( ( (__i*__j) % 2 ) + ((__i*__j) % 3 ) ) % 2 ) == 0 ); } } break; case 7: //((i+j)mod2+(ij)mod3)mod2==0 for ( __j = 0; __j < __qrSize; __j++ ) { for ( __i = 0; __i < __qrSize; __i++ ) { __retArray[__i][__j] = _getQR(__j, __i) ^ int( ( ( ( (__i+__j) % 2 ) + ((__i*__j) % 3 ) ) % 2 ) == 0 ); } } break; } return __retArray; } /** * 機能パターンの範囲をバージョン別に指定する関数 */ private function _makeFixed():void { var __i:int; var __j:int; var __k:int; var __l:int; _fixed = new Array( _qrVersion * 4 + 17 ); for ( __i = 0; __i < (_qrVersion * 4 + 17); __i++) { _fixed[__i] = new Array( _qrVersion * 4 + 17 ); } switch( _qrVersion ) { case 1: for ( __i = 0; __i < 8; __i++) { for ( __j = 0; __j < 8; __j++) { _fixed[__j][__i] = _fixed[__j][_qrVersion*4 + 9 + __i] = _fixed[_qrVersion*4 + 9 + __j][__i] = 1; } } for (__i = 0; __i < 8; __i++) { _fixed[8][__i] = _fixed[__i][8] = _fixed[_qrVersion * 4 + 9+__i][8] = _fixed[8][_qrVersion * 4 + 9+__i] = 1; } _fixed[8][8] = 1; for ( __i = 9; __i < _qrVersion * 4 + 9; __i++ ) { _fixed[6][__i] = _fixed[__i][6] = 1; } break; case 2: case 3: case 4: case 5: case 6: for ( __i = 0; __i < 8; __i++) { for ( __j = 0; __j < 8; __j++) { _fixed[__j][__i] = _fixed[__j][_qrVersion*4 + 9 + __i] = _fixed[_qrVersion*4 + 9 + __j][__i] = 1; } } for (__i = 0; __i < 8; __i++) { _fixed[8][__i] = _fixed[__i][8] = _fixed[_qrVersion * 4 + 9+__i][8] = _fixed[8][_qrVersion * 4 + 9+__i] = 1; } _fixed[8][8] = 1; for ( __i = -2; __i <= 2; __i++ ) { for ( __j = -2; __j <= 2; __j++ ) { _fixed[_qrVersion * 4 + 10 + __j][_qrVersion * 4 + 10 + __i] = 1; } } for ( __i = 9; __i < _qrVersion * 4 + 9; __i++ ) { _fixed[6][__i] = _fixed[__i][6] = 1; } break; case 7: case 8: case 9: case 10: case 12: case 13: for ( __i = 0; __i < 3; __i++) { for ( __j = 0; __j < 6; __j++) { _fixed[__j][_qrVersion*4 + 6 + __i] = _fixed[_qrVersion*4 + 6 + __i][__j] = 1; } } for ( __i = 0; __i < 8; __i++) { for ( __j = 0; __j < 8; __j++) { _fixed[__j][__i] = _fixed[__j][_qrVersion*4 + 9 + __i] = _fixed[_qrVersion*4 + 9 + __j][__i] = 1; } } for (__i = 0; __i < 8; __i++) { _fixed[8][__i] = _fixed[__i][8] = _fixed[_qrVersion * 4 + 9+__i][8] = _fixed[8][_qrVersion * 4 + 9+__i] = 1; } _fixed[8][8] = 1; for( __k = 6; __k <= (_qrVersion*4 + 10); __k += (_qrVersion*2 + 2)){ for( __l = 6; __l <= (_qrVersion*4 + 10); __l += (_qrVersion*2 + 2)){ if( !((__k == 6) && (__l == (_qrVersion*4 + 10))) && !((__l == 6) && (__k == (_qrVersion*4 + 10))) ){ for ( __i = -2; __i <= 2; __i++ ) { for ( __j = -2; __j <= 2; __j++ ) { _fixed[__k + __j][__l + __i] = 1; } } } } } for ( __i = 9; __i < _qrVersion * 4 + 9; __i++ ) { _fixed[6][__i] = _fixed[__i][6] = 1; } break; } } /** * 座標(x,y)のビットパターンを返す関数 */ private function _getQR(x:uint, y:uint):uint { return _qr[y][x]; } /** * 機能パターン情報を返す関数 */ private function _isFixed(x:uint, y:uint):uint { return _fixed[y][x]; } /** * 形式情報をデコードする関数 */ private function _decode15_5():Array { var __str1:Array = new Array(15); var __str2:Array = new Array(15); var __i:uint; var __j:uint; var __S:Array = new Array(5); // シンドローム var __s:Array = new Array(3); // 誤り位置変数 var __tempNum1:G4Num; var __tempNum2:G4Num; var __retArray:Array = new Array(5); // データ部 var __checkPattern:Array = new Array(15); //マスク解除後の形式情報 // シンドローム配列初期化 for ( __j = 0; __j < 5; __j++ ) { __S[__j] = new G4Num(-1); } // 形式情報を取得 for ( __i = 0; __i <= 5; __i++ ) { __str1[__i] = _getQR(8, __i); } __str1[6] = _getQR(8, 7); __str1[7] = _getQR(8, 8); __str1[8] = _getQR(7, 8); for ( __i = 0; __i <= 5; __i++ ) { __str1[__i + 9] = _getQR(5 - __i, 8); } for ( __i = 0; __i <= 7; __i++ ) { __str2[__i] = _getQR(_qrVersion * 4 + 16 - __i, 8); } for ( __i = 0; __i <= 6; __i++ ) { __str2[8+__i] = _getQR(8, _qrVersion * 4 + 10 + __i); } // マスク解除 for ( __i = 0; __i < 15; __i++ ) { __checkPattern[__i] = __str1[14 - __i] ^ _xorPattern[__i]; } for ( __i = 0; __i < 15; __i++ ) { if ( __checkPattern[__i] ) { for ( __j = 0; __j < 5; __j+=2 ) { __S[__j] = __S[__j].plus( new G4Num( __i * (__j + 1) ) ); } } } __S[1] = __S[0].multiply( __S[0] ); __S[3] = __S[1].multiply( __S[1] ); __s[0] = new G4Num( __S[0].getPower() ); __tempNum1 = __S[4].plus( __S[1].multiply( __S[2] ) ); __tempNum2 = __S[2].plus( __S[0].multiply( __S[1] ) ); if ( (__tempNum1.getPower() < 0) || (__tempNum2.getPower() < 0) ) { __s[1] = new G4Num( -1 ); } else { __s[1] = new G4Num( __tempNum1.getPower() - __tempNum2.getPower() + 15 ); } __tempNum1 = __S[1].multiply( __s[0] ); __tempNum2 = __S[0].multiply( __s[1] ); __s[2] = __S[2].plus( __tempNum1.plus( __tempNum2 ) ); for ( __i = 0; __i < 5; __i++ ) { __tempNum1 = new G4Num( (__i) * 3 ); __tempNum2 = new G4Num( (__i) * 2 ); __tempNum1 = __tempNum1.plus( __tempNum2.multiply( __s[0] ) ); __tempNum2 = new G4Num( (__i) ); __tempNum1 = __tempNum1.plus( __tempNum2.multiply( __s[1] ) ); __tempNum1 = __tempNum1.plus( __s[2] ); if ( __tempNum1.getPower() < 0 ) { __retArray[__i] = __checkPattern[__i] ^ 1; } else { __retArray[__i] = __checkPattern[__i]; } } return __retArray; } } }
123912029-ssiagu
qrread/src/com/logosware/utils/QRcode/QRdecode.as
AngelScript
gpl2
34,275
/************************************************************************** * LOGOSWARE Class Library. * * Copyright 2009 (c) LOGOSWARE (http://www.logosware.com) All rights reserved. * * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************/ package com.logosware.utils { import flash.display.BitmapData; import flash.geom.Point; import flash.geom.Rectangle; /** * ラベリングを行うクラスです */ public class LabelingClass { private var _bmp:BitmapData; private var _minSize:uint; private var _startColor:uint; private var _pickedRects:Array = []; private var _pickedColor:Array = []; /** * コンストラクタ * @param bmp 入力画像(0x0, 0xFFFFFFFFでニ値化されたもの) * @param minSize 画素として認める最低サイズ(ノイズ対策) * @param startColor 塗り開始色 * @param isChangeOriginal 入力画像を実際に塗るかどうか **/ public function Labeling(bmp:BitmapData, minSize:uint = 10, startColor:uint = 0xFFFFFFFE, isChangeOriginal:Boolean = true):void{ _minSize = minSize; _startColor = startColor; if( isChangeOriginal ){ _bmp = bmp; } else { _bmp = bmp.clone(); } _process(); } /** * ラベリングした結果得られた範囲の矩形情報を返します * @return 矩形の配列 **/ public function getRects():Array{ return _pickedRects; } /** * ラベリングした結果得られた範囲を塗った色情報を返します * @return 色の配列 **/ public function getColors():Array{ return _pickedColor; } /** * コア関数 **/ private function _process():void { var _fillColor:uint = _startColor; var _rect:Rectangle; while (_paintNextLabel( _bmp, 0xFF000000, _fillColor ) ){ _rect = _bmp.getColorBoundsRect( 0xFFFFFFFF, _fillColor ); if ( ( _rect.width > _minSize) && ( _rect.height > _minSize ) ) { var _tempRect:Rectangle = _rect.clone(); _pickedRects.push( _tempRect ); _pickedColor.push( _fillColor ); } _fillColor --; } } /** * 次のpickcolor色の領域をfillcolor色に塗る。pickcolorが見つからなければfalseを返す * @param bmp 画像 * @param pickcolor 次の色 * @param fillcolor 塗る色 * @return 目的の色があったかどうか **/ private function _paintNextLabel( bmp:BitmapData, pickcolor:uint, fillcolor:uint ):Boolean { var rect:Rectangle = bmp.getColorBoundsRect( 0xFFFFFFFF, pickcolor ); if( (rect.width > 0) && (rect.height> 0) ){ var tempBmp:BitmapData = new BitmapData( rect.width, 1 ); tempBmp.copyPixels( bmp, new Rectangle(rect.topLeft.x, rect.topLeft.y, rect.width, 1 ), new Point(0, 0) ); var rect2:Rectangle = tempBmp.getColorBoundsRect( 0xFFFFFFFF, pickcolor ); bmp.floodFill( rect2.topLeft.x + rect.topLeft.x, rect2.topLeft.y + rect.topLeft.y, fillcolor ); return true; } return false; } } }
123912029-ssiagu
qrread/src/com/logosware/utils/LabelingClass.as
ActionScript
gpl2
3,755
/************************************************************************** * LOGOSWARE Class Library. * * Copyright 2009 (c) LOGOSWARE (http://www.logosware.com) All rights reserved. * * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************/ package com.logosware.event { import flash.display.BitmapData; import flash.events.Event; /** * QRコード画像の抽出完了イベントを送出します */ public class QRreaderEvent extends Event { // 定数( Class constants ) /** * QRコードの抽出完了を通知します。 * @eventType QR_IMAGE_READ_COMPLETE **/ public static const QR_IMAGE_READ_COMPLETE:String = "QR_IMAGE_READ_COMPLETE"; // プロパティ( Proerties ) /** * 解析した結果のQRコード画像が格納されます **/ public var imageData:BitmapData; /** * 解析した結果のQRコード画像のビットパターン配列が格納されます **/ public var data:Array; /** * 入力した任意の配列が格納されます(デバッグ用) **/ public var checkArray:Array; // コンストラクタ( Constructor ) /** * コンストラクタ * @param type イベントタイプ * @param imageData 抽出したQRコード画像 * @param data 抽出したQRコードのビット列 * @param check 入力した任意のコード **/ public function QRreaderEvent(type:String, imageData:BitmapData, data:Array, checkArray:Array = null){ super(type); // 新しいプロパティを設定する this.imageData = imageData; this.data = data; this.checkArray = checkArray; } // Eventからオーバーライドしたメソッド( Overridden Method: Event ) /** * @private **/ override public function clone():Event { return new QRreaderEvent(type, imageData, data, checkArray); } } }
123912029-ssiagu
qrread/src/com/logosware/event/QRreaderEvent.as
ActionScript
gpl2
2,738
/************************************************************************** * LOGOSWARE Class Library. * * Copyright 2009 (c) LOGOSWARE (http://www.logosware.com) All rights reserved. * * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************/ package com.logosware.event { import flash.events.Event; /** * QRコードのデコード完了イベントを送出します */ public class QRdecoderEvent extends Event { // 定数( Class constants ) /** * デコード完了を通知します。 * @eventType QR_DECODE_COMPLETE **/ public static const QR_DECODE_COMPLETE:String = "QR_DECODE_COMPLETE"; // プロパティ( Proerties ) /** * 解析した結果の文字列が格納されます **/ public var data:String; /** * 解析に用いたコード配列が格納されます **/ public var checkArray:Array; // コンストラクタ( Constructor ) /** * コンストラクタ * @param type イベントタイプ * @param data 抽出文字列 * @param check 入力したコード **/ public function QRdecoderEvent(type:String, data:String, check:Array){ super(type); // 新しいプロパティを設定する this.data = data; this.checkArray = check; } // Eventからオーバーライドしたメソッド( Overridden Method: Event ) /** * @private **/ override public function clone():Event { return new QRdecoderEvent(type, data, checkArray); } } }
123912029-ssiagu
qrread/src/com/logosware/event/QRdecoderEvent.as
ActionScript
gpl2
2,344
(function () { "use strict"; var appView = Windows.UI.ViewManagement.ApplicationView; var nav = WinJS.Navigation; WinJS.Namespace.define("Application", { PageControlNavigator: WinJS.Class.define( // Define the constructor function for the PageControlNavigator. function PageControlNavigator(element, options) { this._element = element || document.createElement("div"); this._element.appendChild(this._createPageElement()); this.home = options.home; this._lastViewstate = appView.value; nav.onnavigated = this._navigated.bind(this); window.onresize = this._resized.bind(this); document.body.onkeyup = this._keyupHandler.bind(this); document.body.onkeypress = this._keypressHandler.bind(this); document.body.onmspointerup = this._mspointerupHandler.bind(this); Application.navigator = this; }, { home: "", /// <field domElement="true" /> _element: null, _lastNavigationPromise: WinJS.Promise.as(), _lastViewstate: 0, // This is the currently loaded Page object. pageControl: { get: function () { return this.pageElement && this.pageElement.winControl; } }, // This is the root element of the current page. pageElement: { get: function () { return this._element.firstElementChild; } }, // Creates a container for a new page to be loaded into. _createPageElement: function () { var element = document.createElement("div"); element.setAttribute("dir", window.getComputedStyle(this._element, null).direction); element.style.width = "100%"; element.style.height = "100%"; return element; }, // Retrieves a list of animation elements for the current page. // If the page does not define a list, animate the entire page. _getAnimationElements: function () { if (this.pageControl && this.pageControl.getAnimationElements) { return this.pageControl.getAnimationElements(); } return this.pageElement; }, // Navigates back whenever the backspace key is pressed and // not captured by an input field. _keypressHandler: function (args) { if (args.key === "Backspace") { nav.back(); } }, // Navigates back or forward when alt + left or alt + right // key combinations are pressed. _keyupHandler: function (args) { if ((args.key === "Left" && args.altKey) || (args.key === "BrowserBack")) { nav.back(); } else if ((args.key === "Right" && args.altKey) || (args.key === "BrowserForward")) { nav.forward(); } }, // This function responds to clicks to enable navigation using // back and forward mouse buttons. _mspointerupHandler: function (args) { if (args.button === 3) { nav.back(); } else if (args.button === 4) { nav.forward(); } }, // Responds to navigation by adding new pages to the DOM. _navigated: function (args) { var newElement = this._createPageElement(); var parentedComplete; var parented = new WinJS.Promise(function (c) { parentedComplete = c; }); this._lastNavigationPromise.cancel(); this._lastNavigationPromise = WinJS.Promise.timeout().then(function () { return WinJS.UI.Pages.render(args.detail.location, newElement, args.detail.state, parented); }).then(function parentElement(control) { var oldElement = this.pageElement; if (oldElement.winControl && oldElement.winControl.unload) { oldElement.winControl.unload(); } this._element.appendChild(newElement); this._element.removeChild(oldElement); oldElement.innerText = ""; this._updateBackButton(); parentedComplete(); WinJS.UI.Animation.enterPage(this._getAnimationElements()).done(); }.bind(this)); args.detail.setPromise(this._lastNavigationPromise); }, // Responds to resize events and call the updateLayout function // on the currently loaded page. _resized: function (args) { if (this.pageControl && this.pageControl.updateLayout) { this.pageControl.updateLayout.call(this.pageControl, this.pageElement, appView.value, this._lastViewstate); } this._lastViewstate = appView.value; }, // Updates the back button state. Called after navigation has // completed. _updateBackButton: function () { var backButton = this.pageElement.querySelector("header[role=banner] .win-backbutton"); if (backButton) { backButton.onclick = function () { nav.back(); }; if (nav.canGoBack) { backButton.removeAttribute("disabled"); } else { backButton.setAttribute("disabled", "disabled"); } } }, } ) }); })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/js/navigator.js
JavaScript
mpl11
6,440
/// <reference path="//Microsoft.WinJS.1.0/js/ui.js" /> /// <reference path="//Microsoft.WinJS.1.0/js/base.js" /> var ui = WinJS.Namespace.define("UI", { generateUI: function () { var applicationData = Windows.Storage.ApplicationData.current; var localSettings = applicationData.localSettings; var sessionKey = localSettings.values["sessionKey"]; if (sessionKey == null || sessionKey == "") { var messageDialog = new Windows.UI.Popups.MessageDialog("Не сте влезли в профилът си."); messageDialog.commands.append(new Windows.UI.Popups.UICommand("Вход", function () { document.getElementById("loginForm").style.display = "block"; })); messageDialog.commands.append(new Windows.UI.Popups.UICommand("Регистрация", function () { document.getElementById("loginForm").style.display = "none"; document.getElementById("registerForm").style.display = "block"; })); messageDialog.commands.append(new Windows.UI.Popups.UICommand("Продължи без логин", function () { document.getElementById("loginForm").style.display = "none"; document.getElementById("registerForm").style.display = "none"; document.getElementById("placesContent").style.visibility = "visible"; })); messageDialog.showAsync(); } else { document.getElementById("registerForm").style.display = "none"; document.getElementById("loginForm").style.display = "none"; document.getElementById("placesContent").style.visibility = "visible"; document.getElementById("appBarContainer").style.display = "block"; } } });
100nationalobjects
trunk/NationalPlaces/NationalPlaces/js/UI.js
JavaScript
mpl11
1,866
(function () { "use strict"; var dataArray = []; var itemList = new WinJS.Binding.List(); var applicationData = Windows.Storage.ApplicationData.current; var localSettings = applicationData.localSettings; var sessionKey = localSettings.values["sessionKey"]; WinJS.xhr({ type: "GET", url: "http://100nationalplaces.apphb.com/api/users/getPictures/"+sessionKey, headers: { "Content-type": "application/json" }, }).done( function (success) { var pics = JSON.parse(success.responseText); for (var i = 0; i < pics.length; i++) { itemList.push({ picture: pics[i] }); } }, function (error) { console.log(error.responseText); }); WinJS.Namespace.define("PicturesData", { itemList: itemList }); })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/js/picturesData.js
JavaScript
mpl11
978
(function () { "use strict"; var list = new WinJS.Binding.List(); var groupedItems = list.createGrouped( function groupKeySelector(item) { return item.group.key; }, function groupDataSelector(item) { return item.group; } ); // TODO: Replace the data with your real data. // You can add data from asynchronous sources whenever it becomes available. generateSampleData().then( function (items) { for (var i = 0; i < items.length; i++) { list.push(items[i]); } }, function (error) { console.log(error); }); WinJS.Namespace.define("Data", { items: groupedItems, groups: groupedItems.groups, getItemReference: getItemReference, getItemsFromGroup: getItemsFromGroup, resolveGroupReference: resolveGroupReference, resolveItemReference: resolveItemReference }); // Get a reference for an item, using the group key and item title as a // unique reference to the item that can be easily serialized. function getItemReference(item) { return [item.group.key, item.title]; } // This function returns a WinJS.Binding.List containing only the items // that belong to the provided group. function getItemsFromGroup(group) { return list.createFiltered(function (item) { return item.group.key === group.key; }); } // Get the unique group corresponding to the provided group key. function resolveGroupReference(key) { for (var i = 0; i < groupedItems.groups.length; i++) { if (groupedItems.groups.getAt(i).key === key) { return groupedItems.groups.getAt(i); } } } // Get a unique item from the provided string array, which should contain a // group key and an item title. function resolveItemReference(reference) { for (var i = 0; i < groupedItems.length; i++) { var item = groupedItems.getAt(i); if (item.group.key === reference[0] && item.title === reference[1]) { return item; } } } // Returns an array of sample data that can be added to the application's // data list. function generateSampleData() { // These three strings encode placeholder images. You will want to set the // backgroundImage property in your real data to be URLs to images. var darkGray = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXY3B0cPoPAANMAcOba1BlAAAAAElFTkSuQmCC"; var lightGray = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXY7h4+cp/AAhpA3h+ANDKAAAAAElFTkSuQmCC"; var mediumGray = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXY5g8dcZ/AAY/AsAlWFQ+AAAAAElFTkSuQmCC"; // Each of these sample groups must have a unique key to be displayed // separately. //{ key: "group6", title: "Group Title: 6", subtitle: "Group Subtitle: 6", backgroundImage: darkGray, description: groupDescription } //{ group: sampleGroups[0], title: "Item Title: 1", subtitle: "Item Subtitle: 1", description: itemDescription, content: itemContent, backgroundImage: lightGray } return new WinJS.Promise(function(complete, err, prog) { var sampleGroups = []; WinJS.xhr({ type: "GET", url: "http://100nationalplaces.apphb.com/api/towns/getTownsAndPlaces", headers: { "Content-type": "application/json" }, }).done( function(success) { var allGroups = JSON.parse(success.responseText); for (var k = 0; k < allGroups.length; k++) { sampleGroups.push({ key: allGroups[k].Id, title: allGroups[k].TownName, subtitle: "", backgroundImage: darkGray, description: "" }); } var sampleItems = []; for (var i = 0; i < sampleGroups.length; i++) { for (var j = 0; j < allGroups[i].Places.length; j++) { sampleItems.push({ group: sampleGroups[i], title: allGroups[i].Places[j].Name, description: allGroups[i].Places[j].Description, backgroundImage: allGroups[i].Places[j].PictureUrl, subtitle: "", content: allGroups[i].Places[j].Description, }); } } complete(sampleItems); }, function(error) { err(error); }); }); } })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/js/data.js
JavaScript
mpl11
4,982
/// <reference path="//Microsoft.WinJS.1.0/js/base.js" /> /// <reference path="//Microsoft.WinJS.1.0/js/ui.js" /> var events = WinJS.Namespace.define("Events", { attachEvents: function () { var showRegister = document.getElementById("showRegister"); var showLogin = document.getElementById("showLogin"); var errors = document.getElementById("errorMessage"); var loginButton = document.getElementById("btnLogin"); loginButton.addEventListener("click", function () { var username = document.getElementById("username").value; var password = document.getElementById("password").value; var escapedUsername = escapeSting(username); var authCode = CryptoJS.SHA1(password).toString(); WinJS.xhr({ type: "POST", url: "http://100NationalPlaces.apphb.com/api/users/login/", headers: { "Content-type": "application/json" }, data: JSON.stringify({ Username: escapedUsername, AuthCode: authCode }) }).then( function (success) { var applicationData = Windows.Storage.ApplicationData.current; var localSettings = applicationData.localSettings; var sessionKey = localSettings.values["sessionKey"] = JSON.parse(success.responseText).SessionKey; ui.generateUI(); }, function (error) { var messageDialog = new Windows.UI.Popups.MessageDialog(error.responseText); messageDialog.showAsync(); }); }); var registerButton = document.getElementById("btnRegister"); registerButton.addEventListener("click", function () { var username = document.getElementById("regUsername").value; var name = document.getElementById("fullName").value; var password = document.getElementById("regPassword").value; var picture = document.getElementById("profile-image-container").src; var escapedUsername = escapeSting(username); var escapedName = escapeSting(name); var authCode = CryptoJS.SHA1(password).toString(); WinJS.xhr({ type: "POST", url: "http://100NationalPlaces.apphb.com/api/users/register/", headers: { "Content-type": "application/json" }, data: JSON.stringify({ Username: escapedUsername, AuthCode: authCode, Name: escapedName, ProfilePictureUrl: picture }) }).then( function (success) { var applicationData = Windows.Storage.ApplicationData.current; var localSettings = applicationData.localSettings; var sessionKey = localSettings.values["sessionKey"] = JSON.parse(success.responseText).SessionKey; ui.generateUI(); }, function (error) { var messageDialog = new Windows.UI.Popups.MessageDialog(error.responseText); messageDialog.showAsync(); }); }); var logoutButton = document.getElementById("btnLogout"); logoutButton.addEventListener("click", function () { var applicationData = Windows.Storage.ApplicationData.current; var localSettings = applicationData.localSettings; var sessionKey = localSettings.values["sessionKey"]; WinJS.xhr({ type: "PUT", url: "http://100NationalPlaces.apphb.com/api/users/logout/" + sessionKey, headers: { "Content-type": "application/json" }, }).then( function (success) { var sessionKey = localSettings.values["sessionKey"] = ""; document.getElementById("placesContent").style.visibility = "hidden"; document.getElementById("appBarContainer").style.display = "none"; ui.generateUI(); }, function (error) { var messageDialog = new Windows.UI.Popups.MessageDialog(error.responseText); messageDialog.showAsync(); }); }); var fromCameraButton = document.getElementById("btnCamera"); fromCameraButton.addEventListener("click", function (ev) { var captureUI = new Windows.Media.Capture.CameraCaptureUI(); captureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).then(function (capturedItem) { if (capturedItem) { var container = document.getElementById("profile-image-container"); container.style.display = "inline"; container.src = "images/loading.gif"; uploadImage(capturedItem).then(function (url) { container.setAttribute("src", url); }); } }); }); var checkInButton = document.getElementById("btnCheckIn"); checkInButton.addEventListener("click", function () { var applicationData = Windows.Storage.ApplicationData.current; var localSettings = applicationData.localSettings; var sessionKey = localSettings.values["sessionKey"]; var loc = null; if (loc == null) { loc = new Windows.Devices.Geolocation.Geolocator(); } if (loc != null) { loc.getGeopositionAsync().then(getPositionHandler, errorHandler); } function getPositionHandler(pos) { WinJS.xhr({ type: "POST", url: "http://100nationalplaces.apphb.com/api/places/checkIn/" + sessionKey + "?longitude=" + pos.coordinate.longitude + "&latitude=" + pos.coordinate.latitude, headers: { "Content-type": "application/json" }, }).then( function (success) { var messageDialog = new Windows.UI.Popups.MessageDialog(success.responseText); messageDialog.showAsync(); }, function (error) { var messageDialog = new Windows.UI.Popups.MessageDialog("Error!"); messageDialog.showAsync(); }); } function errorHandler(e) { var messageDialog = new Windows.UI.Popups.MessageDialog("Your location could not been reached!"); messageDialog.showAsync(); } }); var profileButton = document.getElementById("myProfile"); profileButton.addEventListener("click", function () { var menu = document.getElementById("menu-id").winControl; menu.show(); }); WinJS.Utilities.id("btnUploadPicture").listen("click", function () { var openPicker = Windows.Storage.Pickers.FileOpenPicker(); var applicationData = Windows.Storage.ApplicationData.current; var localSettings = applicationData.localSettings; var sessionKey = localSettings.values["sessionKey"]; openPicker.fileTypeFilter.append(".jpg"); openPicker.pickMultipleFilesAsync().then(function (files) { for (var i = 0; i < files.length; i++) { uploadImage(files[i]).then(function (image) { console.log(image); WinJS.xhr({ type: "POST", url: "http://100nationalplaces.apphb.com/api/users/addPicture/" + sessionKey + "?url=" + image, headers: { "Content-type": "application/json" }, }).then( function(success) { var messageDialog = new Windows.UI.Popups.MessageDialog("Сминката е качена успешно"); messageDialog.showAsync(); //console.log(success.responseText); }, function(error) { var messageDialog = new Windows.UI.Popups.MessageDialog("Проблем при качването на снимка"); messageDialog.showAsync(); //console.log(error.responseText); }); }); } }); }); //var areShowed = false; //document.getElementById("btnShowPictures").addEventListener("click", function() { // if (!areShowed) { // areShowed = true; // document.getElementById("placesContent").style.visibility = "hidden"; // //var picturesContainer = document.getElementById("pictiresContainer"); // } else { // areShowed = false; // document.getElementById("placesContent").style.visibility = "visible"; // //var picturesContainer = document.getElementById("pictiresContainer"); // } //}); } }); var uploadImage = function (storageFile) { return new WinJS.Promise(function (success) { var file = MSApp.createFileFromStorageFile(storageFile); if (!file || !file.type.match(/image.*/)) { return; } var fd = new FormData(); fd.append("image", file); fd.append("key", "6528448c258cff474ca9701c5bab6927"); var xhr = new XMLHttpRequest(); xhr.open("POST", "http://api.imgur.com/2/upload.json"); xhr.onload = function () { var imgUrl = JSON.parse(xhr.responseText).upload.links.imgur_page + ".jpg"; success(imgUrl); }; xhr.send(fd); }); }; var escapeSting = (function () { var chr = { '"': '&quot;', '&': '&amp;', "'": '&#39;', '/': '&#47;', '<': '&lt;', '>': '&gt;' }; return function (text) { return text.replace(/[\"&'\/<>]/g, function (a) { return chr[a]; }); }; }());
100nationalobjects
trunk/NationalPlaces/NationalPlaces/js/events.js
JavaScript
mpl11
10,596
/// <reference path="events.js" /> /// <reference path="UI.js" /> // For an introduction to the Grid template, see the following documentation: // http://go.microsoft.com/fwlink/?LinkID=232446 (function () { "use strict"; WinJS.Binding.optimizeBindingReferences = true; var app = WinJS.Application; var activation = Windows.ApplicationModel.Activation; var nav = WinJS.Navigation; app.onsettings = function (e) { e.detail.applicationcommands = { "AppSettings": { title: "AppSettings", href: "/pages/settings/settings.html" }, "aboutUs": { title: "About Us", href: "/pages/aboutUs/aboutUs.html" }, }; WinJS.UI.SettingsFlyout.populateSettings(e); } app.addEventListener("activated", function (args) { if (args.detail.kind === activation.ActivationKind.launch) { if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { // TODO: This application has been newly launched. Initialize // your application here. } else { // TODO: This application has been reactivated from suspension. // Restore application state here. } if (app.sessionState.history) { nav.history = app.sessionState.history; } args.setPromise(WinJS.UI.processAll().then(function () { if (nav.location) { nav.history.current.initialPlaceholder = true; return nav.navigate(nav.location, nav.state); } else { return nav.navigate(Application.navigator.home); } })); ui.generateUI(); events.attachEvents(); } }); app.oncheckpoint = function (args) { // TODO: This application is about to be suspended. Save any state // that needs to persist across suspensions here. If you need to // complete an asynchronous operation before your application is // suspended, call args.setPromise(). app.sessionState.history = nav.history; }; app.start(); })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/js/default.js
JavaScript
mpl11
2,281
//(function () { // "use strict"; // var list = new WinJS.Binding.List(); // var groupedItems = list.createGrouped( // function groupKeySelector(item) { return item.group.key; }, // function groupDataSelector(item) { return item.group; } // ); // // TODO: Replace the data with your real data. // // You can add data from asynchronous sources whenever it becomes available. // generateSampleData().then( // function (items) { // for (var i = 0; i < items.length; i++) { // list.push(items[i]); // } // }, function (error) { // console.log(error); // }); // WinJS.Namespace.define("groupedItems", { // items: groupedItems, // groups: groupedItems.groups, // getItemReference: getItemReference, // getItemsFromGroup: getItemsFromGroup, // resolveGroupReference: resolveGroupReference, // resolveItemReference: resolveItemReference // }); // // Get a reference for an item, using the group key and item title as a // // unique reference to the item that can be easily serialized. // function getItemReference(item) { // return [item.group.key, item.title]; // } // // This function returns a WinJS.Binding.List containing only the items // // that belong to the provided group. // function getItemsFromGroup(group) { // return list.createFiltered(function (item) { return item.group.key === group.key; }); // } // // Get the unique group corresponding to the provided group key. // function resolveGroupReference(key) { // for (var i = 0; i < groupedItems.groups.length; i++) { // if (groupedItems.groups.getAt(i).key === key) { // return groupedItems.groups.getAt(i); // } // } // } // // Get a unique item from the provided string array, which should contain a // // group key and an item title. // function resolveItemReference(reference) { // for (var i = 0; i < groupedItems.length; i++) { // var item = groupedItems.getAt(i); // if (item.group.key === reference[0] && item.title === reference[1]) { // return item; // } // } // } // // Returns an array of sample data that can be added to the application's // // data list. // function generateSampleData() { // // These three strings encode placeholder images. You will want to set the // // backgroundImage property in your real data to be URLs to images. // var darkGray = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXY3B0cPoPAANMAcOba1BlAAAAAElFTkSuQmCC"; // var lightGray = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXY7h4+cp/AAhpA3h+ANDKAAAAAElFTkSuQmCC"; // var mediumGray = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXY5g8dcZ/AAY/AsAlWFQ+AAAAAElFTkSuQmCC"; // // Each of these sample groups must have a unique key to be displayed // // separately. // //{ key: "group6", title: "Group Title: 6", subtitle: "Group Subtitle: 6", backgroundImage: darkGray, description: groupDescription } // //{ group: sampleGroups[0], title: "Item Title: 1", subtitle: "Item Subtitle: 1", description: itemDescription, content: itemContent, backgroundImage: lightGray } // return new WinJS.Promise(function (complete, err, prog) { // var sampleGroups = []; // WinJS.xhr({ // type: "GET", // url: "http://100nationalplaces.apphb.com/api/towns/getTownsAndPlaces", // headers: { "Content-type": "application/json" }, // }).done( // function (success) { // var allGroups = JSON.parse(success.responseText); // for (var k = 0; k < allGroups.length; k++) { // sampleGroups.push({ key: allGroups[k].Id, title: allGroups[k].TownName, subtitle: "", backgroundImage: darkGray, description: "" }); // } // var sampleItems = []; // for (var i = 0; i < sampleGroups.length; i++) { // for (var j = 0; j < allGroups[i].Places.length; j++) { // sampleItems.push({ group: sampleGroups[i], title: allGroups[i].Places[j].Name, description: allGroups[i].Places[j].Description, backgroundImage: allGroups[i].Places[j].PictureUrl, subtitle: "", content: allGroups[i].Places[j].Description, }); // } // } // complete(sampleItems); // }, // function (error) { // err(error); // }); // }); // } //})();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/js/groupedItems.js
JavaScript
mpl11
5,133
(function () { "use strict"; WinJS.UI.Pages.define("/pages/itemDetail/itemDetail.html", { // This function is called whenever a user navigates to this page. It // populates the page elements with the app's data. ready: function (element, options) { var item = options && options.item ? Data.resolveItemReference(options.item) : Data.items.getAt(0); element.querySelector(".titlearea .pagetitle").textContent = item.group.title; element.querySelector("article .item-title").textContent = item.title; element.querySelector("article .item-subtitle").textContent = item.subtitle; element.querySelector("article .item-image").src = item.backgroundImage; element.querySelector("article .item-image").alt = item.subtitle; element.querySelector("article .item-content").innerHTML = item.content; element.querySelector(".content").focus(); //SHARE CODE //var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView(); //dataTransferManager.addEventListener("datarequested", shareTextHandler); //function shareTextHandler(e) { // var request = e.request; // request.data.properties.title = item.title; // request.data.properties.description = item.content; // //request.data.setText(item.content); //} } }); })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/itemDetail/itemDetail.js
JavaScript
mpl11
1,581
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>itemDetailPage</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" /> <script src="//Microsoft.WinJS.1.0/js/base.js"></script> <script src="//Microsoft.WinJS.1.0/js/ui.js"></script> <link href="/css/default.css" rel="stylesheet" /> <link href="/pages/itemDetail/itemDetail.css" rel="stylesheet" /> <script src="/js/data.js"></script> <script src="/pages/itemDetail/itemDetail.js"></script> </head> <body> <!-- The content that will be loaded and displayed. --> <div class="itemdetailpage fragment"> <header aria-label="Header content" role="banner"> <button class="win-backbutton" aria-label="Back" disabled type="button"></button> <h1 class="titlearea win-type-ellipsis"> <span class="pagetitle"></span> </h1> </header> <div class="content" aria-label="Main content" role="main"> <article> <div> <header> <h2 class="item-title"></h2> <h4 class="item-subtitle"></h4> </header> <img class="item-image" src="#" /> <div class="item-content"></div> </div> </article> </div> </div> </body> </html>
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/itemDetail/itemDetail.html
HTML
mpl11
1,470
.itemdetailpage .content { -ms-grid-row: 1; -ms-grid-row-span: 2; display: block; height: 100%; overflow-x: auto; position: relative; width: 100%; z-index: 0; } .itemdetailpage .content article { /* Define a multi-column, horizontally scrolling article by default. */ column-fill: auto; column-gap: 80px; column-width: 480px; height: calc(100% - 183px); margin-left: 120px; margin-right: 120px; margin-top: 133px; width: 480px; } .itemdetailpage .content article header .item-title { margin-bottom: 19px; } .itemdetailpage .content article header .item-subtitle { margin-bottom: 16px; margin-top: 0; } .itemdetailpage .content article .item-image { height: 240px; width: 460px; } .itemdetailpage .content article .item-content p { margin-top: 10px; margin-bottom: 20px; } @media screen and (-ms-view-state: snapped) { .itemdetailpage .content { -ms-grid-row: 2; -ms-grid-row-span: 1; overflow-x: hidden; overflow-y: auto; } .itemdetailpage .content article { /* Define a single column, vertically scrolling article in snapped mode. */ -ms-grid-columns: 300px 1fr; -ms-grid-row: 2; -ms-grid-rows: auto 60px; display: -ms-grid; height: 100%; margin-left: 20px; margin-right: 20px; margin-top: 6px; width: 280px; } .itemdetailpage .content article header .item-title { margin-bottom: 10px; } .itemdetailpage .content article .item-image { height: 140px; width: 280px; } .itemdetailpage .content article .item-content { padding-bottom: 60px; width: 280px; } } @media screen and (-ms-view-state: fullscreen-portrait) { .itemdetailpage .content article { margin-left: 100px; margin-right: 100px; } }
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/itemDetail/itemDetail.css
CSS
mpl11
2,304
.groupeditemspage section[role=main] { -ms-grid-row: 1; -ms-grid-row-span: 2; } .groupeditemspage .groupeditemslist { height: 100%; position: relative; width: 100%; z-index: 0; } /* This selector is used to prevent ui-dark/light.css from overwriting changes to .win-surface. */ .groupeditemspage .groupeditemslist .win-horizontal.win-viewport .win-surface { margin-bottom: 60px; margin-left: 45px; margin-right: 115px; margin-top: 128px; } .groupeditemspage .groupeditemslist.win-rtl .win-horizontal.win-viewport .win-surface { margin-left: 115px; margin-right: 45px; } .groupeditemspage .groupeditemslist .win-groupheader { padding: 0; } /* Use grid and top level layout for truncation */ .groupeditemspage .groupeditemslist .group-header { -ms-grid-columns: minmax(0, max-content) 7px max-content; -ms-grid-rows: max-content; display: -ms-inline-grid; line-height: 1.5; } /* Override default button styles */ .groupeditemspage .groupeditemslist .group-header, .group-header:hover, .group-header:hover:active { background: transparent; border: 0; margin-bottom: 1px; margin-left: 5px; margin-right: 5px; margin-top: 1px; min-height: 0; padding: 0; } .groupeditemspage .groupeditemslist .group-header .group-title { display: inline-block; } .groupeditemspage .groupeditemslist .group-header .group-chevron { -ms-grid-column: 3; display: inline-block; } .groupeditemspage .groupeditemslist .group-header .group-chevron::before { content: "\E26B"; font-family: 'Segoe UI Symbol'; } .groupeditemspage .groupeditemslist.win-rtl .group-header .group-chevron:before { content: "\E26C"; } .groupeditemspage .groupeditemslist .item { -ms-grid-columns: 1fr; -ms-grid-rows: 1fr 90px; display: -ms-grid; height: 250px; width: 250px; } .groupeditemspage .groupeditemslist .item .item-image { -ms-grid-row-span: 2; } .groupeditemspage .groupeditemslist .item .item-overlay { -ms-grid-row: 2; -ms-grid-rows: 1fr 21px; display: -ms-grid; padding: 6px 15px 2px 15px; } .groupeditemspage .groupeditemslist .item .item-overlay .item-title { -ms-grid-row: 1; overflow: hidden; width: 220px; } .groupeditemspage .groupeditemslist .item .item-overlay .item-subtitle { -ms-grid-row: 2; width: 220px; } @media screen and (-ms-view-state: fullscreen-landscape), screen and (-ms-view-state: fullscreen-portrait), screen and (-ms-view-state: filled) { .groupeditemspage .groupeditemslist .item .item-overlay { background: rgba(0,0,0,0.65); } .groupeditemspage .groupeditemslist .item .item-overlay .item-title { color: rgba(255,255,255,0.87); } .groupeditemspage .groupeditemslist .item .item-overlay .item-subtitle { color: rgba(255,255,255,0.6); } } @media screen and (-ms-view-state: fullscreen-landscape) and (-ms-high-contrast), screen and (-ms-view-state: fullscreen-portrait) and (-ms-high-contrast), screen and (-ms-view-state: filled) and (-ms-high-contrast) { .groupeditemspage .groupeditemslist .item .item-overlay { color: WindowText; } } @media screen and (-ms-view-state: snapped) { .groupeditemspage section[role=main] { -ms-grid-row: 2; -ms-grid-row-span: 1; } .groupeditemspage .groupeditemslist .win-vertical.win-viewport .win-surface { margin-bottom: 30px; margin-top: 0; } .groupeditemspage .groupeditemslist .win-container { margin-bottom: 15px; margin-left: 13px; margin-right: 35px; padding: 7px; } .groupeditemspage .groupeditemslist.win-rtl .win-container { margin-left: 21px; margin-right: 26px; } .groupeditemspage .groupeditemslist .item { -ms-grid-columns: 60px 10px 1fr; -ms-grid-rows: 1fr; display: -ms-grid; height: 60px; width: 272px; } .groupeditemspage .groupeditemslist .item .item-image { -ms-grid-column: 1; -ms-grid-row-span: 1; height: 60px; width: 60px; } .groupeditemspage .groupeditemslist .item .item-overlay { -ms-grid-column: 3; -ms-grid-row: 1; -ms-grid-row-align: stretch; background: transparent; display: inline-block; padding: 0; } .groupeditemspage .groupeditemslist .item .item-overlay .item-title { margin-top: 4px; max-height: 40px; width: 202px; } .groupeditemspage .groupeditemslist .item .item-overlay .item-subtitle { opacity: 0.6; width: 202px; } } @media screen and (-ms-view-state: fullscreen-portrait) { .groupeditemspage .groupeditemslist .win-horizontal.win-viewport .win-surface { margin-left: 25px; margin-right: 95px; } .groupeditemspage .groupeditemslist.win-rtl .win-horizontal.win-viewport .win-surface { margin-left: 95px; margin-right: 25px; } }
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/groupedItems/groupedItems.css
CSS
mpl11
5,857
(function () { "use strict"; var appView = Windows.UI.ViewManagement.ApplicationView; var appViewState = Windows.UI.ViewManagement.ApplicationViewState; var nav = WinJS.Navigation; var ui = WinJS.UI; ui.Pages.define("/pages/groupedItems/groupedItems.html", { // Navigates to the groupHeaderPage. Called from the groupHeaders, // keyboard shortcut and iteminvoked. navigateToGroup: function (key) { nav.navigate("/pages/groupDetail/groupDetail.html", { groupKey: key }); }, // This function is called whenever a user navigates to this page. It // populates the page elements with the app's data. ready: function (element, options) { var listView = element.querySelector(".groupeditemslist").winControl; listView.groupHeaderTemplate = element.querySelector(".headertemplate"); listView.itemTemplate = element.querySelector(".itemtemplate"); listView.oniteminvoked = this._itemInvoked.bind(this); // Set up a keyboard shortcut (ctrl + alt + g) to navigate to the // current group when not in snapped mode. listView.addEventListener("keydown", function (e) { if (appView.value !== appViewState.snapped && e.ctrlKey && e.keyCode === WinJS.Utilities.Key.g && e.altKey) { var data = listView.itemDataSource.list.getAt(listView.currentItem.index); this.navigateToGroup(data.group.key); e.preventDefault(); e.stopImmediatePropagation(); } }.bind(this), true); this._initializeLayout(listView, appView.value); listView.element.focus(); sendTileLocalImageNotification(); }, // This function updates the page layout in response to viewState changes. updateLayout: function (element, viewState, lastViewState) { /// <param name="element" domElement="true" /> var listView = element.querySelector(".groupeditemslist").winControl; if (lastViewState !== viewState) { if (lastViewState === appViewState.snapped || viewState === appViewState.snapped) { var handler = function (e) { listView.removeEventListener("contentanimating", handler, false); e.preventDefault(); } listView.addEventListener("contentanimating", handler, false); this._initializeLayout(listView, viewState); } } }, // This function updates the ListView with new layouts _initializeLayout: function (listView, viewState) { /// <param name="listView" value="WinJS.UI.ListView.prototype" /> if (viewState === appViewState.snapped) { listView.itemDataSource = Data.groups.dataSource; listView.groupDataSource = null; listView.layout = new ui.ListLayout(); } else { //trying to make promises!!!! // //Data.data(function (items) { // listView.itemDataSource = items.items.dataSource; // listView.groupDataSource = items.groups.dataSource; // listView.layout = new ui.GridLayout({ groupHeaderPosition: "top" }); //}); listView.itemDataSource = Data.items.dataSource; listView.groupDataSource = Data.groups.dataSource; listView.layout = new ui.GridLayout({ groupHeaderPosition: "top" }); } }, _itemInvoked: function (args) { if (appView.value === appViewState.snapped) { // If the page is snapped, the user invoked a group. var group = Data.groups.getAt(args.detail.itemIndex); this.navigateToGroup(group.key); } else { // If the page is not snapped, the user invoked an item. var item = Data.items.getAt(args.detail.itemIndex); nav.navigate("/pages/itemDetail/itemDetail.html", { item: Data.getItemReference(item) }); } } }); function sendTileLocalImageNotification() { // Note: This sample contains an additional project, NotificationsExtensions. // NotificationsExtensions exposes an object model for creating notifications, but you can also modify the xml // of the notification directly. See the additional function sendTileLocalImageNotificationWithXml to see how // to do it by modifying Xml directly, or sendLocalImageNotificationWithStringManipulation to see how to do it // by modifying strings directly //Clear Existing Notification Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForApplication().clear(); var imgSource = "ms-appx:///images/BigLiveTile1.jpg"; var imgSmallSource = "ms-appx:///images/SmallLiveTile1.jpg"; var tileContent = Windows.UI.Notifications.TileTemplateType.tileWideImageAndText01; var tileXml = Windows.UI.Notifications.TileUpdateManager.getTemplateContent(tileContent); var tileImageAttributes = tileXml.getElementsByTagName("image"); var tileTextAttributes = tileXml.getElementsByTagName("text"); tileImageAttributes[0].setAttribute("src", imgSource); tileImageAttributes[0].setAttribute("alt", "A Wide Live Tile."); tileTextAttributes[0].innerText = "100 National Places"; var binding = tileXml.getElementsByTagName("binding"); // create the square template and attach it to the wide template var template = Windows.UI.Notifications.TileTemplateType.tileSquareImage; var squareTileXml = Windows.UI.Notifications.TileUpdateManager.getTemplateContent(template); var squareTileImageElements = squareTileXml.getElementsByTagName("image"); squareTileImageElements[0].setAttribute("src", imgSmallSource); squareTileImageElements[0].setAttribute("alt", "A Square Live Tile."); var binding = squareTileXml.getElementsByTagName("binding").item(0); var node = tileXml.importNode(binding, true); tileXml.getElementsByTagName("visual").item(0).appendChild(node); var tileNotification = new Windows.UI.Notifications.TileNotification(tileXml); Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForApplication().enableNotificationQueue(true); Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForApplication().update(tileNotification); } })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/groupedItems/groupedItems.js
JavaScript
mpl11
6,860
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>groupedItemsPage</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" /> <script src="//Microsoft.WinJS.1.0/js/base.js"></script> <script src="//Microsoft.WinJS.1.0/js/ui.js"></script> <link href="/css/default.css" rel="stylesheet" /> <script src="../../js/UI.js"></script> <link href="/pages/groupedItems/groupedItems.css" rel="stylesheet" /> <script src="/js/data.js"></script> <script src="/pages/groupedItems/groupedItems.js"></script> </head> <body> <!-- These templates are used to display each item in the ListView declared below. --> <div class="headertemplate" data-win-control="WinJS.Binding.Template"> <button class="group-header win-type-x-large win-type-interactive" data-win-bind="groupKey: key" onclick="Application.navigator.pageControl.navigateToGroup(event.srcElement.groupKey)" role="link" tabindex="-1" type="button"> <span class="group-title win-type-ellipsis" data-win-bind="textContent: title"></span> <span class="group-chevron"></span> </button> </div> <div class="itemtemplate" data-win-control="WinJS.Binding.Template"> <div class="item"> <img class="item-image" src="#" data-win-bind="src: backgroundImage; alt: title" /> <div class="item-overlay"> <h4 class="item-title" data-win-bind="textContent: title"></h4> <h6 class="item-subtitle win-type-ellipsis" data-win-bind="textContent: subtitle"></h6> </div> </div> </div> <!-- The content that will be loaded and displayed. --> <div class="fragment groupeditemspage"> <header aria-label="Header content" role="banner"> <button class="win-backbutton" aria-label="Back" disabled type="button"></button> <h1 class="titlearea win-type-ellipsis"> <span class="pagetitle">100 Национални Туристически Обекта</span> </h1> </header> <section aria-label="Main content" role="main"> <div class="groupeditemslist win-selectionstylefilled" aria-label="List of groups" data-win-control="WinJS.UI.ListView" data-win-options="{ selectionMode: 'none' }"></div> </section> </div> </body> </html>
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/groupedItems/groupedItems.html
HTML
mpl11
2,465
// For an introduction to the Search Contract template, see the following documentation: // http://go.microsoft.com/fwlink/?LinkId=232512 // TODO: Add the following script tag to the start page's head to // subscribe to search contract events. // // <script src="/searchResultPage.js"></script> (function () { "use strict"; WinJS.Binding.optimizeBindingReferences = true; var appModel = Windows.ApplicationModel; var appViewState = Windows.UI.ViewManagement.ApplicationViewState; var nav = WinJS.Navigation; var ui = WinJS.UI; var utils = WinJS.Utilities; var searchPageURI = "/pages/searchResultPage/searchResultPage.html"; ui.Pages.define(searchPageURI, { _filters: [], _lastSearch: "", // This function is called whenever a user navigates to this page. It // populates the page elements with the app's data. ready: function (element, options) { var listView = element.querySelector(".resultslist").winControl; listView.itemTemplate = element.querySelector(".itemtemplate"); listView.oniteminvoked = this._itemInvoked; //this._handleQuery(element, options); //listView.element.focus(); listView.addEventListener("keydown", function (e) { if (Windows.UI.ViewManagement.ApplicationView.value !== appViewState.snapped && e.ctrlKey && e.keyCode === WinJS.Utilities.Key.g && e.altKey) { var data = listView.itemDataSource.list.getAt(listView.currentItem.index); this.navigateToGroup(data.group.key); e.preventDefault(); e.stopImmediatePropagation(); } }.bind(this), true); document.querySelector(".titlearea .pagetitle").textContent = "Search Results " + "for '" + options.queryText + "'"; this._initializeLayout(element.querySelector(".resultslist").winControl, Windows.UI.ViewManagement.ApplicationView.value); listView.element.focus(); }, // This function updates the page layout in response to viewState changes. updateLayout: function (element, viewState, lastViewState) { /// <param name="element" domElement="true" /> var listView = element.querySelector(".resultslist").winControl; if (lastViewState !== viewState) { if (lastViewState === appViewState.snapped || viewState === appViewState.snapped) { var handler = function (e) { listView.removeEventListener("contentanimating", handler, false); e.preventDefault(); } listView.addEventListener("contentanimating", handler, false); var firstVisible = listView.indexOfFirstVisible; this._initializeLayout(listView, viewState); if (firstVisible >= 0 && listView.itemDataSource.list.length > 0) { listView.indexOfFirstVisible = firstVisible; } } } }, // This function updates the ListView with new layouts _initializeLayout: function (listView, viewState) { /// <param name="listView" value="WinJS.UI.ListView.prototype" /> if (viewState === appViewState.snapped) { listView.itemDataSource = Data.items.dataSource; listView.groupDataSource = null; listView.layout = new ui.ListLayout(); //document.querySelector(".titlearea .pagetitle").textContent = '“' + this._lastSearch + '”'; document.querySelector(".titlearea .pagesubtitle").textContent = ""; } else { listView.itemDataSource =Data.items.dataSource; listView.layout = new ui.GridLayout(); // TODO: Change "App Name" to the name of your app. //document.querySelector(".titlearea .pagetitle").textContent = "App Name"; //document.querySelector(".titlearea .pagesubtitle").textContent = "Results for “" + this._lastSearch + '”'; } }, _itemInvoked: function (args) { args.detail.itemPromise.done(function itemInvoked(item) { // TODO: Navigate to the item that was invoked. if (Windows.UI.ViewManagement.ApplicationView.value === appViewState.snapped) { // If the page is snapped, the user invoked a group. //var group = HubData.groups.getAt(args.detail.itemIndex); //this.navigateToGroup(group.key); var item = Data.items.getAt(args.detail.itemIndex); nav.navigate("/pages/itemDetail/itemDetail.html", { item: Data.getItemReference(item) }); } else { // If the page is not snapped, the user invoked an item. var item = Data.items.getAt(args.detail.itemIndex); if (item == null) { var item1 = Data.items.getAt(0); nav.navigate("/pages/itemDetail/itemDetail.html", { item: Data.getItemReference(item1) }); } else { nav.navigate("/pages/itemDetail/itemDetail.html", { item: Data.getItemReference(item) }); } } }); }, // This function colors the search term. Referenced in /searchResultPage.html // as part of the ListView item templates. // This function generates the filter selection list. // This function populates a WinJS.Binding.List with search results for the // provided query. }); WinJS.Application.addEventListener("activated", function (args) { if (args.detail.kind === appModel.Activation.ActivationKind.search) { args.setPromise(ui.processAll().then(function () { if (!nav.location) { nav.history.current = { location: Application.navigator.home, initialState: {} }; } return nav.navigate(searchPageURI, { queryText: args.detail.queryText }); })); } }); appModel.Search.SearchPane.getForCurrentView().onquerysubmitted = function (args) { nav.navigate(searchPageURI, args); }; appModel.Search.SearchPane.getForCurrentView().onresultsuggestionchosen = function (eventObject) { onResultSuggestionChosen(item, eventObject); }; })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/searchResultPage/searchResultPage.js
JavaScript
mpl11
6,751
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="ms-design-extensionType" content="Search" /> <title>Search Contract</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" /> <script src="//Microsoft.WinJS.1.0/js/base.js"></script> <script src="//Microsoft.WinJS.1.0/js/ui.js"></script> <link href="/css/default.css" rel="stylesheet" /> <link href="/pages/searchResultPage/searchResultPage.css" rel="stylesheet" /> <script src="/pages/searchResultPage/searchResultPage.js"></script> <script src="/js/data.js"></script> <script src="/js/SpokeTwoData.js"></script> </head> <body> <!-- This template is used to display each item in the ListView declared below. --> <div class="itemtemplate" data-win-control="WinJS.Binding.Template"> <!-- <div class="item"> <img class="item-image" src="#" data-win-bind="src: backgroundImage; alt: title" /> <div class="item-content"> <h3 class="item-title win-type-x-small win-type-ellipsis" data-win-bind="innerHTML: title searchResultPage.markText"></h3> <h4 class="item-subtitle win-type-x-small win-type-ellipsis" data-win-bind="innerHTML: subtitle searchResultPage.markText"></h4> <h4 class="item-description win-type-x-small win-type-ellipsis" data-win-bind="innerHTML: description searchResultPage.markText"></h4> </div> </div>--> <div class="item"> <div class="item-overlay"> <img class="item-image" src="#" data-win-bind="src: backgroundImage; alt: title" /> <div class="titleDiv"> <h4 class="item-title" data-win-bind="textContent: title"></h4> <h6 class="item-subtitle win-type-ellipsis" data-win-bind="textContent: subtitle"></h6> <!--<h6 class="item-description win-type-ellipsis" data-win-bind="textContent: description"></h6>--> </div> </div> </div> </div> <!-- The content that will be loaded and displayed. --> <div class="searchResultPage fragment"> <header aria-label="Header content" role="banner"> <!--<button class="win-backbutton" aria-label="Back" disabled type="button"></button>--> <div class="titlearea"> <h1 class="pagetitle win-type-ellipsis"></h1> <h2 class="pagesubtitle win-type-ellipsis"></h2> </div> </header> <section aria-label="Main content" role="main"> <!--<p>some text</p>--> <div class="resultslist win-selectionstylefilled" aria-label="Search results" data-win-control="WinJS.UI.ListView" data-win-options="{ selectionMode: 'none' }"></div> </section> </div> </body> </html>
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/searchResultPage/searchResultPage.html
HTML
mpl11
2,942
.searchResultPage header[role=banner] .titlearea { -ms-grid-column: 2; -ms-grid-columns: auto 20px 1fr 20px; display: -ms-grid; } .searchResultPage header[role=banner] .titlearea .pagetitle { width: auto; line-height: 97px; } .searchResultPage header[role=banner] .titlearea .pagesubtitle { -ms-grid-column: 3; margin-top: 10px; } .searchResultPage section[role=main] .resultslist .item .item-overlay { -ms-grid-row: 2; -ms-grid-columns: 98px 1fr; display: -ms-grid; } .searchResultPage section[role=main] .resultslist .item .item-overlay .titleDiv { -ms-grid-column: 2; -ms-grid-rows: 9px 21px 21px 21px 1fr; display: -ms-grid; height: 108px; } .searchResultPage section[role=main] .resultslist .item .item-overlay .titleDiv .item-title { -ms-grid-row: 2; overflow: hidden; width: 108px; font-size: 15px; /*color:black;*/ } .searchResultPage section[role=main] .resultslist .item .item-overlay .titleDiv .item-subtitle { -ms-grid-row: 3; overflow: hidden; width: 108px; font-size: 15px; } .searchResultPage section[role=main] .resultslist .item .item-overlay .titleDiv .item-description { -ms-grid-row: 4; overflow: hidden; width: 108px; font-size: 15px; } .searchResultPage section[role=main] .resultslist .item:hover { background: black; border: 0; } .searchResultPage section[role=main] .resultslist .item { background:white; border: 0; } .searchResultPage section[role=main] { /* Define a grid with rows for the filters and results */ -ms-grid-columns: 1fr; -ms-grid-rows: 180px 1fr; -ms-grid-row: 1; -ms-grid-row-span: 2; display: -ms-grid; } .searchResultPage section[role=main] .resultsmessage { margin-left: 120px; margin-top: 193px; } .searchResultPage section[role=main] .filterarea { -ms-font-feature-settings: "case" 1; -ms-grid-row: 1; } .searchResultPage section[role=main] .filterarea .filterbar { height: auto; list-style-type: none; margin-left: 80px; margin-top: 133px; max-width: calc(100% - 120px); } .searchResultPage section[role=main] .filterarea .filterbar li { display: inline; margin-right: 40px; margin-top: 5px; opacity: 0.6; } .searchResultPage section[role=main] .filterarea .filterbar li.highlight, .searchResultPage section[role=main] .filterarea .filterbar li:hover { opacity: 1.00; } /* Hide the <select> filter list. It will be shown in snapped mode only. */ .searchResultPage section[role=main] .filterarea .filterselect { display: none; } .searchResultPage section[role=main] .resultslist { -ms-grid-row: 1; -ms-grid-row-span: 2; height: 100%; position: relative; width: 100%; z-index: 0; } .searchResultPage section[role=main] .resultslist .win-horizontal.win-viewport .win-surface { margin-bottom: 60px; margin-left: 100px; margin-right: 90px; margin-top: 198px; } .searchResultPage section[role=main] .resultslist .win-container { margin-bottom: 10px; margin-left: 23px; margin-right: 23px; } .searchResultPage section[role=main] .resultslist .item { /* Define a grid with columns for an icon, spacing and item details */ -ms-grid-columns: 40px 1fr; -ms-grid-rows: 1fr; display: -ms-grid; height: 64px; padding-left: 7px; padding-right: 7px; padding-top: 1px; width: 280px; } .searchResultPage section[role=main] .resultslist .item .item-image { -ms-grid-column: 1; -ms-grid-row: 1; height: 50px; margin-top: 6px; width: 60px; } .searchResultPage section[role=main] .resultslist .item .item-content { -ms-grid-column: 2; -ms-grid-row: 1; margin-left: 10px; } .searchResultPage section[role=main] .resultslist .item .item-content .item-subtitle, .searchResultPage section[role=main] .resultslist .item .item-content .item-description { opacity: 0.6; } /* Define a style for both selected filters and text matching the query. */ .searchResultPage section[role=main] .resultslist .item .item-content mark { background: transparent; color: rgba(90, 183, 227, 1); } @media screen and (-ms-view-state: snapped) { .searchResultPage header[role=banner] .titlearea { -ms-grid-columns: 1fr 20px; margin-top:42px; } .searchResultPage header[role=banner] .titlearea .pagetitle { margin-top: 0; } .searchResultPage section[role=main] { /* Rows for the filters and the results */ -ms-grid-columns: 1fr; -ms-grid-rows: 30px 1fr; -ms-grid-row: 2; -ms-grid-row-span: 1; display: -ms-grid; } .searchResultPage section[role=main] .resultsmessage { margin-left: 20px; margin-top: 36px; } /* Hide the horizontal list of filters in snapped mode. */ .searchResultPage section[role=main] .filterarea .filterbar { display: none; } /* Show a <select> list of filters in snapped mode */ .searchResultPage section[role=main] .filterarea .filterselect { display: inline; margin-left: 20px; margin-top: 2px; max-width: calc(100% - 38px); } .searchResultPage section[role=main] .resultslist { height: calc(100% - 30px); -ms-grid-row: 2; -ms-grid-row-span: 1; } .searchResultPage section[role=main] .resultslist .win-vertical.win-viewport .win-surface { margin-bottom: 60px; margin-top: 18px; } .searchResultPage section[role=main] .resultslist .win-container { margin-left: 13px; margin-right: 22px; } } @media screen and (-ms-view-state: fullscreen-portrait) { .searchResultPage section[role=main] .resultslist .win-horizontal.win-viewport .win-surface { margin-left: 70px; } }
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/searchResultPage/searchResultPage.css
CSS
mpl11
7,171
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="ms-design-extensionType" content="FileOpenPicker" /> <title>Item Picker Contract</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" /> <script src="//Microsoft.WinJS.1.0/js/base.js"></script> <script src="//Microsoft.WinJS.1.0/js/ui.js"></script> <link href="/css/default.css" rel="stylesheet" /> <link href="fileOpenPicker.css" rel="stylesheet" /> <script src="/js/data.js"></script> <script src="fileOpenPicker.js"></script> </head> <body> <!-- This template is used to display each item in the ListView declared below. --> <div class="itemtemplate" data-win-control="WinJS.Binding.Template"> <div class="item"> <img class="item-image" src="#" data-win-bind="src: backgroundImage; alt: title" /> </div> </div> <!-- The content that will be loaded and displayed. --> <section role="main" class="fileOpenPicker"> <ul class="commandbar"> <li class="win-type-x-large win-type-interactive">Go Up</li> </ul> <div class="pickerlist" aria-label="Items" data-win-control="WinJS.UI.ListView" data-win-options="{layout: {type: WinJS.UI.GridLayout}, selectionMode: 'multi', tapBehavior: 'toggleSelect', swipeBehavior: 'select'}"></div> </section> </body> </html>
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/fileOpenPicker/fileOpenPicker.html
HTML
mpl11
1,453
// For an introduction to the Picker Contract template, see the following documentation: // http://go.microsoft.com/fwlink/?LinkId=232514 // // TODO: Edit the manifest to enable use as a file open picker. The package // manifest could not be automatically updated. Open the package manifest file // and ensure that support for activation of the 'File Open Picker' is enabled. (function () { "use strict"; WinJS.Binding.optimizeBindingReferences = true; var app = WinJS.Application; var pickerUI; function fileRemovedFromPickerUI(args) { // TODO: Respond to an item being deselected in the picker UI. } function getPickerDataSource() { if (window.Data) { return Data.items.dataSource; } else { return new WinJS.Binding.List().dataSource; } } function updatePickerUI(args) { // TODO: Respond to an item being selected or deselected on the page. } app.onactivated = function activated(args) { if (args.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.fileOpenPicker) { pickerUI = args.detail.fileOpenPickerUI; pickerUI.onfileremoved = fileRemovedFromPickerUI; args.setPromise(WinJS.UI.processAll() .then(function () { var listView = document.querySelector(".pickerlist").winControl; listView.itemDataSource = getPickerDataSource(); listView.itemTemplate = document.querySelector(".itemtemplate"); listView.onselectionchanged = updatePickerUI; listView.element.focus(); })); } }; app.start(); })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/fileOpenPicker/fileOpenPicker.js
JavaScript
mpl11
1,773
.fileOpenPicker { /* Define a grid with rows for commands and items */ -ms-grid-columns: 1fr; -ms-grid-rows: 75px 1fr; display: -ms-grid; height: 100%; width: 100%; } .fileOpenPicker .commandbar { height: 100%; list-style-type: none; margin-left: 60px; margin-right: 60px; margin-top: 13px; width: 100%; } .fileOpenPicker .commandbar li { display: inline; font-family: "Segoe UI Light"; margin-left: 20px; margin-right: 20px; opacity: 0.6; } .fileOpenPicker .commandbar li:hover { opacity: 1.0; } .fileOpenPicker .pickerlist { -ms-grid-row: 2; height: 100%; width: 100%; } /* This selector is used to prevent ui-dark/light.css from overwriting changes to .win-surface. */ .fileOpenPicker .pickerlist .win-horizontal.win-viewport .win-surface { margin-bottom: 20px; margin-left: 115px; margin-right: 115px; } .fileOpenPicker .pickerlist .item { height: 130px; width: 190px; } .fileOpenPicker .pickerlist .item .item-image { height: 130px; width: 190px; }
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/fileOpenPicker/fileOpenPicker.css
CSS
mpl11
1,412
.groupdetailpage section[role=main] { -ms-grid-row: 1; -ms-grid-row-span: 2; } /* This selector is used to prevent ui-dark/light.css from overwriting changes to .win-surface. */ .groupdetailpage .itemslist .win-horizontal.win-viewport .win-surface { margin-bottom: 35px; margin-left: 120px; margin-right: 120px; margin-top: 128px; } .groupdetailpage .itemslist { height: 100%; position: relative; width: 100%; z-index: 0; } .groupdetailpage .itemslist .win-groupheader { -ms-grid-columns: 1fr; -ms-grid-rows: auto auto 1fr; display: -ms-grid; height: 100%; margin-left: 0px; margin-right: 43px; padding: 0; width: 480px; } .groupdetailpage .itemslist.win-rtl .win-groupheader { margin-left: 43px; margin-right: 0px; } .groupdetailpage .itemslist .win-groupheader .group-subtitle { -ms-grid-row: 1; margin-bottom: 14px; margin-top: 6px; max-height: 48pt; overflow: hidden; } .groupdetailpage .itemslist .win-groupheader .group-image { -ms-grid-row: 2; background-color: rgba(147, 149, 152, 1); height: 238px; margin: 0; margin-bottom: 20px; width: 480px; } .groupdetailpage .itemslist .win-groupheader .group-description { -ms-grid-row: 3; margin-bottom: 55px; overflow: hidden; } .groupdetailpage .itemslist .win-container { margin-bottom: 15px; margin-left: 30px; margin-right: 30px; padding: 7px; } .groupdetailpage .itemslist .item { -ms-grid-columns: 110px 1fr; -ms-grid-rows: 1fr; display: -ms-grid; height: 110px; width: 470px; } .groupdetailpage .itemslist .item .item-info { -ms-grid-column: 2; margin-left: 10px; margin-right: 10px; } .groupdetailpage .itemslist .item .item-info .item-title { margin-top: 4px; max-height: 20px; overflow: hidden; } .groupdetailpage .itemslist .item .item-info .item-subtitle { opacity: 0.6; } .groupdetailpage .itemslist .item .item-info .item-description { max-height: 60px; overflow: hidden; } @media screen and (-ms-view-state: snapped) { .groupdetailpage section[role=main] { -ms-grid-row: 2; -ms-grid-row-span: 1; } .groupdetailpage .itemslist .win-vertical.win-viewport .win-surface { margin-bottom: 30px; margin-top: 0; } .groupdetailpage .itemslist .win-groupheader { visibility: hidden; } .groupdetailpage .itemslist .win-container { margin-bottom: 15px; margin-left: 13px; margin-right: 35px; } .groupdetailpage .itemslist.win-rtl .win-container { margin-bottom: 15px; margin-left: 21px; margin-right: 26px; } .groupdetailpage .itemslist .item { -ms-grid-columns: 60px 1fr; height: 60px; width: 272px; } .groupdetailpage .itemslist .item .item-info .item-title { max-height: 30pt; } .groupdetailpage .itemslist .item .item-info .item-description { visibility: hidden; } } @media screen and (-ms-view-state: fullscreen-portrait) { .groupdetailpage .itemslist .win-horizontal.win-viewport .win-surface { margin-left: 100px; margin-right: 100px; } }
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/groupDetail/groupDetail.css
CSS
mpl11
3,872
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>groupDetailPage</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" /> <script src="//Microsoft.WinJS.1.0/js/base.js"></script> <script src="//Microsoft.WinJS.1.0/js/ui.js"></script> <link href="/css/default.css" rel="stylesheet" /> <link href="/pages/groupDetail/groupDetail.css" rel="stylesheet" /> <script src="/js/data.js"></script> <script src="/pages/groupDetail/groupDetail.js"></script> </head> <body> <!-- These templates are used to display each item in the ListView declared below. --> <div class="headertemplate" data-win-control="WinJS.Binding.Template"> <h2 class="group-subtitle" data-win-bind="textContent: subtitle"></h2> <img class="group-image" src="#" data-win-bind="src: backgroundImage; alt: title" /> <h4 class="group-description" data-win-bind="innerHTML: description"></h4> </div> <div class="itemtemplate" data-win-control="WinJS.Binding.Template"> <div class="item"> <img class="item-image" src="#" data-win-bind="src: backgroundImage; alt: title" /> <div class="item-info"> <h4 class="item-title" data-win-bind="textContent: title"></h4> <h6 class="item-subtitle win-type-ellipsis" data-win-bind="textContent: subtitle"></h6> <h4 class="item-description" data-win-bind="textContent: description"></h4> </div> </div> </div> <!-- The content that will be loaded and displayed. --> <div class="groupdetailpage fragment"> <header aria-label="Header content" role="banner"> <button class="win-backbutton" aria-label="Back" disabled type="button"></button> <h1 class="titlearea win-type-ellipsis"> <span class="pagetitle"></span> </h1> </header> <section aria-label="Main content" role="main"> <div class="itemslist win-selectionstylefilled" aria-label="List of this group's items" data-win-control="WinJS.UI.ListView" data-win-options="{ selectionMode: 'none' }"></div> </section> </div> </body> </html>
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/groupDetail/groupDetail.html
HTML
mpl11
2,285
(function () { "use strict"; var appViewState = Windows.UI.ViewManagement.ApplicationViewState; var ui = WinJS.UI; ui.Pages.define("/pages/groupDetail/groupDetail.html", { /// <field type="WinJS.Binding.List" /> _items: null, // This function is called whenever a user navigates to this page. It // populates the page elements with the app's data. ready: function (element, options) { var listView = element.querySelector(".itemslist").winControl; var group = (options && options.groupKey) ? Data.resolveGroupReference(options.groupKey) : Data.groups.getAt(0); this._items = Data.getItemsFromGroup(group); var pageList = this._items.createGrouped( function groupKeySelector(item) { return group.key; }, function groupDataSelector(item) { return group; } ); element.querySelector("header[role=banner] .pagetitle").textContent = group.title; listView.itemDataSource = pageList.dataSource; listView.itemTemplate = element.querySelector(".itemtemplate"); listView.groupDataSource = pageList.groups.dataSource; listView.groupHeaderTemplate = element.querySelector(".headertemplate"); listView.oniteminvoked = this._itemInvoked.bind(this); this._initializeLayout(listView, Windows.UI.ViewManagement.ApplicationView.value); listView.element.focus(); }, unload: function () { this._items.dispose(); }, // This function updates the page layout in response to viewState changes. updateLayout: function (element, viewState, lastViewState) { /// <param name="element" domElement="true" /> var listView = element.querySelector(".itemslist").winControl; if (lastViewState !== viewState) { if (lastViewState === appViewState.snapped || viewState === appViewState.snapped) { var handler = function (e) { listView.removeEventListener("contentanimating", handler, false); e.preventDefault(); } listView.addEventListener("contentanimating", handler, false); var firstVisible = listView.indexOfFirstVisible; this._initializeLayout(listView, viewState); if (firstVisible >= 0 && listView.itemDataSource.list.length > 0) { listView.indexOfFirstVisible = firstVisible; } } } }, // This function updates the ListView with new layouts _initializeLayout: function (listView, viewState) { /// <param name="listView" value="WinJS.UI.ListView.prototype" /> if (viewState === appViewState.snapped) { listView.layout = new ui.ListLayout(); } else { listView.layout = new ui.GridLayout({ groupHeaderPosition: "left" }); } }, _itemInvoked: function (args) { var item = this._items.getAt(args.detail.itemIndex); WinJS.Navigation.navigate("/pages/itemDetail/itemDetail.html", { item: Data.getItemReference(item) }); } }); })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/groupDetail/groupDetail.js
JavaScript
mpl11
3,427
// For an introduction to the Page Control template, see the following documentation: // http://go.microsoft.com/fwlink/?LinkId=232511 (function () { "use strict"; var nav = WinJS.Navigation; WinJS.UI.Pages.define("/pages/aboutUs/aboutUs.html", { ready: function (element, options) { }, updateLayout: function (element, viewState, lastViewState) { /// <param name="element" domElement="true" /> /// <param name="viewState" value="Windows.UI.ViewManagement.ApplicationViewState" /> /// <param name="lastViewState" value="Windows.UI.ViewManagement.ApplicationViewState" /> // TODO: Respond to changes in viewState. }, unload: function () { // TODO: Respond to navigations away from this page. } }); })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/aboutUs/aboutUs.js
JavaScript
mpl11
857
.login p { margin-left: 120px; background-color: red; } .loginMainLoginDiv { width: 200px; height: 30px; font-size: 24px; color: white; }
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/aboutUs/aboutUs.css
CSS
mpl11
177
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Login</title> <link href="login.css" rel="stylesheet" /> <script src="login.js"></script> </head> <body> <!-- BEGINSETTINGFLYOUT --> <div data-win-control="WinJS.UI.SettingsFlyout" id="aboutUs" aria-label="Help settings flyout" data-win-options="{settingsCommandId:'aboutUs',width:'small'}" style="visibility: visible; background-color: rgba(0, 0, 0, 0.950);"> <div class="win-ui-dark win-header"> <!-- Background color reflects app's personality --> <button type="button" onclick="WinJS.UI.SettingsFlyout.show()" class="win-backbutton" style="color: white;"></button> <div class="win-label" style="color: white;">About Us</div> </div> <div class="loginMainLoginDiv" style="margin-left: 50px; margin-top: 30px;"> Content goes Here </div> </div> <!-- ENDSETTINGSFLYOUT --> </body> </html>
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/aboutUs/aboutUs.html
HTML
mpl11
990
// For an introduction to the Page Control template, see the following documentation: // http://go.microsoft.com/fwlink/?LinkId=232511 (function () { "use strict"; var nav = WinJS.Navigation; WinJS.UI.Pages.define("/pages/settings/settings.html", { ready: function (element, options) { }, updateLayout: function (element, viewState, lastViewState) { /// <param name="element" domElement="true" /> /// <param name="viewState" value="Windows.UI.ViewManagement.ApplicationViewState" /> /// <param name="lastViewState" value="Windows.UI.ViewManagement.ApplicationViewState" /> // TODO: Respond to changes in viewState. }, unload: function () { // TODO: Respond to navigations away from this page. } }); })();
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/settings/settings.js
JavaScript
mpl11
859
.login p { margin-left: 120px; background-color: red; } .loginMainLoginDiv { width: 200px; height: 30px; font-size: 24px; color: white; }
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/settings/settings.css
CSS
mpl11
177
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Login</title> <link href="login.css" rel="stylesheet" /> <script src="login.js"></script> </head> <body> <!-- BEGINSETTINGFLYOUT --> <div data-win-control="WinJS.UI.SettingsFlyout" id="settings" aria-label="Help settings flyout" data-win-options="{settingsCommandId:'AppSettings',width:'small'}" style="visibility: visible; background-color: rgba(0, 0, 0, 0.950);"> <div class="win-ui-dark win-header"> <!-- Background color reflects app's personality --> <button type="button" onclick="WinJS.UI.SettingsFlyout.show()" class="win-backbutton" style="color: white;"></button> <div class="win-label" style="color: white;">Settings</div> </div> <div class="loginMainLoginDiv" style="margin-left: 50px; margin-top: 30px;"> Background color: <input type='color' id="inpBackground" /><br/> Font color: <input type='color' id="inpFontColor" /> </div> </div> <!-- ENDSETTINGSFLYOUT --> </body> </html>
100nationalobjects
trunk/NationalPlaces/NationalPlaces/pages/settings/settings.html
HTML
mpl11
1,108
#wrapper { position:relative; width:99%; height:100%; text-align:center; /*background: url("http://sdobreff.com/Wallpapers/Nature/mountains/sanownik_com_mountains_33189.jpg")no-repeat;*/ /*background: url("http://74211.com/wallpaper/picture_big/Free_Wallpaper__Includes_Green_Grass_Red_Flowers_A_Tree_An_Amazing_Scene.jpg") no-repeat;*/ /*color: black;*/ } #registerForm { display:none; } #loginForm { display: none; } .onFocus { color: blue; } #appBarContainer { display: none; } #contenthost { height: 100%; width: 100%; } #placesContent { height: 100%; width: 100%; visibility: hidden; } /*#pictiresContainer { position: absolute; }*/ .fragment { /* Define a grid with rows for a banner and a body */ -ms-grid-columns: 1fr; -ms-grid-rows: 128px 1fr; display: -ms-grid; height: 100%; width: 100%; } .fragment header[role=banner] { /* Define a grid with columns for the back button and page title. */ -ms-grid-columns: 39px 81px 1fr; -ms-grid-rows: 1fr; display: -ms-grid; } .fragment header[role=banner] .win-backbutton { -ms-grid-column: 2; margin-top: 59px; } .fragment header[role=banner] .titlearea { -ms-grid-column: 3; margin-top: 37px; } .fragment header[role=banner] .titlearea .pagetitle { width: calc(100% - 20px); } .fragment section[role=main] { -ms-grid-row: 2; height: 100%; width: 100%; } @media screen and (-ms-view-state: snapped) { .fragment header[role=banner] { -ms-grid-columns: auto 1fr; margin-left: 15px; margin-right: 15px; } .fragment header[role=banner] .win-backbutton { -ms-grid-column: 1; margin-bottom: 0; margin-left: 5px; margin-right: 5px; margin-top: 76px; } .fragment header[role=banner] .win-backbutton:disabled { display: none; } .fragment header[role=banner] .titlearea { -ms-grid-column: 2; margin-bottom: 0; margin-left: 5px; margin-right: 5px; margin-top: 68px; } } #profile-image-container { display: none; } @media screen and (-ms-view-state: fullscreen-portrait) { .fragment header[role=banner] { -ms-grid-columns: 29px 71px 1fr; } }
100nationalobjects
trunk/NationalPlaces/NationalPlaces/css/default.css
CSS
mpl11
2,629
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>NationalPlaces</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" /> <script src="//Microsoft.WinJS.1.0/js/base.js"></script> <script src="//Microsoft.WinJS.1.0/js/ui.js"></script> <!-- NationalPlaces references --> <link href="/css/default.css" rel="stylesheet" /> <script src="/js/data.js"></script> <script src="/js/navigator.js"></script> <script src="js/sha1Generator.js"></script> <script src="js/UI.js"></script> <script src="js/events.js"></script> <script src="/js/default.js"></script> <script src="js/groupedItems.js"></script> <!--<script src="js/picturesData.js"></script>--> <!-- Search Result --> <link href="pages/searchResultPage/searchResultPage.css" rel="stylesheet" /> <script src="pages/searchResultPage/searchResultPage.js"></script> </head> <body> <div id="wrapper"> <!--<span id="showLogin">LOGIN</span> <span id="showRegister">REGISTER</span>--> <div id="loginForm"> <h1>Login</h1> <input type="text" placeholder="Type your username here..." id="username" /><br /> <input type="password" placeholder="Type your password here..." id="password" /><br /> <button id="btnLogin">Login</button> </div> <div id="registerForm"> <h1>Register</h1> <input type="text" placeholder="Username" id="regUsername" /><br /> <input type="text" placeholder="Full name" id="fullName" /><br /> <input type="password" placeholder="Password" id="regPassword" /><br /> <img height="40px" src="#" id="profile-image-container" /> <button id="btnCamera">Take picture</button> <button id="btnRegister">Register</button> </div> <div id="menu-id" data-win-control="WinJS.UI.Menu", data-win-options="{anchor:'myProfile'}"> <button data-win-control="WinJS.UI.MenuCommand" data-win-options="{id:'btnShowPictures',label:'Снимки'}"></button> <button data-win-control="WinJS.UI.MenuCommand" data-win-options="{id:'btnUploadPicture',label:'Качи снимки'}"></button> </div> <!--<div id="uploadPicture" data-win-control="WinJS.UI.Flyout"> <div>Your account will be charged $252.</div> <button id="confirmButton">Complete Order</button>--> <!--</div>--> <div id="appBarContainer"> <div id="appbar" data-win-control="WinJS.UI.AppBar" data-win-options="{placement:'top'}" style="height: 50px;"> <button data-win-control="WinJS.UI.AppBarCommand" id="btnCheckIn">Отбележи ме!</button> <button data-win-control="WinJS.UI.AppBarCommand" id="btnLogout" style="margin: 0px 0px 0px 5px;"> Изход </button> <button data-win-control="WinJS.UI.AppBarCommand" id="myProfile">Профил</button> </div> </div> <!--<div id="pictiresContainer"> <div id="picturesView" data-win-control="WinJS.Binding.Template"> <div style="width: 282px; height: 70px; padding: 5px; overflow: hidden; display: -ms-grid;"> <img data-win-bind="src: picture" src="#" style="width: 60px; height: 60px; margin: 5px; -ms-grid-column: 1;" /> </div> </div> <div id="picturesList" data-win-control="WinJS.UI.ListView" data-win-options="{itemDataSource : PicturesData.itemList.dataSource, itemTemplate: select('#picturesView'), layout : {type: WinJS.UI.GridLayout}}"> </div> </div>--> <div id="placesContent"> <div id="contenthost" data-win-control="Application.PageControlNavigator" data-win-options="{home: '/pages/groupedItems/groupedItems.html'}"></div> </div> </div> <!--<div id="contenthost" data-win-control="Application.PageControlNavigator" data-win-options="{home: '/pages/groupedItems/groupedItems.html'}"></div> <!-- <div id="appbar" data-win-control="WinJS.UI.AppBar"> <button data-win-control="WinJS.UI.AppBarCommand" data-win-options="{id:'cmd', label:'Command', icon:'placeholder'}" type="button"></button> </div> --> </body> </html>
100nationalobjects
trunk/NationalPlaces/NationalPlaces/default.html
HTML
mpl11
4,450
#--------------------------------------------------------------------------------- # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC") endif include $(DEVKITPPC)/wii_rules #--------------------------------------------------------------------------------- # TARGET is the name of the output # BUILD is the directory where object files & intermediate files will be placed # SOURCES is a list of directories containing source code # INCLUDES is a list of directories containing extra header files #--------------------------------------------------------------------------------- TARGET := boot BUILD := build SOURCES := source DATA := data INCLUDES := include #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE) ASFLAGS = $(MACHDEP) $(INCLUDE) -D_LANGUAGE_ASSEMBLY CXXFLAGS = $(CFLAGS) LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- LIBS := -lfat -lwiiuse -lbte -lmad -lm -lmodplay -logc -lpngu #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- LIBDIRS := $(PORTLIBS) #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional # rules for different file extensions #--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR))) #--------------------------------------------------------------------------------- export OUTPUT := $(CURDIR)/$(TARGET) export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) export DEPSDIR := $(CURDIR)/$(BUILD) #--------------------------------------------------------------------------------- # automatically build a list of object files for our project #--------------------------------------------------------------------------------- CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) #--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C #--------------------------------------------------------------------------------- ifeq ($(strip $(CPPFILES)),) export LD := $(CC) else export LD := $(CXX) endif export OFILES := $(addsuffix .o,$(BINFILES)) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ $(sFILES:.s=.o) $(SFILES:.S=.o) #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) \ -I$(LIBOGC_INC) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ -L$(LIBOGC_LIB) export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean all all: $(BUILD) #--------------------------------------------------------------------------------- $(BUILD): @[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile #--------------------------------------------------------------------------------- clean: @echo clean ... @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol #--------------------------------------------------------------------------------- run: wiiupload $(TARGET).dol #--------------------------------------------------------------------------------- else DEPENDS := $(OFILES:.o=.d) #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) #--------------------------------------------------------------------------------- # This rule links in binary data #--------------------------------------------------------------------------------- %.sys.o : %.sys @echo $(notdir $<) $(bin2o) -include $(DEPENDS) %.tik.o : %.tik #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) -include $(DEPENDS) %.tmd.o : %.tmd @echo $(notdir $<) $(bin2o) -include $(DEPENDS) %.app.o : %.app @echo $(notdir $<) $(bin2o) -include $(DEPENDS) #--------------------------------------------------------------------------------- endif #---------------------------------------------------------------------------------
118-c-c-installer
trunk/Makefile
Makefile
gpl2
5,920
// Copyright 2010 Joseph Jordan <joe.ftpii@psychlaw.com.au> // This code is licensed to you under the terms of the GNU GPL, version 2; // see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt #ifndef _IOSPATCH_H #define _IOSPATCH_H #include <gccore.h> u32 IOSPATCH_Apply(); #endif /* _IOSPATCH_H */
118-c-c-installer
trunk/source/iospatch.h
C
gpl2
321
#include <gccore.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <fat.h> #include <sdcard/wiisd_io.h> #include "tools.h" #include <ogc/usbstorage.h> extern DISC_INTERFACE __io_usbstorage; static void *xfb = NULL; static GXRModeObj *rmode = NULL; void Reboot() { if (*(u32*)0x80001800) exit(0); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } void waitforbuttonpress(u32 *out, u32 *outGC) { u32 pressed = 0; u32 pressedGC = 0; while (true) { WPAD_ScanPads(); pressed = WPAD_ButtonsDown(0) | WPAD_ButtonsDown(1) | WPAD_ButtonsDown(2) | WPAD_ButtonsDown(3); PAD_ScanPads(); pressedGC = PAD_ButtonsDown(0) | PAD_ButtonsDown(1) | PAD_ButtonsDown(2) | PAD_ButtonsDown(3); if(pressed || pressedGC) { if (pressedGC) { // Without waiting you can't select anything usleep (20000); } if (out) *out = pressed; if (outGC) *outGC = pressedGC; return; } } } void Init_Console() { // Initialise the video system VIDEO_Init(); // Obtain the preferred video mode from the system // This will correspond to the settings in the Wii menu rmode = VIDEO_GetPreferredMode(NULL); // Allocate memory for the display in the uncached region xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); // Set up the video registers with the chosen mode VIDEO_Configure(rmode); // Tell the video hardware where our display memory is VIDEO_SetNextFramebuffer(xfb); // Make the display visible VIDEO_SetBlack(FALSE); // Flush the video register changes to the hardware VIDEO_Flush(); // Wait for Video setup to complete VIDEO_WaitVSync(); if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); // Set console parameters int x = 24, y = 32, w, h; w = rmode->fbWidth - (32); h = rmode->xfbHeight - (48); // Initialize the console - CON_InitEx works after VIDEO_ calls CON_InitEx(rmode, x, y, w, h); // Clear the garbage around the edges of the console VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK); } s32 Init_SD() { if (!__io_wiisd.startup()) { printf("SD card error, press any button to exit...\n"); return -1; } if (!fatMountSimple("sd", &__io_wiisd)) { printf("FAT error, press any button to exit...\n"); return -1; } return 0; } void Close_SD() { fatUnmount("sd"); //__io_wiisd.shutdown(); } s32 Init_USB() { if (!__io_usbstorage.startup()) { printf("USB storage error, press any button to exit...\n"); return -1; } if (!fatMountSimple("usb", &__io_usbstorage)) { printf("FAT error, press any button to exit...\n"); return -1; } return 0; } void Close_USB() { fatUnmount("usb"); //__io_usbstorage.shutdown(); } void printheadline() { int rows, cols; CON_GetMetrics(&cols, &rows); printf("118Channel and IOS118 Installer v1"); char buf[64]; sprintf(buf, "IOS%u (Rev %u)\n", IOS_GetVersion(), IOS_GetRevision()); printf("\x1B[%d;%dH", 0, cols-strlen(buf)-1); printf(buf); } void set_highlight(bool highlight) { if (highlight) { printf("\x1b[%u;%um", 47, false); printf("\x1b[%u;%um", 30, false); } else { printf("\x1b[%u;%um", 37, false); printf("\x1b[%u;%um", 40, false); } } //void Con_ClearLine() //{ // s32 cols, rows; // u32 cnt; // // printf("\r"); // fflush(stdout); // // /* Get console metrics */ // CON_GetMetrics(&cols, &rows); // // /* Erase line */ // for (cnt = 1; cnt < cols; cnt++) { // printf(" "); // fflush(stdout); // } // // printf("\r"); // fflush(stdout); //}
118-c-c-installer
trunk/source/tools.c
C
gpl2
3,634
// Transparency and fixes by oggzee #include <stdlib.h> #include <string.h> #include <reent.h> #include <errno.h> #include <sys/param.h> #include "ogc/machine/asm.h" #include "ogc/machine/processor.h" #include "ogc/color.h" #include "ogc/cache.h" #include "ogc/video.h" #include "ogc/system.h" #include "console.h" #include "ogc/consol.h" #include "ogc/usbgecko.h" #include <stdio.h> #include <sys/iosupport.h> #include "util.h" #include <pngu.h> extern void *bg_buf_rgba; extern void *bg_buf_ycbr; //--------------------------------------------------------------------------------- const devoptab_t dotab_stdout = { //--------------------------------------------------------------------------------- "stdout", // device name 0, // size of file structure NULL, // device open NULL, // device close __console_write, // device write NULL, // device read NULL, // device seek NULL, // device fstat NULL, // device stat NULL, // device link NULL, // device unlink NULL, // device chdir NULL, // device rename NULL, // device mkdir 0, // dirStateSize NULL, // device diropen_r NULL, // device dirreset_r NULL, // device dirnext_r NULL, // device dirclose_r NULL // device statvfs_r }; //color table YcbYcr const unsigned int color_table_YcbYcr[] = { 0x00800080, // 30 normal black 0x246A24BE, // 31 normal red 0x4856484B, // 32 normal green 0x6D416D8A, // 33 normal yellow 0x0DBE0D75, // 34 normal blue 0x32A932B4, // 35 normal magenta 0x56955641, // 36 normal cyan 0xC580C580, // 37 normal white 0x7B807B80, // 30 bright black 0x4C544CFF, // 31 bright red 0x95299512, // 32 bright green 0xE200E294, // 33 bright yellow 0x1CFF1C6B, // 34 bright blue 0x69D669ED, // 35 bright magenta 0xB2ABB200, // 36 bright cyan 0xFF80FF80, // 37 bright white }; // RGBA const unsigned int color_table[] = { 0x000000FF, // 30 normal black 0x800000FF, // 31 normal red 0x008000FF, // 32 normal green 0x808000FF, // 33 normal yellow 0x000080FF, // 34 normal blue 0x800080FF, // 35 normal magenta 0x008080FF, // 36 normal cyan 0xB0B0B0FF, // 37 normal white 0x606060FF, // 30 bright black 0xFF0000FF, // 31 bright red 0x00FF00FF, // 32 bright green 0xFFFF00FF, // 33 bright yellow 0x0000FFFF, // 34 bright blue 0xFF00FFFF, // 35 bright magenta 0x00FFFFFF, // 36 bright cyan 0xFFFFFFFF, // 37 bright white }; #define RGBA_COLOR_WHITE 0xFFFFFFFF #define RGBA_COLOR_BLACK 0x000000FF struct unifont_header *unifont = NULL; u8 *unifont_glyph = NULL; inline u32 RGB8x2_TO_YCbYCr(u8 *c1, u8 *c2) { return PNGU_RGB8_TO_YCbYCr(c1[0], c1[1], c1[2], c2[0], c2[1], c2[2]); } static u32 do_xfb_copy = FALSE; static struct _console_data_s stdcon; static struct _console_data_s *curr_con = NULL; static void *_console_buffer = NULL; // transparency struct _c1 { //char c; wchar_t c; int fg, bg; }; //static void *_bg_buffer = NULL; //static unsigned int _bg_color = COLOR_BLACK; static unsigned int _bg_color = RGBA_COLOR_BLACK; static int _c_buffer_size = 0; static struct _c1 *_c_buffer = NULL; static int _tr_enable = 0; int __console_disable = 0; int __console_scroll = 0; static s32 __gecko_status = -1; static u32 __gecko_safe = 0; extern u8 console_font_8x16[]; extern u8 console_font_512[]; int fb_change = 0; int retrace_cnt = 0; void __console_vipostcb(u32 retraceCnt) { if (retrace_cnt < 5) { retrace_cnt++; return; } if (!fb_change) return; do_xfb_copy = TRUE; __console_flush(0); do_xfb_copy = FALSE; } void __console_flush(int retrace_min) { u32 ycnt,xcnt, fb_stride; u32 *fb,*ptr; if (!fb_change && retrace_min >= 0) { if (retrace_min == 0) retrace_cnt = 0; return; } if (retrace_cnt < retrace_min) return; fb_change = 0; retrace_cnt = 0; if (__console_disable) return; ptr = curr_con->destbuffer; fb = VIDEO_GetCurrentFramebuffer()+(curr_con->target_y*curr_con->tgt_stride) + curr_con->target_x*VI_DISPLAY_PIX_SZ; fb_stride = curr_con->tgt_stride/4 - (curr_con->con_xres/VI_DISPLAY_PIX_SZ); for(ycnt=curr_con->con_yres;ycnt>0;ycnt--) { for(xcnt=curr_con->con_xres;xcnt>0;xcnt-=VI_DISPLAY_PIX_SZ) { *fb++ = *ptr++; } fb += fb_stride; } } void __console_bg_grab(void *x_fb) { /* u32 ycnt,xcnt, fb_stride; u32 *fb,*ptr; if (x_fb == NULL) x_fb = VIDEO_GetCurrentFramebuffer(); if (!_bg_buffer) return; ptr = _bg_buffer; fb = x_fb + (curr_con->target_y*curr_con->tgt_stride) + curr_con->target_x*VI_DISPLAY_PIX_SZ; fb_stride = curr_con->tgt_stride/4 - (curr_con->con_xres/VI_DISPLAY_PIX_SZ); for(ycnt=curr_con->con_yres;ycnt>0;ycnt--) { for(xcnt=curr_con->con_xres;xcnt>0;xcnt-=VI_DISPLAY_PIX_SZ) { *ptr++ = *fb++; } fb += fb_stride; } */ } int console_set_unifont(void *buf, int size) { unifont_header *u = (unifont_header*) buf; char *end; unifont = NULL; unifont_glyph = NULL; if (!buf) return -1; if (size < sizeof(unifont_header) + 4) return -1; /* printf("head: %.8s\n", u->head_tag); printf("index: %.4s\n", u->index_tag); printf("glyph: %.4s\n", u->glyph_tag); printf("max i: %04x\n", u->max_idx); printf("siz g: %04x\n", u->glyph_size); */ if (memcmp(u->head_tag, "UNIFONT", 8)) return -1; if (memcmp(u->index_tag, "INDX", 4)) return -1; if (memcmp(u->glyph_tag, "GLYP", 4)) return -1; if (u->max_idx != 0xFFFF) return -1; if (size < sizeof(unifont_header) + u->glyph_size + 4) return -1; end = buf + sizeof(unifont_header) + u->glyph_size * 16; //printf("end: %.4s\n", end); if (memcmp(end, "END", 4)) return -1; unifont = u; unifont_glyph = buf + sizeof(unifont_header); return 0; } //int console_load_unifont(char *fname) //{ // FILE *f = NULL; // void *buf = NULL; // struct stat st; // u32 size; // s32 ret; // // //printf("load %s\n", fname); Wpad_WaitButtons(); // ret = stat(fname, &st); // if (ret != 0) return -1; // size = st.st_size; // buf = mem1_alloc(size); // if (!buf) return -1; // f = fopen(fname, "rb"); // if (!f) goto err; // ret = fread(buf, 1, size, f); // fclose(f); // if (ret != size) goto err; // //printf("unifont: %d\n", size); Wpad_WaitButtons(); // if (console_set_unifont(buf, size)) goto err; // /*printf("unifont: OK\n"); // printf("機動戦士ガンダム MS戦線\n"); // printf("機 動 戦 士 ガ ン ダ ム MS 戦 線\n"); // Wpad_WaitButtons();*/ // extern void unifont_cache_init(); // unifont_cache_init(); // // return 0; //err: // SAFE_FREE(buf) // return -1; //} static void _bg_console_draw_glyph(unsigned char *pbits) { console_data_s *con; int ay; unsigned int *ptr; //unsigned char bg[8] = {0,0,0,0,0,0,0,0}; unsigned char *bg; unsigned char bits; unsigned int color; unsigned int fgcolor, bgcolor; unsigned int nextline; u8 *c1, *c2; if(do_xfb_copy==TRUE) return; if(!curr_con) return; con = curr_con; if(!bg_buf_rgba) return; ptr = (unsigned int*)(con->destbuffer + ( con->con_stride * con->cursor_row * FONT_YSIZE ) + ((con->cursor_col * FONT_XSIZE / 2) * 4)); //bg = (unsigned char*)(bg_buf_rgba + ( con->target_y + con->cursor_row * FONT_YSIZE )*640*4 + (con->target_x + con->cursor_col * FONT_XSIZE) * 4 ); nextline = con->con_stride/4 - 4; fgcolor = con->foreground; bgcolor = con->background; for (ay = 0; ay < FONT_YSIZE; ay++) { /* hard coded loop unrolling ! */ /* this depends on FONT_XSIZE = 8*/ #if FONT_XSIZE == 8 bits = *pbits++; bg = (unsigned char*)(bg_buf_rgba + ( con->target_y + con->cursor_row * FONT_YSIZE + ay)*640*4 + (con->target_x + con->cursor_col * FONT_XSIZE) * 4 ); /* bits 1 & 2 */ c1 = (bits & 0x80) ? (u8*)&fgcolor : &bg[0]; c2 = (bits & 0x40) ? (u8*)&fgcolor : &bg[4]; color = RGB8x2_TO_YCbYCr(c1, c2); *ptr++ = color; bg += 8; /* bits 3 & 4 */ c1 = (bits & 0x20) ? (u8*)&fgcolor : &bg[0]; c2 = (bits & 0x10) ? (u8*)&fgcolor : &bg[4]; color = RGB8x2_TO_YCbYCr(c1, c2); *ptr++ = color; bg += 8; /* bits 5 & 6 */ c1 = (bits & 0x08) ? (u8*)&fgcolor : &bg[0]; c2 = (bits & 0x04) ? (u8*)&fgcolor : &bg[4]; color = RGB8x2_TO_YCbYCr(c1, c2); *ptr++ = color; bg += 8; /* bits 7 & 8 */ c1 = (bits & 0x02) ? (u8*)&fgcolor : &bg[0]; c2 = (bits & 0x01) ? (u8*)&fgcolor : &bg[4]; color = RGB8x2_TO_YCbYCr(c1, c2); *ptr++ = color; bg += 8; /* next line */ ptr += nextline; #else #endif } } static void _nc_console_draw_glyph(unsigned char *pbits) { console_data_s *con; int ay; unsigned int *ptr; unsigned char bits; unsigned int color; unsigned int fgcolor, bgcolor; unsigned int nextline; u8 *c1, *c2; if(do_xfb_copy==TRUE) return; if(!curr_con) return; con = curr_con; ptr = (unsigned int*)(con->destbuffer + ( con->con_stride * con->cursor_row * FONT_YSIZE ) + ((con->cursor_col * FONT_XSIZE / 2) * 4)); nextline = con->con_stride/4 - 4; fgcolor = con->foreground; bgcolor = con->background; for (ay = 0; ay < FONT_YSIZE; ay++) { /* hard coded loop unrolling ! */ /* this depends on FONT_XSIZE = 8*/ #if FONT_XSIZE == 8 bits = *pbits++; /* bits 1 & 2 */ c1 = (bits & 0x80) ? (u8*)&fgcolor : (u8*)&bgcolor; c2 = (bits & 0x40) ? (u8*)&fgcolor : (u8*)&bgcolor; color = RGB8x2_TO_YCbYCr(c1, c2); *ptr++ = color; /* bits 3 & 4 */ c1 = (bits & 0x20) ? (u8*)&fgcolor : (u8*)&bgcolor; c2 = (bits & 0x10) ? (u8*)&fgcolor : (u8*)&bgcolor; color = RGB8x2_TO_YCbYCr(c1, c2); *ptr++ = color; /* bits 5 & 6 */ c1 = (bits & 0x08) ? (u8*)&fgcolor : (u8*)&bgcolor; c2 = (bits & 0x04) ? (u8*)&fgcolor : (u8*)&bgcolor; color = RGB8x2_TO_YCbYCr(c1, c2); *ptr++ = color; /* bits 7 & 8 */ c1 = (bits & 0x02) ? (u8*)&fgcolor : (u8*)&bgcolor; c2 = (bits & 0x01) ? (u8*)&fgcolor : (u8*)&bgcolor; color = RGB8x2_TO_YCbYCr(c1, c2); *ptr++ = color; /* next line */ ptr += nextline; #else #endif } } static void _console_draw_glyph(unsigned char *pbits) { if (_tr_enable && curr_con->background == _bg_color) { _bg_console_draw_glyph(pbits); } else { _nc_console_draw_glyph(pbits); } } static void _nc_console_drawc(int c) { if (!curr_con) return; unsigned char *pbits; if (c <= 512) { pbits = &curr_con->font[c * FONT_YSIZE]; _console_draw_glyph(pbits); } else if (unifont && unifont->index[c]) { u32 off = unifont->index[c] >> 8; u32 len = unifont->index[c] & 0x0F; pbits = &unifont_glyph[off * 16]; _console_draw_glyph(pbits); if (len == 2) { if (curr_con->cursor_col + 1 >= curr_con->con_cols) return; curr_con->cursor_col++; pbits = &unifont_glyph[(off+1) * 16]; _console_draw_glyph(pbits); } } } #if 0 // YcbYcr static void _nc_console_drawc(int c) { console_data_s *con; int ay; unsigned int *ptr; unsigned char *pbits; unsigned char bits; unsigned int color; unsigned int fgcolor, bgcolor; unsigned int nextline; if(do_xfb_copy==TRUE) return; if(!curr_con) return; con = curr_con; if (_tr_enable && _bg_buffer && con->background == _bg_color) { _bg_console_drawc(c); return; } ptr = (unsigned int*)(con->destbuffer + ( con->con_stride * con->cursor_row * FONT_YSIZE ) + ((con->cursor_col * FONT_XSIZE / 2) * 4)); pbits = &con->font[c * FONT_YSIZE]; nextline = con->con_stride/4 - 4; fgcolor = con->foreground; bgcolor = con->background; for (ay = 0; ay < FONT_YSIZE; ay++) { /* hard coded loop unrolling ! */ /* this depends on FONT_XSIZE = 8*/ #if FONT_XSIZE == 8 bits = *pbits++; /* bits 1 & 2 */ if ( bits & 0x80) color = fgcolor & 0xFFFF00FF; else color = bgcolor & 0xFFFF00FF; if (bits & 0x40) color |= fgcolor & 0x0000FF00; else color |= bgcolor & 0x0000FF00; *ptr++ = color; /* bits 3 & 4 */ if ( bits & 0x20) color = fgcolor & 0xFFFF00FF; else color = bgcolor & 0xFFFF00FF; if (bits & 0x10) color |= fgcolor & 0x0000FF00; else color |= bgcolor & 0x0000FF00; *ptr++ = color; /* bits 5 & 6 */ if ( bits & 0x08) color = fgcolor & 0xFFFF00FF; else color = bgcolor & 0xFFFF00FF; if (bits & 0x04) color |= fgcolor & 0x0000FF00; else color |= bgcolor & 0x0000FF00; *ptr++ = color; /* bits 7 & 8 */ if ( bits & 0x02) color = fgcolor & 0xFFFF00FF; else color = bgcolor & 0xFFFF00FF; if (bits & 0x01) color |= fgcolor & 0x0000FF00; else color |= bgcolor & 0x0000FF00; *ptr++ = color; /* next line */ ptr += nextline; #else #endif } } #endif static void __console_drawc(int c) { if(!curr_con) return; if (_tr_enable && _c_buffer) { int cidx = curr_con->cursor_row * curr_con->con_cols + curr_con->cursor_col; _c_buffer[cidx].c = c; _c_buffer[cidx].fg = curr_con->foreground; _c_buffer[cidx].bg = curr_con->background; } _nc_console_drawc(c); //fb_change = 1; } void _c_repaint(); void _bg_repaint() { /* if (!_bg_buffer) return; // clear unsigned int c; unsigned int *p; unsigned int *bg; c = (curr_con->con_xres * curr_con->con_yres)/2; p = (unsigned int*)curr_con->destbuffer; bg = _bg_buffer; while(c--) *p++ = *bg++; */ unsigned int y; unsigned int *p; unsigned int *bg; if (!bg_buf_ycbr) return; p = (unsigned int*)curr_con->destbuffer; bg = (unsigned int*)(bg_buf_ycbr + curr_con->target_y * 640 * 2 + curr_con->target_x * 2 ); for (y=0; y<curr_con->con_yres; y++) { memcpy(p, bg, curr_con->con_xres * 2); p += curr_con->con_xres / 2; bg += 640/2; } } void _bg_scroll() { // clear _bg_repaint(); // scroll memmove(_c_buffer, _c_buffer + curr_con->con_cols, sizeof(struct _c1) * (curr_con->con_rows-1) * curr_con->con_cols); // clear last memset(_c_buffer + (curr_con->con_rows-1) * curr_con->con_cols, 0, sizeof(struct _c1) * curr_con->con_cols); // redraw characters _c_repaint(); } void _c_repaint() { // repaint if (!_c_buffer) return; int save_row = curr_con->cursor_row; int save_col = curr_con->cursor_col; int save_fg = curr_con->foreground; int save_bg = curr_con->background; int x, y, i = 0; for (y=0; y < curr_con->con_rows - 1; y++) { for (x=0; x < curr_con->con_cols; x++) { curr_con->cursor_col = x; curr_con->cursor_row = y; curr_con->foreground = _c_buffer[i].fg; curr_con->background = _c_buffer[i].bg; if (_c_buffer[i].c) _nc_console_drawc(_c_buffer[i].c); i++; } } curr_con->cursor_row = save_row; curr_con->cursor_col = save_col; curr_con->foreground = save_fg; curr_con->background = save_bg; } static void __console_clear(void) { console_data_s *con; unsigned int c; unsigned int color; unsigned int *p; if(!curr_con) return; con = curr_con; if (_tr_enable) { _bg_repaint(); memset(_c_buffer, 0, _c_buffer_size); } else { c = (con->con_xres*con->con_yres)/2; p = (unsigned int*)con->destbuffer; color = RGB8x2_TO_YCbYCr((u8 *)&(con->background), (u8 *)&(con->background)); while (c--) *p++ = color; } con->cursor_row = 0; con->cursor_col = 0; con->saved_row = 0; con->saved_col = 0; } void __console_enable(void *fb) { if(_tr_enable) { __console_bg_grab(fb); _bg_repaint(); _c_repaint(); } __console_disable = 0; __console_flush(-1); } void __console_init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride) { unsigned int level; console_data_s *con = &stdcon; _CPU_ISR_Disable(level); _tr_enable = 0; con->destbuffer = framebuffer; con->con_xres = xres; con->con_yres = yres; con->con_cols = xres / FONT_XSIZE; con->con_rows = yres / FONT_YSIZE; con->con_stride = con->tgt_stride = stride; con->target_x = xstart; con->target_y = ystart; con->font = console_font_8x16; //con->foreground = COLOR_WHITE; //con->background = COLOR_BLACK; con->foreground = RGBA_COLOR_WHITE; con->background = RGBA_COLOR_BLACK; curr_con = con; __console_clear(); fb_change = 1; devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout; _CPU_ISR_Restore(level); setvbuf(stdout, NULL , _IONBF, 0); setvbuf(stderr, NULL , _IONBF, 0); } void __console_init_ex(void *conbuffer,int tgt_xstart,int tgt_ystart,int tgt_stride,int con_xres,int con_yres,int con_stride) { unsigned int level; console_data_s *con = &stdcon; _CPU_ISR_Disable(level); con->destbuffer = conbuffer; con->target_x = tgt_xstart; con->target_y = tgt_ystart; con->con_xres = con_xres; con->con_yres = con_yres; con->tgt_stride = tgt_stride; con->con_stride = con_stride; con->con_cols = con_xres / FONT_XSIZE; con->con_rows = con_yres / FONT_YSIZE; con->cursor_row = 0; con->cursor_col = 0; con->saved_row = 0; con->saved_col = 0; //con->font = console_font_8x16; con->font = console_font_512; //con->foreground = COLOR_WHITE; //con->background = COLOR_BLACK; con->foreground = RGBA_COLOR_WHITE; con->background = RGBA_COLOR_BLACK; curr_con = con; if(_tr_enable) { __console_bg_grab(NULL); con->background = _bg_color; } __console_clear(); fb_change = 1; retrace_cnt = 0; devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout; VIDEO_SetPostRetraceCallback(__console_vipostcb); _CPU_ISR_Restore(level); setvbuf(stdout, NULL , _IONBF, 0); setvbuf(stderr, NULL , _IONBF, 0); } static int __console_parse_escsequence(char *pchr) { char chr; console_data_s *con; int i; int parameters[3]; int para; if(!curr_con) return -1; con = curr_con; /* set default value */ para = 0; parameters[0] = 0; parameters[1] = 0; parameters[2] = 0; /* scan parameters */ i = 0; chr = *pchr; while( (para < 3) && (chr >= '0') && (chr <= '9') ) { while( (chr >= '0') && (chr <= '9') ) { /* parse parameter */ parameters[para] *= 10; parameters[para] += chr - '0'; pchr++; i++; chr = *pchr; } para++; if( *pchr == ';' ) { /* skip parameter delimiter */ pchr++; i++; } chr = *pchr; } /* get final character */ chr = *pchr++; i++; switch(chr) { ///////////////////////////////////////// // Cursor directional movement ///////////////////////////////////////// case 'A': { curr_con->cursor_row -= parameters[0]; if(curr_con->cursor_row < 0) curr_con->cursor_row = 0; break; } case 'B': { curr_con->cursor_row += parameters[0]; if(curr_con->cursor_row >= curr_con->con_rows) curr_con->cursor_row = curr_con->con_rows - 1; break; } case 'C': { curr_con->cursor_col += parameters[0]; if(curr_con->cursor_col >= curr_con->con_cols) curr_con->cursor_col = curr_con->con_cols - 1; break; } case 'D': { curr_con->cursor_col -= parameters[0]; if(curr_con->cursor_col < 0) curr_con->cursor_col = 0; break; } ///////////////////////////////////////// // Cursor position movement ///////////////////////////////////////// case 'H': case 'f': { curr_con->cursor_col = parameters[1]; curr_con->cursor_row = parameters[0]; if(curr_con->cursor_row >= curr_con->con_rows) curr_con->cursor_row = curr_con->con_rows - 1; if(curr_con->cursor_col >= curr_con->con_cols) curr_con->cursor_col = curr_con->con_cols - 1; break; } ///////////////////////////////////////// // Screen clear ///////////////////////////////////////// case 'J': { /* different erase modes not yet supported, just clear all */ __console_clear(); break; } ///////////////////////////////////////// // Line clear ///////////////////////////////////////// case 'K': { break; } ///////////////////////////////////////// // Save cursor position ///////////////////////////////////////// case 's': { con->saved_col = con->cursor_col; con->saved_row = con->cursor_row; break; } ///////////////////////////////////////// // Load cursor position ///////////////////////////////////////// case 'u': con->cursor_col = con->saved_col; con->cursor_row = con->saved_row; break; ///////////////////////////////////////// // SGR Select Graphic Rendition ///////////////////////////////////////// case 'm': { // handle 30-37,39 for foreground color changes if( (parameters[0] >= 30) && (parameters[0] <= 39) ) { parameters[0] -= 30; //39 is the reset code if(parameters[0] == 9){ parameters[0] = 15; } else if(parameters[0] > 7){ parameters[0] = 7; } if(parameters[1] == 1) { // Intensity: Bold makes color bright parameters[0] += 8; } con->foreground = color_table[parameters[0]]; } // handle 40-47 for background color changes else if( (parameters[0] >= 40) && (parameters[0] <= 47) ) { parameters[0] -= 40; if(parameters[1] == 1) { // Intensity: Bold makes color bright parameters[0] += 8; } con->background = color_table[parameters[0]]; } break; } } return(i); } int __console_write(struct _reent *r,int fd,const char *ptr,size_t len) { int i = 0; char *tmp = (char*)ptr; console_data_s *con; //char chr; wchar_t chr; if(__gecko_status>=0) { if(__gecko_safe) usb_sendbuffer_safe(__gecko_status,ptr,len); else usb_sendbuffer(__gecko_status,ptr,len); } if(!curr_con) return -1; con = curr_con; if(!tmp || len<=0) return -1; i = 0; while(*tmp!='\0' && i<len) { int k = 1; chr = *tmp; if (chr >= 0x80) { // UTF-8 decode k = mbtowc(&chr, tmp, MIN(6,len-i)); // ignore utf8 parse errors if (k < 1) k = 1; // font only contains the first 512 chars /*if ((unsigned)chr >= 512) { int map_chr = map_ufont(chr); if (map_chr == 0 && (unsigned)chr <= 0xFFFF) { if (unifont && unifont->index[(unsigned)chr]) { // unifont containst almost all unicode chars map_chr = chr; // if len==2 and right border reached: wrap around int len = unifont->index[(unsigned)chr] & 0x0F; if (len > 1 && con->cursor_col + len > con->con_cols) { // insert fake space chr = ' '; goto just_print; } } } chr = map_chr; }*/ } tmp += k; i += k; if ( (chr == 0x1b) && (*tmp == '[') ) { /* escape sequence found */ int k; tmp++; i++; k = __console_parse_escsequence(tmp); tmp += k; i += k; } else { switch(chr) { case '\n': con->cursor_row++; con->cursor_col = 0; break; case '\r': con->cursor_col = 0; break; case '\b': con->cursor_col--; if(con->cursor_col < 0) { con->cursor_col = 0; } break; case '\f': con->cursor_row++; break; case '\t': if(con->cursor_col%TAB_SIZE) con->cursor_col += (con->cursor_col%TAB_SIZE); else con->cursor_col += TAB_SIZE; break; default: //just_print: __console_drawc(chr); con->cursor_col++; if( con->cursor_col >= con->con_cols) { /* if right border reached wrap around */ con->cursor_row++; con->cursor_col = 0; } } } if( con->cursor_row >= con->con_rows) { /* if bottom border reached scroll */ if (_tr_enable) { _bg_scroll(); } else { memcpy(con->destbuffer, con->destbuffer+con->con_stride*(FONT_YSIZE*FONT_YFACTOR+FONT_YGAP), con->con_stride*con->con_yres-FONT_YSIZE); unsigned int cnt = (con->con_stride * (FONT_YSIZE * FONT_YFACTOR + FONT_YGAP))/4; unsigned int *bptr = (unsigned int*)(con->destbuffer + con->con_stride * (con->con_yres - FONT_YSIZE)); unsigned int color = RGB8x2_TO_YCbYCr((u8 *)&(con->background), (u8 *)&(con->background)); while(cnt--) *bptr++ = color; } if (__console_scroll) { // flush on screen __console_flush(0); VIDEO_WaitVSync(); } con->cursor_row--; } } fb_change = 1; return i; } void CON_Init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride) { // note: this is called by the CODE DUMP handler _tr_enable = 0; __console_disable = 0; __console_init(framebuffer,xstart,ystart,xres,yres,stride); } /* void _con_free_bg_buf() { if(_bg_buffer) free(_bg_buffer); _bg_buffer = NULL; if(_c_buffer) free(_c_buffer); _c_buffer = NULL; } */ /* void _con_print_buf() { printf("\ncon_buf: %p\n", _console_buffer); printf("_bg_buf: %p\n", _bg_buffer); printf("_c_buf: %p\n", _c_buffer); } */ void _con_alloc_buf(s32 *conW, s32 *conH) { int w = 640; int h = 480; int size; if (conW && *conW > w) *conW = w; if (conH && *conH > h) *conH = h; if (_console_buffer) return; size = w * h * VI_DISPLAY_PIX_SZ; _c_buffer_size = sizeof(struct _c1) * (w / FONT_XSIZE) * (h / FONT_YSIZE); _console_buffer = LARGE_memalign(32, size); //_bg_buffer = LARGE_memalign(32, size); _c_buffer = LARGE_memalign(32, _c_buffer_size); } s32 CON_InitEx(GXRModeObj *rmode, s32 conXOrigin,s32 conYOrigin,s32 conWidth,s32 conHeight) { VIDEO_SetPostRetraceCallback(NULL); _con_alloc_buf(&conWidth, &conHeight); /* if(_console_buffer) free(_console_buffer); _console_buffer = malloc(conWidth*conHeight*VI_DISPLAY_PIX_SZ); if(!_console_buffer) return -1; _con_free_bg_buf(); */ _tr_enable = 0; __console_init_ex(_console_buffer,conXOrigin,conYOrigin,rmode->fbWidth*VI_DISPLAY_PIX_SZ,conWidth,conHeight,conWidth*VI_DISPLAY_PIX_SZ); return 0; } s32 CON_InitTr(GXRModeObj *rmode, s32 conXOrigin,s32 conYOrigin,s32 conWidth,s32 conHeight, s32 bgColor) { VIDEO_SetPostRetraceCallback(NULL); _con_alloc_buf(&conWidth, &conHeight); /* if(_console_buffer) free(_console_buffer); _console_buffer = malloc(conWidth*conHeight*VI_DISPLAY_PIX_SZ); if(!_console_buffer) return -1; _con_free_bg_buf(); _bg_buffer = malloc(conWidth*conHeight*VI_DISPLAY_PIX_SZ); if(!_bg_buffer) return -1; _c_buffer_size = sizeof(struct _c1) * (conWidth / FONT_XSIZE) * (conHeight/FONT_YSIZE); _c_buffer = malloc(_c_buffer_size); if(!_c_buffer) return -1; */ memset(_c_buffer, 0, _c_buffer_size); if (bgColor < 0 || bgColor > 15) bgColor = 0; _bg_color = color_table[bgColor]; _tr_enable = 1; __console_init_ex(_console_buffer,conXOrigin,conYOrigin,rmode->fbWidth*VI_DISPLAY_PIX_SZ,conWidth,conHeight,conWidth*VI_DISPLAY_PIX_SZ); return 0; } void CON_GetMetrics(int *cols, int *rows) { if(curr_con) { *cols = curr_con->con_cols; *rows = curr_con->con_rows; } } void CON_GetPosition(int *col, int *row) { if(curr_con) { *col = curr_con->cursor_col; *row = curr_con->cursor_row; } } void CON_EnableGecko(int channel,int safe) { if(channel && (channel>1 || !usb_isgeckoalive(channel))) channel = -1; __gecko_status = channel; __gecko_safe = safe; if(__gecko_status!=-1) { devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout; // line buffered output for threaded apps when only using the usbgecko if(!curr_con) { setvbuf(stdout, NULL, _IOLBF, 0); setvbuf(stderr, NULL, _IOLBF, 0); } } }
118-c-c-installer
trunk/source/console.c
C
gpl2
27,706
typedef struct { signed_blob *certs; signed_blob *ticket; signed_blob *tmd; signed_blob *crl; u32 certs_size; u32 ticket_size; u32 tmd_size; u32 crl_size; u8 **encrypted_buffer; u8 **decrypted_buffer; u32 *buffer_size; u32 content_count; } ATTRIBUTE_PACKED IOS; void decrypt_IOS(IOS *ios); s32 Init_IOS(IOS **ios); void free_IOS(IOS **ios); s32 set_content_count(IOS *ios, u32 count); s32 Install_patched_IOS(u32 iosnr, u32 iosrevision, bool es_trucha_patch, bool es_identify_patch, bool nand_patch, bool version_patch, u32 location, u32 newrevision, bool free); s32 Downgrade_IOS(u32 iosversion, u32 highrevision, u32 lowrevision, bool free); s32 install_unpatched_IOS(u32 iosversion, u32 revision, bool free); s32 checkTitle(u64 title); s32 checkIOS(u32 IOS); bool network_initialized;
118-c-c-installer
trunk/source/IOSPatcher.h
C
gpl2
836
// very simple heap allocation // todo (maybe): // - guard marks around blocks // - linked list // // by oggzee // note: // some regions of MEM2 get reset during IOS reload // MEM1 will be reset before game load #include <ogcsys.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <stdio.h> #include "mem.h" #include "util.h" // required for memcheck #include "console.h" static heap mem1; static heap mem2; static void *mem2_start = NULL; mem_blk* blk_find_size(blk_list *bl, int size) { int i; for (i=0; i < bl->num; i++) { if (size <= bl->list[i].size) { return &bl->list[i]; } } return NULL; } mem_blk* blk_find_ptr(blk_list *bl, void *ptr) { int i; for (i=0; i < bl->num; i++) { if (ptr == bl->list[i].ptr) { return &bl->list[i]; } } return NULL; } mem_blk* blk_find_ptr_end(blk_list *bl, void *ptr) { int i; for (i=0; i < bl->num; i++) { if (ptr == bl->list[i].ptr + bl->list[i].size) { return &bl->list[i]; } } return NULL; } // find first blk that is after ptr // (so that we can insert before it to keep blocks sorted) mem_blk* blk_find_ptr_after(blk_list *bl, void *ptr) { int i; for (i=0; i < bl->num; i++) { if (ptr > bl->list[i].ptr) { return &bl->list[i]; } } if (bl->num >= MAX_MEM_BLK) return NULL; return &bl->list[bl->num]; // return one after last } // inser before blk b mem_blk* blk_insert(blk_list *bl, mem_blk *b) { int i, n; if (!b) return NULL; if (bl->num >= MAX_MEM_BLK) { // list full // fatal error return NULL; } i = b - bl->list; // index of b in list if (i < 0 || i > bl->num) { // out of range // fatal error return NULL; } n = bl->num - i; // num of blks after b bl->num++; if (n) { // move blks from b up memmove(b+1, b, n*sizeof(mem_blk)); } // clear current one (now unused) memset(b, 0, sizeof(mem_blk)); return b; } void blk_remove(blk_list *bl, mem_blk *b) { int i, n; if (!b) { // fatal error return; } if (bl->num == 0) { // fatal error return; } i = b - bl->list; // index of b in list if (i < 0 || i >= bl->num) { // out of range // fatal error return; } bl->num--; n = bl->num - i; // num of blks after b if (n) { // move blks after b down memmove(b, b+1, n*sizeof(mem_blk)); // clear last one (now unused) memset(b+n, 0, sizeof(mem_blk)); } } mem_blk* blk_merge_add(blk_list *list, mem_blk *ab) { mem_blk *fb; // try to extend start of an existing free block fb = blk_find_ptr(list, ab->ptr + ab->size); if (fb) { fb->ptr -= ab->size; fb->size += ab->size; } else { // try to extend end of an existing free block fb = blk_find_ptr_end(list, ab->ptr); if (fb) { fb->size += ab->size; } else { // insert a new free block fb = blk_find_ptr_after(list, ab->ptr); if (!fb) { // fatal return NULL; } fb = blk_insert(list, fb); if (!fb) { // fatal return NULL; } *fb = *ab; } } return fb; } void *heap_alloc(heap *h, int size) { mem_blk *ab, *fb; // round up to 32bit (4byte) aligned size if (size == 0) size = 4; size = ((size+3) >> 2) << 2; if (h->used_list.num >= MAX_MEM_BLK - 1) return NULL; fb = blk_find_size(&h->free_list, size); if (!fb) return NULL; ab = &h->used_list.list[ h->used_list.num ]; h->used_list.num++; ab->ptr = fb->ptr; ab->size = size; fb->ptr += size; fb->size -= size; if (fb->size == 0) { blk_remove(&h->free_list, fb); } memset(ab->ptr, 0, size); return ab->ptr; } int heap_free(heap *h, void *ptr) { mem_blk *ab, *fb; if (!ptr) return 0; ab = blk_find_ptr(&h->used_list, ptr); if (!ab) return -1; // try to extend start of an existing free block fb = blk_merge_add(&h->free_list, ab); if (!fb) { // fatal return -1; } blk_remove(&h->used_list, ab); return 0; } void *heap_realloc(heap *h, void *ptr, int size) { mem_blk *ab, *fb, bb; void *new_ptr; int delta; // round up to 32bit (4byte) aligned size if (size == 0) size = 4; size = ((size+3) >> 2) << 2; // new allocation if (ptr == NULL) { return heap_alloc(h, size); } // find existing ab = blk_find_ptr(&h->used_list, ptr); if (!ab) { // fatal return NULL; } // size equal? - do nothing if (size == ab->size) { return ptr; } // size larger? if (size > ab->size) { delta = size - ab->size; // find a free block at the end fb = blk_find_ptr(&h->free_list, ptr + ab->size); if (fb && fb->size >= delta ) { // extend memset(fb->ptr, 0, delta); fb->ptr += delta; fb->size -= delta; ab->size = size; if (fb->size == 0) { blk_remove(&h->free_list, fb); } return ptr; } // can't extend new_ptr = heap_alloc(h, size); if (!new_ptr) { return NULL; } memcpy(new_ptr, ptr, ab->size); memset(new_ptr + ab->size, 0, delta); heap_free(h, ptr); return new_ptr; } // size smaller // insert or merge a free block bb.ptr = ab->ptr + size; bb.size = ab->size - size; fb = blk_merge_add(&h->free_list, &bb); if (!fb) { // fatal return NULL; } ab->size = size; return ptr; } void heap_init(heap *h, void *ptr, int size) { int d; // init memset(h, 0, sizeof(heap)); h->start = ptr; h->size = size; // round to 4 bytes d = ((((unsigned)ptr + 3) >> 2) << 2) - (unsigned)ptr; ptr += d; size -= d; size = (size >> 2) << 2; h->free_list.num = 1; h->free_list.list[0].ptr = ptr; h->free_list.list[0].size = size; } int heap_ptr_inside(heap *h, void *ptr) { return (ptr >= h->start && ptr < h->start + h->size); } void heap_stat(heap *h, heap_stats *s) { int i; void *ptr; memset(s, 0, sizeof(heap_stats)); s->highptr = h->start; for (i=0; i<h->used_list.num; i++) { s->used += h->used_list.list[i].size; ptr = h->used_list.list[i].ptr + h->used_list.list[i].size; if (ptr > s->highptr) s->highptr = ptr; } for (i=0; i<h->free_list.num; i++) { s->free += h->free_list.list[i].size; } s->size = s->used + s->free; } void mem_init() { void *m1_start = (void*)0x80004000; void *m1_end = (void*)0x80a00000; void *m2_start; int m2_size; m2_size = SYS_GetArena2Hi() - SYS_GetArena2Lo(); // leave 512k of mem2 (sys_arena2) free // 211k will be used by wpad, 300k remains just in case... m2_size = (m2_size >> 2 << 2) - 512*1024; m2_start = SYS_AllocArena2MemLo(m2_size, 32); heap_init(&mem1, m1_start, m1_end - m1_start); heap_init(&mem2, m2_start, m2_size); } void *mem1_alloc(int size) { return heap_alloc(&mem1, size); } void *mem2_alloc(int size) { return heap_alloc(&mem2, size); } void *mem_alloc(int size) { void *ptr; // round up to 32bit (4byte) aligned size if (size == 0) size = 4; size = ((size+3) >> 2) << 2; // mem2 ptr = mem2_alloc(size); if (ptr) return ptr; // mem1 ptr = mem1_alloc(size); if (ptr) return ptr; // sys ptr = memalign(32, size); memset(ptr, 0, size); return ptr; } // defaults to MEM2 void *mem_realloc(void *ptr, int size) { // round up to 32bit (4byte) aligned size if (size == 0) size = 4; size = ((size+3) >> 2) << 2; // first time if (ptr == NULL) { return mem_alloc(size); } // mem2 if (heap_ptr_inside(&mem2, ptr)) { return heap_realloc(&mem2, ptr, size); } // mem1 if (heap_ptr_inside(&mem1, ptr)) { return heap_realloc(&mem1, ptr, size); } // sys // note, this one doesn't clean up newly allocated // part of mem while the above do return realloc(ptr, size); } // defaults to MEM1 void *mem1_realloc(void *ptr, int size) { if (ptr) return mem_realloc(ptr, size); return heap_alloc(&mem1, size); } void mem_free(void *ptr) { if (ptr == NULL) return; // mem2 if (heap_ptr_inside(&mem2, ptr)) { heap_free(&mem2, ptr); return; } // mem1 if (heap_ptr_inside(&mem1, ptr)) { heap_free(&mem1, ptr); return; } // sys free(ptr); } #if 0 struct mallinfo { int arena; /* total space allocated from system */ int ordblks; /* number of non-inuse chunks */ int smblks; /* unused -- always zero */ int hblks; /* number of mmapped regions */ int hblkhd; /* total space in mmapped regions */ int usmblks; /* unused -- always zero */ int fsmblks; /* unused -- always zero */ int uordblks; /* total allocated space */ int fordblks; /* total non-inuse space */ int keepcost; /* top-most, releasable (via malloc_trim) space */ }; #endif void print_mallinfo() { struct mallinfo m = mallinfo(); #define PM(X) printf("%8s : %d\n", #X, m.X) PM(arena); PM(ordblks); PM(smblks); PM(hblks); PM(hblkhd); PM(usmblks); PM(fsmblks); PM(uordblks); PM(fordblks); PM(keepcost); #undef PM } void mem_stat_str(char * buffer) { heap_stats hs1, hs2; heap_stat(&mem1, &hs1); heap_stat(&mem2, &hs2); *buffer = 0; #define fMB (1024.0 * 1024.0) sprintf(buffer, "%smem1: s:%5.2f u:%5.2f f:%5.2f t:%d,%d\n", buffer, hs1.size / fMB, hs1.used / fMB, hs1.free / fMB, mem1.used_list.num, mem1.free_list.num); sprintf(buffer, "%smem2: s:%5.2f u:%5.2f f:%5.2f t:%d,%d\n", buffer, hs2.size / fMB, hs2.used / fMB, hs2.free / fMB, mem2.used_list.num, mem2.free_list.num); sprintf(buffer, "%sm1+2: s:%5.2f u:%5.2f f:%5.2f\n", buffer, (hs1.size+hs2.size) / fMB, (hs1.used+hs2.used) / fMB, (hs1.free+hs2.free) / fMB); void *p; int size; struct mallinfo m = mallinfo(); for (size = 10*1024*1024; size > 0; size -= 16*1024) { p = memalign(32, size); if (p) { m = mallinfo(); free(p); break; } } sprintf(buffer, "%ssys1: s:%5.2f u:%5.2f f:%5.2f mx:%.2f\n", buffer, m.arena / fMB, (m.uordblks-size) / fMB, (m.fordblks+size) / fMB, size / fMB); sprintf(buffer, "%stotl: s:%5.2f u:%5.2f f:%5.2f\n", buffer, (hs1.size+hs2.size + m.arena) / fMB, (hs1.used+hs2.used + m.uordblks-size) / fMB, (hs1.free+hs2.free + m.fordblks+size) / fMB); //printf("max malloc: %.2f\n", (float)size/1024/1024); } void mem_stat() { char buffer[1000]; mem_stat_str(buffer); printf("\n%s", buffer); /* printf("\n"); printf("slot1: t:%d u:%d f:%d\n", MAX_MEM_BLK, mem1.used_list.num, mem1.free_list.num); printf("slot2: t:%d u:%d f:%d\n", MAX_MEM_BLK, mem2.used_list.num, mem2.free_list.num); printf("adr1: %p-%p h:%p\n", mem1.start, mem1.start+mem1.size, hs1.highptr); printf("adr2: %p-%p h:%p\n", mem2.start, mem2.start+mem2.size, hs2.highptr); memstat2(); */ } // moved from util.c: void* LARGE_memalign(size_t align, size_t size) { return mem_alloc(size); } void* LARGE_alloc(size_t size) { return mem_alloc(size); } void* LARGE_realloc(void *ptr, size_t size) { return mem_realloc(ptr, size); } void LARGE_free(void *ptr) { return mem_free(ptr); } /* size_t LARGE_used() { size_t size = SYS_GetArena2Lo() - (void*)0x90000000; return size; } */ void memstat2() { void *m2base = (void*)0x90000000; void *m2lo = SYS_GetArena2Lo(); void *m2hi = SYS_GetArena2Hi(); void *ipclo = __SYS_GetIPCBufferLo(); void *ipchi = __SYS_GetIPCBufferHi(); size_t isize = ipchi - ipclo; printf("\n"); printf("MEM2: %p %p %p\n", m2base, m2lo, m2hi); printf("s:%d u:%d f:%d\n", m2hi - m2base, m2lo - m2base, m2hi - m2lo); printf("s:%.2f MB u:%.2f MB f:%.2f MB\n", (float)(m2hi - m2base)/1024/1024, (float)(m2lo - m2base)/1024/1024, (float)(m2hi - m2lo)/1024/1024); printf("IPC: %p %p %d\n", ipclo, ipchi, isize); } // save M2 ptr void util_init() { void _con_alloc_buf(s32 *conW, s32 *conH); _con_alloc_buf(NULL, NULL); //mem2_start = SYS_GetArena2Lo(); heap_stats hs; heap_stat(&mem2, &hs); mem2_start = hs.highptr; } void util_clear() { // game start: 0x80004000 // game end: 0x80a00000 approx void *game_start = (void*)0x80004000; void *game_end = (void*)0x80a00000; u32 size; // unload unifont console_set_unifont(NULL, 0); // clear mem1 main size = game_end - game_start; //printf("Clear %p [%x]\n", game_start, size); __console_flush(0); memset(game_start, 0, size); DCFlushRange(game_start, size); // clear mem2 if (mem2_start == NULL) return; size = SYS_GetArena2Lo() - mem2_start; //printf("Clear %p [%x]\n", mem2_start, size); __console_flush(0); sleep(2); memset(mem2_start, 0, size); DCFlushRange(mem2_start, size); // clear mem1 heap // find appropriate size void *p; for (size = 10*1024*1024; size > 0; size -= 128*1024) { p = memalign(32, size); if (p) { //printf("Clear %p [%x] %p\n", p, size, p+size); //__console_flush(0); sleep(2); memset(p, 0, size); DCFlushRange(p, size); free(p); break; } } }
118-c-c-installer
trunk/source/mem.c
C
gpl2
12,934
/* SHA-1 in C By Steve Reid <steve@edmweb.com> 100% Public Domain Test Vectors (from FIPS PUB 180-1) "abc" A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 A million repetitions of "a" 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F */ /* #define LITTLE_ENDIAN * This should be #define'd if true. */ #define SHA1HANDSOFF #include <stdio.h> #include <string.h> #include "sha1.h" #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) /* blk0() and blk() perform the initial expand. */ /* I got the idea of expanding during the round function from SSLeay */ #ifdef LITTLE_ENDIAN #define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ |(rol(block->l[i],8)&0x00FF00FF)) #else #define blk0(i) block->l[i] #endif #define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ ^block->l[(i+2)&15]^block->l[i&15],1)) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ #define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); #define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); #define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); /* Hash a single 512-bit block. This is the core of the algorithm. */ void SHA1Transform(unsigned long state[5], unsigned char buffer[64]) { unsigned long a, b, c, d, e; typedef union { unsigned char c[64]; unsigned long l[16]; } CHAR64LONG16; CHAR64LONG16* block; #ifdef SHA1HANDSOFF static unsigned char workspace[64]; block = (CHAR64LONG16*)workspace; memcpy(block, buffer, 64); #else block = (CHAR64LONG16*)buffer; #endif /* Copy context->state[] to working vars */ a = state[0]; b = state[1]; c = state[2]; d = state[3]; e = state[4]; /* 4 rounds of 20 operations each. Loop unrolled. */ R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); /* Add the working vars back into context.state[] */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; state[4] += e; /* Wipe variables */ a = b = c = d = e = 0; } /* SHA1Init - Initialize new context */ void SHA1Init(SHA1_CTX* context) { /* SHA1 initialization constants */ context->state[0] = 0x67452301; context->state[1] = 0xEFCDAB89; context->state[2] = 0x98BADCFE; context->state[3] = 0x10325476; context->state[4] = 0xC3D2E1F0; context->count[0] = context->count[1] = 0; } /* Run your data through this. */ void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len) { unsigned int i, j; j = (context->count[0] >> 3) & 63; if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++; context->count[1] += (len >> 29); if ((j + len) > 63) { memcpy(&context->buffer[j], data, (i = 64-j)); SHA1Transform(context->state, context->buffer); for ( ; i + 63 < len; i += 64) { SHA1Transform(context->state, &data[i]); } j = 0; } else i = 0; memcpy(&context->buffer[j], &data[i], len - i); } /* Add padding and return the message digest. */ void SHA1Final(unsigned char digest[20], SHA1_CTX* context) { unsigned long i, j; unsigned char finalcount[8]; for (i = 0; i < 8; i++) { finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ } SHA1Update(context, (unsigned char *)"\200", 1); while ((context->count[0] & 504) != 448) { SHA1Update(context, (unsigned char *)"\0", 1); } SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ for (i = 0; i < 20; i++) { digest[i] = (unsigned char) ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); } /* Wipe variables */ i = j = 0; memset(context->buffer, 0, 64); memset(context->state, 0, 20); memset(context->count, 0, 8); memset(&finalcount, 0, 8); #ifdef SHA1HANDSOFF /* make SHA1Transform overwrite it's own static vars */ SHA1Transform(context->state, context->buffer); #endif } void SHA1(unsigned char *ptr, unsigned int size, unsigned char *outbuf) { SHA1_CTX ctx; SHA1Init(&ctx); SHA1Update(&ctx, ptr, size); SHA1Final(outbuf, &ctx); }
118-c-c-installer
trunk/source/sha1.c
C
gpl2
5,975
#include <gccore.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <malloc.h> #include <network.h> #include "IOSPatcher.h" #include "rijndael.h" #include "sha1.h" #include "tools.h" #include "http.h" #include "../build/cert_sys.h" #define round_up(x,n) (-(-(x) & -(n))) #define TITLE_UPPER(x) ( (u32)((x) >> 32) ) #define TITLE_LOWER(x) ((u32)(x)) u8 commonkey[16] = { 0xeb, 0xe4, 0x2a, 0x22, 0x5e, 0x85, 0x93, 0xe4, 0x48, 0xd9, 0xc5, 0x45, 0x73, 0x81, 0xaa, 0xf7 }; s32 Wad_Read_into_memory(char *filename, IOS **ios, u32 iosnr, u32 revision); void get_title_key(signed_blob *s_tik, u8 *key) { static u8 iv[16] ATTRIBUTE_ALIGN(0x20); static u8 keyin[16] ATTRIBUTE_ALIGN(0x20); static u8 keyout[16] ATTRIBUTE_ALIGN(0x20); const tik *p_tik; p_tik = (tik*)SIGNATURE_PAYLOAD(s_tik); u8 *enc_key = (u8 *)&p_tik->cipher_title_key; memcpy(keyin, enc_key, sizeof keyin); memset(keyout, 0, sizeof keyout); memset(iv, 0, sizeof iv); memcpy(iv, &p_tik->titleid, sizeof p_tik->titleid); aes_set_key(commonkey); aes_decrypt(iv, keyin, keyout, sizeof keyin); memcpy(key, keyout, sizeof keyout); } void change_ticket_title_id(signed_blob *s_tik, u32 titleid1, u32 titleid2) { static u8 iv[16] ATTRIBUTE_ALIGN(0x20); static u8 keyin[16] ATTRIBUTE_ALIGN(0x20); static u8 keyout[16] ATTRIBUTE_ALIGN(0x20); tik *p_tik; p_tik = (tik*)SIGNATURE_PAYLOAD(s_tik); u8 *enc_key = (u8 *)&p_tik->cipher_title_key; memcpy(keyin, enc_key, sizeof keyin); memset(keyout, 0, sizeof keyout); memset(iv, 0, sizeof iv); memcpy(iv, &p_tik->titleid, sizeof p_tik->titleid); aes_set_key(commonkey); aes_decrypt(iv, keyin, keyout, sizeof keyin); p_tik->titleid = (u64)titleid1 << 32 | (u64)titleid2; memset(iv, 0, sizeof iv); memcpy(iv, &p_tik->titleid, sizeof p_tik->titleid); aes_encrypt(iv, keyout, keyin, sizeof keyout); memcpy(enc_key, keyin, sizeof keyin); } void change_tmd_title_id(signed_blob *s_tmd, u32 titleid1, u32 titleid2) { tmd *p_tmd; u64 title_id = titleid1; title_id <<= 32; title_id |= titleid2; p_tmd = (tmd*)SIGNATURE_PAYLOAD(s_tmd); p_tmd->title_id = title_id; } void zero_sig(signed_blob *sig) { u8 *sig_ptr = (u8 *)sig; memset(sig_ptr + 4, 0, SIGNATURE_SIZE(sig)-4); } s32 brute_tmd(tmd *p_tmd) { u16 fill; for(fill=0; fill<65535; fill++) { p_tmd->fill3=fill; sha1 hash; SHA1((u8 *)p_tmd, TMD_SIZE(p_tmd), hash);; if (hash[0]==0) { return 0; } } return -1; } s32 brute_tik(tik *p_tik) { u16 fill; for(fill=0; fill<65535; fill++) { p_tik->padding=fill; sha1 hash; SHA1((u8 *)p_tik, sizeof(tik), hash); if (hash[0]==0) { return 0; } } return -1; } void forge_tmd(signed_blob *s_tmd) { zero_sig(s_tmd); brute_tmd(SIGNATURE_PAYLOAD(s_tmd)); } void forge_tik(signed_blob *s_tik) { zero_sig(s_tik); brute_tik(SIGNATURE_PAYLOAD(s_tik)); } int patch_version_check(u8 *buf, u32 size) { u32 match_count = 0; u8 version_check[] = { 0xD2, 0x01, 0x4E, 0x56 }; u32 i; for(i = 0; i < size - 4; i++) { if(!memcmp(buf + i, version_check, sizeof version_check)) { buf[i] = 0xE0; buf[i+3] = 0; i += 4; match_count++; continue; } } return match_count; } int patch_hash_check(u8 *buf, u32 size) { u32 i; u32 match_count = 0; u8 new_hash_check[] = {0x20,0x07,0x4B,0x0B}; u8 old_hash_check[] = {0x20,0x07,0x23,0xA2}; for (i=0; i<size-4; i++) { if (!memcmp(buf + i, new_hash_check, sizeof new_hash_check)) { buf[i+1] = 0; i += 4; match_count++; continue; } if (!memcmp(buf + i, old_hash_check, sizeof old_hash_check)) { buf[i+1] = 0; i += 4; match_count++; continue; } } return match_count; } int patch_identify_check(u8 *buf, u32 size) { u32 match_count = 0; u8 identify_check[] = { 0x28, 0x03, 0xD1, 0x23 }; u32 i; for(i = 0; i < size - 4; i++) { if(!memcmp(buf + i, identify_check, sizeof identify_check)) { buf[i+2] = 0; buf[i+3] = 0; i += 4; match_count++; continue; } } return match_count; } int patch_patch_fsperms(u8 *buf, u32 size) { u32 i; u32 match_count = 0; u8 old_table[] = {0x42, 0x8B, 0xD0, 0x01, 0x25, 0x66}; u8 new_table[] = {0x42, 0x8B, 0xE0, 0x01, 0x25, 0x66}; for (i=0; i<size-sizeof old_table; i++) { if (!memcmp(buf + i, old_table, sizeof old_table)) { memcpy(buf + i, new_table, sizeof new_table); i += sizeof new_table; match_count++; continue; } } return match_count; } void display_tag(u8 *buf) { printf("Firmware version: %s Builder: %s\n", buf, buf+0x30); } void display_ios_tags(u8 *buf, u32 size) { u32 i; char *ios_version_tag = "$IOSVersion:"; if (size == 64) { display_tag(buf); return; } for (i=0; i<(size-64); i++) { if (!strncmp((char *)buf+i, ios_version_tag, 10)) { char version_buf[128], *date; while (buf[i+strlen(ios_version_tag)] == ' ') i++; // skip spaces strlcpy(version_buf, (char *)buf + i + strlen(ios_version_tag), sizeof version_buf); date = version_buf; strsep(&date, "$"); date = version_buf; strsep(&date, ":"); printf("%s (%s)\n", version_buf, date); i += 64; } } } bool contains_module(u8 *buf, u32 size, char *module) { u32 i; char *ios_version_tag = "$IOSVersion:"; for (i=0; i<(size-64); i++) { if (!strncmp((char *)buf+i, ios_version_tag, 10)) { char version_buf[128]; while (buf[i+strlen(ios_version_tag)] == ' ') i++; // skip spaces strlcpy(version_buf, (char *)buf + i + strlen(ios_version_tag), sizeof version_buf); i += 64; if (strncmp(version_buf, module, strlen(module)) == 0) { return true; } } } return false; } s32 module_index(IOS *ios, char *module) { int i; for (i = 0; i < ios->content_count; i++) { if (!ios->decrypted_buffer[i] || !ios->buffer_size[i]) { return -1; } if (contains_module(ios->decrypted_buffer[i], ios->buffer_size[i], module)) { return i; } } return -1; } void decrypt_buffer(u16 index, u8 *source, u8 *dest, u32 len) { static u8 iv[16]; memset(iv, 0, 16); memcpy(iv, &index, 2); aes_decrypt(iv, source, dest, len); } void encrypt_buffer(u16 index, u8 *source, u8 *dest, u32 len) { static u8 iv[16]; memset(iv, 0, 16); memcpy(iv, &index, 2); aes_encrypt(iv, source, dest, len); } void decrypt_IOS(IOS *ios) { u8 key[16]; get_title_key(ios->ticket, key); aes_set_key(key); int i; for (i = 0; i < ios->content_count; i++) { decrypt_buffer(i, ios->encrypted_buffer[i], ios->decrypted_buffer[i], ios->buffer_size[i]); } } void encrypt_IOS(IOS *ios) { u8 key[16]; get_title_key(ios->ticket, key); aes_set_key(key); int i; for (i = 0; i < ios->content_count; i++) { encrypt_buffer(i, ios->decrypted_buffer[i], ios->encrypted_buffer[i], ios->buffer_size[i]); } } void display_tags(IOS *ios) { int i; for (i = 0; i < ios->content_count; i++) { printf("Content %2u: ", i); display_ios_tags(ios->decrypted_buffer[i], ios->buffer_size[i]); } } s32 Init_IOS(IOS **ios) { if (ios == NULL) return -1; *ios = memalign(32, sizeof(IOS)); if (*ios == NULL) return -1; (*ios)->content_count = 0; (*ios)->certs = NULL; (*ios)->certs_size = 0; (*ios)->ticket = NULL; (*ios)->ticket_size = 0; (*ios)->tmd = NULL; (*ios)->tmd_size = 0; (*ios)->crl = NULL; (*ios)->crl_size = 0; (*ios)->encrypted_buffer = NULL; (*ios)->decrypted_buffer = NULL; (*ios)->buffer_size = NULL; return 0; } void free_IOS(IOS **ios) { if (ios && *ios) { if ((*ios)->certs) free((*ios)->certs); if ((*ios)->ticket) free((*ios)->ticket); if ((*ios)->tmd) free((*ios)->tmd); if ((*ios)->crl) free((*ios)->crl); int i; for (i = 0; i < (*ios)->content_count; i++) { if ((*ios)->encrypted_buffer && (*ios)->encrypted_buffer[i]) free((*ios)->encrypted_buffer[i]); if ((*ios)->decrypted_buffer && (*ios)->decrypted_buffer[i]) free((*ios)->decrypted_buffer[i]); } if ((*ios)->encrypted_buffer) free((*ios)->encrypted_buffer); if ((*ios)->decrypted_buffer) free((*ios)->decrypted_buffer); if ((*ios)->buffer_size) free((*ios)->buffer_size); free(*ios); } } s32 set_content_count(IOS *ios, u32 count) { int i; if (ios->content_count > 0) { for (i = 0; i < ios->content_count; i++) { if (ios->encrypted_buffer && ios->encrypted_buffer[i]) free(ios->encrypted_buffer[i]); if (ios->decrypted_buffer && ios->decrypted_buffer[i]) free(ios->decrypted_buffer[i]); } if (ios->encrypted_buffer) free(ios->encrypted_buffer); if (ios->decrypted_buffer) free(ios->decrypted_buffer); if (ios->buffer_size) free(ios->buffer_size); } ios->content_count = count; if (count > 0) { ios->encrypted_buffer = memalign(32, 4*count); ios->decrypted_buffer = memalign(32, 4*count); ios->buffer_size = memalign(32, 4*count); for (i = 0; i < count; i++) { if (ios->encrypted_buffer) ios->encrypted_buffer[i] = NULL; if (ios->decrypted_buffer) ios->decrypted_buffer[i] = NULL; } if (!ios->encrypted_buffer || !ios->decrypted_buffer || !ios->buffer_size) { return -1; } } return 0; } s32 install_IOS(IOS *ios, bool skipticket) { int ret; int cfd; if (!skipticket) { ret = ES_AddTicket(ios->ticket, ios->ticket_size, ios->certs, ios->certs_size, ios->crl, ios->crl_size); if (ret < 0) { printf("ES_AddTicket returned: %d\n", ret); ES_AddTitleCancel(); return ret; } } printf("."); ret = ES_AddTitleStart(ios->tmd, ios->tmd_size, ios->certs, ios->certs_size, ios->crl, ios->crl_size); if (ret < 0) { printf("\nES_AddTitleStart returned: %d\n", ret); ES_AddTitleCancel(); return ret; } printf("."); tmd *tmd_data = (tmd *)SIGNATURE_PAYLOAD(ios->tmd); int i; for (i = 0; i < ios->content_count; i++) { tmd_content *content = &tmd_data->contents[i]; cfd = ES_AddContentStart(tmd_data->title_id, content->cid); if (cfd < 0) { printf("\nES_AddContentStart for content #%u cid %u returned: %d\n", i, content->cid, cfd); ES_AddTitleCancel(); return cfd; } ret = ES_AddContentData(cfd, ios->encrypted_buffer[i], ios->buffer_size[i]); if (ret < 0) { printf("\nES_AddContentData for content #%u cid %u returned: %d\n", i, content->cid, ret); ES_AddTitleCancel(); return ret; } ret = ES_AddContentFinish(cfd); if (ret < 0) { printf("\nES_AddContentFinish for content #%u cid %u returned: %d\n", i, content->cid, ret); ES_AddTitleCancel(); return ret; } printf("."); } ret = ES_AddTitleFinish(); if (ret < 0) { printf("\nES_AddTitleFinish returned: %d\n", ret); ES_AddTitleCancel(); return ret; } printf(".\n"); return 0; } int get_nus_object(u32 titleid1, u32 titleid2, char *content, u8 **outbuf, u32 *outlen) { static char buf[128]; int retval; u32 http_status; snprintf(buf, 128, "http://nus.cdn.shop.wii.com/ccs/download/%08x%08x/%s", titleid1, titleid2, content); retval = http_request(buf, 1 << 31); if (!retval) { printf("Error making http request\n"); return -1; } retval = http_get_result(&http_status, outbuf, outlen); if (((int)*outbuf & 0xF0000000) == 0xF0000000) { return (int) *outbuf; } return 0; } s32 GetCerts(signed_blob** Certs, u32* Length) { if (cert_sys_size != 2560) { return -1; } *Certs = memalign(32, 2560); if (*Certs == NULL) { printf("Out of memory\n"); return -1; } memcpy(*Certs, cert_sys, cert_sys_size); *Length = 2560; return 0; } bool network_initialized = false; s32 Download_IOS(IOS **ios, u32 iosnr, u32 revision) { s32 ret; ret = Init_IOS(ios); if (ret < 0) { printf("Out of memory\n"); goto err; } tmd *tmd_data = NULL; u32 cnt; //static bool network_initialized = false; char buf[32]; if (!network_initialized) { printf("Initializing network..."); while (1) { ret = net_init (); if (ret < 0) { //if (ret != -EAGAIN) if (ret != -11) { printf ("net_init failed: %d\n", ret); goto err; } } if (!ret) break; usleep(100000); printf("."); } printf("done\n"); network_initialized = true; } printf("Loading certs...\n"); ret = GetCerts(&((*ios)->certs), &((*ios)->certs_size)); if (ret < 0) { printf ("Loading certs from nand failed, ret = %d\n", ret); goto err; } if ((*ios)->certs == NULL || (*ios)->certs_size == 0) { printf("certs error\n"); ret = -1; goto err; } if (!IS_VALID_SIGNATURE((*ios)->certs)) { printf("Error: Bad certs signature!\n"); ret = -1; goto err; } printf("Loading TMD...\n"); sprintf(buf, "tmd.%u", revision); u8 *tmd_buffer = NULL; ret = get_nus_object(1, iosnr, buf, &tmd_buffer, &((*ios)->tmd_size)); if (ret < 0) { printf("Loading tmd failed, ret = %u\n", ret); goto err; } if (tmd_buffer == NULL || (*ios)->tmd_size == 0) { printf("TMD error\n"); ret = -1; goto err; } (*ios)->tmd_size = SIGNED_TMD_SIZE((signed_blob *)tmd_buffer); (*ios)->tmd = memalign(32, (*ios)->tmd_size); if ((*ios)->tmd == NULL) { printf("Out of memory\n"); ret = -1; goto err; } memcpy((*ios)->tmd, tmd_buffer, (*ios)->tmd_size); free(tmd_buffer); if (!IS_VALID_SIGNATURE((*ios)->tmd)) { printf("Error: Bad TMD signature!\n"); ret = -1; goto err; } printf("Loading ticket...\n"); u8 *ticket_buffer = NULL; ret = get_nus_object(1, iosnr, "cetk", &ticket_buffer, &((*ios)->ticket_size)); if (ret < 0) { printf("Loading ticket failed, ret = %u\n", ret); goto err; } if (ticket_buffer == NULL || (*ios)->ticket_size == 0) { printf("ticket error\n"); ret = -1; goto err; } (*ios)->ticket_size = SIGNED_TIK_SIZE((signed_blob *)ticket_buffer); (*ios)->ticket = memalign(32, (*ios)->ticket_size); if ((*ios)->ticket == NULL) { printf("Out of memory\n"); ret = -1; goto err; } memcpy((*ios)->ticket, ticket_buffer, (*ios)->ticket_size); free(ticket_buffer); if(!IS_VALID_SIGNATURE((*ios)->ticket)) { printf("Error: Bad ticket signature!\n"); ret = -1; goto err; } /* Get TMD info */ tmd_data = (tmd *)SIGNATURE_PAYLOAD((*ios)->tmd); printf("Checking titleid and revision...\n"); if (TITLE_UPPER(tmd_data->title_id) != 1 || TITLE_LOWER(tmd_data->title_id) != iosnr) { printf("IOS has titleid: %08x%08x but expected was: %08x%08x\n", TITLE_UPPER(tmd_data->title_id), TITLE_LOWER(tmd_data->title_id), 1, iosnr); ret = -1; goto err; } if (tmd_data->title_version != revision) { printf("IOS has revision: %u but expected was: %u\n", tmd_data->title_version, revision); ret = -1; goto err; } ret = set_content_count(*ios, tmd_data->num_contents); if (ret < 0) { printf("Out of memory\n"); goto err; } printf("Loading contents"); for (cnt = 0; cnt < tmd_data->num_contents; cnt++) { printf("."); tmd_content *content = &tmd_data->contents[cnt]; /* Encrypted content size */ (*ios)->buffer_size[cnt] = round_up((u32)content->size, 64); sprintf(buf, "%08x", content->cid); ret = get_nus_object(1, iosnr, buf, &((*ios)->encrypted_buffer[cnt]), &((*ios)->buffer_size[cnt])); if ((*ios)->buffer_size[cnt] % 16) { printf("Content %u size is not a multiple of 16\n", cnt); ret = -1; goto err; } if ((*ios)->buffer_size[cnt] < (u32)content->size) { printf("Content %u size is too small\n", cnt); ret = -1; goto err; } (*ios)->decrypted_buffer[cnt] = memalign(32, (*ios)->buffer_size[cnt]); if (!(*ios)->decrypted_buffer[cnt]) { printf("Out of memory\n"); ret = -1; goto err; } } printf("done\n"); printf("Reading file into memory complete.\n"); printf("Decrypting IOS...\n"); decrypt_IOS(*ios); tmd_content *p_cr = TMD_CONTENTS(tmd_data); sha1 hash; int i; printf("Checking hashes...\n"); for (i=0;i < (*ios)->content_count;i++) { SHA1((*ios)->decrypted_buffer[i], (u32)p_cr[i].size, hash); if (memcmp(p_cr[i].hash, hash, sizeof hash) != 0) { printf("Wrong hash for content #%u\n", i); ret = -1; goto err; } } goto out; err: free_IOS(ios); out: return ret; } s32 get_IOS(IOS **ios, u32 iosnr, u32 revision) { char buf[64]; u32 pressed; u32 pressedGC; int selection = 0; int ret; char *optionsstring[4] = { "<Load IOS from sd card>", "<Load IOS from usb storage>", "<Download IOS from NUS>", "<Exit>" }; while (true) { Con_ClearLine(); set_highlight(true); printf(optionsstring[selection]); set_highlight(false); waitforbuttonpress(&pressed, &pressedGC); if (pressed == WPAD_BUTTON_LEFT || pressedGC == PAD_BUTTON_LEFT) { if (selection > 0) { selection--; } else { selection = 3; } } if (pressed == WPAD_BUTTON_RIGHT || pressedGC == PAD_BUTTON_RIGHT) { if (selection < 3) { selection++; } else { selection = 0; } } if (pressed == WPAD_BUTTON_A || pressedGC == PAD_BUTTON_A) { printf("\n"); if (selection == 0) { ret = Init_SD(); if (ret < 0) { return ret; } sprintf(buf, "sd:/IOS%u-64-v%u.wad", iosnr, revision); ret = Wad_Read_into_memory(buf, ios, iosnr, revision); if (ret < 0) { sprintf(buf, "sd:/IOS%u-64-v%u.wad.out.wad", iosnr, revision); ret = Wad_Read_into_memory(buf, ios, iosnr, revision); } return ret; } if (selection == 1) { ret = Init_USB(); if (ret < 0) { return ret; } sprintf(buf, "usb:/IOS%u-64-v%u.wad", iosnr, revision); ret = Wad_Read_into_memory(buf, ios, iosnr, revision); if (ret < 0) { sprintf(buf, "usb:/IOS%u-64-v%u.wad.out.wad", iosnr, revision); ret = Wad_Read_into_memory(buf, ios, iosnr, revision); } return ret; } if (selection == 2) { ret = Download_IOS(ios, iosnr, revision); return ret; } if (selection == 3) { return -1; } } } } s32 install_unpatched_IOS(u32 iosversion, u32 revision, bool free) { int ret; IOS *ios; printf("Getting IOS%u revision %u...\n", iosversion, revision); ret = get_IOS(&ios, iosversion, revision); if (ret < 0) { printf("Error reading IOS into memory\n"); return ret; } printf("\n"); printf("Press A to start installation...\n"); u32 pressed; u32 pressedGC; waitforbuttonpress(&pressed, &pressedGC); if (pressed != WPAD_BUTTON_A && pressedGC != PAD_BUTTON_A) { printf("Other button pressed\n"); free_IOS(&ios); return -1; } printf("Installing IOS%u Rev %u...\n", iosversion, revision); ret = install_IOS(ios, false); if (ret < 0) { printf("Error: Could not install IOS%u Rev %u\n", iosversion, revision); free_IOS(&ios); return ret; } printf("done\n"); if (free) free_IOS(&ios); return 0; } s32 Install_patched_IOS(u32 iosnr, u32 iosrevision, bool es_trucha_patch, bool es_identify_patch, bool nand_patch, bool version_patch, u32 location, u32 newrevision, bool free) { int ret; if (iosnr == location && iosrevision == newrevision && !es_trucha_patch && !es_identify_patch && !nand_patch) { ret = install_unpatched_IOS(iosnr, iosrevision, free); return ret; } IOS *ios; int index; bool tmd_dirty = false; bool tik_dirty = false; printf("Getting IOS%u revision %u...\n", iosnr, iosrevision); ret = get_IOS(&ios, iosnr, iosrevision); if (ret < 0) { printf("Error reading IOS into memory\n"); return -1; } tmd *p_tmd = (tmd*)SIGNATURE_PAYLOAD(ios->tmd); tmd_content *p_cr = TMD_CONTENTS(p_tmd); if (es_trucha_patch || es_identify_patch || nand_patch) { index = module_index(ios, "ES:"); if (index < 0) { printf("Could not identify ES module\n"); free_IOS(&ios); return -1; } int trucha = 0; int identify = 0; int nand = 0; int version = 0; if (es_trucha_patch) { printf("Patching trucha bug into ES module(#%u)...", index); trucha = patch_hash_check(ios->decrypted_buffer[index], ios->buffer_size[index]); printf("patched %u hash check(s)\n", trucha); } if (es_identify_patch) { printf("Patching ES_Identify in ES module(#%u)...", index); identify = patch_identify_check(ios->decrypted_buffer[index], ios->buffer_size[index]); printf("patch applied %u time(s)\n", identify); } if (nand_patch) { printf("Patching nand permissions in ES module(#%u)...", index); nand = patch_patch_fsperms(ios->decrypted_buffer[index], ios->buffer_size[index]); printf("patch applied %u time(s)\n", nand); } if (version_patch) { printf("Patching version check in ES module(#%u)...", index); version = patch_version_check(ios->decrypted_buffer[index], ios->buffer_size[index]); printf("patch applied %u time(s)\n", version); } if (trucha > 0 || identify > 0 || nand > 0 || version > 0) { // Force the patched module to be not shared tmd_content *content = &p_tmd->contents[index]; content->type = 1; // Update the content hash inside the tmd sha1 hash; SHA1(ios->decrypted_buffer[index], (u32)p_cr[index].size, hash); memcpy(p_cr[index].hash, hash, sizeof hash); tmd_dirty = true; } } if (iosnr != location) { change_ticket_title_id(ios->ticket, 1, location); change_tmd_title_id(ios->tmd, 1, location); tmd_dirty = true; tik_dirty = true; } if (iosrevision != newrevision) { p_tmd->title_version = newrevision; tmd_dirty = true; } if (tmd_dirty) { printf("Trucha signing the tmd...\n"); forge_tmd(ios->tmd); } if (tik_dirty) { printf("Trucha signing the ticket..\n"); forge_tik(ios->ticket); } printf("Encrypting IOS...\n"); encrypt_IOS(ios); printf("Preparations complete\n\n"); printf("Press A to start the install...\n"); u32 pressed; u32 pressedGC; waitforbuttonpress(&pressed, &pressedGC); if (pressed != WPAD_BUTTON_A && pressedGC != PAD_BUTTON_A) { printf("Other button pressed\n"); free_IOS(&ios); return -1; } printf("Installing...\n"); ret = install_IOS(ios, false); if (ret < 0) { free_IOS(&ios); if (ret == -1017 || ret == -2011) { printf("You need to use an IOS with trucha bug.\n"); printf("That's what the IOS15 downgrade is good for...\n"); } else if (ret == -1035) { printf("Has your installed IOS%u a higher revison than %u?\n", iosnr, iosrevision); } return -1; } printf("done\n"); if (free) free_IOS(&ios); return 0; } s32 Downgrade_TMD_Revision(void *ptmd, u32 tmd_size, void *certs, u32 certs_size) { // The revison of the tmd used as paramter here has to be >= the revision of the installed tmd s32 ret; printf("Setting the revision to 0...\n"); ret = ES_AddTitleStart(ptmd, tmd_size, certs, certs_size, NULL, 0); if (ret < 0) { if (ret == -1035) { printf("Error: ES_AddTitleStart returned %d, maybe you need an updated Downgrader\n", ret); } else { printf("Error: ES_AddTitleStart returned %d\n", ret); } ES_AddTitleCancel(); return ret; } ret = ISFS_Initialize(); if (ret < 0) { printf("Error: ISFS_Initialize returned %d\n", ret); ES_AddTitleCancel(); return ret; } s32 file; char *tmd_path = "/tmp/title.tmd"; ret = ISFS_Delete(tmd_path); if (ret < 0) { printf("Error: ISFS_Delete returned %d\n", ret); ES_AddTitleCancel(); ISFS_Deinitialize(); return ret; } ret = ISFS_CreateFile(tmd_path, 0, 3, 3, 3); if (ret < 0) { printf("Error: ISFS_CreateFile returned %d\n", ret); ES_AddTitleCancel(); ISFS_Deinitialize(); return ret; } file = ISFS_Open(tmd_path, ISFS_OPEN_RW); if (file < 0) { printf("Error: ISFS_Open returned %d\n", file); ES_AddTitleCancel(); ISFS_Deinitialize(); return file; } u8 *tmd = (u8 *)ptmd; tmd[0x1dc] = 0; tmd[0x1dd] = 0; ret = ISFS_Write(file, (u8 *)ptmd, tmd_size); if (ret < 0) { printf("Error: ISFS_Write returned %d\n", ret); ISFS_Close(file); ES_AddTitleCancel(); ISFS_Deinitialize(); return ret; } ISFS_Close(file); ISFS_Deinitialize(); ret = ES_AddTitleFinish(); if (ret < 0) { printf("Error: ES_AddTitleFinish returned %d\n", ret); return ret; } return 1; } s32 Downgrade_IOS(u32 iosversion, u32 highrevision, u32 lowrevision, bool free) { printf("Preparing downgrade of IOS%u from revison: %u to: %u\n", iosversion, highrevision, lowrevision); int ret; IOS *highios; IOS *lowios; printf("Getting IOS%u revision %u...\n", iosversion, highrevision); ret = get_IOS(&highios, iosversion, highrevision); if (ret < 0) { printf("Error reading IOS into memory\n"); return ret; } printf("Getting IOS%u revision %u...\n", iosversion, lowrevision); ret = get_IOS(&lowios, iosversion, lowrevision); if (ret < 0) { printf("Error reading IOS into memory\n"); free_IOS(&highios); return ret; } printf("\n"); printf("Downgrading involves two steps:\n"); printf("Step 1: Set the revison to 0\n"); printf("Step 2: Install IOS with low revision\n"); printf("Preparations complete, press A to start step 1...\n"); u32 pressed; u32 pressedGC; waitforbuttonpress(&pressed, &pressedGC); if (pressed != WPAD_BUTTON_A && pressedGC != PAD_BUTTON_A) { printf("Other button pressed\n"); free_IOS(&highios); free_IOS(&lowios); return -1; } printf("Installing ticket...\n"); ret = ES_AddTicket(highios->ticket, highios->ticket_size, highios->certs, highios->certs_size, highios->crl, highios->crl_size); if (ret < 0) { printf("ES_AddTicket returned: %d\n", ret); free_IOS(&highios); free_IOS(&lowios); ES_AddTitleCancel(); return ret; } ret = Downgrade_TMD_Revision(highios->tmd, highios->tmd_size, highios->certs, highios->certs_size); if (ret < 0) { printf("Error: Could not set the revision to 0\n"); free_IOS(&highios); free_IOS(&lowios); return ret; } printf("Revision set to 0, step 1 of downgrade complete.\n"); printf("\n"); printf("Press A to start step 2 of downgrade...\n"); waitforbuttonpress(&pressed, &pressedGC); if (pressed != WPAD_BUTTON_A && pressedGC != PAD_BUTTON_A) { printf("Other button pressed\n"); free_IOS(&highios); free_IOS(&lowios); return -1; } printf("Installing IOS%u Rev %u...\n", iosversion, lowrevision); ret = install_IOS(lowios, true); if (ret < 0) { printf("Error: Could not install IOS%u Rev %u\n", iosversion, lowrevision); free_IOS(&highios); free_IOS(&lowios); return ret; } printf("IOS%u downgrade to revision: %u complete.\n", iosversion, lowrevision); if (free) { free_IOS(&highios); free_IOS(&lowios); } return 0; } s32 GetTMD(u64 TicketID, signed_blob **Output, u32 *Length) { signed_blob* TMD = NULL; u32 TMD_Length; s32 ret; /* Retrieve TMD length */ ret = ES_GetStoredTMDSize(TicketID, &TMD_Length); if (ret < 0) return ret; /* Allocate memory */ TMD = (signed_blob*)memalign(32, (TMD_Length+31)&(~31)); if (!TMD) return IPC_ENOMEM; /* Retrieve TMD */ ret = ES_GetStoredTMD(TicketID, TMD, TMD_Length); if (ret < 0) { free(TMD); return ret; } /* Set values */ *Output = TMD; *Length = TMD_Length; return 0; } s32 checkTitle(u64 title_id) { signed_blob *TMD = NULL; tmd *t = NULL; u32 TMD_size = 0; s32 ret = 0; ret = GetTMD(title_id, &TMD, &TMD_size); if (ret == 0) { t = (tmd*)SIGNATURE_PAYLOAD(TMD); return t->title_version; } else { ret = -2; } free(TMD); return ret; } s32 checkIOS(u32 IOS) { // Get tmd to determine the version of the IOS return checkTitle(((u64)(1) << 32) | (IOS)); }
118-c-c-installer
trunk/source/IOSPatcher.c
C
gpl2
28,517
void install_channel_118();
118-c-c-installer
trunk/source/C118_install.h
C
gpl2
27
///////////////////////////////// // // mem check // // by oggzee #include <ogcsys.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <malloc.h> #include <stdarg.h> #include <stdio.h> #define XM_NO_OVERRIDE #include "memcheck.h" #include "util.h" //#include "wpad.h" #ifdef DEBUG_MEM_CHECK extern int con_inited; unsigned int xm_signature[] = { 0xdeadbeef, 0xdeadc0de, 0xc001babe, 0xf001b001, 0x12345678, 0xabcdef99, 0xa1b2c3d4, 0xe5f67890 }; #define XM_SIG_SIZE sizeof(xm_signature) #define XM_OVERHEAD (XM_SIG_SIZE+32) #define XM_PTR_MAX 200 struct xm_ps { void *ptr; size_t size; int line; char fun[20]; }; struct xm_ps xm_ptr[XM_PTR_MAX]; int xm_ptr_num; int xm_ptr_use; int xm_ptr_size; char xm_fun[100]; int xm_line; void xm_call(const char *fun, int line) { STRCOPY(xm_fun, fun); xm_line = line; } void xm_print_fun2(char *fun, int line) { if (con_inited) { printf("\nXM: %s : %d\n", fun, line); } } void xm_print_fun() { xm_print_fun2(xm_fun, xm_line); } void xm_print_err(char *fmt, ...) { if (con_inited) { char str[200]; va_list argp; va_start(argp, fmt); vsnprintf(str, sizeof(str), fmt, argp); va_end(argp); xm_print_fun(); printf("ERROR: %s\n", str); //sleep(5); int i, j; for (i=0; i<10; i++) { for (j=0; j<60; j++) { VIDEO_WaitVSync(); } printf(". "); } //Wpad_WaitButtonsCommon(); //*(char*)0=0; // crash //Sys_Exit(); exit(0); } } int xm_find(void *ptr) { int i; for (i=0; i<xm_ptr_num; i++) { if (xm_ptr[i].ptr == ptr) return i; } return -1; } void xm_add(void *ptr, size_t size) { int i; if (ptr == NULL) return; i = xm_find(NULL); if (i < 0) { if (xm_ptr_num < XM_PTR_MAX) { i = xm_ptr_num; xm_ptr_num++; } else { return; } } xm_ptr[i].ptr = ptr; xm_ptr[i].size = size; xm_ptr[i].line = xm_line; STRCOPY(xm_ptr[i].fun, xm_fun); xm_ptr_use++; xm_ptr_size += size; } void xm_del(void *ptr) { int i; if (ptr == NULL) return; i = xm_find(ptr); if (i < 0) return; xm_ptr_use--; xm_ptr_size -= xm_ptr[i].size; xm_ptr[i].ptr = NULL; xm_ptr[i].size = 0; while (xm_ptr_num > 0 && xm_ptr[xm_ptr_num-1].ptr == NULL) xm_ptr_num--; } void xm_mark(void *ptr, size_t size) { if (ptr == NULL) { xm_print_err("alloc %p [%d]", ptr, size); return; } memcpy(ptr+size, xm_signature, XM_SIG_SIZE); xm_add(ptr, size); } int xm_cmp(void *ptr, size_t size) { return memcmp(ptr+size, xm_signature, XM_SIG_SIZE); } int xm_check(struct xm_ps *xx) { if (xx->ptr == 0) return 0; if (xm_cmp(xx->ptr, xx->size) == 0) return 0; xm_print_err("ptr %p [%d]\n(%s : %d)\n", xx->ptr, xx->size, xx->fun, xx->line); return -1; } void xm_check_all() { int i; for (i=0; i<xm_ptr_num; i++) { xm_check(&xm_ptr[i]); } mallinfo(); } void *xm_malloc(size_t size) { xm_check_all(); void *p = malloc(size + XM_OVERHEAD); xm_mark(p, size); xm_check_all(); return p; } void *xm_memalign(size_t align, size_t size) { xm_check_all(); void *p = memalign(align, size + XM_OVERHEAD); if (!p) return p; xm_mark(p, size); xm_check_all(); return p; } void *xm_realloc(void *ptr, size_t size) { xm_check_all(); xm_del(ptr); void *p = realloc(ptr, size + XM_OVERHEAD); xm_mark(p, size); xm_check_all(); return p; } void *xm_calloc(size_t num, size_t size) { //void *p = calloc(num, size); size_t s = num * size; void *p = xm_malloc(s); if (p) memset(p, 0, s); return p; } void xm_free(void *ptr) { int i; xm_check_all(); i = xm_find(ptr); if (i < 0 || ptr == NULL) { xm_print_err("free unk %p", ptr); } free(ptr); xm_del(ptr); xm_check_all(); } void xm_memcheck_ptr(void *base, void *ptr) { xm_check_all(); mallinfo(); if (base == NULL || ptr == NULL || ptr < base) { xm_print_err("access %p %p", base, ptr); return; } int i; i = xm_find(base); if (i < 0) { xm_print_err("unk %p %p", base, ptr); return; } if (ptr - base > xm_ptr[i].size) { xm_print_err("access %p %p [%d]", base, ptr, xm_ptr[i].size); } } void memstat() { int i; xm_check_all(); printf("\n"); malloc_stats(); printf("XM: %d / %d %d\n", xm_ptr_use, xm_ptr_num, xm_ptr_size); // print larger than 128kb allocs for (i=0; i<xm_ptr_num; i++) { if (xm_ptr[i].size > 128*1024) { printf("%p %4dk %-20.20s %d\n", xm_ptr[i].ptr, xm_ptr[i].size/1024, xm_ptr[i].fun, xm_ptr[i].line); } } } void memcheck() { xm_check_all(); mallinfo(); } #else void memstat() { //malloc_stats(); } void memcheck() { //mallinfo(); } #endif
118-c-c-installer
trunk/source/memcheck.c
C
gpl2
4,774
// by oggzee #ifndef _MEMCHECK_H #define _MEMCHECK_H void memstat(); void memcheck(); //#define DEBUG_MEM_CHECK #if defined(DEBUG_MEM_CHECK) && !defined(XM_NO_OVERRIDE) #include <stdlib.h> #include <malloc.h> void xm_call(const char *fun, int line); void* xm_malloc(size_t size); void* xm_memalign(size_t align, size_t size); void* xm_realloc(void *ptr, size_t size); void* xm_calloc(size_t num, size_t size); void xm_free(void *ptr); void xm_memcheck_ptr(void *base, void *ptr); #define XM_OVERRIDE(F, ARGS...) (xm_call(__FUNCTION__, __LINE__), xm_##F(ARGS)) #define malloc(S) XM_OVERRIDE(malloc, S) #define memalign(A, S) XM_OVERRIDE(memalign, A, S) #define realloc(P, S) XM_OVERRIDE(realloc, P, S) #define calloc(N, S) XM_OVERRIDE(calloc, N, S) #define free(P) XM_OVERRIDE(free, P) #define memcheck_ptr(B, P) XM_OVERRIDE(memcheck_ptr, B, P) #else #define memcheck_ptr(B,P) do{}while(0) #endif #endif
118-c-c-installer
trunk/source/memcheck.h
C
gpl2
978
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <gccore.h> #include <malloc.h> #include "IOSPatcher.h" #include "iospatch.h" #include "wad.h" #include "tools.h" #include "network.h" #include "C118_install.h" #include "Install_Uninstall.h" #define IOS36version 3351 // Prevent IOS36 loading at startup s32 __IOS_LoadStartupIOS() { return 0; } s32 __u8Cmp(const void *a, const void *b) { return *(u8 *)a-*(u8 *)b; } int main(int argc, char* argv[]) { u32 pressed; u32 pressedGC; Init_Console(); printf("\x1b[%u;%um", 37, false); PAD_Init(); WPAD_Init(); WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR); printheadline(); printf("WARNING: If you are not connected to the Internet, this app might crash.\n"); printf("If you get a DSI error, rerun the app and be a little quicker.\n\n"); printf("\nThis Application will install the 118Channel and IOS118 onto your Wii.\n"); printf("It relies on the fact that you launched this app with.\n"); printf("the AHBPROT flags set, so you must be using HBC 1.07 or later.\n"); printf("\nIOS118 is a patched IOS36 v3351 and this app can be used\n"); printf("instead of the Trucha Bug Restorer, upon which the app was based.\n"); printf("\nThis application should work on all Wii firmwares 4.3 and below,\n"); printf("and as long as the HBC supports AHBPROT, it should work on newer\n"); printf("firmwares too. It is safe to use this application to reinstall\n"); printf("IOS118 or replace a different IOS118.\n"); printf("\nThanks, in no particular order, go to the Wiitaly\n"); printf("Team (Step, wasabi, student, Shur'tugal, Zahir71, dafunk and Lupo96),\n"); printf("Dr. Clipper, Wiipower, oggzee, Team Twiizers, tona, Joseph Jordan\n"); printf("and anybody else who has code included in the app.\n"); printf("The app was quite a simple job, built upon their\n"); printf("actual real work.\n"); /*printf("\nPlease Wait...\n"); time_t t = time(NULL) + 7; while (time(NULL) < t) { WPAD_ScanPads(); PAD_ScanPads(); if(WPAD_ButtonsDown(0) || PAD_ButtonsDown(0)) { printf("Don't be impatient, press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } }*/ printf("Press 1 or Start to start the application...\n"); waitforbuttonpress(&pressed, &pressedGC); if (pressed != WPAD_BUTTON_1 && pressedGC != PAD_BUTTON_START) { printf("Other button pressed, press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } printf("Performing Step 1\n"); printf("Patching IOS\n"); if (!IOSPATCH_Apply()) { printf("Unable to initialise the initial patches.\n"); printf("This either means you didn't follow the download\n"); printf("and launching instructions correctly, or your IOS\n"); printf("is not vulnerable for an unknown reason.\n"); printf("Perhaps you need to update the Homebrew Channel (HBC).\n"); printf("Installation cannot continue. Press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } printf("IOS patched\n"); what_to_do(); return 0; }
118-c-c-installer
trunk/source/main.c
C
gpl2
3,184
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ogcsys.h> #include <gccore.h> #include <ogc/isfs.h> #include <wiiuse/wpad.h> #include "IOSPatcher.h" #include "iospatch.h" #include "wad.h" #include "tools.h" #include "network.h" #include "C118_install.h" #include "uninstall.h" #define IOS36version 3351 s32 what_to_do() { u32 pressed; u32 pressedGC; int selection = 0; int ret; char *optionsstring[3] = { "<Install IOS118 and 118 Channel>", "<Uninstall IOS118 and 118 Channel>", "<Exit>" }; while (true) { Con_ClearLine(); set_highlight(true); printf(optionsstring[selection]); set_highlight(false); waitforbuttonpress(&pressed, &pressedGC); if (pressed == WPAD_BUTTON_LEFT || pressedGC == PAD_BUTTON_LEFT) { if (selection > 0) { selection--; } else { selection =2; } } if (pressed == WPAD_BUTTON_RIGHT || pressedGC == PAD_BUTTON_RIGHT) { if (selection < 2) { selection++; } else { selection = 0; } } if (pressed == WPAD_BUTTON_A || pressedGC == PAD_BUTTON_A) { printf("\n"); if (selection == 0) { printf("About to install IOS118\n"); ret = Install_patched_IOS(36, IOS36version, true, true, true, true, 118, 65535, false); if (ret < 0) { printf("IOS118 Install failed. Press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); } printf("\nStep 1 Complete!\n"); printf("IOS118 Installation is complete!\n"); install_channel_118(); printf("\nStep 2 Complete!\n"); printf("118Channel Installation is complete!\n"); printf("Press any button to exit...\n"); waitforbuttonpress(NULL, NULL); Reboot(); return 0; } if (selection == 1) { ISFS_Initialize(); Uninstall_DeleteTicket(1, 118); Uninstall_DeleteTitle(1, 118); Uninstall_118Channel_all(); ISFS_Deinitialize(); } if (selection == 2) { Reboot(); } } } }
118-c-c-installer
trunk/source/Install_Uninstall.c
C
gpl2
2,080
/* pngconf.h - machine configurable file for libpng * * libpng version 1.2.29 - May 8, 2008 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ /* Any machine specific code is near the front of this file, so if you * are configuring libpng for a machine, you may want to read the section * starting here down to where it starts to typedef png_color, png_text, * and png_info. */ #ifndef PNGCONF_H #define PNGCONF_H #define PNG_1_2_X /* * PNG_USER_CONFIG has to be defined on the compiler command line. This * includes the resource compiler for Windows DLL configurations. */ #ifdef PNG_USER_CONFIG # ifndef PNG_USER_PRIVATEBUILD # define PNG_USER_PRIVATEBUILD # endif #include "pngusr.h" #endif /* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */ #ifdef PNG_CONFIGURE_LIBPNG #ifdef HAVE_CONFIG_H #include "config.h" #endif #endif /* * Added at libpng-1.2.8 * * If you create a private DLL you need to define in "pngusr.h" the followings: * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of * the DLL was built> * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons." * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to * distinguish your DLL from those of the official release. These * correspond to the trailing letters that come after the version * number and must match your private DLL name> * e.g. // private DLL "libpng13gx.dll" * #define PNG_USER_DLLFNAME_POSTFIX "gx" * * The following macros are also at your disposal if you want to complete the * DLL VERSIONINFO structure. * - PNG_USER_VERSIONINFO_COMMENTS * - PNG_USER_VERSIONINFO_COMPANYNAME * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS */ #ifdef __STDC__ #ifdef SPECIALBUILD # pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\ are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.") #endif #ifdef PRIVATEBUILD # pragma message("PRIVATEBUILD is deprecated.\ Use PNG_USER_PRIVATEBUILD instead.") # define PNG_USER_PRIVATEBUILD PRIVATEBUILD #endif #endif /* __STDC__ */ #ifndef PNG_VERSION_INFO_ONLY /* End of material added to libpng-1.2.8 */ /* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble Restored at libpng-1.2.21 */ #if !defined(PNG_NO_WARN_UNINITIALIZED_ROW) && \ !defined(PNG_WARN_UNINITIALIZED_ROW) # define PNG_WARN_UNINITIALIZED_ROW 1 #endif /* End of material added at libpng-1.2.19/1.2.21 */ /* This is the size of the compression buffer, and thus the size of * an IDAT chunk. Make this whatever size you feel is best for your * machine. One of these will be allocated per png_struct. When this * is full, it writes the data to the disk, and does some other * calculations. Making this an extremely small size will slow * the library down, but you may want to experiment to determine * where it becomes significant, if you are concerned with memory * usage. Note that zlib allocates at least 32Kb also. For readers, * this describes the size of the buffer available to read the data in. * Unless this gets smaller than the size of a row (compressed), * it should not make much difference how big this is. */ #ifndef PNG_ZBUF_SIZE # define PNG_ZBUF_SIZE 8192 #endif /* Enable if you want a write-only libpng */ #ifndef PNG_NO_READ_SUPPORTED # define PNG_READ_SUPPORTED #endif /* Enable if you want a read-only libpng */ #ifndef PNG_NO_WRITE_SUPPORTED # define PNG_WRITE_SUPPORTED #endif /* Enabled by default in 1.2.0. You can disable this if you don't need to support PNGs that are embedded in MNG datastreams */ #if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES) # ifndef PNG_MNG_FEATURES_SUPPORTED # define PNG_MNG_FEATURES_SUPPORTED # endif #endif #ifndef PNG_NO_FLOATING_POINT_SUPPORTED # ifndef PNG_FLOATING_POINT_SUPPORTED # define PNG_FLOATING_POINT_SUPPORTED # endif #endif /* If you are running on a machine where you cannot allocate more * than 64K of memory at once, uncomment this. While libpng will not * normally need that much memory in a chunk (unless you load up a very * large file), zlib needs to know how big of a chunk it can use, and * libpng thus makes sure to check any memory allocation to verify it * will fit into memory. #define PNG_MAX_MALLOC_64K */ #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) # define PNG_MAX_MALLOC_64K #endif /* Special munging to support doing things the 'cygwin' way: * 'Normal' png-on-win32 defines/defaults: * PNG_BUILD_DLL -- building dll * PNG_USE_DLL -- building an application, linking to dll * (no define) -- building static library, or building an * application and linking to the static lib * 'Cygwin' defines/defaults: * PNG_BUILD_DLL -- (ignored) building the dll * (no define) -- (ignored) building an application, linking to the dll * PNG_STATIC -- (ignored) building the static lib, or building an * application that links to the static lib. * ALL_STATIC -- (ignored) building various static libs, or building an * application that links to the static libs. * Thus, * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and * this bit of #ifdefs will define the 'correct' config variables based on * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but * unnecessary. * * Also, the precedence order is: * ALL_STATIC (since we can't #undef something outside our namespace) * PNG_BUILD_DLL * PNG_STATIC * (nothing) == PNG_USE_DLL * * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent * of auto-import in binutils, we no longer need to worry about * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes * to __declspec() stuff. However, we DO need to worry about * PNG_BUILD_DLL and PNG_STATIC because those change some defaults * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed. */ #if defined(__CYGWIN__) # if defined(ALL_STATIC) # if defined(PNG_BUILD_DLL) # undef PNG_BUILD_DLL # endif # if defined(PNG_USE_DLL) # undef PNG_USE_DLL # endif # if defined(PNG_DLL) # undef PNG_DLL # endif # if !defined(PNG_STATIC) # define PNG_STATIC # endif # else # if defined (PNG_BUILD_DLL) # if defined(PNG_STATIC) # undef PNG_STATIC # endif # if defined(PNG_USE_DLL) # undef PNG_USE_DLL # endif # if !defined(PNG_DLL) # define PNG_DLL # endif # else # if defined(PNG_STATIC) # if defined(PNG_USE_DLL) # undef PNG_USE_DLL # endif # if defined(PNG_DLL) # undef PNG_DLL # endif # else # if !defined(PNG_USE_DLL) # define PNG_USE_DLL # endif # if !defined(PNG_DLL) # define PNG_DLL # endif # endif # endif # endif #endif /* This protects us against compilers that run on a windowing system * and thus don't have or would rather us not use the stdio types: * stdin, stdout, and stderr. The only one currently used is stderr * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will * prevent these from being compiled and used. #defining PNG_NO_STDIO * will also prevent these, plus will prevent the entire set of stdio * macros and functions (FILE *, printf, etc.) from being compiled and used, * unless (PNG_DEBUG > 0) has been #defined. * * #define PNG_NO_CONSOLE_IO * #define PNG_NO_STDIO */ #if defined(_WIN32_WCE) # include <windows.h> /* Console I/O functions are not supported on WindowsCE */ # define PNG_NO_CONSOLE_IO # ifdef PNG_DEBUG # undef PNG_DEBUG # endif #endif #ifdef PNG_BUILD_DLL # ifndef PNG_CONSOLE_IO_SUPPORTED # ifndef PNG_NO_CONSOLE_IO # define PNG_NO_CONSOLE_IO # endif # endif #endif # ifdef PNG_NO_STDIO # ifndef PNG_NO_CONSOLE_IO # define PNG_NO_CONSOLE_IO # endif # ifdef PNG_DEBUG # if (PNG_DEBUG > 0) # include <stdio.h> # endif # endif # else # if !defined(_WIN32_WCE) /* "stdio.h" functions are not supported on WindowsCE */ # include <stdio.h> # endif # endif /* This macro protects us against machines that don't have function * prototypes (ie K&R style headers). If your compiler does not handle * function prototypes, define this macro and use the included ansi2knr. * I've always been able to use _NO_PROTO as the indicator, but you may * need to drag the empty declaration out in front of here, or change the * ifdef to suit your own needs. */ #ifndef PNGARG #ifdef OF /* zlib prototype munger */ # define PNGARG(arglist) OF(arglist) #else #ifdef _NO_PROTO # define PNGARG(arglist) () # ifndef PNG_TYPECAST_NULL # define PNG_TYPECAST_NULL # endif #else # define PNGARG(arglist) arglist #endif /* _NO_PROTO */ #endif /* OF */ #endif /* PNGARG */ /* Try to determine if we are compiling on a Mac. Note that testing for * just __MWERKS__ is not good enough, because the Codewarrior is now used * on non-Mac platforms. */ #ifndef MACOS # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) # define MACOS # endif #endif /* enough people need this for various reasons to include it here */ #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE) # include <sys/types.h> #endif #if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) # define PNG_SETJMP_SUPPORTED #endif #ifdef PNG_SETJMP_SUPPORTED /* This is an attempt to force a single setjmp behaviour on Linux. If * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. */ # ifdef __linux__ # ifdef _BSD_SOURCE # define PNG_SAVE_BSD_SOURCE # undef _BSD_SOURCE # endif # ifdef _SETJMP_H /* If you encounter a compiler error here, see the explanation * near the end of INSTALL. */ __pngconf.h__ already includes setjmp.h; __dont__ include it again.; # endif # endif /* __linux__ */ /* include setjmp.h for error handling */ # include <setjmp.h> # ifdef __linux__ # ifdef PNG_SAVE_BSD_SOURCE # ifndef _BSD_SOURCE # define _BSD_SOURCE # endif # undef PNG_SAVE_BSD_SOURCE # endif # endif /* __linux__ */ #endif /* PNG_SETJMP_SUPPORTED */ #ifdef BSD # include <strings.h> #else # include <string.h> #endif /* Other defines for things like memory and the like can go here. */ #ifdef PNG_INTERNAL #include <stdlib.h> /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which * aren't usually used outside the library (as far as I know), so it is * debatable if they should be exported at all. In the future, when it is * possible to have run-time registry of chunk-handling functions, some of * these will be made available again. #define PNG_EXTERN extern */ #define PNG_EXTERN /* Other defines specific to compilers can go here. Try to keep * them inside an appropriate ifdef/endif pair for portability. */ #if defined(PNG_FLOATING_POINT_SUPPORTED) # if defined(MACOS) /* We need to check that <math.h> hasn't already been included earlier * as it seems it doesn't agree with <fp.h>, yet we should really use * <fp.h> if possible. */ # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) # include <fp.h> # endif # else # include <math.h> # endif # if defined(_AMIGA) && defined(__SASC) && defined(_M68881) /* Amiga SAS/C: We must include builtin FPU functions when compiling using * MATH=68881 */ # include <m68881.h> # endif #endif /* Codewarrior on NT has linking problems without this. */ #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__) # define PNG_ALWAYS_EXTERN #endif /* This provides the non-ANSI (far) memory allocation routines. */ #if defined(__TURBOC__) && defined(__MSDOS__) # include <mem.h> # include <alloc.h> #endif /* I have no idea why is this necessary... */ #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \ defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__)) # include <malloc.h> #endif /* This controls how fine the dithering gets. As this allocates * a largish chunk of memory (32K), those who are not as concerned * with dithering quality can decrease some or all of these. */ #ifndef PNG_DITHER_RED_BITS # define PNG_DITHER_RED_BITS 5 #endif #ifndef PNG_DITHER_GREEN_BITS # define PNG_DITHER_GREEN_BITS 5 #endif #ifndef PNG_DITHER_BLUE_BITS # define PNG_DITHER_BLUE_BITS 5 #endif /* This controls how fine the gamma correction becomes when you * are only interested in 8 bits anyway. Increasing this value * results in more memory being used, and more pow() functions * being called to fill in the gamma tables. Don't set this value * less then 8, and even that may not work (I haven't tested it). */ #ifndef PNG_MAX_GAMMA_8 # define PNG_MAX_GAMMA_8 11 #endif /* This controls how much a difference in gamma we can tolerate before * we actually start doing gamma conversion. */ #ifndef PNG_GAMMA_THRESHOLD # define PNG_GAMMA_THRESHOLD 0.05 #endif #endif /* PNG_INTERNAL */ /* The following uses const char * instead of char * for error * and warning message functions, so some compilers won't complain. * If you do not want to use const, define PNG_NO_CONST here. */ #ifndef PNG_NO_CONST # define PNG_CONST const #else # define PNG_CONST #endif /* The following defines give you the ability to remove code from the * library that you will not be using. I wish I could figure out how to * automate this, but I can't do that without making it seriously hard * on the users. So if you are not using an ability, change the #define * to and #undef, and that part of the library will not be compiled. If * your linker can't find a function, you may want to make sure the * ability is defined here. Some of these depend upon some others being * defined. I haven't figured out all the interactions here, so you may * have to experiment awhile to get everything to compile. If you are * creating or using a shared library, you probably shouldn't touch this, * as it will affect the size of the structures, and this will cause bad * things to happen if the library and/or application ever change. */ /* Any features you will not be using can be undef'ed here */ /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS * on the compile line, then pick and choose which ones to define without * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED * if you only want to have a png-compliant reader/writer but don't need * any of the extra transformations. This saves about 80 kbytes in a * typical installation of the library. (PNG_NO_* form added in version * 1.0.1c, for consistency) */ /* The size of the png_text structure changed in libpng-1.0.6 when * iTXt support was added. iTXt support was turned off by default through * libpng-1.2.x, to support old apps that malloc the png_text structure * instead of calling png_set_text() and letting libpng malloc it. It * was turned on by default in libpng-1.3.0. */ #if defined(PNG_1_0_X) || defined (PNG_1_2_X) # ifndef PNG_NO_iTXt_SUPPORTED # define PNG_NO_iTXt_SUPPORTED # endif # ifndef PNG_NO_READ_iTXt # define PNG_NO_READ_iTXt # endif # ifndef PNG_NO_WRITE_iTXt # define PNG_NO_WRITE_iTXt # endif #endif #if !defined(PNG_NO_iTXt_SUPPORTED) # if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt) # define PNG_READ_iTXt # endif # if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt) # define PNG_WRITE_iTXt # endif #endif /* The following support, added after version 1.0.0, can be turned off here en * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility * with old applications that require the length of png_struct and png_info * to remain unchanged. */ #ifdef PNG_LEGACY_SUPPORTED # define PNG_NO_FREE_ME # define PNG_NO_READ_UNKNOWN_CHUNKS # define PNG_NO_WRITE_UNKNOWN_CHUNKS # define PNG_NO_READ_USER_CHUNKS # define PNG_NO_READ_iCCP # define PNG_NO_WRITE_iCCP # define PNG_NO_READ_iTXt # define PNG_NO_WRITE_iTXt # define PNG_NO_READ_sCAL # define PNG_NO_WRITE_sCAL # define PNG_NO_READ_sPLT # define PNG_NO_WRITE_sPLT # define PNG_NO_INFO_IMAGE # define PNG_NO_READ_RGB_TO_GRAY # define PNG_NO_READ_USER_TRANSFORM # define PNG_NO_WRITE_USER_TRANSFORM # define PNG_NO_USER_MEM # define PNG_NO_READ_EMPTY_PLTE # define PNG_NO_MNG_FEATURES # define PNG_NO_FIXED_POINT_SUPPORTED #endif /* Ignore attempt to turn off both floating and fixed point support */ #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \ !defined(PNG_NO_FIXED_POINT_SUPPORTED) # define PNG_FIXED_POINT_SUPPORTED #endif #ifndef PNG_NO_FREE_ME # define PNG_FREE_ME_SUPPORTED #endif #if defined(PNG_READ_SUPPORTED) #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ !defined(PNG_NO_READ_TRANSFORMS) # define PNG_READ_TRANSFORMS_SUPPORTED #endif #ifdef PNG_READ_TRANSFORMS_SUPPORTED # ifndef PNG_NO_READ_EXPAND # define PNG_READ_EXPAND_SUPPORTED # endif # ifndef PNG_NO_READ_SHIFT # define PNG_READ_SHIFT_SUPPORTED # endif # ifndef PNG_NO_READ_PACK # define PNG_READ_PACK_SUPPORTED # endif # ifndef PNG_NO_READ_BGR # define PNG_READ_BGR_SUPPORTED # endif # ifndef PNG_NO_READ_SWAP # define PNG_READ_SWAP_SUPPORTED # endif # ifndef PNG_NO_READ_PACKSWAP # define PNG_READ_PACKSWAP_SUPPORTED # endif # ifndef PNG_NO_READ_INVERT # define PNG_READ_INVERT_SUPPORTED # endif # ifndef PNG_NO_READ_DITHER # define PNG_READ_DITHER_SUPPORTED # endif # ifndef PNG_NO_READ_BACKGROUND # define PNG_READ_BACKGROUND_SUPPORTED # endif # ifndef PNG_NO_READ_16_TO_8 # define PNG_READ_16_TO_8_SUPPORTED # endif # ifndef PNG_NO_READ_FILLER # define PNG_READ_FILLER_SUPPORTED # endif # ifndef PNG_NO_READ_GAMMA # define PNG_READ_GAMMA_SUPPORTED # endif # ifndef PNG_NO_READ_GRAY_TO_RGB # define PNG_READ_GRAY_TO_RGB_SUPPORTED # endif # ifndef PNG_NO_READ_SWAP_ALPHA # define PNG_READ_SWAP_ALPHA_SUPPORTED # endif # ifndef PNG_NO_READ_INVERT_ALPHA # define PNG_READ_INVERT_ALPHA_SUPPORTED # endif # ifndef PNG_NO_READ_STRIP_ALPHA # define PNG_READ_STRIP_ALPHA_SUPPORTED # endif # ifndef PNG_NO_READ_USER_TRANSFORM # define PNG_READ_USER_TRANSFORM_SUPPORTED # endif # ifndef PNG_NO_READ_RGB_TO_GRAY # define PNG_READ_RGB_TO_GRAY_SUPPORTED # endif #endif /* PNG_READ_TRANSFORMS_SUPPORTED */ #if !defined(PNG_NO_PROGRESSIVE_READ) && \ !defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive */ # define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ #endif /* about interlacing capability! You'll */ /* still have interlacing unless you change the following line: */ #define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */ #ifndef PNG_NO_READ_COMPOSITE_NODIV # ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ # define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ # endif #endif #if defined(PNG_1_0_X) || defined (PNG_1_2_X) /* Deprecated, will be removed from version 2.0.0. Use PNG_MNG_FEATURES_SUPPORTED instead. */ #ifndef PNG_NO_READ_EMPTY_PLTE # define PNG_READ_EMPTY_PLTE_SUPPORTED #endif #endif #endif /* PNG_READ_SUPPORTED */ #if defined(PNG_WRITE_SUPPORTED) # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ !defined(PNG_NO_WRITE_TRANSFORMS) # define PNG_WRITE_TRANSFORMS_SUPPORTED #endif #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED # ifndef PNG_NO_WRITE_SHIFT # define PNG_WRITE_SHIFT_SUPPORTED # endif # ifndef PNG_NO_WRITE_PACK # define PNG_WRITE_PACK_SUPPORTED # endif # ifndef PNG_NO_WRITE_BGR # define PNG_WRITE_BGR_SUPPORTED # endif # ifndef PNG_NO_WRITE_SWAP # define PNG_WRITE_SWAP_SUPPORTED # endif # ifndef PNG_NO_WRITE_PACKSWAP # define PNG_WRITE_PACKSWAP_SUPPORTED # endif # ifndef PNG_NO_WRITE_INVERT # define PNG_WRITE_INVERT_SUPPORTED # endif # ifndef PNG_NO_WRITE_FILLER # define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */ # endif # ifndef PNG_NO_WRITE_SWAP_ALPHA # define PNG_WRITE_SWAP_ALPHA_SUPPORTED # endif # ifndef PNG_NO_WRITE_INVERT_ALPHA # define PNG_WRITE_INVERT_ALPHA_SUPPORTED # endif # ifndef PNG_NO_WRITE_USER_TRANSFORM # define PNG_WRITE_USER_TRANSFORM_SUPPORTED # endif #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ #if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \ !defined(PNG_WRITE_INTERLACING_SUPPORTED) #define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant encoders, but can cause trouble if left undefined */ #endif #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ !defined(PNG_WRITE_WEIGHTED_FILTER) && \ defined(PNG_FLOATING_POINT_SUPPORTED) # define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #endif #ifndef PNG_NO_WRITE_FLUSH # define PNG_WRITE_FLUSH_SUPPORTED #endif #if defined(PNG_1_0_X) || defined (PNG_1_2_X) /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */ #ifndef PNG_NO_WRITE_EMPTY_PLTE # define PNG_WRITE_EMPTY_PLTE_SUPPORTED #endif #endif #endif /* PNG_WRITE_SUPPORTED */ #ifndef PNG_1_0_X # ifndef PNG_NO_ERROR_NUMBERS # define PNG_ERROR_NUMBERS_SUPPORTED # endif #endif /* PNG_1_0_X */ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) # ifndef PNG_NO_USER_TRANSFORM_PTR # define PNG_USER_TRANSFORM_PTR_SUPPORTED # endif #endif #ifndef PNG_NO_STDIO # define PNG_TIME_RFC1123_SUPPORTED #endif /* This adds extra functions in pngget.c for accessing data from the * info pointer (added in version 0.99) * png_get_image_width() * png_get_image_height() * png_get_bit_depth() * png_get_color_type() * png_get_compression_type() * png_get_filter_type() * png_get_interlace_type() * png_get_pixel_aspect_ratio() * png_get_pixels_per_meter() * png_get_x_offset_pixels() * png_get_y_offset_pixels() * png_get_x_offset_microns() * png_get_y_offset_microns() */ #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED) # define PNG_EASY_ACCESS_SUPPORTED #endif /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 * and removed from version 1.2.20. The following will be removed * from libpng-1.4.0 */ #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE) # ifndef PNG_OPTIMIZED_CODE_SUPPORTED # define PNG_OPTIMIZED_CODE_SUPPORTED # endif #endif #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) # ifndef PNG_ASSEMBLER_CODE_SUPPORTED # define PNG_ASSEMBLER_CODE_SUPPORTED # endif # if defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4) /* work around 64-bit gcc compiler bugs in gcc-3.x */ # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) # define PNG_NO_MMX_CODE # endif # endif # if defined(__APPLE__) # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) # define PNG_NO_MMX_CODE # endif # endif # if (defined(__MWERKS__) && ((__MWERKS__ < 0x0900) || macintosh)) # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) # define PNG_NO_MMX_CODE # endif # endif # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) # define PNG_MMX_CODE_SUPPORTED # endif #endif /* end of obsolete code to be removed from libpng-1.4.0 */ #if !defined(PNG_1_0_X) #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) # define PNG_USER_MEM_SUPPORTED #endif #endif /* PNG_1_0_X */ /* Added at libpng-1.2.6 */ #if !defined(PNG_1_0_X) #ifndef PNG_SET_USER_LIMITS_SUPPORTED #if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED) # define PNG_SET_USER_LIMITS_SUPPORTED #endif #endif #endif /* PNG_1_0_X */ /* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter * how large, set these limits to 0x7fffffffL */ #ifndef PNG_USER_WIDTH_MAX # define PNG_USER_WIDTH_MAX 1000000L #endif #ifndef PNG_USER_HEIGHT_MAX # define PNG_USER_HEIGHT_MAX 1000000L #endif /* These are currently experimental features, define them if you want */ /* very little testing */ /* #ifdef PNG_READ_SUPPORTED # ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED # define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED # endif #endif */ /* This is only for PowerPC big-endian and 680x0 systems */ /* some testing */ /* #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED # define PNG_READ_BIG_ENDIAN_SUPPORTED #endif */ /* Buggy compilers (e.g., gcc 2.7.2.2) need this */ /* #define PNG_NO_POINTER_INDEXING */ /* These functions are turned off by default, as they will be phased out. */ /* #define PNG_USELESS_TESTS_SUPPORTED #define PNG_CORRECT_PALETTE_SUPPORTED */ /* Any chunks you are not interested in, you can undef here. The * ones that allocate memory may be expecially important (hIST, * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info * a bit smaller. */ #if defined(PNG_READ_SUPPORTED) && \ !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ !defined(PNG_NO_READ_ANCILLARY_CHUNKS) # define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED #endif #if defined(PNG_WRITE_SUPPORTED) && \ !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) # define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED #endif #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED #ifdef PNG_NO_READ_TEXT # define PNG_NO_READ_iTXt # define PNG_NO_READ_tEXt # define PNG_NO_READ_zTXt #endif #ifndef PNG_NO_READ_bKGD # define PNG_READ_bKGD_SUPPORTED # define PNG_bKGD_SUPPORTED #endif #ifndef PNG_NO_READ_cHRM # define PNG_READ_cHRM_SUPPORTED # define PNG_cHRM_SUPPORTED #endif #ifndef PNG_NO_READ_gAMA # define PNG_READ_gAMA_SUPPORTED # define PNG_gAMA_SUPPORTED #endif #ifndef PNG_NO_READ_hIST # define PNG_READ_hIST_SUPPORTED # define PNG_hIST_SUPPORTED #endif #ifndef PNG_NO_READ_iCCP # define PNG_READ_iCCP_SUPPORTED # define PNG_iCCP_SUPPORTED #endif #ifndef PNG_NO_READ_iTXt # ifndef PNG_READ_iTXt_SUPPORTED # define PNG_READ_iTXt_SUPPORTED # endif # ifndef PNG_iTXt_SUPPORTED # define PNG_iTXt_SUPPORTED # endif #endif #ifndef PNG_NO_READ_oFFs # define PNG_READ_oFFs_SUPPORTED # define PNG_oFFs_SUPPORTED #endif #ifndef PNG_NO_READ_pCAL # define PNG_READ_pCAL_SUPPORTED # define PNG_pCAL_SUPPORTED #endif #ifndef PNG_NO_READ_sCAL # define PNG_READ_sCAL_SUPPORTED # define PNG_sCAL_SUPPORTED #endif #ifndef PNG_NO_READ_pHYs # define PNG_READ_pHYs_SUPPORTED # define PNG_pHYs_SUPPORTED #endif #ifndef PNG_NO_READ_sBIT # define PNG_READ_sBIT_SUPPORTED # define PNG_sBIT_SUPPORTED #endif #ifndef PNG_NO_READ_sPLT # define PNG_READ_sPLT_SUPPORTED # define PNG_sPLT_SUPPORTED #endif #ifndef PNG_NO_READ_sRGB # define PNG_READ_sRGB_SUPPORTED # define PNG_sRGB_SUPPORTED #endif #ifndef PNG_NO_READ_tEXt # define PNG_READ_tEXt_SUPPORTED # define PNG_tEXt_SUPPORTED #endif #ifndef PNG_NO_READ_tIME # define PNG_READ_tIME_SUPPORTED # define PNG_tIME_SUPPORTED #endif #ifndef PNG_NO_READ_tRNS # define PNG_READ_tRNS_SUPPORTED # define PNG_tRNS_SUPPORTED #endif #ifndef PNG_NO_READ_zTXt # define PNG_READ_zTXt_SUPPORTED # define PNG_zTXt_SUPPORTED #endif #ifndef PNG_NO_READ_UNKNOWN_CHUNKS # define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED # define PNG_UNKNOWN_CHUNKS_SUPPORTED # endif # ifndef PNG_NO_HANDLE_AS_UNKNOWN # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED # endif #endif #if !defined(PNG_NO_READ_USER_CHUNKS) && \ defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) # define PNG_READ_USER_CHUNKS_SUPPORTED # define PNG_USER_CHUNKS_SUPPORTED # ifdef PNG_NO_READ_UNKNOWN_CHUNKS # undef PNG_NO_READ_UNKNOWN_CHUNKS # endif # ifdef PNG_NO_HANDLE_AS_UNKNOWN # undef PNG_NO_HANDLE_AS_UNKNOWN # endif #endif #ifndef PNG_NO_READ_OPT_PLTE # define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ #endif /* optional PLTE chunk in RGB and RGBA images */ #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ defined(PNG_READ_zTXt_SUPPORTED) # define PNG_READ_TEXT_SUPPORTED # define PNG_TEXT_SUPPORTED #endif #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED #ifdef PNG_NO_WRITE_TEXT # define PNG_NO_WRITE_iTXt # define PNG_NO_WRITE_tEXt # define PNG_NO_WRITE_zTXt #endif #ifndef PNG_NO_WRITE_bKGD # define PNG_WRITE_bKGD_SUPPORTED # ifndef PNG_bKGD_SUPPORTED # define PNG_bKGD_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_cHRM # define PNG_WRITE_cHRM_SUPPORTED # ifndef PNG_cHRM_SUPPORTED # define PNG_cHRM_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_gAMA # define PNG_WRITE_gAMA_SUPPORTED # ifndef PNG_gAMA_SUPPORTED # define PNG_gAMA_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_hIST # define PNG_WRITE_hIST_SUPPORTED # ifndef PNG_hIST_SUPPORTED # define PNG_hIST_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_iCCP # define PNG_WRITE_iCCP_SUPPORTED # ifndef PNG_iCCP_SUPPORTED # define PNG_iCCP_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_iTXt # ifndef PNG_WRITE_iTXt_SUPPORTED # define PNG_WRITE_iTXt_SUPPORTED # endif # ifndef PNG_iTXt_SUPPORTED # define PNG_iTXt_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_oFFs # define PNG_WRITE_oFFs_SUPPORTED # ifndef PNG_oFFs_SUPPORTED # define PNG_oFFs_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_pCAL # define PNG_WRITE_pCAL_SUPPORTED # ifndef PNG_pCAL_SUPPORTED # define PNG_pCAL_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_sCAL # define PNG_WRITE_sCAL_SUPPORTED # ifndef PNG_sCAL_SUPPORTED # define PNG_sCAL_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_pHYs # define PNG_WRITE_pHYs_SUPPORTED # ifndef PNG_pHYs_SUPPORTED # define PNG_pHYs_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_sBIT # define PNG_WRITE_sBIT_SUPPORTED # ifndef PNG_sBIT_SUPPORTED # define PNG_sBIT_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_sPLT # define PNG_WRITE_sPLT_SUPPORTED # ifndef PNG_sPLT_SUPPORTED # define PNG_sPLT_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_sRGB # define PNG_WRITE_sRGB_SUPPORTED # ifndef PNG_sRGB_SUPPORTED # define PNG_sRGB_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_tEXt # define PNG_WRITE_tEXt_SUPPORTED # ifndef PNG_tEXt_SUPPORTED # define PNG_tEXt_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_tIME # define PNG_WRITE_tIME_SUPPORTED # ifndef PNG_tIME_SUPPORTED # define PNG_tIME_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_tRNS # define PNG_WRITE_tRNS_SUPPORTED # ifndef PNG_tRNS_SUPPORTED # define PNG_tRNS_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_zTXt # define PNG_WRITE_zTXt_SUPPORTED # ifndef PNG_zTXt_SUPPORTED # define PNG_zTXt_SUPPORTED # endif #endif #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS # define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED # define PNG_UNKNOWN_CHUNKS_SUPPORTED # endif # ifndef PNG_NO_HANDLE_AS_UNKNOWN # ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED # endif # endif #endif #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ defined(PNG_WRITE_zTXt_SUPPORTED) # define PNG_WRITE_TEXT_SUPPORTED # ifndef PNG_TEXT_SUPPORTED # define PNG_TEXT_SUPPORTED # endif #endif #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ /* Turn this off to disable png_read_png() and * png_write_png() and leave the row_pointers member * out of the info structure. */ #ifndef PNG_NO_INFO_IMAGE # define PNG_INFO_IMAGE_SUPPORTED #endif /* need the time information for reading tIME chunks */ #if defined(PNG_tIME_SUPPORTED) # if !defined(_WIN32_WCE) /* "time.h" functions are not supported on WindowsCE */ # include <time.h> # endif #endif /* Some typedefs to get us started. These should be safe on most of the * common platforms. The typedefs should be at least as large as the * numbers suggest (a png_uint_32 must be at least 32 bits long), but they * don't have to be exactly that size. Some compilers dislike passing * unsigned shorts as function parameters, so you may be better off using * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may * want to have unsigned int for png_uint_32 instead of unsigned long. */ typedef unsigned long png_uint_32; typedef long png_int_32; typedef unsigned short png_uint_16; typedef short png_int_16; typedef unsigned char png_byte; /* This is usually size_t. It is typedef'ed just in case you need it to change (I'm not sure if you will or not, so I thought I'd be safe) */ #ifdef PNG_SIZE_T typedef PNG_SIZE_T png_size_t; # define png_sizeof(x) png_convert_size(sizeof (x)) #else typedef size_t png_size_t; # define png_sizeof(x) sizeof (x) #endif /* The following is needed for medium model support. It cannot be in the * PNG_INTERNAL section. Needs modification for other compilers besides * MSC. Model independent support declares all arrays and pointers to be * large using the far keyword. The zlib version used must also support * model independent data. As of version zlib 1.0.4, the necessary changes * have been made in zlib. The USE_FAR_KEYWORD define triggers other * changes that are needed. (Tim Wegner) */ /* Separate compiler dependencies (problem here is that zlib.h always defines FAR. (SJT) */ #ifdef __BORLANDC__ # if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) # define LDATA 1 # else # define LDATA 0 # endif /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ # if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) # define PNG_MAX_MALLOC_64K # if (LDATA != 1) # ifndef FAR # define FAR __far # endif # define USE_FAR_KEYWORD # endif /* LDATA != 1 */ /* Possibly useful for moving data out of default segment. * Uncomment it if you want. Could also define FARDATA as * const if your compiler supports it. (SJT) # define FARDATA FAR */ # endif /* __WIN32__, __FLAT__, __CYGWIN__ */ #endif /* __BORLANDC__ */ /* Suggest testing for specific compiler first before testing for * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, * making reliance oncertain keywords suspect. (SJT) */ /* MSC Medium model */ #if defined(FAR) # if defined(M_I86MM) # define USE_FAR_KEYWORD # define FARDATA FAR # include <dos.h> # endif #endif /* SJT: default case */ #ifndef FAR # define FAR #endif /* At this point FAR is always defined */ #ifndef FARDATA # define FARDATA #endif /* Typedef for floating-point numbers that are converted to fixed-point with a multiple of 100,000, e.g., int_gamma */ typedef png_int_32 png_fixed_point; /* Add typedefs for pointers */ typedef void FAR * png_voidp; typedef png_byte FAR * png_bytep; typedef png_uint_32 FAR * png_uint_32p; typedef png_int_32 FAR * png_int_32p; typedef png_uint_16 FAR * png_uint_16p; typedef png_int_16 FAR * png_int_16p; typedef PNG_CONST char FAR * png_const_charp; typedef char FAR * png_charp; typedef png_fixed_point FAR * png_fixed_point_p; #ifndef PNG_NO_STDIO #if defined(_WIN32_WCE) typedef HANDLE png_FILE_p; #else typedef FILE * png_FILE_p; #endif #endif #ifdef PNG_FLOATING_POINT_SUPPORTED typedef double FAR * png_doublep; #endif /* Pointers to pointers; i.e. arrays */ typedef png_byte FAR * FAR * png_bytepp; typedef png_uint_32 FAR * FAR * png_uint_32pp; typedef png_int_32 FAR * FAR * png_int_32pp; typedef png_uint_16 FAR * FAR * png_uint_16pp; typedef png_int_16 FAR * FAR * png_int_16pp; typedef PNG_CONST char FAR * FAR * png_const_charpp; typedef char FAR * FAR * png_charpp; typedef png_fixed_point FAR * FAR * png_fixed_point_pp; #ifdef PNG_FLOATING_POINT_SUPPORTED typedef double FAR * FAR * png_doublepp; #endif /* Pointers to pointers to pointers; i.e., pointer to array */ typedef char FAR * FAR * FAR * png_charppp; #if defined(PNG_1_0_X) || defined(PNG_1_2_X) /* SPC - Is this stuff deprecated? */ /* It'll be removed as of libpng-1.3.0 - GR-P */ /* libpng typedefs for types in zlib. If zlib changes * or another compression library is used, then change these. * Eliminates need to change all the source files. */ typedef charf * png_zcharp; typedef charf * FAR * png_zcharpp; typedef z_stream FAR * png_zstreamp; #endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */ /* * Define PNG_BUILD_DLL if the module being built is a Windows * LIBPNG DLL. * * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL. * It is equivalent to Microsoft predefined macro _DLL that is * automatically defined when you compile using the share * version of the CRT (C Run-Time library) * * The cygwin mods make this behavior a little different: * Define PNG_BUILD_DLL if you are building a dll for use with cygwin * Define PNG_STATIC if you are building a static library for use with cygwin, * -or- if you are building an application that you want to link to the * static library. * PNG_USE_DLL is defined by default (no user action needed) unless one of * the other flags is defined. */ #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL)) # define PNG_DLL #endif /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib. * When building a static lib, default to no GLOBAL ARRAYS, but allow * command-line override */ #if defined(__CYGWIN__) # if !defined(PNG_STATIC) # if defined(PNG_USE_GLOBAL_ARRAYS) # undef PNG_USE_GLOBAL_ARRAYS # endif # if !defined(PNG_USE_LOCAL_ARRAYS) # define PNG_USE_LOCAL_ARRAYS # endif # else # if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS) # if defined(PNG_USE_GLOBAL_ARRAYS) # undef PNG_USE_GLOBAL_ARRAYS # endif # endif # endif # if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) # define PNG_USE_LOCAL_ARRAYS # endif #endif /* Do not use global arrays (helps with building DLL's) * They are no longer used in libpng itself, since version 1.0.5c, * but might be required for some pre-1.0.5c applications. */ #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) # if defined(PNG_NO_GLOBAL_ARRAYS) || \ (defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER) # define PNG_USE_LOCAL_ARRAYS # else # define PNG_USE_GLOBAL_ARRAYS # endif #endif #if defined(__CYGWIN__) # undef PNGAPI # define PNGAPI __cdecl # undef PNG_IMPEXP # define PNG_IMPEXP #endif /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", * you may get warnings regarding the linkage of png_zalloc and png_zfree. * Don't ignore those warnings; you must also reset the default calling * convention in your compiler to match your PNGAPI, and you must build * zlib and your applications the same way you build libpng. */ #if defined(__MINGW32__) && !defined(PNG_MODULEDEF) # ifndef PNG_NO_MODULEDEF # define PNG_NO_MODULEDEF # endif #endif #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF) # define PNG_IMPEXP #endif #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ (( defined(_Windows) || defined(_WINDOWS) || \ defined(WIN32) || defined(_WIN32) || defined(__WIN32__) )) # ifndef PNGAPI # if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) # define PNGAPI __cdecl # else # define PNGAPI _cdecl # endif # endif # if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */) # define PNG_IMPEXP # endif # if !defined(PNG_IMPEXP) # define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol # define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol /* Borland/Microsoft */ # if defined(_MSC_VER) || defined(__BORLANDC__) # if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) # define PNG_EXPORT PNG_EXPORT_TYPE1 # else # define PNG_EXPORT PNG_EXPORT_TYPE2 # if defined(PNG_BUILD_DLL) # define PNG_IMPEXP __export # else # define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */ # endif /* Exists in Borland C++ for C++ classes (== huge) */ # endif # endif # if !defined(PNG_IMPEXP) # if defined(PNG_BUILD_DLL) # define PNG_IMPEXP __declspec(dllexport) # else # define PNG_IMPEXP __declspec(dllimport) # endif # endif # endif /* PNG_IMPEXP */ #else /* !(DLL || non-cygwin WINDOWS) */ # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) # ifndef PNGAPI # define PNGAPI _System # endif # else # if 0 /* ... other platforms, with other meanings */ # endif # endif #endif #ifndef PNGAPI # define PNGAPI #endif #ifndef PNG_IMPEXP # define PNG_IMPEXP #endif #ifdef PNG_BUILDSYMS # ifndef PNG_EXPORT # define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END # endif # ifdef PNG_USE_GLOBAL_ARRAYS # ifndef PNG_EXPORT_VAR # define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT # endif # endif #endif #ifndef PNG_EXPORT # define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol #endif #ifdef PNG_USE_GLOBAL_ARRAYS # ifndef PNG_EXPORT_VAR # define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type # endif #endif /* User may want to use these so they are not in PNG_INTERNAL. Any library * functions that are passed far data must be model independent. */ #ifndef PNG_ABORT # define PNG_ABORT() abort() #endif #ifdef PNG_SETJMP_SUPPORTED # define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) #else # define png_jmpbuf(png_ptr) \ (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED) #endif #if defined(USE_FAR_KEYWORD) /* memory model independent fns */ /* use this to make far-to-near assignments */ # define CHECK 1 # define NOCHECK 0 # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) # define png_snprintf _fsnprintf /* Added to v 1.2.19 */ # define png_strlen _fstrlen # define png_memcmp _fmemcmp /* SJT: added */ # define png_memcpy _fmemcpy # define png_memset _fmemset #else /* use the usual functions */ # define CVT_PTR(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr) # ifndef PNG_NO_SNPRINTF # ifdef _MSC_VER # define png_snprintf _snprintf /* Added to v 1.2.19 */ # define png_snprintf2 _snprintf # define png_snprintf6 _snprintf # else # define png_snprintf snprintf /* Added to v 1.2.19 */ # define png_snprintf2 snprintf # define png_snprintf6 snprintf # endif # else /* You don't have or don't want to use snprintf(). Caution: Using * sprintf instead of snprintf exposes your application to accidental * or malevolent buffer overflows. If you don't have snprintf() * as a general rule you should provide one (you can get one from * Portable OpenSSH). */ # define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1) # define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2) # define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) # endif # define png_strlen strlen # define png_memcmp memcmp /* SJT: added */ # define png_memcpy memcpy # define png_memset memset #endif /* End of memory model independent support */ /* Just a little check that someone hasn't tried to define something * contradictory. */ #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) # undef PNG_ZBUF_SIZE # define PNG_ZBUF_SIZE 65536L #endif /* Added at libpng-1.2.8 */ #endif /* PNG_VERSION_INFO_ONLY */ #endif /* PNGCONF_H */
118-c-c-installer
trunk/source/pngconf.h
C
gpl2
46,173
// by oggzee #include <ogcsys.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <malloc.h> #include <stdio.h> #include <ctype.h> //#include <libgen.h> #include <errno.h> #include <sys/stat.h> #include "console.h" //#include "menu.h" #include "util.h" /* extern void* SYS_GetArena2Lo(); extern void* SYS_GetArena2Hi(); extern void* SYS_AllocArena2MemLo(u32 size,u32 align); extern void* __SYS_GetIPCBufferLo(); extern void* __SYS_GetIPCBufferHi(); static void *mem2_start = NULL; */ char* strcopy(char *dest, const char *src, int size) { strncpy(dest,src,size); dest[size-1] = 0; return dest; } char *strappend(char *dest, char *src, int size) { int len = strlen(dest); strcopy(dest+len, src, size-len); return dest; } bool str_replace(char *str, char *olds, char *news, int size) { char *p; int len; p = strstr(str, olds); if (!p) return false; // new len len = strlen(str) - strlen(olds) + strlen(news); // check size if (len >= size) return false; // move remainder to fit (and nul) memmove(p+strlen(news), p+strlen(olds), strlen(p)-strlen(olds)+1); // copy new in place memcpy(p, news, strlen(news)); // terminate str[len] = 0; return true; } bool str_replace_all(char *str, char *olds, char *news, int size) { int cnt = 0; bool ret = str_replace(str, olds, news, size); while (ret) { ret = str_replace(str, olds, news, size); cnt++; } return (cnt > 0); } //bool str_replace_tag_val(char *str, char *tag, char *val) //{ // char *p, *end; // p = strstr(str, tag); // if (!p) return false; // p += strlen(tag); // end = strstr(p, "</"); // if (!end) return false; // dbg_printf("%s '%.*s' -> '%s'\n", tag, end-p, p, val); // // make space for new val // memmove(p+strlen(val), end, strlen(end)+1); // +1 for 0 termination // // copy over new val // memcpy(p, val, strlen(val)); // return true; //} #if 0 void* LARGE_memalign(size_t align, size_t size) { return SYS_AllocArena2MemLo(size, align); } void LARGE_free(void *ptr) { // nothing } size_t LARGE_used() { size_t size = SYS_GetArena2Lo() - (void*)0x90000000; return size; } void memstat2() { void *m2base = (void*)0x90000000; void *m2lo = SYS_GetArena2Lo(); void *m2hi = SYS_GetArena2Hi(); void *ipclo = __SYS_GetIPCBufferLo(); void *ipchi = __SYS_GetIPCBufferHi(); size_t isize = ipchi - ipclo; printf("\n"); printf("MEM2: %p %p %p\n", m2base, m2lo, m2hi); printf("s:%d u:%d f:%d\n", m2hi - m2base, m2lo - m2base, m2hi - m2lo); printf("s:%.2f MB u:%.2f MB f:%.2f MB\n", (float)(m2hi - m2base)/1024/1024, (float)(m2lo - m2base)/1024/1024, (float)(m2hi - m2lo)/1024/1024); printf("IPC: %p %p %d\n", ipclo, ipchi, isize); } // save M2 ptr void util_init() { void _con_alloc_buf(s32 *conW, s32 *conH); _con_alloc_buf(NULL, NULL); mem2_start = SYS_GetArena2Lo(); } void util_clear() { // game start: 0x80004000 // game end: 0x80a00000 approx void *game_start = (void*)0x80004000; void *game_end = (void*)0x80a00000; u32 size; // clear mem1 main size = game_end - game_start; //printf("Clear %p [%x]\n", game_start, size); __console_flush(0); memset(game_start, 0, size); DCFlushRange(game_start, size); // clear mem2 if (mem2_start == NULL) return; size = SYS_GetArena2Lo() - mem2_start; //printf("Clear %p [%x]\n", mem2_start, size); __console_flush(0); sleep(2); memset(mem2_start, 0, size); DCFlushRange(mem2_start, size); // clear mem1 heap // find appropriate size void *p; for (size = 10*1024*1024; size > 0; size -= 128*1024) { p = memalign(32, size); if (p) { //printf("Clear %p [%x] %p\n", p, size, p+size); //__console_flush(0); sleep(2); memset(p, 0, size); DCFlushRange(p, size); free(p); break; } } } #endif // Thanks Dteyn for this nice feature =) // Toggle wiilight (thanks Bool for wiilight source) void wiilight(int enable) { static vu32 *_wiilight_reg = (u32*)0xCD0000C0; u32 val = (*_wiilight_reg&~0x20); if(enable) val |= 0x20; *_wiilight_reg=val; } int mbs_len(char *s) { int count, n; for (count = 0; *s; count++) { n = mblen(s, 4); if (n < 0) { // invalid char, ignore n = 1; } s += n; } return count; } int mbs_len_valid(char *s) { int count, n; for (count = 0; *s; count++) { n = mblen(s, 4); if (n < 0) { // invalid char, stop break; } s += n; } return count; } char *mbs_copy(char *dest, char *src, int size) { char *s; int n; strcopy(dest, src, size); s = dest; while (*s) { n = mblen(s, 4); if (n < 0) { // invalid char, stop *s = 0; break; } s += n; } return dest; } bool mbs_trunc(char *mbs, int n) { int len = mbs_len(mbs); if (len <= n) return false; int slen = strlen(mbs); wchar_t wbuf[n+1]; wbuf[0] = 0; mbstowcs(wbuf, mbs, n); wbuf[n] = 0; wcstombs(mbs, wbuf, slen+1); return true; } char *mbs_align(const char *str, int n) { static char strbuf[100]; if (strlen(str) >= sizeof(strbuf) || n >= sizeof(strbuf)) return (char*)str; // fill with space memset(strbuf, ' ', sizeof(strbuf)); // overwrite with str, keeping trailing space memcpy(strbuf, str, strlen(str)); // terminate strbuf[sizeof(strbuf)-1] = 0; // truncate multibyte string mbs_trunc(strbuf, n); return strbuf; } int mbs_coll(char *a, char *b) { //int lena = strlen(a); //int lenb = strlen(b); int lena = mbs_len_valid(a); int lenb = mbs_len_valid(b); wchar_t wa[lena+1]; wchar_t wb[lenb+1]; int wlen, i; int sa, sb, x; wlen = mbstowcs(wa, a, lena); wa[wlen>0?wlen:0] = 0; wlen = mbstowcs(wb, b, lenb); wb[wlen>0?wlen:0] = 0; for (i=0; wa[i] || wb[i]; i++) { sa = wa[i]; if ((unsigned)sa < MAX_USORT_MAP) sa = usort_map[sa]; sb = wb[i]; if ((unsigned)sb < MAX_USORT_MAP) sb = usort_map[sb]; x = sa - sb; if (x) return x; } return 0; } int con_char_len(int c) { return 1; /*int cc; int len; if (c < 512) return 1; cc = map_ufont(c); if (cc != 0) return 1; if (c < 0 || c > 0xFFFF) return 1; if (unifont == NULL) return 1; len = unifont->index[c] & 0x0F; if (len < 1) return 1; if (len > 2) return 2; return len;*/ } int con_len(char *s) { int i, len = 0; int n = mbs_len(s); wchar_t wbuf[n+1]; wbuf[0] = 0; mbstowcs(wbuf, s, n); wbuf[n] = 0; for (i=0; i<n; i++) { len += con_char_len(wbuf[i]); } return len; } bool con_trunc(char *s, int n) { int slen = strlen(s); int i, len = 0; wchar_t wbuf[n+1]; wbuf[0] = 0; mbstowcs(wbuf, s, n); wbuf[n] = 0; for (i=0; i<n; i++) { len += con_char_len(wbuf[i]); if (len > n) break; } wbuf[i] = 0; // terminate; wcstombs(s, wbuf, slen+1); return (len > n); // true if truncated } char *con_align(const char *str, int n) { static char strbuf[100]; if (strlen(str) >= sizeof(strbuf) || n >= sizeof(strbuf)) return (char*)str; // fill with space memset(strbuf, ' ', sizeof(strbuf)); // overwrite with str, keeping trailing space memcpy(strbuf, str, strlen(str)); // terminate strbuf[sizeof(strbuf)-1] = 0; // truncate multibyte string con_trunc(strbuf, n); while (con_len(strbuf) < n) strcat(strbuf, " "); return strbuf; } /*int map_ufont(int c) { int i; if ((unsigned)c < 512) return c; for (i=0; ufont_map[i]; i+=2) { if (ufont_map[i] == c) return ufont_map[i+1]; } return 0; }*/ // FFx y AABB void hex_dump1(void *p, int size) { char *c = p; int i; for (i=0; i<size; i++) { unsigned cc = (unsigned char)c[i]; if (cc < 32 || cc > 128) { printf("%02x", cc); } else { printf("%c ", cc); } } } // FF 40 41 AA BB | .xy.. void hex_dump2(void *p, int size) { int i = 0, j, x = 12; char *c = p; printf("\n"); while (i<size) { printf("%02x ", i); for (j=0; j<x && i+j<size; j++) printf("%02x", (int)c[i+j]); printf(" |"); for (j=0; j<x && i+j<size; j++) { unsigned cc = (unsigned char)c[i+j]; if (cc < 32 || cc > 128) cc = '.'; printf("%c", cc); } printf("|\n"); i += x; } } // FF4041AABB void hex_dump3(void *p, int size) { int i = 0, j, x = 16; char *c = p; while (i<size) { printf_(""); for (j=0; j<x && i+j<size; j++) printf("%02x", (int)c[i+j]); printf("\n"); i += x; } } #if 0 void memstat() { //malloc_stats(); } void memcheck() { //mallinfo(); } #endif /* Copyright 2005 Shaun Jackman * Permission to use, copy, modify, and distribute this software * is freely granted, provided that this notice is preserved. */ //This code from dirname.c, meant to be part of libgen, modified by Clipper char* dirname(char *path) { char *p; if( path == NULL || *path == '\0' ) return "."; p = path + strlen(path) - 1; while( *p == '/' ) { if( p == path ) return path; *p-- = '\0'; } while( p >= path && *p != '/' ) p--; return p < path ? "." : p == path ? "/" : *(p-1) == ':' ? "/" : (*p = '\0', path); } //#include "wpad.h" // code modified from http://niallohiggins.com/2009/01/08/mkpath-mkdir-p-alike-in-c-for-unix/ int mkpath(const char *s, int mode){ char *up, *path; int rv; rv = -1; if (strcmp(s, ".") == 0 || strcmp(s, "/") == 0) return (0); if ((path = strdup(s)) == NULL) return -1; if ((up = dirname(path)) == NULL) goto out; if ((mkpath(up, mode) == -1) && (errno != EEXIST)) goto out; if ((mkdir(s, mode) == -1) && (errno != EEXIST)) rv = -1; else rv = 0; out: if (path != NULL) SAFE_FREE(path); return (rv); }
118-c-c-installer
trunk/source/util.c
C
gpl2
9,922
/* png.h - header file for PNG reference library * * libpng version 1.2.29 - May 8, 2008 * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.97, January 1998, through 1.2.29 - May 8, 2008: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: * * Due to various miscommunications, unforeseen code incompatibilities * and occasional factors outside the authors' control, version numbering * on the library has not always been consistent and straightforward. * The following table summarizes matters since version 0.89c, which was * the first widely used release: * * source png.h png.h shared-lib * version string int version * ------- ------ ----- ---------- * 0.89c "1.0 beta 3" 0.89 89 1.0.89 * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] * 0.97c 0.97 97 2.0.97 * 0.98 0.98 98 2.0.98 * 0.99 0.99 98 2.0.99 * 0.99a-m 0.99 99 2.0.99 * 1.00 1.00 100 2.1.0 [100 should be 10000] * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] * 1.0.1 png.h string is 10001 2.1.0 * 1.0.1a-e identical to the 10002 from here on, the shared library * 1.0.2 source version) 10002 is 2.V where V is the source code * 1.0.2a-b 10003 version, except as noted. * 1.0.3 10003 * 1.0.3a-d 10004 * 1.0.4 10004 * 1.0.4a-f 10005 * 1.0.5 (+ 2 patches) 10005 * 1.0.5a-d 10006 * 1.0.5e-r 10100 (not source compatible) * 1.0.5s-v 10006 (not binary compatible) * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) * 1.0.6d-f 10007 (still binary incompatible) * 1.0.6g 10007 * 1.0.6h 10007 10.6h (testing xy.z so-numbering) * 1.0.6i 10007 10.6i * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) * 1.0.7 1 10007 (still compatible) * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 * 1.0.8rc1 1 10008 2.1.0.8rc1 * 1.0.8 1 10008 2.1.0.8 * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 * 1.0.9rc1 1 10009 2.1.0.9rc1 * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 * 1.0.9rc2 1 10009 2.1.0.9rc2 * 1.0.9 1 10009 2.1.0.9 * 1.0.10beta1 1 10010 2.1.0.10beta1 * 1.0.10rc1 1 10010 2.1.0.10rc1 * 1.0.10 1 10010 2.1.0.10 * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 * 1.0.11rc1 1 10011 2.1.0.11rc1 * 1.0.11 1 10011 2.1.0.11 * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 * 1.0.12rc1 2 10012 2.1.0.12rc1 * 1.0.12 2 10012 2.1.0.12 * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned) * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 * 1.2.0rc1 3 10200 3.1.2.0rc1 * 1.2.0 3 10200 3.1.2.0 * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4 * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 * 1.2.1 3 10201 3.1.2.1 * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 * 1.0.13 10 10013 10.so.0.1.0.13 * 1.2.2 12 10202 12.so.0.1.2.2 * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 * 1.2.3 12 10203 12.so.0.1.2.3 * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1 * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 * 1.0.14 10 10014 10.so.0.1.0.14 * 1.2.4 13 10204 12.so.0.1.2.4 * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3 * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3 * 1.0.15 10 10015 10.so.0.1.0.15 * 1.2.5 13 10205 12.so.0.1.2.5 * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 * 1.0.16 10 10016 10.so.0.1.0.16 * 1.2.6 13 10206 12.so.0.1.2.6 * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 * 1.0.17rc1 10 10017 10.so.0.1.0.17rc1 * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 * 1.0.17 10 10017 10.so.0.1.0.17 * 1.2.7 13 10207 12.so.0.1.2.7 * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5 * 1.0.18rc1-5 10 10018 10.so.0.1.0.18rc1-5 * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5 * 1.0.18 10 10018 10.so.0.1.0.18 * 1.2.8 13 10208 12.so.0.1.2.8 * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3 * 1.2.9beta4-11 13 10209 12.so.0.9[.0] * 1.2.9rc1 13 10209 12.so.0.9[.0] * 1.2.9 13 10209 12.so.0.9[.0] * 1.2.10beta1-8 13 10210 12.so.0.10[.0] * 1.2.10rc1-3 13 10210 12.so.0.10[.0] * 1.2.10 13 10210 12.so.0.10[.0] * 1.2.11beta1-4 13 10211 12.so.0.11[.0] * 1.0.19rc1-5 10 10019 10.so.0.19[.0] * 1.2.11rc1-5 13 10211 12.so.0.11[.0] * 1.0.19 10 10019 10.so.0.19[.0] * 1.2.11 13 10211 12.so.0.11[.0] * 1.0.20 10 10020 10.so.0.20[.0] * 1.2.12 13 10212 12.so.0.12[.0] * 1.2.13beta1 13 10213 12.so.0.13[.0] * 1.0.21 10 10021 10.so.0.21[.0] * 1.2.13 13 10213 12.so.0.13[.0] * 1.2.14beta1-2 13 10214 12.so.0.14[.0] * 1.0.22rc1 10 10022 10.so.0.22[.0] * 1.2.14rc1 13 10214 12.so.0.14[.0] * 1.0.22 10 10022 10.so.0.22[.0] * 1.2.14 13 10214 12.so.0.14[.0] * 1.2.15beta1-6 13 10215 12.so.0.15[.0] * 1.0.23rc1-5 10 10023 10.so.0.23[.0] * 1.2.15rc1-5 13 10215 12.so.0.15[.0] * 1.0.23 10 10023 10.so.0.23[.0] * 1.2.15 13 10215 12.so.0.15[.0] * 1.2.16beta1-2 13 10216 12.so.0.16[.0] * 1.2.16rc1 13 10216 12.so.0.16[.0] * 1.0.24 10 10024 10.so.0.24[.0] * 1.2.16 13 10216 12.so.0.16[.0] * 1.2.17beta1-2 13 10217 12.so.0.17[.0] * 1.0.25rc1 10 10025 10.so.0.25[.0] * 1.2.17rc1-3 13 10217 12.so.0.17[.0] * 1.0.25 10 10025 10.so.0.25[.0] * 1.2.17 13 10217 12.so.0.17[.0] * 1.0.26 10 10026 10.so.0.26[.0] * 1.2.18 13 10218 12.so.0.18[.0] * 1.2.19beta1-31 13 10219 12.so.0.19[.0] * 1.0.27rc1-6 10 10027 10.so.0.27[.0] * 1.2.19rc1-6 13 10219 12.so.0.19[.0] * 1.0.27 10 10027 10.so.0.27[.0] * 1.2.19 13 10219 12.so.0.19[.0] * 1.2.20beta01-04 13 10220 12.so.0.20[.0] * 1.0.28rc1-6 10 10028 10.so.0.28[.0] * 1.2.20rc1-6 13 10220 12.so.0.20[.0] * 1.0.28 10 10028 10.so.0.28[.0] * 1.2.20 13 10220 12.so.0.20[.0] * 1.2.21beta1-2 13 10221 12.so.0.21[.0] * 1.2.21rc1-3 13 10221 12.so.0.21[.0] * 1.0.29 10 10029 10.so.0.29[.0] * 1.2.21 13 10221 12.so.0.21[.0] * 1.2.22beta1-4 13 10222 12.so.0.22[.0] * 1.0.30rc1 10 10030 10.so.0.30[.0] * 1.2.22rc1 13 10222 12.so.0.22[.0] * 1.0.30 10 10030 10.so.0.30[.0] * 1.2.22 13 10222 12.so.0.22[.0] * 1.2.23beta01-05 13 10223 12.so.0.23[.0] * 1.2.23rc01 13 10223 12.so.0.23[.0] * 1.2.23 13 10223 12.so.0.23[.0] * 1.2.24beta01-02 13 10224 12.so.0.24[.0] * 1.2.24rc01 13 10224 12.so.0.24[.0] * 1.2.24 13 10224 12.so.0.24[.0] * 1.2.25beta01-06 13 10225 12.so.0.25[.0] * 1.2.25rc01-02 13 10225 12.so.0.25[.0] * 1.0.31 10 10031 10.so.0.31[.0] * 1.2.25 13 10225 12.so.0.25[.0] * 1.2.26beta01-06 13 10226 12.so.0.26[.0] * 1.2.26rc01 13 10226 12.so.0.26[.0] * 1.2.26 13 10226 12.so.0.26[.0] * 1.0.32 10 10032 10.so.0.32[.0] * 1.2.27beta01-06 13 10227 12.so.0.27[.0] * 1.2.27rc01 13 10227 12.so.0.27[.0] * 1.0.33 10 10033 10.so.0.33[.0] * 1.2.27 13 10227 12.so.0.27[.0] * 1.0.34 10 10034 10.so.0.34[.0] * 1.2.28 13 10228 12.so.0.28[.0] * 1.2.29beta01-03 13 10229 12.so.0.29[.0] * 1.2.29rc01 13 10229 12.so.0.29[.0] * 1.0.35 10 10035 10.so.0.35[.0] * 1.2.29 13 10229 12.so.0.29[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be * used for changes in backward compatibility, as it is intended. The * PNG_LIBPNG_VER macro, which is not used within libpng but is available * for applications, is an unsigned integer of the form xyyzz corresponding * to the source version x.y.z (leading zeros in y and z). Beta versions * were given the previous public release number plus a letter, until * version 1.0.6j; from then on they were given the upcoming public * release number plus "betaNN" or "rcNN". * * Binary incompatibility exists only when applications make direct access * to the info_ptr or png_ptr members through png.h, and the compiled * application is loaded with a different version of the library. * * DLLNUM will change each time there are forward or backward changes * in binary compatibility (e.g., when a new feature is added). * * See libpng.txt or libpng.3 for more information. The PNG specification * is available as a W3C Recommendation and as an ISO Specification, * <http://www.w3.org/TR/2003/REC-PNG-20031110/ */ /* * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: * * If you modify libpng you may insert additional notices immediately following * this sentence. * * libpng versions 1.2.6, August 15, 2004, through 1.2.29, May 8, 2008, are * Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: * * Cosmin Truta * * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.0.6 * with the following individuals added to the list of Contributing Authors: * * Simon-Pierre Cadieux * Eric S. Raymond * Gilles Vollant * * and with the following additions to the disclaimer: * * There is no warranty against interference with your enjoyment of the * library or against infringement. There is no warranty that our * efforts or the library will fulfill any of your particular purposes * or needs. This library is provided with all faults, and the entire * risk of satisfactory quality, performance, accuracy, and effort is with * the user. * * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-0.96, * with the following individuals added to the list of Contributing Authors: * * Tom Lane * Glenn Randers-Pehrson * Willem van Schaik * * libpng versions 0.89, June 1996, through 0.96, May 1997, are * Copyright (c) 1996, 1997 Andreas Dilger * Distributed according to the same disclaimer and license as libpng-0.88, * with the following individuals added to the list of Contributing Authors: * * John Bowler * Kevin Bracey * Sam Bushell * Magnus Holmgren * Greg Roelofs * Tom Tanner * * libpng versions 0.5, May 1995, through 0.88, January 1996, are * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * * For the purposes of this copyright and license, "Contributing Authors" * is defined as the following set of individuals: * * Andreas Dilger * Dave Martindale * Guy Eric Schalnat * Paul Schmidt * Tim Wegner * * The PNG Reference Library is supplied "AS IS". The Contributing Authors * and Group 42, Inc. disclaim all warranties, expressed or implied, * including, without limitation, the warranties of merchantability and of * fitness for any purpose. The Contributing Authors and Group 42, Inc. * assume no liability for direct, indirect, incidental, special, exemplary, * or consequential damages, which may result from the use of the PNG * Reference Library, even if advised of the possibility of such damage. * * Permission is hereby granted to use, copy, modify, and distribute this * source code, or portions hereof, for any purpose, without fee, subject * to the following restrictions: * * 1. The origin of this source code must not be misrepresented. * * 2. Altered versions must be plainly marked as such and * must not be misrepresented as being the original source. * * 3. This Copyright notice may not be removed or altered from * any source or altered source distribution. * * The Contributing Authors and Group 42, Inc. specifically permit, without * fee, and encourage the use of this source code as a component to * supporting the PNG file format in commercial products. If you use this * source code in a product, acknowledgment is not required but would be * appreciated. */ /* * A "png_get_copyright" function is available, for convenient use in "about" * boxes and the like: * * printf("%s",png_get_copyright(NULL)); * * Also, the PNG logo (in PNG format, of course) is supplied in the * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). */ /* * Libpng is OSI Certified Open Source Software. OSI Certified is a * certification mark of the Open Source Initiative. */ /* * The contributing authors would like to thank all those who helped * with testing, bug fixes, and patience. This wouldn't have been * possible without all of you. * * Thanks to Frank J. T. Wojcik for helping with the documentation. */ /* * Y2K compliance in libpng: * ========================= * * May 8, 2008 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and * upward through 1.2.29 are Y2K compliant. It is my belief that earlier * versions were also Y2K compliant. * * Libpng only has three year fields. One is a 2-byte unsigned integer * that will hold years up to 65535. The other two hold the date in text * format, and will hold years up to 9999. * * The integer is * "png_uint_16 year" in png_time_struct. * * The strings are * "png_charp time_buffer" in png_struct and * "near_time_buffer", which is a local character string in png.c. * * There are seven time-related functions: * png.c: png_convert_to_rfc_1123() in png.c * (formerly png_convert_to_rfc_1152() in error) * png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c * png_convert_from_time_t() in pngwrite.c * png_get_tIME() in pngget.c * png_handle_tIME() in pngrutil.c, called in pngread.c * png_set_tIME() in pngset.c * png_write_tIME() in pngwutil.c, called in pngwrite.c * * All handle dates properly in a Y2K environment. The * png_convert_from_time_t() function calls gmtime() to convert from system * clock time, which returns (year - 1900), which we properly convert to * the full 4-digit year. There is a possibility that applications using * libpng are not passing 4-digit years into the png_convert_to_rfc_1123() * function, or that they are incorrectly passing only a 2-digit year * instead of "year - 1900" into the png_convert_from_struct_tm() function, * but this is not under our control. The libpng documentation has always * stated that it works with 4-digit years, and the APIs have been * documented as such. * * The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned * integer to hold the year, and can hold years as large as 65535. * * zlib, upon which libpng depends, is also Y2K compliant. It contains * no date-related code. * * Glenn Randers-Pehrson * libpng maintainer * PNG Development Group */ #ifndef PNG_H #define PNG_H /* This is not the place to learn how to use libpng. The file libpng.txt * describes how to use libpng, and the file example.c summarizes it * with some code on which to build. This file is useful for looking * at the actual function definitions and structure components. */ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.2.29" #define PNG_HEADER_VERSION_STRING \ " libpng version 1.2.29 - May 8, 2008\n" #define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_DLLNUM 13 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 2 #define PNG_LIBPNG_VER_RELEASE 29 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ #define PNG_LIBPNG_VER_BUILD 0 /* Release Status */ #define PNG_LIBPNG_BUILD_ALPHA 1 #define PNG_LIBPNG_BUILD_BETA 2 #define PNG_LIBPNG_BUILD_RC 3 #define PNG_LIBPNG_BUILD_STABLE 4 #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7 /* Release-Specific Flags */ #define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with PNG_LIBPNG_BUILD_STABLE only */ #define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with PNG_LIBPNG_BUILD_SPECIAL */ #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with PNG_LIBPNG_BUILD_PRIVATE */ #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE /* Careful here. At one time, Guy wanted to use 082, but that would be octal. * We must not include leading zeros. * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ #define PNG_LIBPNG_VER 10229 /* 1.2.29 */ #ifndef PNG_VERSION_INFO_ONLY /* include the compression library's header */ #include "zlib.h" #endif /* include all user configurable info, including optional assembler routines */ #include "pngconf.h" /* * Added at libpng-1.2.8 */ /* Ref MSDN: Private as priority over Special * VS_FF_PRIVATEBUILD File *was not* built using standard release * procedures. If this value is given, the StringFileInfo block must * contain a PrivateBuild string. * * VS_FF_SPECIALBUILD File *was* built by the original company using * standard release procedures but is a variation of the standard * file of the same version number. If this value is given, the * StringFileInfo block must contain a SpecialBuild string. */ #if defined(PNG_USER_PRIVATEBUILD) # define PNG_LIBPNG_BUILD_TYPE \ (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE) #else # if defined(PNG_LIBPNG_SPECIALBUILD) # define PNG_LIBPNG_BUILD_TYPE \ (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL) # else # define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE) # endif #endif #ifndef PNG_VERSION_INFO_ONLY /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* This file is arranged in several sections. The first section contains * structure and type definitions. The second section contains the external * library functions, while the third has the internal library functions, * which applications aren't expected to use directly. */ #ifndef PNG_NO_TYPECAST_NULL #define int_p_NULL (int *)NULL #define png_bytep_NULL (png_bytep)NULL #define png_bytepp_NULL (png_bytepp)NULL #define png_doublep_NULL (png_doublep)NULL #define png_error_ptr_NULL (png_error_ptr)NULL #define png_flush_ptr_NULL (png_flush_ptr)NULL #define png_free_ptr_NULL (png_free_ptr)NULL #define png_infopp_NULL (png_infopp)NULL #define png_malloc_ptr_NULL (png_malloc_ptr)NULL #define png_read_status_ptr_NULL (png_read_status_ptr)NULL #define png_rw_ptr_NULL (png_rw_ptr)NULL #define png_structp_NULL (png_structp)NULL #define png_uint_16p_NULL (png_uint_16p)NULL #define png_voidp_NULL (png_voidp)NULL #define png_write_status_ptr_NULL (png_write_status_ptr)NULL #else #define int_p_NULL NULL #define png_bytep_NULL NULL #define png_bytepp_NULL NULL #define png_doublep_NULL NULL #define png_error_ptr_NULL NULL #define png_flush_ptr_NULL NULL #define png_free_ptr_NULL NULL #define png_infopp_NULL NULL #define png_malloc_ptr_NULL NULL #define png_read_status_ptr_NULL NULL #define png_rw_ptr_NULL NULL #define png_structp_NULL NULL #define png_uint_16p_NULL NULL #define png_voidp_NULL NULL #define png_write_status_ptr_NULL NULL #endif /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) /* Version information for C files, stored in png.c. This had better match * the version above. */ #ifdef PNG_USE_GLOBAL_ARRAYS PNG_EXPORT_VAR (PNG_CONST char) png_libpng_ver[18]; /* need room for 99.99.99beta99z */ #else #define png_libpng_ver png_get_header_ver(NULL) #endif #ifdef PNG_USE_GLOBAL_ARRAYS /* This was removed in version 1.0.5c */ /* Structures to facilitate easy interlacing. See png.c for more details */ PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_start[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_inc[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_ystart[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_yinc[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_mask[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_dsp_mask[7]; /* This isn't currently used. If you need it, see png.c for more details. PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_height[7]; */ #endif #endif /* PNG_NO_EXTERN */ /* Three color definitions. The order of the red, green, and blue, (and the * exact size) is not important, although the size of the fields need to * be png_byte or png_uint_16 (as defined below). */ typedef struct png_color_struct { png_byte red; png_byte green; png_byte blue; } png_color; typedef png_color FAR * png_colorp; typedef png_color FAR * FAR * png_colorpp; typedef struct png_color_16_struct { png_byte index; /* used for palette files */ png_uint_16 red; /* for use in red green blue files */ png_uint_16 green; png_uint_16 blue; png_uint_16 gray; /* for use in grayscale files */ } png_color_16; typedef png_color_16 FAR * png_color_16p; typedef png_color_16 FAR * FAR * png_color_16pp; typedef struct png_color_8_struct { png_byte red; /* for use in red green blue files */ png_byte green; png_byte blue; png_byte gray; /* for use in grayscale files */ png_byte alpha; /* for alpha channel files */ } png_color_8; typedef png_color_8 FAR * png_color_8p; typedef png_color_8 FAR * FAR * png_color_8pp; /* * The following two structures are used for the in-core representation * of sPLT chunks. */ typedef struct png_sPLT_entry_struct { png_uint_16 red; png_uint_16 green; png_uint_16 blue; png_uint_16 alpha; png_uint_16 frequency; } png_sPLT_entry; typedef png_sPLT_entry FAR * png_sPLT_entryp; typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp; /* When the depth of the sPLT palette is 8 bits, the color and alpha samples * occupy the LSB of their respective members, and the MSB of each member * is zero-filled. The frequency member always occupies the full 16 bits. */ typedef struct png_sPLT_struct { png_charp name; /* palette name */ png_byte depth; /* depth of palette samples */ png_sPLT_entryp entries; /* palette entries */ png_int_32 nentries; /* number of palette entries */ } png_sPLT_t; typedef png_sPLT_t FAR * png_sPLT_tp; typedef png_sPLT_t FAR * FAR * png_sPLT_tpp; #ifdef PNG_TEXT_SUPPORTED /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file, * and whether that contents is compressed or not. The "key" field * points to a regular zero-terminated C string. The "text", "lang", and * "lang_key" fields can be regular C strings, empty strings, or NULL pointers. * However, the * structure returned by png_get_text() will always contain * regular zero-terminated C strings (possibly empty), never NULL pointers, * so they can be safely used in printf() and other string-handling functions. */ typedef struct png_text_struct { int compression; /* compression value: -1: tEXt, none 0: zTXt, deflate 1: iTXt, none 2: iTXt, deflate */ png_charp key; /* keyword, 1-79 character description of "text" */ png_charp text; /* comment, may be an empty string (ie "") or a NULL pointer */ png_size_t text_length; /* length of the text string */ #ifdef PNG_iTXt_SUPPORTED png_size_t itxt_length; /* length of the itxt string */ png_charp lang; /* language code, 0-79 characters or a NULL pointer */ png_charp lang_key; /* keyword translated UTF-8 string, 0 or more chars or a NULL pointer */ #endif } png_text; typedef png_text FAR * png_textp; typedef png_text FAR * FAR * png_textpp; #endif /* Supported compression types for text in PNG files (tEXt, and zTXt). * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */ #define PNG_TEXT_COMPRESSION_NONE_WR -3 #define PNG_TEXT_COMPRESSION_zTXt_WR -2 #define PNG_TEXT_COMPRESSION_NONE -1 #define PNG_TEXT_COMPRESSION_zTXt 0 #define PNG_ITXT_COMPRESSION_NONE 1 #define PNG_ITXT_COMPRESSION_zTXt 2 #define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */ /* png_time is a way to hold the time in an machine independent way. * Two conversions are provided, both from time_t and struct tm. There * is no portable way to convert to either of these structures, as far * as I know. If you know of a portable way, send it to me. As a side * note - PNG has always been Year 2000 compliant! */ typedef struct png_time_struct { png_uint_16 year; /* full year, as in, 1995 */ png_byte month; /* month of year, 1 - 12 */ png_byte day; /* day of month, 1 - 31 */ png_byte hour; /* hour of day, 0 - 23 */ png_byte minute; /* minute of hour, 0 - 59 */ png_byte second; /* second of minute, 0 - 60 (for leap seconds) */ } png_time; typedef png_time FAR * png_timep; typedef png_time FAR * FAR * png_timepp; #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) /* png_unknown_chunk is a structure to hold queued chunks for which there is * no specific support. The idea is that we can use this to queue * up private chunks for output even though the library doesn't actually * know about their semantics. */ #define PNG_CHUNK_NAME_LENGTH 5 typedef struct png_unknown_chunk_t { png_byte name[PNG_CHUNK_NAME_LENGTH]; png_byte *data; png_size_t size; /* libpng-using applications should NOT directly modify this byte. */ png_byte location; /* mode of operation at read time */ } png_unknown_chunk; typedef png_unknown_chunk FAR * png_unknown_chunkp; typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp; #endif /* png_info is a structure that holds the information in a PNG file so * that the application can find out the characteristics of the image. * If you are reading the file, this structure will tell you what is * in the PNG file. If you are writing the file, fill in the information * you want to put into the PNG file, then call png_write_info(). * The names chosen should be very close to the PNG specification, so * consult that document for information about the meaning of each field. * * With libpng < 0.95, it was only possible to directly set and read the * the values in the png_info_struct, which meant that the contents and * order of the values had to remain fixed. With libpng 0.95 and later, * however, there are now functions that abstract the contents of * png_info_struct from the application, so this makes it easier to use * libpng with dynamic libraries, and even makes it possible to use * libraries that don't have all of the libpng ancillary chunk-handing * functionality. * * In any case, the order of the parameters in png_info_struct should NOT * be changed for as long as possible to keep compatibility with applications * that use the old direct-access method with png_info_struct. * * The following members may have allocated storage attached that should be * cleaned up before the structure is discarded: palette, trans, text, * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile, * splt_palettes, scal_unit, row_pointers, and unknowns. By default, these * are automatically freed when the info structure is deallocated, if they were * allocated internally by libpng. This behavior can be changed by means * of the png_data_freer() function. * * More allocation details: all the chunk-reading functions that * change these members go through the corresponding png_set_* * functions. A function to clear these members is available: see * png_free_data(). The png_set_* functions do not depend on being * able to point info structure members to any of the storage they are * passed (they make their own copies), EXCEPT that the png_set_text * functions use the same storage passed to them in the text_ptr or * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns * functions do not make their own copies. */ typedef struct png_info_struct { /* the following are necessary for every PNG file */ png_uint_32 width; /* width of image in pixels (from IHDR) */ png_uint_32 height; /* height of image in pixels (from IHDR) */ png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */ png_uint_32 rowbytes; /* bytes needed to hold an untransformed row */ png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */ png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */ png_uint_16 num_trans; /* number of transparent palette color (tRNS) */ png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */ png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */ /* The following three should have been named *_method not *_type */ png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */ png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */ png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ /* The following is informational only on read, and not used on writes. */ png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */ png_byte pixel_depth; /* number of bits per pixel */ png_byte spare_byte; /* to align the data, and for future use */ png_byte signature[8]; /* magic bytes read by libpng from start of file */ /* The rest of the data is optional. If you are reading, check the * valid field to see if the information in these are valid. If you * are writing, set the valid field to those chunks you want written, * and initialize the appropriate fields below. */ #if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) /* The gAMA chunk describes the gamma characteristics of the system * on which the image was created, normally in the range [1.0, 2.5]. * Data is valid if (valid & PNG_INFO_gAMA) is non-zero. */ float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */ #endif #if defined(PNG_sRGB_SUPPORTED) /* GR-P, 0.96a */ /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */ png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */ #endif #if defined(PNG_TEXT_SUPPORTED) /* The tEXt, and zTXt chunks contain human-readable textual data in * uncompressed, compressed, and optionally compressed forms, respectively. * The data in "text" is an array of pointers to uncompressed, * null-terminated C strings. Each chunk has a keyword that describes the * textual data contained in that chunk. Keywords are not required to be * unique, and the text string may be empty. Any number of text chunks may * be in an image. */ int num_text; /* number of comments read/to write */ int max_text; /* current size of text array */ png_textp text; /* array of comments read/to write */ #endif /* PNG_TEXT_SUPPORTED */ #if defined(PNG_tIME_SUPPORTED) /* The tIME chunk holds the last time the displayed image data was * modified. See the png_time struct for the contents of this struct. */ png_time mod_time; #endif #if defined(PNG_sBIT_SUPPORTED) /* The sBIT chunk specifies the number of significant high-order bits * in the pixel data. Values are in the range [1, bit_depth], and are * only specified for the channels in the pixel data. The contents of * the low-order bits is not specified. Data is valid if * (valid & PNG_INFO_sBIT) is non-zero. */ png_color_8 sig_bit; /* significant bits in color channels */ #endif #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \ defined(PNG_READ_BACKGROUND_SUPPORTED) /* The tRNS chunk supplies transparency data for paletted images and * other image types that don't need a full alpha channel. There are * "num_trans" transparency values for a paletted image, stored in the * same order as the palette colors, starting from index 0. Values * for the data are in the range [0, 255], ranging from fully transparent * to fully opaque, respectively. For non-paletted images, there is a * single color specified that should be treated as fully transparent. * Data is valid if (valid & PNG_INFO_tRNS) is non-zero. */ png_bytep trans; /* transparent values for paletted image */ png_color_16 trans_values; /* transparent color for non-palette image */ #endif #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) /* The bKGD chunk gives the suggested image background color if the * display program does not have its own background color and the image * is needs to composited onto a background before display. The colors * in "background" are normally in the same color space/depth as the * pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero. */ png_color_16 background; #endif #if defined(PNG_oFFs_SUPPORTED) /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards * and downwards from the top-left corner of the display, page, or other * application-specific co-ordinate space. See the PNG_OFFSET_ defines * below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero. */ png_int_32 x_offset; /* x offset on page */ png_int_32 y_offset; /* y offset on page */ png_byte offset_unit_type; /* offset units type */ #endif #if defined(PNG_pHYs_SUPPORTED) /* The pHYs chunk gives the physical pixel density of the image for * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_ * defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero. */ png_uint_32 x_pixels_per_unit; /* horizontal pixel density */ png_uint_32 y_pixels_per_unit; /* vertical pixel density */ png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */ #endif #if defined(PNG_hIST_SUPPORTED) /* The hIST chunk contains the relative frequency or importance of the * various palette entries, so that a viewer can intelligently select a * reduced-color palette, if required. Data is an array of "num_palette" * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST) * is non-zero. */ png_uint_16p hist; #endif #ifdef PNG_cHRM_SUPPORTED /* The cHRM chunk describes the CIE color characteristics of the monitor * on which the PNG was created. This data allows the viewer to do gamut * mapping of the input image to ensure that the viewer sees the same * colors in the image as the creator. Values are in the range * [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero. */ #ifdef PNG_FLOATING_POINT_SUPPORTED float x_white; float y_white; float x_red; float y_red; float x_green; float y_green; float x_blue; float y_blue; #endif #endif #if defined(PNG_pCAL_SUPPORTED) /* The pCAL chunk describes a transformation between the stored pixel * values and original physical data values used to create the image. * The integer range [0, 2^bit_depth - 1] maps to the floating-point * range given by [pcal_X0, pcal_X1], and are further transformed by a * (possibly non-linear) transformation function given by "pcal_type" * and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_ * defines below, and the PNG-Group's PNG extensions document for a * complete description of the transformations and how they should be * implemented, and for a description of the ASCII parameter strings. * Data values are valid if (valid & PNG_INFO_pCAL) non-zero. */ png_charp pcal_purpose; /* pCAL chunk description string */ png_int_32 pcal_X0; /* minimum value */ png_int_32 pcal_X1; /* maximum value */ png_charp pcal_units; /* Latin-1 string giving physical units */ png_charpp pcal_params; /* ASCII strings containing parameter values */ png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */ png_byte pcal_nparams; /* number of parameters given in pcal_params */ #endif /* New members added in libpng-1.0.6 */ #ifdef PNG_FREE_ME_SUPPORTED png_uint_32 free_me; /* flags items libpng is responsible for freeing */ #endif #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) /* storage for unknown chunks that the library doesn't recognize. */ png_unknown_chunkp unknown_chunks; png_size_t unknown_chunks_num; #endif #if defined(PNG_iCCP_SUPPORTED) /* iCCP chunk data. */ png_charp iccp_name; /* profile name */ png_charp iccp_profile; /* International Color Consortium profile data */ /* Note to maintainer: should be png_bytep */ png_uint_32 iccp_proflen; /* ICC profile data length */ png_byte iccp_compression; /* Always zero */ #endif #if defined(PNG_sPLT_SUPPORTED) /* data on sPLT chunks (there may be more than one). */ png_sPLT_tp splt_palettes; png_uint_32 splt_palettes_num; #endif #if defined(PNG_sCAL_SUPPORTED) /* The sCAL chunk describes the actual physical dimensions of the * subject matter of the graphic. The chunk contains a unit specification * a byte value, and two ASCII strings representing floating-point * values. The values are width and height corresponsing to one pixel * in the image. This external representation is converted to double * here. Data values are valid if (valid & PNG_INFO_sCAL) is non-zero. */ png_byte scal_unit; /* unit of physical scale */ #ifdef PNG_FLOATING_POINT_SUPPORTED double scal_pixel_width; /* width of one pixel */ double scal_pixel_height; /* height of one pixel */ #endif #ifdef PNG_FIXED_POINT_SUPPORTED png_charp scal_s_width; /* string containing height */ png_charp scal_s_height; /* string containing width */ #endif #endif #if defined(PNG_INFO_IMAGE_SUPPORTED) /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */ /* Data valid if (valid & PNG_INFO_IDAT) non-zero */ png_bytepp row_pointers; /* the image bits */ #endif #if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED) png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */ #endif #if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED) png_fixed_point int_x_white; png_fixed_point int_y_white; png_fixed_point int_x_red; png_fixed_point int_y_red; png_fixed_point int_x_green; png_fixed_point int_y_green; png_fixed_point int_x_blue; png_fixed_point int_y_blue; #endif } png_info; typedef png_info FAR * png_infop; typedef png_info FAR * FAR * png_infopp; /* Maximum positive integer used in PNG is (2^31)-1 */ #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL) #define PNG_UINT_32_MAX ((png_uint_32)(-1)) #define PNG_SIZE_MAX ((png_size_t)(-1)) #if defined(PNG_1_0_X) || defined (PNG_1_2_X) /* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */ #define PNG_MAX_UINT PNG_UINT_31_MAX #endif /* These describe the color_type field in png_info. */ /* color type masks */ #define PNG_COLOR_MASK_PALETTE 1 #define PNG_COLOR_MASK_COLOR 2 #define PNG_COLOR_MASK_ALPHA 4 /* color types. Note that not all combinations are legal */ #define PNG_COLOR_TYPE_GRAY 0 #define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE) #define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR) #define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA) #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA) /* aliases */ #define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA #define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA /* This is for compression type. PNG 1.0-1.2 only define the single type. */ #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */ #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE /* This is for filter type. PNG 1.0-1.2 only define the single type. */ #define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */ #define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */ #define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE /* These are for the interlacing type. These values should NOT be changed. */ #define PNG_INTERLACE_NONE 0 /* Non-interlaced image */ #define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */ #define PNG_INTERLACE_LAST 2 /* Not a valid value */ /* These are for the oFFs chunk. These values should NOT be changed. */ #define PNG_OFFSET_PIXEL 0 /* Offset in pixels */ #define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */ #define PNG_OFFSET_LAST 2 /* Not a valid value */ /* These are for the pCAL chunk. These values should NOT be changed. */ #define PNG_EQUATION_LINEAR 0 /* Linear transformation */ #define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */ #define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */ #define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */ #define PNG_EQUATION_LAST 4 /* Not a valid value */ /* These are for the sCAL chunk. These values should NOT be changed. */ #define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */ #define PNG_SCALE_METER 1 /* meters per pixel */ #define PNG_SCALE_RADIAN 2 /* radians per pixel */ #define PNG_SCALE_LAST 3 /* Not a valid value */ /* These are for the pHYs chunk. These values should NOT be changed. */ #define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */ #define PNG_RESOLUTION_METER 1 /* pixels/meter */ #define PNG_RESOLUTION_LAST 2 /* Not a valid value */ /* These are for the sRGB chunk. These values should NOT be changed. */ #define PNG_sRGB_INTENT_PERCEPTUAL 0 #define PNG_sRGB_INTENT_RELATIVE 1 #define PNG_sRGB_INTENT_SATURATION 2 #define PNG_sRGB_INTENT_ABSOLUTE 3 #define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */ /* This is for text chunks */ #define PNG_KEYWORD_MAX_LENGTH 79 /* Maximum number of entries in PLTE/sPLT/tRNS arrays */ #define PNG_MAX_PALETTE_LENGTH 256 /* These determine if an ancillary chunk's data has been successfully read * from the PNG header, or if the application has filled in the corresponding * data in the info_struct to be written into the output file. The values * of the PNG_INFO_<chunk> defines should NOT be changed. */ #define PNG_INFO_gAMA 0x0001 #define PNG_INFO_sBIT 0x0002 #define PNG_INFO_cHRM 0x0004 #define PNG_INFO_PLTE 0x0008 #define PNG_INFO_tRNS 0x0010 #define PNG_INFO_bKGD 0x0020 #define PNG_INFO_hIST 0x0040 #define PNG_INFO_pHYs 0x0080 #define PNG_INFO_oFFs 0x0100 #define PNG_INFO_tIME 0x0200 #define PNG_INFO_pCAL 0x0400 #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ #define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */ /* This is used for the transformation routines, as some of them * change these values for the row. It also should enable using * the routines for other purposes. */ typedef struct png_row_info_struct { png_uint_32 width; /* width of row */ png_uint_32 rowbytes; /* number of bytes in row */ png_byte color_type; /* color type of row */ png_byte bit_depth; /* bit depth of row */ png_byte channels; /* number of channels (1, 2, 3, or 4) */ png_byte pixel_depth; /* bits per pixel (depth * channels) */ } png_row_info; typedef png_row_info FAR * png_row_infop; typedef png_row_info FAR * FAR * png_row_infopp; /* These are the function types for the I/O functions and for the functions * that allow the user to override the default I/O functions with his or her * own. The png_error_ptr type should match that of user-supplied warning * and error functions, while the png_rw_ptr type should match that of the * user read/write data functions. */ typedef struct png_struct_def png_struct; typedef png_struct FAR * png_structp; typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp)); typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t)); typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp)); typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32, int)); typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32, int)); #ifdef PNG_PROGRESSIVE_READ_SUPPORTED typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop)); typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop)); typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep, png_uint_32, int)); #endif #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_LEGACY_SUPPORTED) typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp, png_row_infop, png_bytep)); #endif #if defined(PNG_USER_CHUNKS_SUPPORTED) typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp)); #endif #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp)); #endif /* Transform masks for the high-level interface */ #define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ #define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ #define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ #define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ #define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ #define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ #define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ #define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ #define PNG_TRANSFORM_BGR 0x0080 /* read and write */ #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */ /* Flags for MNG supported features */ #define PNG_FLAG_MNG_EMPTY_PLTE 0x01 #define PNG_FLAG_MNG_FILTER_64 0x04 #define PNG_ALL_MNG_FEATURES 0x05 typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t)); typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp)); /* The structure that holds the information to read and write PNG files. * The only people who need to care about what is inside of this are the * people who will be modifying the library for their own special needs. * It should NOT be accessed directly by an application, except to store * the jmp_buf. */ struct png_struct_def { #ifdef PNG_SETJMP_SUPPORTED jmp_buf jmpbuf; /* used in png_error */ #endif png_error_ptr error_fn; /* function for printing errors and aborting */ png_error_ptr warning_fn; /* function for printing warnings */ png_voidp error_ptr; /* user supplied struct for error functions */ png_rw_ptr write_data_fn; /* function for writing output data */ png_rw_ptr read_data_fn; /* function for reading input data */ png_voidp io_ptr; /* ptr to application struct for I/O functions */ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) png_user_transform_ptr read_user_transform_fn; /* user read transform */ #endif #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) png_user_transform_ptr write_user_transform_fn; /* user write transform */ #endif /* These were added in libpng-1.0.2 */ #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) png_voidp user_transform_ptr; /* user supplied struct for user transform */ png_byte user_transform_depth; /* bit depth of user transformed pixels */ png_byte user_transform_channels; /* channels in user transformed pixels */ #endif #endif png_uint_32 mode; /* tells us where we are in the PNG file */ png_uint_32 flags; /* flags indicating various things to libpng */ png_uint_32 transformations; /* which transformations to perform */ z_stream zstream; /* pointer to decompression structure (below) */ png_bytep zbuf; /* buffer for zlib */ png_size_t zbuf_size; /* size of zbuf */ int zlib_level; /* holds zlib compression level */ int zlib_method; /* holds zlib compression method */ int zlib_window_bits; /* holds zlib compression window bits */ int zlib_mem_level; /* holds zlib compression memory level */ int zlib_strategy; /* holds zlib compression strategy */ png_uint_32 width; /* width of image in pixels */ png_uint_32 height; /* height of image in pixels */ png_uint_32 num_rows; /* number of rows in current pass */ png_uint_32 usr_width; /* width of row at start of write */ png_uint_32 rowbytes; /* size of row in bytes */ png_uint_32 irowbytes; /* size of current interlaced row in bytes */ png_uint_32 iwidth; /* width of current interlaced row in pixels */ png_uint_32 row_number; /* current row in interlace pass */ png_bytep prev_row; /* buffer to save previous (unfiltered) row */ png_bytep row_buf; /* buffer to save current (unfiltered) row */ #ifndef PNG_NO_WRITE_FILTERING png_bytep sub_row; /* buffer to save "sub" row when filtering */ png_bytep up_row; /* buffer to save "up" row when filtering */ png_bytep avg_row; /* buffer to save "avg" row when filtering */ png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */ #endif png_row_info row_info; /* used for transformation routines */ png_uint_32 idat_size; /* current IDAT size for read */ png_uint_32 crc; /* current chunk CRC value */ png_colorp palette; /* palette from the input file */ png_uint_16 num_palette; /* number of color entries in palette */ png_uint_16 num_trans; /* number of transparency values */ png_byte chunk_name[5]; /* null-terminated name of current chunk */ png_byte compression; /* file compression type (always 0) */ png_byte filter; /* file filter type (always 0) */ png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ png_byte pass; /* current interlace pass (0 - 6) */ png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */ png_byte color_type; /* color type of file */ png_byte bit_depth; /* bit depth of file */ png_byte usr_bit_depth; /* bit depth of users row */ png_byte pixel_depth; /* number of bits per pixel */ png_byte channels; /* number of channels in file */ png_byte usr_channels; /* channels at start of write */ png_byte sig_bytes; /* magic bytes read/written from start of file */ #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) #ifdef PNG_LEGACY_SUPPORTED png_byte filler; /* filler byte for pixel expansion */ #else png_uint_16 filler; /* filler bytes for pixel expansion */ #endif #endif #if defined(PNG_bKGD_SUPPORTED) png_byte background_gamma_type; # ifdef PNG_FLOATING_POINT_SUPPORTED float background_gamma; # endif png_color_16 background; /* background color in screen gamma space */ #if defined(PNG_READ_GAMMA_SUPPORTED) png_color_16 background_1; /* background normalized to gamma 1.0 */ #endif #endif /* PNG_bKGD_SUPPORTED */ #if defined(PNG_WRITE_FLUSH_SUPPORTED) png_flush_ptr output_flush_fn;/* Function for flushing output */ png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */ png_uint_32 flush_rows; /* number of rows written since last flush */ #endif #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) int gamma_shift; /* number of "insignificant" bits 16-bit gamma */ #ifdef PNG_FLOATING_POINT_SUPPORTED float gamma; /* file gamma value */ float screen_gamma; /* screen gamma value (display_exponent) */ #endif #endif #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) png_bytep gamma_table; /* gamma table for 8-bit depth files */ png_bytep gamma_from_1; /* converts from 1.0 to screen */ png_bytep gamma_to_1; /* converts from file to 1.0 */ png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */ png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */ png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */ #endif #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED) png_color_8 sig_bit; /* significant bits in each available channel */ #endif #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) png_color_8 shift; /* shift for significant bit tranformation */ #endif #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) png_bytep trans; /* transparency values for paletted files */ png_color_16 trans_values; /* transparency values for non-paletted files */ #endif png_read_status_ptr read_row_fn; /* called after each row is decoded */ png_write_status_ptr write_row_fn; /* called after each row is encoded */ #ifdef PNG_PROGRESSIVE_READ_SUPPORTED png_progressive_info_ptr info_fn; /* called after header data fully read */ png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */ png_progressive_end_ptr end_fn; /* called after image is complete */ png_bytep save_buffer_ptr; /* current location in save_buffer */ png_bytep save_buffer; /* buffer for previously read data */ png_bytep current_buffer_ptr; /* current location in current_buffer */ png_bytep current_buffer; /* buffer for recently used data */ png_uint_32 push_length; /* size of current input chunk */ png_uint_32 skip_length; /* bytes to skip in input data */ png_size_t save_buffer_size; /* amount of data now in save_buffer */ png_size_t save_buffer_max; /* total size of save_buffer */ png_size_t buffer_size; /* total amount of available input data */ png_size_t current_buffer_size; /* amount of data now in current_buffer */ int process_mode; /* what push library is currently doing */ int cur_palette; /* current push library palette index */ # if defined(PNG_TEXT_SUPPORTED) png_size_t current_text_size; /* current size of text input data */ png_size_t current_text_left; /* how much text left to read in input */ png_charp current_text; /* current text chunk buffer */ png_charp current_text_ptr; /* current location in current_text */ # endif /* PNG_TEXT_SUPPORTED */ #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) /* for the Borland special 64K segment handler */ png_bytepp offset_table_ptr; png_bytep offset_table; png_uint_16 offset_table_number; png_uint_16 offset_table_count; png_uint_16 offset_table_count_free; #endif #if defined(PNG_READ_DITHER_SUPPORTED) png_bytep palette_lookup; /* lookup table for dithering */ png_bytep dither_index; /* index translation for palette files */ #endif #if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED) png_uint_16p hist; /* histogram */ #endif #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) png_byte heuristic_method; /* heuristic for row filter selection */ png_byte num_prev_filters; /* number of weights for previous rows */ png_bytep prev_filters; /* filter type(s) of previous row(s) */ png_uint_16p filter_weights; /* weight(s) for previous line(s) */ png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */ png_uint_16p filter_costs; /* relative filter calculation cost */ png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */ #endif #if defined(PNG_TIME_RFC1123_SUPPORTED) png_charp time_buffer; /* String to hold RFC 1123 time text */ #endif /* New members added in libpng-1.0.6 */ #ifdef PNG_FREE_ME_SUPPORTED png_uint_32 free_me; /* flags items libpng is responsible for freeing */ #endif #if defined(PNG_USER_CHUNKS_SUPPORTED) png_voidp user_chunk_ptr; png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */ #endif #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) int num_chunk_list; png_bytep chunk_list; #endif /* New members added in libpng-1.0.3 */ #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) png_byte rgb_to_gray_status; /* These were changed from png_byte in libpng-1.0.6 */ png_uint_16 rgb_to_gray_red_coeff; png_uint_16 rgb_to_gray_green_coeff; png_uint_16 rgb_to_gray_blue_coeff; #endif /* New member added in libpng-1.0.4 (renamed in 1.0.9) */ #if defined(PNG_MNG_FEATURES_SUPPORTED) || \ defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) /* changed from png_byte to png_uint_32 at version 1.2.0 */ #ifdef PNG_1_0_X png_byte mng_features_permitted; #else png_uint_32 mng_features_permitted; #endif /* PNG_1_0_X */ #endif /* New member added in libpng-1.0.7 */ #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) png_fixed_point int_gamma; #endif /* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */ #if defined(PNG_MNG_FEATURES_SUPPORTED) png_byte filter_type; #endif #if defined(PNG_1_0_X) /* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */ png_uint_32 row_buf_size; #endif /* New members added in libpng-1.2.0 */ #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) # if !defined(PNG_1_0_X) # if defined(PNG_MMX_CODE_SUPPORTED) png_byte mmx_bitdepth_threshold; png_uint_32 mmx_rowbytes_threshold; # endif png_uint_32 asm_flags; # endif #endif /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ #ifdef PNG_USER_MEM_SUPPORTED png_voidp mem_ptr; /* user supplied struct for mem functions */ png_malloc_ptr malloc_fn; /* function for allocating memory */ png_free_ptr free_fn; /* function for freeing memory */ #endif /* New member added in libpng-1.0.13 and 1.2.0 */ png_bytep big_row_buf; /* buffer to save current (unfiltered) row */ #if defined(PNG_READ_DITHER_SUPPORTED) /* The following three members were added at version 1.0.14 and 1.2.4 */ png_bytep dither_sort; /* working sort array */ png_bytep index_to_palette; /* where the original index currently is */ /* in the palette */ png_bytep palette_to_index; /* which original index points to this */ /* palette color */ #endif /* New members added in libpng-1.0.16 and 1.2.6 */ png_byte compression_type; #ifdef PNG_SET_USER_LIMITS_SUPPORTED png_uint_32 user_width_max; png_uint_32 user_height_max; #endif /* New member added in libpng-1.0.25 and 1.2.17 */ #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) /* storage for unknown chunk that the library doesn't recognize. */ png_unknown_chunk unknown_chunk; #endif /* New members added in libpng-1.2.26 */ png_uint_32 old_big_row_buf_size, old_prev_row_size; }; /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ typedef png_structp version_1_2_29; typedef png_struct FAR * FAR * png_structpp; /* Here are the function definitions most commonly used. This is not * the place to find out how to use libpng. See libpng.txt for the * full explanation, see example.c for the summary. This just provides * a simple one line description of the use of each function. */ /* Returns the version number of the library */ extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void)); /* Tell lib we have already handled the first <num_bytes> magic bytes. * Handling more than 8 bytes from the beginning of the file is an error. */ extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr, int num_bytes)); /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a * PNG file. Returns zero if the supplied bytes match the 8-byte PNG * signature, and non-zero otherwise. Having num_to_check == 0 or * start > 7 will always fail (ie return non-zero). */ extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start, png_size_t num_to_check)); /* Simple signature checking function. This is the same as calling * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). */ extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)); /* Allocate and initialize png_ptr struct for reading, and any other memory. */ extern PNG_EXPORT(png_structp,png_create_read_struct) PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn)); /* Allocate and initialize png_ptr struct for writing, and any other memory */ extern PNG_EXPORT(png_structp,png_create_write_struct) PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn)); #ifdef PNG_WRITE_SUPPORTED extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size) PNGARG((png_structp png_ptr)); #endif #ifdef PNG_WRITE_SUPPORTED extern PNG_EXPORT(void,png_set_compression_buffer_size) PNGARG((png_structp png_ptr, png_uint_32 size)); #endif /* Reset the compression stream */ extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr)); /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ #ifdef PNG_USER_MEM_SUPPORTED extern PNG_EXPORT(png_structp,png_create_read_struct_2) PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); extern PNG_EXPORT(png_structp,png_create_write_struct_2) PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); #endif /* Write a PNG chunk - size, type, (optional) data, CRC. */ extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr, png_bytep chunk_name, png_bytep data, png_size_t length)); /* Write the start of a PNG chunk - length and chunk name. */ extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr, png_bytep chunk_name, png_uint_32 length)); /* Write the data of a PNG chunk started with png_write_chunk_start(). */ extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr, png_bytep data, png_size_t length)); /* Finish a chunk started with png_write_chunk_start() (includes CRC). */ extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr)); /* Allocate and initialize the info structure */ extern PNG_EXPORT(png_infop,png_create_info_struct) PNGARG((png_structp png_ptr)); #if defined(PNG_1_0_X) || defined (PNG_1_2_X) /* Initialize the info structure (old interface - DEPRECATED) */ extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr)); #undef png_info_init #define png_info_init(info_ptr) png_info_init_3(&info_ptr,\ png_sizeof(png_info)); #endif extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr, png_size_t png_info_struct_size)); /* Writes all the PNG information before the image. */ extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, png_infop info_ptr)); extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, png_infop info_ptr)); #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED /* read the information before the actual image data. */ extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr, png_infop info_ptr)); #endif #if defined(PNG_TIME_RFC1123_SUPPORTED) extern PNG_EXPORT(png_charp,png_convert_to_rfc1123) PNGARG((png_structp png_ptr, png_timep ptime)); #endif #if !defined(_WIN32_WCE) /* "time.h" functions are not supported on WindowsCE */ #if defined(PNG_WRITE_tIME_SUPPORTED) /* convert from a struct tm to png_time */ extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime, struct tm FAR * ttime)); /* convert from time_t to png_time. Uses gmtime() */ extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime, time_t ttime)); #endif /* PNG_WRITE_tIME_SUPPORTED */ #endif /* _WIN32_WCE */ #if defined(PNG_READ_EXPAND_SUPPORTED) /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr)); #if !defined(PNG_1_0_X) extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp png_ptr)); #endif extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr)); #if defined(PNG_1_0_X) || defined (PNG_1_2_X) /* Deprecated */ extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr)); #endif #endif #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) /* Use blue, green, red order for pixels. */ extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) /* Expand the grayscale to 24-bit RGB if necessary. */ extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) /* Reduce RGB to grayscale. */ #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr, int error_action, double red, double green )); #endif extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr, int error_action, png_fixed_point red, png_fixed_point green )); extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp png_ptr)); #endif extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, png_colorp palette)); #if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) /* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr, png_uint_32 filler, int flags)); /* The values of the PNG_FILLER_ defines should NOT be changed */ #define PNG_FILLER_BEFORE 0 #define PNG_FILLER_AFTER 1 /* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ #if !defined(PNG_1_0_X) extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr, png_uint_32 filler, int flags)); #endif #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) /* Swap bytes in 16-bit depth files. */ extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) /* Swap packing order of pixels in bytes. */ extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) /* Converts files to legal bit depths. */ extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr, png_color_8p true_bits)); #endif #if defined(PNG_READ_INTERLACING_SUPPORTED) || \ defined(PNG_WRITE_INTERLACING_SUPPORTED) /* Have the code handle the interlacing. Returns the number of passes. */ extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) /* Invert monochrome files */ extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_BACKGROUND_SUPPORTED) /* Handle alpha and tRNS by replacing with a background color. */ #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr, png_color_16p background_color, int background_gamma_code, int need_expand, double background_gamma)); #endif #define PNG_BACKGROUND_GAMMA_UNKNOWN 0 #define PNG_BACKGROUND_GAMMA_SCREEN 1 #define PNG_BACKGROUND_GAMMA_FILE 2 #define PNG_BACKGROUND_GAMMA_UNIQUE 3 #endif #if defined(PNG_READ_16_TO_8_SUPPORTED) /* strip the second byte of information from a 16-bit depth file. */ extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_DITHER_SUPPORTED) /* Turn on dithering, and reduce the palette to the number of colors available. */ extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr, png_colorp palette, int num_palette, int maximum_colors, png_uint_16p histogram, int full_dither)); #endif #if defined(PNG_READ_GAMMA_SUPPORTED) /* Handle gamma correction. Screen_gamma=(display_exponent) */ #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr, double screen_gamma, double default_file_gamma)); #endif #endif #if defined(PNG_1_0_X) || defined (PNG_1_2_X) #if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) /* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */ /* Deprecated and will be removed. Use png_permit_mng_features() instead. */ extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr, int empty_plte_permitted)); #endif #endif #if defined(PNG_WRITE_FLUSH_SUPPORTED) /* Set how many lines between output flushes - 0 for no flushing */ extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows)); /* Flush the current PNG output buffer */ extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr)); #endif /* optional update palette with requested transformations */ extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); /* optional call to update the users info structure */ extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, png_infop info_ptr)); #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED /* read one or more rows of image data. */ extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); #endif #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED /* read a row of data. */ extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, png_bytep row, png_bytep display_row)); #endif #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED /* read the whole image into memory at once. */ extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, png_bytepp image)); #endif /* write a row of image data */ extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr, png_bytep row)); /* write a few rows of image data */ extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr, png_bytepp row, png_uint_32 num_rows)); /* write the image data */ extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, png_bytepp image)); /* writes the end of the PNG file. */ extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, png_infop info_ptr)); #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED /* read the end of the PNG file. */ extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, png_infop info_ptr)); #endif /* free any memory associated with the png_info_struct */ extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr, png_infopp info_ptr_ptr)); /* free any memory associated with the png_struct and the png_info_structs */ extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); /* free all memory used by the read (old method - NOT DLL EXPORTED) */ extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr)); /* free any memory associated with the png_struct and the png_info_structs */ extern PNG_EXPORT(void,png_destroy_write_struct) PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); /* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ extern void png_write_destroy PNGARG((png_structp png_ptr)); /* set the libpng method of handling chunk CRC errors */ extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr, int crit_action, int ancil_action)); /* Values for png_set_crc_action() to say how to handle CRC errors in * ancillary and critical chunks, and whether to use the data contained * therein. Note that it is impossible to "discard" data in a critical * chunk. For versions prior to 0.90, the action was always error/quit, * whereas in version 0.90 and later, the action for CRC errors in ancillary * chunks is warn/discard. These values should NOT be changed. * * value action:critical action:ancillary */ #define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ #define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ #define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ #define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ #define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ #define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ /* These functions give the user control over the scan-line filtering in * libpng and the compression methods used by zlib. These functions are * mainly useful for testing, as the defaults should work with most users. * Those users who are tight on memory or want faster performance at the * expense of compression can modify them. See the compression library * header file (zlib.h) for an explination of the compression functions. */ /* set the filtering method(s) used by libpng. Currently, the only valid * value for "method" is 0. */ extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, int filters)); /* Flags for png_set_filter() to say which filters to use. The flags * are chosen so that they don't conflict with real filter types * below, in case they are supplied instead of the #defined constants. * These values should NOT be changed. */ #define PNG_NO_FILTERS 0x00 #define PNG_FILTER_NONE 0x08 #define PNG_FILTER_SUB 0x10 #define PNG_FILTER_UP 0x20 #define PNG_FILTER_AVG 0x40 #define PNG_FILTER_PAETH 0x80 #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ PNG_FILTER_AVG | PNG_FILTER_PAETH) /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. * These defines should NOT be changed. */ #define PNG_FILTER_VALUE_NONE 0 #define PNG_FILTER_VALUE_SUB 1 #define PNG_FILTER_VALUE_UP 2 #define PNG_FILTER_VALUE_AVG 3 #define PNG_FILTER_VALUE_PAETH 4 #define PNG_FILTER_VALUE_LAST 5 #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */ /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ * defines, either the default (minimum-sum-of-absolute-differences), or * the experimental method (weighted-minimum-sum-of-absolute-differences). * * Weights are factors >= 1.0, indicating how important it is to keep the * filter type consistent between rows. Larger numbers mean the current * filter is that many times as likely to be the same as the "num_weights" * previous filters. This is cumulative for each previous row with a weight. * There needs to be "num_weights" values in "filter_weights", or it can be * NULL if the weights aren't being specified. Weights have no influence on * the selection of the first row filter. Well chosen weights can (in theory) * improve the compression for a given image. * * Costs are factors >= 1.0 indicating the relative decoding costs of a * filter type. Higher costs indicate more decoding expense, and are * therefore less likely to be selected over a filter with lower computational * costs. There needs to be a value in "filter_costs" for each valid filter * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't * setting the costs. Costs try to improve the speed of decompression without * unduly increasing the compressed image size. * * A negative weight or cost indicates the default value is to be used, and * values in the range [0.0, 1.0) indicate the value is to remain unchanged. * The default values for both weights and costs are currently 1.0, but may * change if good general weighting/cost heuristics can be found. If both * the weights and costs are set to 1.0, this degenerates the WEIGHTED method * to the UNWEIGHTED method, but with added encoding time/computation. */ #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, int heuristic_method, int num_weights, png_doublep filter_weights, png_doublep filter_costs)); #endif #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ /* Heuristic used for row filter selection. These defines should NOT be * changed. */ #define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ #define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ #define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ /* Set the library compression level. Currently, valid values range from * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 * (0 - no compression, 9 - "maximal" compression). Note that tests have * shown that zlib compression levels 3-6 usually perform as well as level 9 * for PNG images, and do considerably fewer caclulations. In the future, * these values may not correspond directly to the zlib compression levels. */ extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr, int level)); extern PNG_EXPORT(void,png_set_compression_mem_level) PNGARG((png_structp png_ptr, int mem_level)); extern PNG_EXPORT(void,png_set_compression_strategy) PNGARG((png_structp png_ptr, int strategy)); extern PNG_EXPORT(void,png_set_compression_window_bits) PNGARG((png_structp png_ptr, int window_bits)); extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr, int method)); /* These next functions are called for input/output, memory, and error * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, * and call standard C I/O routines such as fread(), fwrite(), and * fprintf(). These functions can be made to use other I/O routines * at run time for those applications that need to handle I/O in a * different manner by calling png_set_???_fn(). See libpng.txt for * more information. */ #if !defined(PNG_NO_STDIO) /* Initialize the input/output for the PNG file to the default functions. */ extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp)); #endif /* Replace the (error and abort), and warning functions with user * supplied functions. If no messages are to be printed you must still * write and use replacement functions. The replacement error_fn should * still do a longjmp to the last setjmp location if you are using this * method of error handling. If error_fn or warning_fn is NULL, the * default function will be used. */ extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); /* Return the user pointer associated with the error functions */ extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); /* Replace the default data output functions with a user supplied one(s). * If buffered output is not used, then output_flush_fn can be set to NULL. * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time * output_flush_fn will be ignored (and thus can be NULL). */ extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); /* Replace the default data input function with a user supplied one. */ extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn)); /* Return the user pointer associated with the I/O functions */ extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr, png_read_status_ptr read_row_fn)); extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, png_write_status_ptr write_row_fn)); #ifdef PNG_USER_MEM_SUPPORTED /* Replace the default memory allocation functions with user supplied one(s). */ extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); /* Return the user pointer associated with the memory functions */ extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr)); #endif #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_LEGACY_SUPPORTED) extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp png_ptr, png_user_transform_ptr read_user_transform_fn)); #endif #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_LEGACY_SUPPORTED) extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp png_ptr, png_user_transform_ptr write_user_transform_fn)); #endif #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_LEGACY_SUPPORTED) extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp png_ptr, png_voidp user_transform_ptr, int user_transform_depth, int user_transform_channels)); /* Return the user pointer associated with the user transform functions */ extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr) PNGARG((png_structp png_ptr)); #endif #ifdef PNG_USER_CHUNKS_SUPPORTED extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr, png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp png_ptr)); #endif #ifdef PNG_PROGRESSIVE_READ_SUPPORTED /* Sets the function callbacks for the push reader, and a pointer to a * user-defined structure available to the callback functions. */ extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, png_voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)); /* returns the user pointer associated with the push read functions */ extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) PNGARG((png_structp png_ptr)); /* function to be called when data becomes available */ extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); /* function that combines rows. Not very much different than the * png_combine_row() call. Is this even used????? */ extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, png_bytep old_row, png_bytep new_row)); #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr, png_uint_32 size)); #if defined(PNG_1_0_X) # define png_malloc_warn png_malloc #else /* Added at libpng version 1.2.4 */ extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr, png_uint_32 size)); #endif /* frees a pointer allocated by png_malloc() */ extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); #if defined(PNG_1_0_X) /* Function to allocate memory for zlib. */ extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items, uInt size)); /* Function to free memory for zlib */ extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr)); #endif /* Free data that was allocated internally */ extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 free_me, int num)); #ifdef PNG_FREE_ME_SUPPORTED /* Reassign responsibility for freeing existing data, whether allocated * by libpng or by the application */ extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, png_infop info_ptr, int freer, png_uint_32 mask)); #endif /* assignments for png_data_freer */ #define PNG_DESTROY_WILL_FREE_DATA 1 #define PNG_SET_WILL_FREE_DATA 1 #define PNG_USER_WILL_FREE_DATA 2 /* Flags for png_ptr->free_me and info_ptr->free_me */ #define PNG_FREE_HIST 0x0008 #define PNG_FREE_ICCP 0x0010 #define PNG_FREE_SPLT 0x0020 #define PNG_FREE_ROWS 0x0040 #define PNG_FREE_PCAL 0x0080 #define PNG_FREE_SCAL 0x0100 #define PNG_FREE_UNKN 0x0200 #define PNG_FREE_LIST 0x0400 #define PNG_FREE_PLTE 0x1000 #define PNG_FREE_TRNS 0x2000 #define PNG_FREE_TEXT 0x4000 #define PNG_FREE_ALL 0x7fff #define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ #ifdef PNG_USER_MEM_SUPPORTED extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, png_uint_32 size)); extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr, png_voidp ptr)); #endif extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr, png_voidp s1, png_voidp s2, png_uint_32 size)); extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr, png_voidp s1, int value, png_uint_32 size)); #if defined(USE_FAR_KEYWORD) /* memory model conversion function */ extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr, int check)); #endif /* USE_FAR_KEYWORD */ #ifndef PNG_NO_ERROR_TEXT /* Fatal error in PNG image of libpng - can't continue */ extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, png_const_charp error_message)); /* The same, but the chunk name is prepended to the error string. */ extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, png_const_charp error_message)); #else /* Fatal error in PNG image of libpng - can't continue */ extern PNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr)); #endif #ifndef PNG_NO_WARNINGS /* Non-fatal error in libpng. Can continue, but may have a problem. */ extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, png_const_charp warning_message)); #ifdef PNG_READ_SUPPORTED /* Non-fatal error in libpng, chunk name is prepended to message. */ extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, png_const_charp warning_message)); #endif /* PNG_READ_SUPPORTED */ #endif /* PNG_NO_WARNINGS */ /* The png_set_<chunk> functions are for storing values in the png_info_struct. * Similarly, the png_get_<chunk> calls are used to read values from the * png_info_struct, either storing the parameters in the passed variables, or * setting pointers into the png_info_struct where the data is stored. The * png_get_<chunk> functions return a non-zero value if the data was available * in info_ptr, or return zero and do not change any of the parameters if the * data was not available. * * These functions should be used instead of directly accessing png_info * to avoid problems with future changes in the size and internal layout of * png_info_struct. */ /* Returns "flag" if chunk data is valid in info_ptr. */ extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)); /* Returns number of bytes needed to hold a transformed row. */ extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr, png_infop info_ptr)); #if defined(PNG_INFO_IMAGE_SUPPORTED) /* Returns row_pointers, which is an array of pointers to scanlines that was returned from png_read_png(). */ extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr, png_infop info_ptr)); /* Set row_pointers, which is an array of pointers to scanlines for use by png_write_png(). */ extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)); #endif /* Returns number of color channels in image. */ extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr, png_infop info_ptr)); #ifdef PNG_EASY_ACCESS_SUPPORTED /* Returns image width in pixels. */ extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp png_ptr, png_infop info_ptr)); /* Returns image height in pixels. */ extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp png_ptr, png_infop info_ptr)); /* Returns image bit_depth. */ extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp png_ptr, png_infop info_ptr)); /* Returns image color_type. */ extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp png_ptr, png_infop info_ptr)); /* Returns image filter_type. */ extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp png_ptr, png_infop info_ptr)); /* Returns image interlace_type. */ extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp png_ptr, png_infop info_ptr)); /* Returns image compression_type. */ extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp png_ptr, png_infop info_ptr)); /* Returns image resolution in pixels per meter, from pHYs chunk data. */ extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp png_ptr, png_infop info_ptr)); extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp png_ptr, png_infop info_ptr)); extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp png_ptr, png_infop info_ptr)); /* Returns pixel aspect ratio, computed from pHYs chunk data. */ #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp png_ptr, png_infop info_ptr)); #endif /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp png_ptr, png_infop info_ptr)); extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp png_ptr, png_infop info_ptr)); extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp png_ptr, png_infop info_ptr)); extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp png_ptr, png_infop info_ptr)); #endif /* PNG_EASY_ACCESS_SUPPORTED */ /* Returns pointer to signature string read from PNG header */ extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr, png_infop info_ptr)); #if defined(PNG_bKGD_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr, png_infop info_ptr, png_color_16p *background)); #endif #if defined(PNG_bKGD_SUPPORTED) extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, png_infop info_ptr, png_color_16p background)); #endif #if defined(PNG_cHRM_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr, png_infop info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, double *blue_y)); #endif #ifdef PNG_FIXED_POINT_SUPPORTED extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr, png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_blue_x, png_fixed_point *int_blue_y)); #endif #endif #if defined(PNG_cHRM_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr, png_infop info_ptr, double white_x, double white_y, double red_x, double red_y, double green_x, double green_y, double blue_x, double blue_y)); #endif #ifdef PNG_FIXED_POINT_SUPPORTED extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr, png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, png_fixed_point int_blue_y)); #endif #endif #if defined(PNG_gAMA_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr, png_infop info_ptr, double *file_gamma)); #endif extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr, png_infop info_ptr, png_fixed_point *int_file_gamma)); #endif #if defined(PNG_gAMA_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, png_infop info_ptr, double file_gamma)); #endif extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr, png_infop info_ptr, png_fixed_point int_file_gamma)); #endif #if defined(PNG_hIST_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)); #endif #if defined(PNG_hIST_SUPPORTED) extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)); #endif extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method)); extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int interlace_method, int compression_method, int filter_method)); #if defined(PNG_oFFs_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr, png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)); #endif #if defined(PNG_oFFs_SUPPORTED) extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, int unit_type)); #endif #if defined(PNG_pCAL_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr, png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *units, png_charpp *params)); #endif #if defined(PNG_pCAL_SUPPORTED) extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr, png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_charp units, png_charpp params)); #endif #if defined(PNG_pHYs_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); #endif #if defined(PNG_pHYs_SUPPORTED) extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); #endif extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr, png_infop info_ptr, png_colorp *palette, int *num_palette)); extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, png_infop info_ptr, png_colorp palette, int num_palette)); #if defined(PNG_sBIT_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)); #endif #if defined(PNG_sBIT_SUPPORTED) extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, png_infop info_ptr, png_color_8p sig_bit)); #endif #if defined(PNG_sRGB_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr, png_infop info_ptr, int *intent)); #endif #if defined(PNG_sRGB_SUPPORTED) extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, png_infop info_ptr, int intent)); extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, png_infop info_ptr, int intent)); #endif #if defined(PNG_iCCP_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr, png_infop info_ptr, png_charpp name, int *compression_type, png_charpp profile, png_uint_32 *proflen)); /* Note to maintainer: profile should be png_bytepp */ #endif #if defined(PNG_iCCP_SUPPORTED) extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr, png_infop info_ptr, png_charp name, int compression_type, png_charp profile, png_uint_32 proflen)); /* Note to maintainer: profile should be png_bytep */ #endif #if defined(PNG_sPLT_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr, png_infop info_ptr, png_sPLT_tpp entries)); #endif #if defined(PNG_sPLT_SUPPORTED) extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, png_infop info_ptr, png_sPLT_tp entries, int nentries)); #endif #if defined(PNG_TEXT_SUPPORTED) /* png_get_text also returns the number of text chunks in *num_text */ extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, int *num_text)); #endif /* * Note while png_set_text() will accept a structure whose text, * language, and translated keywords are NULL pointers, the structure * returned by png_get_text will always contain regular * zero-terminated C strings. They might be empty strings but * they will never be NULL pointers. */ #if defined(PNG_TEXT_SUPPORTED) extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, int num_text)); #endif #if defined(PNG_tIME_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)); #endif #if defined(PNG_tIME_SUPPORTED) extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, png_infop info_ptr, png_timep mod_time)); #endif #if defined(PNG_tRNS_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values)); #endif #if defined(PNG_tRNS_SUPPORTED) extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, png_infop info_ptr, png_bytep trans, int num_trans, png_color_16p trans_values)); #endif #if defined(PNG_tRNS_SUPPORTED) #endif #if defined(PNG_sCAL_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr, png_infop info_ptr, int *unit, double *width, double *height)); #else #ifdef PNG_FIXED_POINT_SUPPORTED extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr, png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); #endif #endif #endif /* PNG_sCAL_SUPPORTED */ #if defined(PNG_sCAL_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr, png_infop info_ptr, int unit, double width, double height)); #else #ifdef PNG_FIXED_POINT_SUPPORTED extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr, png_infop info_ptr, int unit, png_charp swidth, png_charp sheight)); #endif #endif #endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */ #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) /* provide a list of chunks and how they are to be handled, if the built-in handling or default unknown chunk handling is not desired. Any chunks not listed will be handled in the default manner. The IHDR and IEND chunks must not be listed. keep = 0: follow default behaviour = 1: do not keep = 2: keep only if safe-to-copy = 3: keep even if unsafe-to-copy */ extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp png_ptr, int keep, png_bytep chunk_list, int num_chunks)); extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr, png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)); extern PNG_EXPORT(void, png_set_unknown_chunk_location) PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location)); extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp png_ptr, png_infop info_ptr, png_unknown_chunkpp entries)); #endif #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep chunk_name)); #endif /* Png_free_data() will turn off the "valid" flag for anything it frees. If you need to turn it off for a chunk that your application has freed, you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */ extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr, png_infop info_ptr, int mask)); #if defined(PNG_INFO_IMAGE_SUPPORTED) /* The "params" pointer is currently not used and is for future expansion. */ extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, png_infop info_ptr, int transforms, png_voidp params)); extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, png_infop info_ptr, int transforms, png_voidp params)); #endif /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout * libpng yet, but more support will be added as needed. */ #ifdef PNG_DEBUG #if (PNG_DEBUG > 0) #if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) #include <crtdbg.h> #if (PNG_DEBUG > 1) #define png_debug(l,m) _RPT0(_CRT_WARN,m) #define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1) #define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2) #endif #else /* PNG_DEBUG_FILE || !_MSC_VER */ #ifndef PNG_DEBUG_FILE #define PNG_DEBUG_FILE stderr #endif /* PNG_DEBUG_FILE */ #if (PNG_DEBUG > 1) #define png_debug(l,m) \ { \ int num_tabs=l; \ fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ } #define png_debug1(l,m,p1) \ { \ int num_tabs=l; \ fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ } #define png_debug2(l,m,p1,p2) \ { \ int num_tabs=l; \ fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ } #endif /* (PNG_DEBUG > 1) */ #endif /* _MSC_VER */ #endif /* (PNG_DEBUG > 0) */ #endif /* PNG_DEBUG */ #ifndef png_debug #define png_debug(l, m) #endif #ifndef png_debug1 #define png_debug1(l, m, p1) #endif #ifndef png_debug2 #define png_debug2(l, m, p1, p2) #endif extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); #ifdef PNG_MNG_FEATURES_SUPPORTED extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp png_ptr, png_uint_32 mng_features_permitted)); #endif /* For use in png_set_keep_unknown, added to version 1.2.6 */ #define PNG_HANDLE_CHUNK_AS_DEFAULT 0 #define PNG_HANDLE_CHUNK_NEVER 1 #define PNG_HANDLE_CHUNK_IF_SAFE 2 #define PNG_HANDLE_CHUNK_ALWAYS 3 /* Added to version 1.2.0 */ #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) #if defined(PNG_MMX_CODE_SUPPORTED) #define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */ #define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */ #define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04 #define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08 #define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10 #define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20 #define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40 #define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80 #define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */ #define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \ | PNG_ASM_FLAG_MMX_READ_INTERLACE \ | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \ | PNG_ASM_FLAG_MMX_READ_FILTER_UP \ | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \ | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ) #define PNG_MMX_WRITE_FLAGS ( 0 ) #define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \ | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \ | PNG_MMX_READ_FLAGS \ | PNG_MMX_WRITE_FLAGS ) #define PNG_SELECT_READ 1 #define PNG_SELECT_WRITE 2 #endif /* PNG_MMX_CODE_SUPPORTED */ #if !defined(PNG_1_0_X) /* pngget.c */ extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask) PNGARG((int flag_select, int *compilerID)); /* pngget.c */ extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask) PNGARG((int flag_select)); /* pngget.c */ extern PNG_EXPORT(png_uint_32,png_get_asm_flags) PNGARG((png_structp png_ptr)); /* pngget.c */ extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold) PNGARG((png_structp png_ptr)); /* pngget.c */ extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold) PNGARG((png_structp png_ptr)); /* pngset.c */ extern PNG_EXPORT(void,png_set_asm_flags) PNGARG((png_structp png_ptr, png_uint_32 asm_flags)); /* pngset.c */ extern PNG_EXPORT(void,png_set_mmx_thresholds) PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold, png_uint_32 mmx_rowbytes_threshold)); #endif /* PNG_1_0_X */ #if !defined(PNG_1_0_X) /* png.c, pnggccrd.c, or pngvcrd.c */ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ /* Strip the prepended error numbers ("#nnn ") from error and warning * messages before passing them to the error or warning handler. */ #ifdef PNG_ERROR_NUMBERS_SUPPORTED extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp png_ptr, png_uint_32 strip_mode)); #endif #endif /* PNG_1_0_X */ /* Added at libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp png_ptr)); #endif /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED /* With these routines we avoid an integer divide, which will be slower on * most machines. However, it does take more operations than the corresponding * divide method, so it may be slower on a few RISC systems. There are two * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. * * Note that the rounding factors are NOT supposed to be the same! 128 and * 32768 are correct for the NODIV code; 127 and 32767 are correct for the * standard method. * * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] */ /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ # define png_composite(composite, fg, alpha, bg) \ { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \ + (png_uint_16)(bg)*(png_uint_16)(255 - \ (png_uint_16)(alpha)) + (png_uint_16)128); \ (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } # define png_composite_16(composite, fg, alpha, bg) \ { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \ + (png_uint_32)(bg)*(png_uint_32)(65535L - \ (png_uint_32)(alpha)) + (png_uint_32)32768L); \ (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } #else /* standard method using integer division */ # define png_composite(composite, fg, alpha, bg) \ (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ (png_uint_16)127) / 255) # define png_composite_16(composite, fg, alpha, bg) \ (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \ (png_uint_32)32767) / (png_uint_32)65535L) #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ /* Inline macros to do direct reads of bytes from the input buffer. These * require that you are using an architecture that uses PNG byte ordering * (MSB first) and supports unaligned data storage. I think that PowerPC * in big-endian mode and 680x0 are the only ones that will support this. * The x86 line of processors definitely do not. The png_get_int_32() * routine also assumes we are using two's complement format for negative * values, which is almost certainly true. */ #if defined(PNG_READ_BIG_ENDIAN_SUPPORTED) # define png_get_uint_32(buf) ( *((png_uint_32p) (buf))) # define png_get_uint_16(buf) ( *((png_uint_16p) (buf))) # define png_get_int_32(buf) ( *((png_int_32p) (buf))) #else extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf)); extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf)); extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf)); #endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */ extern PNG_EXPORT(png_uint_32,png_get_uint_31) PNGARG((png_structp png_ptr, png_bytep buf)); /* No png_get_int_16 -- may be added if there's a real need for it. */ /* Place a 32-bit number into a buffer in PNG byte order (big-endian). */ extern PNG_EXPORT(void,png_save_uint_32) PNGARG((png_bytep buf, png_uint_32 i)); extern PNG_EXPORT(void,png_save_int_32) PNGARG((png_bytep buf, png_int_32 i)); /* Place a 16-bit number into a buffer in PNG byte order. * The parameter is declared unsigned int, not png_uint_16, * just to avoid potential problems on pre-ANSI C compilers. */ extern PNG_EXPORT(void,png_save_uint_16) PNGARG((png_bytep buf, unsigned int i)); /* No png_save_int_16 -- may be added if there's a real need for it. */ /* ************************************************************************* */ /* These next functions are used internally in the code. They generally * shouldn't be used unless you are writing code to add or replace some * functionality in libpng. More information about most functions can * be found in the files where the functions are located. */ /* Various modes of operation, that are visible to applications because * they are used for unknown chunk location. */ #define PNG_HAVE_IHDR 0x01 #define PNG_HAVE_PLTE 0x02 #define PNG_HAVE_IDAT 0x04 #define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */ #define PNG_HAVE_IEND 0x10 #if defined(PNG_INTERNAL) /* More modes of operation. Note that after an init, mode is set to * zero automatically when the structure is created. */ #define PNG_HAVE_gAMA 0x20 #define PNG_HAVE_cHRM 0x40 #define PNG_HAVE_sRGB 0x80 #define PNG_HAVE_CHUNK_HEADER 0x100 #define PNG_WROTE_tIME 0x200 #define PNG_WROTE_INFO_BEFORE_PLTE 0x400 #define PNG_BACKGROUND_IS_GRAY 0x800 #define PNG_HAVE_PNG_SIGNATURE 0x1000 #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ /* flags for the transformations the PNG library does on the image data */ #define PNG_BGR 0x0001 #define PNG_INTERLACE 0x0002 #define PNG_PACK 0x0004 #define PNG_SHIFT 0x0008 #define PNG_SWAP_BYTES 0x0010 #define PNG_INVERT_MONO 0x0020 #define PNG_DITHER 0x0040 #define PNG_BACKGROUND 0x0080 #define PNG_BACKGROUND_EXPAND 0x0100 /* 0x0200 unused */ #define PNG_16_TO_8 0x0400 #define PNG_RGBA 0x0800 #define PNG_EXPAND 0x1000 #define PNG_GAMMA 0x2000 #define PNG_GRAY_TO_RGB 0x4000 #define PNG_FILLER 0x8000L #define PNG_PACKSWAP 0x10000L #define PNG_SWAP_ALPHA 0x20000L #define PNG_STRIP_ALPHA 0x40000L #define PNG_INVERT_ALPHA 0x80000L #define PNG_USER_TRANSFORM 0x100000L #define PNG_RGB_TO_GRAY_ERR 0x200000L #define PNG_RGB_TO_GRAY_WARN 0x400000L #define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */ /* 0x800000L Unused */ #define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */ #define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */ /* 0x4000000L unused */ /* 0x8000000L unused */ /* 0x10000000L unused */ /* 0x20000000L unused */ /* 0x40000000L unused */ /* flags for png_create_struct */ #define PNG_STRUCT_PNG 0x0001 #define PNG_STRUCT_INFO 0x0002 /* Scaling factor for filter heuristic weighting calculations */ #define PNG_WEIGHT_SHIFT 8 #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) #define PNG_COST_SHIFT 3 #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) /* flags for the png_ptr->flags rather than declaring a byte for each one */ #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 #define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 #define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 #define PNG_FLAG_ZLIB_FINISHED 0x0020 #define PNG_FLAG_ROW_INIT 0x0040 #define PNG_FLAG_FILLER_AFTER 0x0080 #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 #define PNG_FLAG_CRC_CRITICAL_USE 0x0400 #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 #define PNG_FLAG_FREE_PLTE 0x1000 #define PNG_FLAG_FREE_TRNS 0x2000 #define PNG_FLAG_FREE_HIST 0x4000 #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L #define PNG_FLAG_LIBRARY_MISMATCH 0x20000L #define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L #define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L #define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L #define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */ #define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */ /* 0x800000L unused */ /* 0x1000000L unused */ /* 0x2000000L unused */ /* 0x4000000L unused */ /* 0x8000000L unused */ /* 0x10000000L unused */ /* 0x20000000L unused */ /* 0x40000000L unused */ #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ PNG_FLAG_CRC_ANCILLARY_NOWARN) #define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ PNG_FLAG_CRC_CRITICAL_IGNORE) #define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ PNG_FLAG_CRC_CRITICAL_MASK) /* save typing and make code easier to understand */ #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ abs((int)((c1).green) - (int)((c2).green)) + \ abs((int)((c1).blue) - (int)((c2).blue))) /* Added to libpng-1.2.6 JB */ #define PNG_ROWBYTES(pixel_bits, width) \ ((pixel_bits) >= 8 ? \ ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \ (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) ) /* PNG_OUT_OF_RANGE returns true if value is outside the range ideal-delta..ideal+delta. Each argument is evaluated twice. "ideal" and "delta" should be constants, normally simple integers, "value" a variable. Added to libpng-1.2.6 JB */ #define PNG_OUT_OF_RANGE(value, ideal, delta) \ ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) /* place to hold the signature string for a PNG file. */ #ifdef PNG_USE_GLOBAL_ARRAYS PNG_EXPORT_VAR (PNG_CONST png_byte FARDATA) png_sig[8]; #else #endif #endif /* PNG_NO_EXTERN */ /* Constant strings for known chunk types. If you need to add a chunk, * define the name here, and add an invocation of the macro in png.c and * wherever it's needed. */ #define PNG_IHDR png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'} #define PNG_IDAT png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'} #define PNG_IEND png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'} #define PNG_PLTE png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'} #define PNG_bKGD png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'} #define PNG_cHRM png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'} #define PNG_gAMA png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'} #define PNG_hIST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'} #define PNG_iCCP png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'} #define PNG_iTXt png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'} #define PNG_oFFs png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'} #define PNG_pCAL png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'} #define PNG_sCAL png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'} #define PNG_pHYs png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'} #define PNG_sBIT png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'} #define PNG_sPLT png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'} #define PNG_sRGB png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'} #define PNG_tEXt png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'} #define PNG_tIME png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} #define PNG_tRNS png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} #define PNG_zTXt png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} #ifdef PNG_USE_GLOBAL_ARRAYS PNG_EXPORT_VAR (png_byte FARDATA) png_IHDR[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_IDAT[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_IEND[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_PLTE[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_bKGD[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_cHRM[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_gAMA[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_hIST[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_iCCP[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_iTXt[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_oFFs[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_pCAL[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_sCAL[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_pHYs[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_sBIT[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_sPLT[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_sRGB[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_tEXt[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_tIME[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_tRNS[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5]; #endif /* PNG_USE_GLOBAL_ARRAYS */ #if defined(PNG_1_0_X) || defined (PNG_1_2_X) /* Initialize png_ptr struct for reading, and allocate any other memory. * (old interface - DEPRECATED - use png_create_read_struct instead). */ extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr)); #undef png_read_init #define png_read_init(png_ptr) png_read_init_3(&png_ptr, \ PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); #endif extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr, png_const_charp user_png_ver, png_size_t png_struct_size)); #if defined(PNG_1_0_X) || defined (PNG_1_2_X) extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr, png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t png_info_size)); #endif #if defined(PNG_1_0_X) || defined (PNG_1_2_X) /* Initialize png_ptr struct for writing, and allocate any other memory. * (old interface - DEPRECATED - use png_create_write_struct instead). */ extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr)); #undef png_write_init #define png_write_init(png_ptr) png_write_init_3(&png_ptr, \ PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); #endif extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr, png_const_charp user_png_ver, png_size_t png_struct_size)); extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr, png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t png_info_size)); /* Allocate memory for an internal libpng struct */ PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); /* Free memory from internal libpng struct */ PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)); PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, png_free_ptr free_fn, png_voidp mem_ptr)); /* Free any memory that info_ptr points to and reset struct. */ PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, png_infop info_ptr)); #ifndef PNG_1_0_X /* Function to allocate memory for zlib. */ PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); /* Function to free memory for zlib */ PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); #ifdef PNG_SIZE_T /* Function to convert a sizeof an item to png_sizeof item */ PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size)); #endif /* Next four functions are used internally as callbacks. PNGAPI is required * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */ PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr, png_bytep data, png_size_t length)); #ifdef PNG_PROGRESSIVE_READ_SUPPORTED PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr, png_bytep buffer, png_size_t length)); #endif PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr, png_bytep data, png_size_t length)); #if defined(PNG_WRITE_FLUSH_SUPPORTED) #if !defined(PNG_NO_STDIO) PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr)); #endif #endif #else /* PNG_1_0_X */ #ifdef PNG_PROGRESSIVE_READ_SUPPORTED PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr, png_bytep buffer, png_size_t length)); #endif #endif /* PNG_1_0_X */ /* Reset the CRC variable */ PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); /* Write the "data" buffer to whatever output you are using. */ PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data, png_size_t length)); /* Read data from whatever input you are using into the "data" buffer */ PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, png_size_t length)); /* Read bytes into buf, and update png_ptr->crc */ PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, png_size_t length)); /* Decompress data in a chunk that uses compression */ #if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr, int comp_type, png_charp chunkdata, png_size_t chunklength, png_size_t prefix_length, png_size_t *data_length)); #endif /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); /* Read the CRC from the file and compare it to the libpng calculated CRC */ PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); /* Calculate the CRC over a section of data. Note that we are only * passing a maximum of 64K on systems that have this as a memory limit, * since this is the maximum buffer size we can specify. */ PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr, png_size_t length)); #if defined(PNG_WRITE_FLUSH_SUPPORTED) PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); #endif /* simple function to write the signature */ PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)); /* write various chunks */ /* Write the IHDR chunk, and update the png_struct with the necessary * information. */ PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int compression_method, int filter_method, int interlace_method)); PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)); PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, png_size_t length)); PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); #if defined(PNG_WRITE_gAMA_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); #endif #ifdef PNG_FIXED_POINT_SUPPORTED PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point file_gamma)); #endif #endif #if defined(PNG_WRITE_sBIT_SUPPORTED) PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit, int color_type)); #endif #if defined(PNG_WRITE_cHRM_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, double white_x, double white_y, double red_x, double red_y, double green_x, double green_y, double blue_x, double blue_y)); #endif #ifdef PNG_FIXED_POINT_SUPPORTED PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, png_fixed_point int_blue_y)); #endif #endif #if defined(PNG_WRITE_sRGB_SUPPORTED) PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, int intent)); #endif #if defined(PNG_WRITE_iCCP_SUPPORTED) PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, png_charp name, int compression_type, png_charp profile, int proflen)); /* Note to maintainer: profile should be png_bytep */ #endif #if defined(PNG_WRITE_sPLT_SUPPORTED) PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, png_sPLT_tp palette)); #endif #if defined(PNG_WRITE_tRNS_SUPPORTED) PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans, png_color_16p values, int number, int color_type)); #endif #if defined(PNG_WRITE_bKGD_SUPPORTED) PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, png_color_16p values, int color_type)); #endif #if defined(PNG_WRITE_hIST_SUPPORTED) PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist, int num_hist)); #endif #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, png_charp key, png_charpp new_key)); #endif #if defined(PNG_WRITE_tEXt_SUPPORTED) PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key, png_charp text, png_size_t text_len)); #endif #if defined(PNG_WRITE_zTXt_SUPPORTED) PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key, png_charp text, png_size_t text_len, int compression)); #endif #if defined(PNG_WRITE_iTXt_SUPPORTED) PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, int compression, png_charp key, png_charp lang, png_charp lang_key, png_charp text)); #endif #if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */ PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, int num_text)); #endif #if defined(PNG_WRITE_oFFs_SUPPORTED) PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset, int unit_type)); #endif #if defined(PNG_WRITE_pCAL_SUPPORTED) PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_charp units, png_charpp params)); #endif #if defined(PNG_WRITE_pHYs_SUPPORTED) PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, int unit_type)); #endif #if defined(PNG_WRITE_tIME_SUPPORTED) PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, png_timep mod_time)); #endif #if defined(PNG_WRITE_sCAL_SUPPORTED) #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr, int unit, double width, double height)); #else #ifdef PNG_FIXED_POINT_SUPPORTED PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, int unit, png_charp width, png_charp height)); #endif #endif #endif /* Called when finished processing a row of data */ PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); /* Internal use only. Called before first row of data */ PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); #if defined(PNG_READ_GAMMA_SUPPORTED) PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)); #endif /* combine a row of data, dealing with alpha, etc. if requested */ PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, int mask)); #if defined(PNG_READ_INTERLACING_SUPPORTED) /* expand an interlaced row */ /* OLD pre-1.0.9 interface: PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, png_bytep row, int pass, png_uint_32 transformations)); */ PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)); #endif /* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ #if defined(PNG_WRITE_INTERLACING_SUPPORTED) /* grab pixels out of a row for an interlaced pass */ PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, png_bytep row, int pass)); #endif /* unfilter a row */ PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr, png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); /* Choose the best filter to use and filter the row data */ PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, png_row_infop row_info)); /* Write out the filtered row. */ PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr, png_bytep filtered_row)); /* finish a row while reading, dealing with interlacing passes, etc. */ PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); /* initialize the row buffers, etc. */ PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); /* optional call to update the users info structure */ PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, png_infop info_ptr)); /* these are the functions that do the transformations */ #if defined(PNG_READ_FILLER_SUPPORTED) PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, png_bytep row, png_uint_32 filler, png_uint_32 flags)); #endif #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ defined(PNG_READ_STRIP_ALPHA_SUPPORTED) PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, png_bytep row, png_uint_32 flags)); #endif #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_READ_PACK_SUPPORTED) PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_READ_SHIFT_SUPPORTED) PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row, png_color_8p sig_bits)); #endif #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_READ_16_TO_8_SUPPORTED) PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_READ_DITHER_SUPPORTED) PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info, png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup)); # if defined(PNG_CORRECT_PALETTE_SUPPORTED) PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, png_colorp palette, int num_palette)); # endif #endif #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_WRITE_PACK_SUPPORTED) PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)); #endif #if defined(PNG_WRITE_SHIFT_SUPPORTED) PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row, png_color_8p bit_depth)); #endif #if defined(PNG_READ_BACKGROUND_SUPPORTED) #if defined(PNG_READ_GAMMA_SUPPORTED) PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, png_color_16p trans_values, png_color_16p background, png_color_16p background_1, png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, png_uint_16pp gamma_16_to_1, int gamma_shift)); #else PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, png_color_16p trans_values, png_color_16p background)); #endif #endif #if defined(PNG_READ_GAMMA_SUPPORTED) PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row, png_bytep gamma_table, png_uint_16pp gamma_16_table, int gamma_shift)); #endif #if defined(PNG_READ_EXPAND_SUPPORTED) PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, png_bytep row, png_colorp palette, png_bytep trans, int num_trans)); PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, png_bytep row, png_color_16p trans_value)); #endif /* The following decodes the appropriate chunks, and does error correction, * then calls the appropriate callback for the chunk if it is valid. */ /* decode the IHDR chunk */ PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #if defined(PNG_READ_bKGD_SUPPORTED) PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_cHRM_SUPPORTED) PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_gAMA_SUPPORTED) PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_hIST_SUPPORTED) PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_iCCP_SUPPORTED) extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif /* PNG_READ_iCCP_SUPPORTED */ #if defined(PNG_READ_iTXt_SUPPORTED) PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_oFFs_SUPPORTED) PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_pCAL_SUPPORTED) PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_pHYs_SUPPORTED) PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_sBIT_SUPPORTED) PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_sCAL_SUPPORTED) PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_sPLT_SUPPORTED) extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif /* PNG_READ_sPLT_SUPPORTED */ #if defined(PNG_READ_sRGB_SUPPORTED) PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_tEXt_SUPPORTED) PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_tIME_SUPPORTED) PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_tRNS_SUPPORTED) PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif #if defined(PNG_READ_zTXt_SUPPORTED) PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); #endif PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, png_bytep chunk_name)); /* handle the transformations for reading and writing */ PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); #ifdef PNG_PROGRESSIVE_READ_SUPPORTED PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, png_uint_32 length)); PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, png_bytep buffer, png_size_t buffer_length)); PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, png_bytep buffer, png_size_t buffer_length)); PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); #if defined(PNG_READ_tEXt_SUPPORTED) PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr)); #endif #if defined(PNG_READ_zTXt_SUPPORTED) PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr)); #endif #if defined(PNG_READ_iTXt_SUPPORTED) PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 length)); PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr)); #endif #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ #ifdef PNG_MNG_FEATURES_SUPPORTED PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, png_bytep row)); PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, png_bytep row)); #endif #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) #if defined(PNG_MMX_CODE_SUPPORTED) /* png.c */ /* PRIVATE */ PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)); #endif #endif #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN png_uint_32 png_get_x_pixels_per_inch PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN png_uint_32 png_get_y_pixels_per_inch PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN float png_get_x_offset_inches PNGARG((png_structp png_ptr, png_infop info_ptr)); PNG_EXTERN float png_get_y_offset_inches PNGARG((png_structp png_ptr, png_infop info_ptr)); #if defined(PNG_pHYs_SUPPORTED) PNG_EXTERN png_uint_32 png_get_pHYs_dpi PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); #endif /* PNG_pHYs_SUPPORTED */ #endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ #endif /* PNG_INTERNAL */ #ifdef __cplusplus } #endif #endif /* PNG_VERSION_INFO_ONLY */ /* do not put anything past this line */ #endif /* PNG_H */
118-c-c-installer
trunk/source/png.h
C
gpl2
152,462
#ifndef _MEM_H #define _MEM_H #define MAX_MEM_BLK 1024 typedef struct { void *ptr; int size; } mem_blk; typedef struct { int num; mem_blk list[MAX_MEM_BLK]; } blk_list; typedef struct { void *start; int size; blk_list used_list; blk_list free_list; } heap; typedef struct { int size; int used; int free; void *highptr; // end of last used block } heap_stats; // mem_blk mem_blk* blk_find_size(blk_list *bl, int size); mem_blk* blk_find_ptr(blk_list *bl, void *ptr); mem_blk* blk_find_ptr_end(blk_list *bl, void *ptr); mem_blk* blk_find_ptr_after(blk_list *bl, void *ptr); mem_blk* blk_insert(blk_list *bl, mem_blk *b); void blk_remove(blk_list *bl, mem_blk *b); mem_blk* blk_merge_add(blk_list *list, mem_blk *ab); // heap void* heap_alloc(heap *h, int size); int heap_free(heap *h, void *ptr); void* heap_realloc(heap *h, void *ptr, int size); void heap_init(heap *h, void *ptr, int size); int heap_ptr_inside(heap *h, void *ptr); void heap_stat(heap *h, heap_stats *s); // mem void mem_init(); void* mem1_alloc(int size); void* mem1_realloc(void *ptr, int size); void* mem2_alloc(int size); void* mem_alloc(int size); void* mem_realloc(void *ptr, int size); void mem_free(void *ptr); void mem_stat(); void mem_stat_str(char * buffer); // ogc sys extern void* SYS_GetArena2Lo(); extern void* SYS_GetArena2Hi(); extern void* SYS_AllocArena2MemLo(u32 size,u32 align); extern void* __SYS_GetIPCBufferLo(); extern void* __SYS_GetIPCBufferHi(); // util void* LARGE_memalign(size_t align, size_t size); void* LARGE_alloc(size_t size); void* LARGE_realloc(void *ptr, size_t size); void LARGE_free(void *ptr); void memstat2(); void util_init(); void util_clear(); #define SAFE_FREE(P) if(P){mem_free(P);P=NULL;} #endif
118-c-c-installer
trunk/source/mem.h
C
gpl2
1,839
unsigned char console_font_512[] = { /* 0 0x00 '^@' */ 0x00, // -------- 0x00, // -------- 0xFF, // ######## 0xC3, // ##----## 0x99, // #--##--# 0x99, // #--##--# 0xF3, // ####--## 0xE7, // ###--### 0xE7, // ###--### 0xFF, // ######## 0xE7, // ###--### 0xE7, // ###--### 0xFF, // ######## 0x00, // -------- 0x00, // -------- 0x00, // -------- /* 1 0x01 '^A' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x7e, /* .######. */ 0x81, /* #......# */ 0xa5, /* #.#..#.# */ 0x81, /* #......# */ 0x81, /* #......# */ 0xbd, /* #.####.# */ 0x99, /* #..##..# */ 0x81, /* #......# */ 0x81, /* #......# */ 0x7e, /* .######. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 2 0x02 '^B' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x7e, /* .######. */ 0xff, /* ######## */ 0xdb, /* ##.##.## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xc3, /* ##....## */ 0xe7, /* ###..### */ 0xff, /* ######## */ 0xff, /* ######## */ 0x7e, /* .######. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 3 0x03 '^C' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x6c, /* .##.##.. */ 0xfe, /* #######. */ 0xfe, /* #######. */ 0xfe, /* #######. */ 0xfe, /* #######. */ 0x7c, /* .#####.. */ 0x38, /* ..###... */ 0x10, /* ...#.... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 4 0x04 '^D' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x10, /* ...#.... */ 0x38, /* ..###... */ 0x7c, /* .#####.. */ 0xfe, /* #######. */ 0x7c, /* .#####.. */ 0x38, /* ..###... */ 0x10, /* ...#.... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 5 0x05 '^E' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x18, /* ...##... */ 0x3c, /* ..####.. */ 0x3c, /* ..####.. */ 0xe7, /* ###..### */ 0xe7, /* ###..### */ 0xe7, /* ###..### */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x3c, /* ..####.. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 6 0x06 '^F' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x18, /* ...##... */ 0x3c, /* ..####.. */ 0x7e, /* .######. */ 0xff, /* ######## */ 0xff, /* ######## */ 0x7e, /* .######. */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x3c, /* ..####.. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 7 0x07 '^G' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x18, /* ...##... */ 0x3c, /* ..####.. */ 0x3c, /* ..####.. */ 0x18, /* ...##... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 8 0x08 '^H' */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xe7, /* ###..### */ 0xc3, /* ##....## */ 0xc3, /* ##....## */ 0xe7, /* ###..### */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ /* 9 0x09 '^I' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x3c, /* ..####.. */ 0x66, /* .##..##. */ 0x42, /* .#....#. */ 0x42, /* .#....#. */ 0x66, /* .##..##. */ 0x3c, /* ..####.. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 10 0x0a '^J' */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xc3, /* ##....## */ 0x99, /* #..##..# */ 0xbd, /* #.####.# */ 0xbd, /* #.####.# */ 0x99, /* #..##..# */ 0xc3, /* ##....## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ 0xff, /* ######## */ /* 11 0x0b '^K' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x1e, /* ...####. */ 0x0e, /* ....###. */ 0x1a, /* ...##.#. */ 0x32, /* ..##..#. */ 0x78, /* .####... */ 0xcc, /* ##..##.. */ 0xcc, /* ##..##.. */ 0xcc, /* ##..##.. */ 0xcc, /* ##..##.. */ 0x78, /* .####... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 12 0x0c '^L' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x3c, /* ..####.. */ 0x66, /* .##..##. */ 0x66, /* .##..##. */ 0x66, /* .##..##. */ 0x66, /* .##..##. */ 0x3c, /* ..####.. */ 0x18, /* ...##... */ 0x7e, /* .######. */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 13 0x0d '^M' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x3f, /* ..###### */ 0x33, /* ..##..## */ 0x3f, /* ..###### */ 0x30, /* ..##.... */ 0x30, /* ..##.... */ 0x30, /* ..##.... */ 0x30, /* ..##.... */ 0x70, /* .###.... */ 0xf0, /* ####.... */ 0xe0, /* ###..... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 14 0x0e '^N' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x7f, /* .####### */ 0x63, /* .##...## */ 0x7f, /* .####### */ 0x63, /* .##...## */ 0x63, /* .##...## */ 0x63, /* .##...## */ 0x63, /* .##...## */ 0x67, /* .##..### */ 0xe7, /* ###..### */ 0xe6, /* ###..##. */ 0xc0, /* ##...... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 15 0x0f '^O' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0xdb, /* ##.##.## */ 0x3c, /* ..####.. */ 0xe7, /* ###..### */ 0x3c, /* ..####.. */ 0xdb, /* ##.##.## */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 16 0x10 '^P' */ 0x00, /* ........ */ 0x80, /* #....... */ 0xc0, /* ##...... */ 0xe0, /* ###..... */ 0xf0, /* ####.... */ 0xf8, /* #####... */ 0xfe, /* #######. */ 0xf8, /* #####... */ 0xf0, /* ####.... */ 0xe0, /* ###..... */ 0xc0, /* ##...... */ 0x80, /* #....... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 17 0x11 '^Q' */ 0x00, /* ........ */ 0x02, /* ......#. */ 0x06, /* .....##. */ 0x0e, /* ....###. */ 0x1e, /* ...####. */ 0x3e, /* ..#####. */ 0xfe, /* #######. */ 0x3e, /* ..#####. */ 0x1e, /* ...####. */ 0x0e, /* ....###. */ 0x06, /* .....##. */ 0x02, /* ......#. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 18 0x12 '^R' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x18, /* ...##... */ 0x3c, /* ..####.. */ 0x7e, /* .######. */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x7e, /* .######. */ 0x3c, /* ..####.. */ 0x18, /* ...##... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 19 0x13 '^S' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x66, /* .##..##. */ 0x66, /* .##..##. */ 0x66, /* .##..##. */ 0x66, /* .##..##. */ 0x66, /* .##..##. */ 0x66, /* .##..##. */ 0x66, /* .##..##. */ 0x00, /* ........ */ 0x66, /* .##..##. */ 0x66, /* .##..##. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 20 0x14 '^T' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x7f, /* .####### */ 0xdb, /* ##.##.## */ 0xdb, /* ##.##.## */ 0xdb, /* ##.##.## */ 0x7b, /* .####.## */ 0x1b, /* ...##.## */ 0x1b, /* ...##.## */ 0x1b, /* ...##.## */ 0x1b, /* ...##.## */ 0x1b, /* ...##.## */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 21 0x15 '^U' */ 0x00, /* ........ */ 0x7c, /* .#####.. */ 0xc6, /* ##...##. */ 0x60, /* .##..... */ 0x38, /* ..###... */ 0x6c, /* .##.##.. */ 0xc6, /* ##...##. */ 0xc6, /* ##...##. */ 0x6c, /* .##.##.. */ 0x38, /* ..###... */ 0x0c, /* ....##.. */ 0xc6, /* ##...##. */ 0x7c, /* .#####.. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 22 0x16 '^V' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0xfe, /* #######. */ 0xfe, /* #######. */ 0xfe, /* #######. */ 0xfe, /* #######. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 23 0x17 '^W' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x18, /* ...##... */ 0x3c, /* ..####.. */ 0x7e, /* .######. */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x7e, /* .######. */ 0x3c, /* ..####.. */ 0x18, /* ...##... */ 0x7e, /* .######. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 24 0x18 '^X' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x18, /* ...##... */ 0x3c, /* ..####.. */ 0x7e, /* .######. */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 25 0x19 '^Y' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x18, /* ...##... */ 0x7e, /* .######. */ 0x3c, /* ..####.. */ 0x18, /* ...##... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 26 0x1a '^Z' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x18, /* ...##... */ 0x0c, /* ....##.. */ 0xfe, /* #######. */ 0x0c, /* ....##.. */ 0x18, /* ...##... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 27 0x1b '^[' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x30, /* ..##.... */ 0x60, /* .##..... */ 0xfe, /* #######. */ 0x60, /* .##..... */ 0x30, /* ..##.... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 28 0x1c '^\' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0xc0, /* ##...... */ 0xc0, /* ##...... */ 0xc0, /* ##...... */ 0xfe, /* #######. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 29 0x1d '^]' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x28, /* ..#.#... */ 0x6c, /* .##.##.. */ 0xfe, /* #######. */ 0x6c, /* .##.##.. */ 0x28, /* ..#.#... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 30 0x1e '^^' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x10, /* ...#.... */ 0x38, /* ..###... */ 0x38, /* ..###... */ 0x7c, /* .#####.. */ 0x7c, /* .#####.. */ 0xfe, /* #######. */ 0xfe, /* #######. */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ /* 31 0x1f '^_' */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0xfe, /* #######. */ 0xfe, /* #######. */ 0x7c, /* .#####.. */ 0x7c, /* .#####.. */ 0x38, /* ..###... */ 0x38, /* ..###... */ 0x10, /* ...#.... */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ 0x00, /* ........ */ // 32 0x0020 ' ' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 33 0x0021 '!' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x3C, // --####-- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 34 0x0022 '"' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 35 0x0023 '#' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x36, // --##-##- 0x36, // --##-##- 0x7F, // -####### 0x36, // --##-##- 0x36, // --##-##- 0x36, // --##-##- 0x7F, // -####### 0x36, // --##-##- 0x36, // --##-##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 36 0x0024 '$' 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x0C, // ----##-- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- // 37 0x0025 '%' 0x00, // -------- 0x00, // -------- 0x70, // -###---- 0xD8, // ##-##--- 0xDA, // ##-##-#- 0x76, // -###-##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x6E, // -##-###- 0x5B, // -#-##-## 0x1B, // ---##-## 0x0E, // ----###- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 38 0x0026 '&' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x38, // --###--- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x38, // --###--- 0x60, // -##----- 0x6F, // -##-#### 0x66, // -##--##- 0x66, // -##--##- 0x3B, // --###-## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 39 0x0027 ''' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 40 0x0028 '(' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x0C, // ----##-- 0x18, // ---##--- 0x18, // ---##--- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x18, // ---##--- 0x18, // ---##--- 0x0C, // ----##-- 0x00, // -------- 0x00, // -------- // 41 0x0029 ')' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x18, // ---##--- 0x18, // ---##--- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x18, // ---##--- 0x18, // ---##--- 0x30, // --##---- 0x00, // -------- 0x00, // -------- // 42 0x002a '*' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x36, // --##-##- 0x1C, // ---###-- 0x7F, // -####### 0x1C, // ---###-- 0x36, // --##-##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 43 0x002b '+' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 44 0x002c ',' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1C, // ---###-- 0x1C, // ---###-- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- // 45 0x002d '-' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 46 0x002e '.' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1C, // ---###-- 0x1C, // ---###-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 47 0x002f '/' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x06, // -----##- 0x06, // -----##- 0x0C, // ----##-- 0x0C, // ----##-- 0x18, // ---##--- 0x18, // ---##--- 0x30, // --##---- 0x30, // --##---- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 48 0x0030 '0' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1E, // ---####- 0x33, // --##--## 0x37, // --##-### 0x37, // --##-### 0x33, // --##--## 0x3B, // --###-## 0x3B, // --###-## 0x33, // --##--## 0x1E, // ---####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 49 0x0031 '1' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x0C, // ----##-- 0x1C, // ---###-- 0x7C, // -#####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 50 0x0032 '2' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 51 0x0033 '3' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x06, // -----##- 0x1C, // ---###-- 0x06, // -----##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 52 0x0034 '4' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x30, // --##---- 0x36, // --##-##- 0x36, // --##-##- 0x36, // --##-##- 0x66, // -##--##- 0x7F, // -####### 0x06, // -----##- 0x06, // -----##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 53 0x0035 '5' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x06, // -----##- 0x06, // -----##- 0x0C, // ----##-- 0x78, // -####--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 54 0x0036 '6' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1C, // ---###-- 0x18, // ---##--- 0x30, // --##---- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 55 0x0037 '7' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x0C, // ----##-- 0x0C, // ----##-- 0x18, // ---##--- 0x18, // ---##--- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 56 0x0038 '8' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x76, // -###-##- 0x3C, // --####-- 0x6E, // -##-###- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 57 0x0039 '9' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x0C, // ----##-- 0x18, // ---##--- 0x38, // --###--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 58 0x003a ':' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1C, // ---###-- 0x1C, // ---###-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1C, // ---###-- 0x1C, // ---###-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 59 0x003b ';' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1C, // ---###-- 0x1C, // ---###-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1C, // ---###-- 0x1C, // ---###-- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- // 60 0x003c '<' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x0C, // ----##-- 0x06, // -----##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 61 0x003d '=' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 62 0x003e '>' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x0C, // ----##-- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 63 0x003f '?' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x0C, // ----##-- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 64 0x0040 '@' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0xC3, // ##----## 0xC3, // ##----## 0xCF, // ##--#### 0xDB, // ##-##-## 0xDB, // ##-##-## 0xCF, // ##--#### 0xC0, // ##------ 0x7F, // -####### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 65 0x0041 'A' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 66 0x0042 'B' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 67 0x0043 'C' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 68 0x0044 'D' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x78, // -####--- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 69 0x0045 'E' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 70 0x0046 'F' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 71 0x0047 'G' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x6E, // -##-###- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 72 0x0048 'H' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 73 0x0049 'I' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 74 0x004a 'J' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 75 0x004b 'K' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x78, // -####--- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 76 0x004c 'L' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 77 0x004d 'M' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x63, // -##---## 0x63, // -##---## 0x77, // -###-### 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 78 0x004e 'N' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x63, // -##---## 0x63, // -##---## 0x73, // -###--## 0x7B, // -####-## 0x6F, // -##-#### 0x67, // -##--### 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 79 0x004f 'O' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 80 0x0050 'P' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 81 0x0051 'Q' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x06, // -----##- 0x00, // -------- 0x00, // -------- // 82 0x0052 'R' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 83 0x0053 'S' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x0C, // ----##-- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 84 0x0054 'T' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 85 0x0055 'U' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 86 0x0056 'V' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 87 0x0057 'W' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x36, // --##-##- 0x36, // --##-##- 0x36, // --##-##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 88 0x0058 'X' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x34, // --##-#-- 0x18, // ---##--- 0x18, // ---##--- 0x2C, // --#-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 89 0x0059 'Y' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 90 0x005a 'Z' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 91 0x005b '[' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x3C, // --####-- 0x00, // -------- // 92 0x005c '\' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x30, // --##---- 0x30, // --##---- 0x18, // ---##--- 0x18, // ---##--- 0x0C, // ----##-- 0x0C, // ----##-- 0x06, // -----##- 0x06, // -----##- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 93 0x005d ']' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x3C, // --####-- 0x00, // -------- // 94 0x005e '^' 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 95 0x005f '_' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0xFF, // ######## 0x00, // -------- // 96 0x0060 '`' 0x00, // -------- 0x38, // --###--- 0x18, // ---##--- 0x0C, // ----##-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 97 0x0061 'a' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 98 0x0062 'b' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 99 0x0063 'c' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 100 0x0064 'd' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 101 0x0065 'e' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 102 0x0066 'f' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1E, // ---####- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x7E, // -######- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 103 0x0067 'g' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- // 104 0x0068 'h' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 105 0x0069 'i' 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 106 0x006a 'j' 0x00, // -------- 0x00, // -------- 0x0C, // ----##-- 0x0C, // ----##-- 0x00, // -------- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x78, // -####--- 0x00, // -------- // 107 0x006b 'k' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 108 0x006c 'l' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 109 0x006d 'm' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x63, // -##---## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 110 0x006e 'n' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 111 0x006f 'o' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 112 0x0070 'p' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- // 113 0x0071 'q' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x00, // -------- // 114 0x0072 'r' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x6E, // -##-###- 0x70, // -###---- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 115 0x0073 's' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 116 0x0074 't' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x30, // --##---- 0x7E, // -######- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x1E, // ---####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 117 0x0075 'u' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 118 0x0076 'v' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 119 0x0077 'w' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x63, // -##---## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x36, // --##-##- 0x36, // --##-##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 120 0x0078 'x' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 121 0x0079 'y' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x18, // ---##--- 0xF0, // ####---- 0x00, // -------- // 122 0x007a 'z' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 123 0x007b '{' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x0C, // ----##-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x0C, // ----##-- 0x00, // -------- 0x00, // -------- // 124 0x007c '|' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- // 125 0x007d '}' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x0C, // ----##-- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x30, // --##---- 0x00, // -------- 0x00, // -------- // 126 0x007e '~' 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x71, // -###---# 0xDB, // ##-##-## 0x8E, // #---###- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 127 0x007f 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 128 0x0080 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3B, // --###-## 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3B, // --###-## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 129 0x0081 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- // 130 0x0082 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 131 0x0083 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 132 0x0084 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 133 0x0085 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3F, // --###### 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 134 0x0086 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7B, // -####-## 0x60, // -##----- 0x60, // -##----- 0xC0, // ##------ 0x00, // -------- // 135 0x0087 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 136 0x0088 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0xDB, // ##-##-## 0xDB, // ##-##-## 0xDB, // ##-##-## 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 137 0x0089 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 138 0x008a 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x36, // --##-##- 0x77, // -###-### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 139 0x008b 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x30, // --##---- 0x1C, // ---###-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 140 0x008c 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0xE3, // ###---## 0x36, // --##-##- 0x1C, // ---###-- 0x36, // --##-##- 0xE3, // ###---## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 141 0x008d 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x6D, // -##-##-# 0x6D, // -##-##-# 0x6D, // -##-##-# 0x6D, // -##-##-# 0x6D, // -##-##-# 0x3E, // --#####- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x00, // -------- // 142 0x008e 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x38, // --###--- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 143 0x008f 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 144 0x0090 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x08, // ----#--- 0x08, // ----#--- 0x7F, // -####### 0x1C, // ---###-- 0x1C, // ---###-- 0x22, // --#---#- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 145 0x0091 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0xFC, // ######-- 0x60, // -##----- 0xFC, // ######-- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 146 0x0092 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 147 0x0093 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 148 0x0094 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 149 0x0095 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 150 0x0096 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 151 0x0097 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 152 0x0098 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 153 0x0099 0x00, // -------- 0x00, // -------- 0x00, // -------- 0xFB, // #####-## 0x6F, // -##-#### 0x6B, // -##-#-## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 154 0x009a 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 155 0x009b 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 156 0x009c 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 157 0x009d 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 158 0x009e 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 159 0x009f 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 160 0x00a0 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 161 0x00a1 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x3C, // --####-- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- // 162 0x00a2 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 163 0x00a3 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0xFC, // ######-- 0x60, // -##----- 0x60, // -##----- 0xC0, // ##------ 0xFE, // #######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 164 0x00a4 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 165 0x00a5 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x7E, // -######- 0x18, // ---##--- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 166 0x00a6 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- // 167 0x00a7 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x38, // --###--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x1C, // ---###-- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- // 168 0x00a8 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 169 0x00a9 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0xC3, // ##----## 0x99, // #--##--# 0xA5, // #-#--#-# 0xA1, // #-#----# 0xA5, // #-#--#-# 0x99, // #--##--# 0xC3, // ##----## 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 170 0x00aa 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 171 0x00ab 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x33, // --##--## 0x66, // -##--##- 0xCC, // ##--##-- 0x66, // -##--##- 0x33, // --##--## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 172 0x00ac 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x06, // -----##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 173 0x00ad 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 174 0x00ae 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0xC3, // ##----## 0xB9, // #-###--# 0xA5, // #-#--#-# 0xA5, // #-#--#-# 0xB9, // #-###--# 0xA5, // #-#--#-# 0xC3, // ##----## 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 175 0x00af 0xFF, // ######## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 176 0x00b0 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 177 0x00b1 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 178 0x00b2 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x38, // --###--- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 179 0x00b3 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x38, // --###--- 0x0C, // ----##-- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 180 0x00b4 0x00, // -------- 0x1C, // ---###-- 0x18, // ---##--- 0x30, // --##---- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 181 0x00b5 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7B, // -####-## 0x60, // -##----- 0x60, // -##----- 0xC0, // ##------ 0x00, // -------- // 182 0x00b6 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1F, // ---##### 0x3E, // --#####- 0x7E, // -######- 0x7E, // -######- 0x7E, // -######- 0x3E, // --#####- 0x1E, // ---####- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x00, // -------- // 183 0x00b7 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1C, // ---###-- 0x1C, // ---###-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 184 0x00b8 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 185 0x00b9 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x38, // --###--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 186 0x00ba 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 187 0x00bb 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0xCC, // ##--##-- 0x66, // -##--##- 0x33, // --##--## 0x66, // -##--##- 0xCC, // ##--##-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 188 0x00bc 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0xE0, // ###----- 0x63, // -##---## 0x66, // -##--##- 0x6C, // -##-##-- 0x18, // ---##--- 0x37, // --##-### 0x6F, // -##-#### 0xDB, // ##-##-## 0x1F, // ---##### 0x03, // ------## 0x00, // -------- 0x00, // -------- 0x00, // -------- // 189 0x00bd 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0xE0, // ###----- 0x63, // -##---## 0x66, // -##--##- 0x6C, // -##-##-- 0x18, // ---##--- 0x3E, // --#####- 0x63, // -##---## 0xC6, // ##---##- 0x0C, // ----##-- 0x0F, // ----#### 0x00, // -------- 0x00, // -------- 0x00, // -------- // 190 0x00be 0x00, // -------- 0x00, // -------- 0xE0, // ###----- 0x30, // --##---- 0x63, // -##---## 0x36, // --##-##- 0xEC, // ###-##-- 0x18, // ---##--- 0x37, // --##-### 0x6F, // -##-#### 0xDB, // ##-##-## 0x1F, // ---##### 0x03, // ------## 0x00, // -------- 0x00, // -------- 0x00, // -------- // 191 0x00bf 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x30, // --##---- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- // 192 0x00c0 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 193 0x00c1 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 194 0x00c2 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 195 0x00c3 0x3B, // --###-## 0x6E, // -##-###- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 196 0x00c4 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 197 0x00c5 0x3C, // --####-- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 198 0x00c6 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x0F, // ----#### 0x1C, // ---###-- 0x3C, // --####-- 0x6C, // -##-##-- 0x6F, // -##-#### 0x7C, // -#####-- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x6F, // -##-#### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 199 0x00c7 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 200 0x00c8 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 201 0x00c9 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 202 0x00ca 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 203 0x00cb 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 204 0x00cc 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 205 0x00cd 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 206 0x00ce 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 207 0x00cf 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 208 0x00d0 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x78, // -####--- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0xF6, // ####-##- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 209 0x00d1 0x3B, // --###-## 0x6E, // -##-###- 0x00, // -------- 0x63, // -##---## 0x63, // -##---## 0x73, // -###--## 0x7B, // -####-## 0x6F, // -##-#### 0x67, // -##--### 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 210 0x00d2 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 211 0x00d3 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 212 0x00d4 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 213 0x00d5 0x3B, // --###-## 0x6E, // -##-###- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 214 0x00d6 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 215 0x00d7 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x42, // -#----#- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x42, // -#----#- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 216 0x00d8 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x6E, // -##-###- 0x6E, // -##-###- 0x7E, // -######- 0x76, // -###-##- 0x76, // -###-##- 0x66, // -##--##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 217 0x00d9 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 218 0x00da 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 219 0x00db 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 220 0x00dc 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 221 0x00dd 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 222 0x00de 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 223 0x00df 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x38, // --###--- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 224 0x00e0 0x00, // -------- 0x70, // -###---- 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 225 0x00e1 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 226 0x00e2 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 227 0x00e3 0x00, // -------- 0x71, // -###---# 0xDB, // ##-##-## 0x8E, // #---###- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 228 0x00e4 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 229 0x00e5 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 230 0x00e6 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x6E, // -##-###- 0x1B, // ---##-## 0x1B, // ---##-## 0x7F, // -####### 0xD8, // ##-##--- 0xD8, // ##-##--- 0x77, // -###-### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 231 0x00e7 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 232 0x00e8 0x00, // -------- 0x70, // -###---- 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 233 0x00e9 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 234 0x00ea 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 235 0x00eb 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 236 0x00ec 0x00, // -------- 0x70, // -###---- 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 237 0x00ed 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 238 0x00ee 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 239 0x00ef 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 240 0x00f0 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x36, // --##-##- 0x18, // ---##--- 0x6C, // -##-##-- 0x1E, // ---####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 241 0x00f1 0x00, // -------- 0x71, // -###---# 0xDB, // ##-##-## 0x8E, // #---###- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 242 0x00f2 0x00, // -------- 0x70, // -###---- 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 243 0x00f3 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 244 0x00f4 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 245 0x00f5 0x00, // -------- 0x71, // -###---# 0xDB, // ##-##-## 0x8E, // #---###- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 246 0x00f6 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 247 0x00f7 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 248 0x00f8 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x6E, // -##-###- 0x7E, // -######- 0x76, // -###-##- 0x66, // -##--##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 249 0x00f9 0x00, // -------- 0x70, // -###---- 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 250 0x00fa 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 251 0x00fb 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 252 0x00fc 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 253 0x00fd 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x18, // ---##--- 0xF0, // ####---- 0x00, // -------- // 254 0x00fe 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- // 255 0x00ff 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x18, // ---##--- 0xF0, // ####---- 0x00, // -------- // 256 0x0100 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 257 0x0101 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 258 0x0102 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 259 0x0103 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 260 0x0104 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 261 0x0105 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 262 0x0106 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 263 0x0107 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 264 0x0108 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 265 0x0109 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 266 0x010a 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 267 0x010b 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 268 0x010c 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 269 0x010d 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 270 0x010e 0x6C, // -##-##-- 0x38, // --###--- 0x00, // -------- 0x78, // -####--- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 271 0x010f 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 272 0x0110 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x78, // -####--- 0x6C, // -##-##-- 0x66, // -##--##- 0xF6, // ####-##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 273 0x0111 0x00, // -------- 0x00, // -------- 0x06, // -----##- 0x1F, // ---##### 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 274 0x0112 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 275 0x0113 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 276 0x0114 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 277 0x0115 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 278 0x0116 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 279 0x0117 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 280 0x0118 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 281 0x0119 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 282 0x011a 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 283 0x011b 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 284 0x011c 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x6E, // -##-###- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 285 0x011d 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- // 286 0x011e 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x6E, // -##-###- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 287 0x011f 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- // 288 0x0120 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x6E, // -##-###- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 289 0x0121 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- // 290 0x0122 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x6E, // -##-###- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 291 0x0123 0x0C, // ----##-- 0x18, // ---##--- 0x1C, // ---###-- 0x1C, // ---###-- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- // 292 0x0124 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 293 0x0125 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 294 0x0126 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0xFF, // ######## 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 295 0x0127 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0xF8, // #####--- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 296 0x0128 0x3B, // --###-## 0x6E, // -##-###- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 297 0x0129 0x00, // -------- 0x71, // -###---# 0xDB, // ##-##-## 0x8E, // #---###- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 298 0x012a 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 299 0x012b 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 300 0x012c 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 301 0x012d 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 302 0x012e 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x0E, // ----###- 0x00, // -------- // 303 0x012f 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x0E, // ----###- 0x00, // -------- // 304 0x0130 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 305 0x0131 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 306 0x0132 0x00, // -------- 0x00, // -------- 0x00, // -------- 0xC0, // ##------ 0x80, // #------- 0x80, // #------- 0x80, // #------- 0x80, // #------- 0x80, // #------- 0x8C, // #---##-- 0x8C, // #---##-- 0xC7, // ##---### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 307 0x0133 0x00, // -------- 0x00, // -------- 0x61, // -##----# 0x61, // -##----# 0x00, // -------- 0xE7, // ###--### 0x61, // -##----# 0x61, // -##----# 0x61, // -##----# 0x61, // -##----# 0x61, // -##----# 0xF9, // #####--# 0x01, // -------# 0x01, // -------# 0x0F, // ----#### 0x00, // -------- // 308 0x0134 0x1E, // ---####- 0x33, // --##--## 0x00, // -------- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 309 0x0135 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x78, // -####--- 0x00, // -------- // 310 0x0136 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x78, // -####--- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 311 0x0137 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 312 0x0138 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 313 0x0139 0x18, // ---##--- 0x30, // --##---- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 314 0x013a 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 315 0x013b 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 316 0x013c 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 317 0x013d 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x62, // -##---#- 0x64, // -##--#-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 318 0x013e 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7B, // -####-## 0x1B, // ---##-## 0x19, // ---##--# 0x1A, // ---##-#- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 319 0x013f 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 320 0x0140 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x1B, // ---##-## 0x1B, // ---##-## 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 321 0x0141 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x68, // -##-#--- 0x78, // -####--- 0x70, // -###---- 0x60, // -##----- 0xE0, // ###----- 0xE0, // ###----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 322 0x0142 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x78, // -####--- 0x1A, // ---##-#- 0x1E, // ---####- 0x1C, // ---###-- 0x18, // ---##--- 0x38, // --###--- 0x78, // -####--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 323 0x0143 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x63, // -##---## 0x63, // -##---## 0x73, // -###--## 0x7B, // -####-## 0x6F, // -##-#### 0x67, // -##--### 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 324 0x0144 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 325 0x0145 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x63, // -##---## 0x63, // -##---## 0x73, // -###--## 0x7B, // -####-## 0x6F, // -##-#### 0x67, // -##--### 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 326 0x0146 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 327 0x0147 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x63, // -##---## 0x63, // -##---## 0x73, // -###--## 0x7B, // -####-## 0x6F, // -##-#### 0x67, // -##--### 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 328 0x0148 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 329 0x0149 0xE0, // ###----- 0xE0, // ###----- 0x60, // -##----- 0xC0, // ##------ 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 330 0x014a 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x06, // -----##- 0x06, // -----##- 0x1C, // ---###-- 0x00, // -------- // 331 0x014b 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x06, // -----##- 0x06, // -----##- 0x1C, // ---###-- 0x00, // -------- // 332 0x014c 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 333 0x014d 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 334 0x014e 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 335 0x014f 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 336 0x0150 0x33, // --##--## 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 337 0x0151 0x00, // -------- 0x00, // -------- 0x33, // --##--## 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 338 0x0152 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3F, // --###### 0x6C, // -##-##-- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x6F, // -##-#### 0x6C, // -##-##-- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x3F, // --###### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 339 0x0153 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0xDB, // ##-##-## 0xDB, // ##-##-## 0xDF, // ##-##### 0xD8, // ##-##--- 0xD8, // ##-##--- 0x7F, // -####### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 340 0x0154 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 341 0x0155 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x66, // -##--##- 0x6E, // -##-###- 0x70, // -###---- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 342 0x0156 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 343 0x0157 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x6E, // -##-###- 0x70, // -###---- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x70, // -###---- 0x00, // -------- // 344 0x0158 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 345 0x0159 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x66, // -##--##- 0x6E, // -##-###- 0x70, // -###---- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 346 0x015a 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x0C, // ----##-- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 347 0x015b 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3E, // --#####- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 348 0x015c 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x0C, // ----##-- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 349 0x015d 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x3E, // --#####- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 350 0x015e 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x0C, // ----##-- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 351 0x015f 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 352 0x0160 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x0C, // ----##-- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 353 0x0161 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x3E, // --#####- 0x60, // -##----- 0x60, // -##----- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 354 0x0162 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 355 0x0163 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x30, // --##---- 0x7E, // -######- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x1E, // ---####- 0x18, // ---##--- 0x0C, // ----##-- 0x38, // --###--- 0x00, // -------- // 356 0x0164 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 357 0x0165 0x6C, // -##-##-- 0x38, // --###--- 0x00, // -------- 0x30, // --##---- 0x30, // --##---- 0x7E, // -######- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x1E, // ---####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 358 0x0166 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 359 0x0167 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x30, // --##---- 0x7E, // -######- 0x30, // --##---- 0x7C, // -#####-- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x1E, // ---####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 360 0x0168 0x3B, // --###-## 0x6E, // -##-###- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 361 0x0169 0x00, // -------- 0x71, // -###---# 0xDB, // ##-##-## 0x8E, // #---###- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 362 0x016a 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 363 0x016b 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 364 0x016c 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 365 0x016d 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 366 0x016e 0x3C, // --####-- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 367 0x016f 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 368 0x0170 0x33, // --##--## 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 369 0x0171 0x00, // -------- 0x00, // -------- 0x33, // --##--## 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 370 0x0172 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 371 0x0173 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 372 0x0174 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x36, // --##-##- 0x36, // --##-##- 0x36, // --##-##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 373 0x0175 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x63, // -##---## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x36, // --##-##- 0x36, // --##-##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 374 0x0176 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 375 0x0177 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x18, // ---##--- 0xF0, // ####---- 0x00, // -------- // 376 0x0178 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 377 0x0179 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 378 0x017a 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 379 0x017b 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 380 0x017c 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 381 0x017d 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 382 0x017e 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 383 0x017f 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1E, // ---####- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 384 0x0180 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0xF8, // #####--- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 385 0x0181 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0xB3, // #-##--## 0xB3, // #-##--## 0x33, // --##--## 0x3E, // --#####- 0x33, // --##--## 0x33, // --##--## 0x33, // --##--## 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 386 0x0182 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 387 0x0183 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 388 0x0184 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0xE0, // ###----- 0xE0, // ###----- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 389 0x0185 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0xE0, // ###----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 390 0x0186 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 391 0x0187 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3B, // --###-## 0x6D, // -##-##-# 0x6C, // -##-##-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x38, // --###--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 392 0x0188 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x03, // ------## 0x3D, // --####-# 0x6C, // -##-##-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x6C, // -##-##-- 0x38, // --###--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 393 0x0189 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x78, // -####--- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0xF6, // ####-##- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 394 0x018a 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0xB6, // #-##-##- 0xB3, // #-##--## 0x33, // --##--## 0x33, // --##--## 0x33, // --##--## 0x33, // --##--## 0x36, // --##-##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 395 0x018b 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 396 0x018c 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 397 0x018d 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x38, // --###--- 0x0C, // ----##-- 0x7E, // -######- 0x00, // -------- 0x00, // -------- // 398 0x018e 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 399 0x018f 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x06, // -----##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 400 0x0190 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x38, // --###--- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 401 0x0191 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0xC0, // ##------ 0x00, // -------- // 402 0x0192 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x0E, // ----###- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x30, // --##---- 0x00, // -------- // 403 0x0193 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3D, // --####-# 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x6E, // -##-###- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 404 0x0194 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- // 405 0x0195 0x00, // -------- 0x00, // -------- 0x00, // -------- 0xC0, // ##------ 0xC0, // ##------ 0xF6, // ####-##- 0xDB, // ##-##-## 0xDB, // ##-##-## 0xDB, // ##-##-## 0xDB, // ##-##-## 0xDB, // ##-##-## 0xCE, // ##--###- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 406 0x0196 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x1C, // ---###-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 407 0x0197 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 408 0x0198 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x6E, // -##-###- 0x6D, // -##-##-# 0x6D, // -##-##-# 0x6C, // -##-##-- 0x78, // -####--- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 409 0x0199 0x00, // -------- 0x00, // -------- 0x38, // --###--- 0x6C, // -##-##-- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 410 0x019a 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 411 0x019b 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x34, // --##-#-- 0x3C, // --####-- 0x78, // -####--- 0x58, // -#-##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 412 0x019c 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x63, // -##---## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x3F, // --###### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 413 0x019d 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x63, // -##---## 0x63, // -##---## 0x73, // -###--## 0x7B, // -####-## 0x6F, // -##-#### 0x67, // -##--### 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x60, // -##----- 0x60, // -##----- 0xC0, // ##------ 0x00, // -------- // 414 0x019e 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x00, // -------- // 415 0x019f 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 416 0x01a0 0x00, // -------- 0x00, // -------- 0x01, // -------# 0x79, // -####--# 0xCF, // ##--#### 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0x78, // -####--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 417 0x01a1 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x01, // -------# 0x79, // -####--# 0xCF, // ##--#### 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0x78, // -####--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 418 0x01a2 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x3B, // --###-## 0x03, // ------## 0x03, // ------## 0x03, // ------## 0x00, // -------- // 419 0x01a3 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x6B, // -##-#-## 0x3B, // --###-## 0x03, // ------## 0x03, // ------## 0x03, // ------## 0x00, // -------- // 420 0x01a4 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0xB3, // #-##--## 0xB3, // #-##--## 0x33, // --##--## 0x3E, // --#####- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 421 0x01a5 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x38, // --###--- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- // 422 0x01a6 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x7C, // -#####-- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x06, // -----##- 0x06, // -----##- 0x03, // ------## 0x00, // -------- // 423 0x01a7 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 424 0x01a8 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x06, // -----##- 0x06, // -----##- 0x3C, // --####-- 0x60, // -##----- 0x60, // -##----- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 425 0x01a9 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x30, // --##---- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 426 0x01aa 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x38, // --###--- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 427 0x01ab 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x30, // --##---- 0x7E, // -######- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x1E, // ---####- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- // 428 0x01ac 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3F, // --###### 0x6C, // -##-##-- 0x6C, // -##-##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 429 0x01ad 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x1E, // ---####- 0x30, // --##---- 0x7E, // -######- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x1E, // ---####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 430 0x01ae 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x0E, // ----###- 0x00, // -------- // 431 0x01af 0x00, // -------- 0x00, // -------- 0x01, // -------# 0xCD, // ##--##-# 0xCF, // ##--#### 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0x78, // -####--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 432 0x01b0 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x01, // -------# 0xCD, // ##--##-# 0xCF, // ##--#### 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0xCC, // ##--##-- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 433 0x01b1 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x77, // -###-### 0x36, // --##-##- 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 434 0x01b2 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 435 0x01b3 0x00, // -------- 0x00, // -------- 0x00, // -------- 0xF1, // ####---# 0x99, // #--##--# 0x99, // #--##--# 0x19, // ---##--# 0x0F, // ----#### 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 436 0x01b4 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x03, // ------## 0x06, // -----##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x18, // ---##--- 0xF0, // ####---- 0x00, // -------- // 437 0x01b5 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x06, // -----##- 0x0C, // ----##-- 0x7E, // -######- 0x30, // --##---- 0x60, // -##----- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 438 0x01b6 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x0C, // ----##-- 0x7E, // -######- 0x30, // --##---- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 439 0x01b7 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x0C, // ----##-- 0x1C, // ---###-- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 440 0x01b8 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x30, // --##---- 0x38, // --###--- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 441 0x01b9 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x60, // -##----- 0x30, // --##---- 0x18, // ---##--- 0x3C, // --####-- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- // 442 0x01ba 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x38, // --###--- 0x0C, // ----##-- 0x0C, // ----##-- 0x38, // --###--- 0x62, // -##---#- 0x3C, // --####-- 0x00, // -------- // 443 0x01bb 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x06, // -----##- 0x0C, // ----##-- 0x7E, // -######- 0x30, // --##---- 0x60, // -##----- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 444 0x01bc 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 445 0x01bd 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x30, // --##---- 0x30, // --##---- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 446 0x01be 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x30, // --##---- 0x7E, // -######- 0x30, // --##---- 0x30, // --##---- 0x1C, // ---###-- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 447 0x01bf 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x70, // -###---- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- // 448 0x01c0 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 449 0x01c1 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 450 0x01c2 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x18, // ---##--- 0x7E, // -######- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 451 0x01c3 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x3C, // --####-- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 452 0x01c4 0x03, // ------## 0x01, // -------# 0x00, // -------- 0x87, // #----### 0xC0, // ##------ 0x60, // -##----- 0x60, // -##----- 0x61, // -##----# 0x63, // -##---## 0x66, // -##--##- 0xC6, // ##---##- 0x87, // #----### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 453 0x01c5 0x00, // -------- 0x06, // -----##- 0x03, // ------## 0x81, // #------# 0xC0, // ##------ 0x67, // -##--### 0x60, // -##----- 0x60, // -##----- 0x61, // -##----# 0x63, // -##---## 0xC6, // ##---##- 0x87, // #----### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 454 0x01c6 0x00, // -------- 0x06, // -----##- 0x03, // ------## 0x61, // -##----# 0x60, // -##----- 0xE7, // ###--### 0x60, // -##----- 0x60, // -##----- 0x61, // -##----# 0x63, // -##---## 0x66, // -##--##- 0xE7, // ###--### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 455 0x01c7 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x06, // -----##- 0x06, // -----##- 0xE3, // ###---## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 456 0x01c8 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x03, // ------## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0xE0, // ###----- 0x00, // -------- 0x00, // -------- 0x07, // -----### 0x00, // -------- // 457 0x01c9 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x80, // #------- 0x80, // #------- 0x83, // #-----## 0x80, // #------- 0x80, // #------- 0x80, // #------- 0x80, // #------- 0x80, // #------- 0xE0, // ###----- 0x00, // -------- 0x00, // -------- 0x07, // -----### 0x00, // -------- // 458 0x01ca 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0xB0, // #-##---- 0xF0, // ####---- 0x70, // -###---- 0x36, // --##-##- 0x36, // --##-##- 0x33, // --##--## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 459 0x01cb 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x30, // --##---- 0x30, // --##---- 0x33, // --##--## 0xB0, // #-##---- 0xF0, // ####---- 0x70, // -###---- 0x30, // --##---- 0x30, // --##---- 0x30, // --##---- 0x00, // -------- 0x00, // -------- 0x07, // -----### 0x00, // -------- // 460 0x01cc 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0xC3, // ##----## 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x07, // -----### 0x00, // -------- // 461 0x01cd 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 462 0x01ce 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 463 0x01cf 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x3C, // --####-- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 464 0x01d0 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x78, // -####--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x18, // ---##--- 0x7E, // -######- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 465 0x01d1 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 466 0x01d2 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 467 0x01d3 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 468 0x01d4 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 469 0x01d5 0x7E, // -######- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 470 0x01d6 0x7E, // -######- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 471 0x01d7 0x0C, // ----##-- 0xDB, // ##-##-## 0xC3, // ##----## 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 472 0x01d8 0x0C, // ----##-- 0x0C, // ----##-- 0xDB, // ##-##-## 0xD3, // ##-#--## 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 473 0x01d9 0x36, // --##-##- 0x1C, // ---###-- 0x63, // -##---## 0x63, // -##---## 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 474 0x01da 0x36, // --##-##- 0x1C, // ---###-- 0x63, // -##---## 0x63, // -##---## 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 475 0x01db 0x30, // --##---- 0xDB, // ##-##-## 0xC3, // ##----## 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 476 0x01dc 0x30, // --##---- 0x30, // --##---- 0xDB, // ##-##-## 0xCB, // ##--#-## 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 477 0x01dd 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 478 0x01de 0x7E, // -######- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 479 0x01df 0x7E, // -######- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 480 0x01e0 0x7E, // -######- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 481 0x01e1 0x7E, // -######- 0x00, // -------- 0x18, // ---##--- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 482 0x01e2 0x00, // -------- 0x1F, // ---##### 0x00, // -------- 0x0F, // ----#### 0x1C, // ---###-- 0x3C, // --####-- 0x6C, // -##-##-- 0x6F, // -##-#### 0x7C, // -#####-- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x6F, // -##-#### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 483 0x01e3 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x6E, // -##-###- 0x1B, // ---##-## 0x1B, // ---##-## 0x7F, // -####### 0xD8, // ##-##--- 0xD8, // ##-##--- 0x77, // -###-### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 484 0x01e4 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x6E, // -##-###- 0x66, // -##--##- 0x6F, // -##-#### 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 485 0x01e5 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x06, // -----##- 0x7F, // -####### 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- // 486 0x01e6 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x6E, // -##-###- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 487 0x01e7 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- // 488 0x01e8 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x78, // -####--- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 489 0x01e9 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x6C, // -##-##-- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 490 0x01ea 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 491 0x01eb 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 492 0x01ec 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 493 0x01ed 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7E, // -######- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x07, // -----### 0x00, // -------- // 494 0x01ee 0x36, // --##-##- 0x1C, // ---###-- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x0C, // ----##-- 0x1C, // ---###-- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 495 0x01ef 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x7E, // -######- 0x06, // -----##- 0x0C, // ----##-- 0x18, // ---##--- 0x3C, // --####-- 0x06, // -----##- 0x06, // -----##- 0x06, // -----##- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- // 496 0x01f0 0x00, // -------- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x0C, // ----##-- 0x78, // -####--- 0x00, // -------- // 497 0x01f1 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x87, // #----### 0xC0, // ##------ 0x60, // -##----- 0x60, // -##----- 0x61, // -##----# 0x63, // -##---## 0x66, // -##--##- 0xC6, // ##---##- 0x87, // #----### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 498 0x01f2 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x80, // #------- 0xC0, // ##------ 0x67, // -##--### 0x60, // -##----- 0x60, // -##----- 0x61, // -##----# 0x63, // -##---## 0xC6, // ##---##- 0x87, // #----### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 499 0x01f3 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x60, // -##----- 0x60, // -##----- 0xE7, // ###--### 0x60, // -##----- 0x60, // -##----- 0x61, // -##----# 0x63, // -##---## 0x66, // -##--##- 0xE7, // ###--### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 500 0x01f4 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x60, // -##----- 0x60, // -##----- 0x6E, // -##-###- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 501 0x01f5 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x06, // -----##- 0x06, // -----##- 0x7C, // -#####-- 0x00, // -------- // 502 0x01f6 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x98, // #--##--- 0x98, // #--##--- 0x98, // #--##--- 0x98, // #--##--- 0xF9, // #####--# 0x99, // #--##--# 0x99, // #--##--# 0x99, // #--##--# 0x99, // #--##--# 0x19, // ---##--# 0x19, // ---##--# 0x0F, // ----#### 0x00, // -------- // 503 0x01f7 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x6C, // -##-##-- 0x78, // -####--- 0x70, // -###---- 0x60, // -##----- 0x60, // -##----- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 504 0x01f8 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x63, // -##---## 0x63, // -##---## 0x73, // -###--## 0x7B, // -####-## 0x6F, // -##-#### 0x67, // -##--### 0x63, // -##---## 0x63, // -##---## 0x63, // -##---## 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 505 0x01f9 0x00, // -------- 0x70, // -###---- 0x30, // --##---- 0x18, // ---##--- 0x00, // -------- 0x7C, // -#####-- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 506 0x01fa 0x0C, // ----##-- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x3C, // --####-- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x66, // -##--##- 0x7E, // -######- 0x66, // -##--##- 0x66, // -##--##- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 507 0x01fb 0x0C, // ----##-- 0x18, // ---##--- 0x3C, // --####-- 0x66, // -##--##- 0x3C, // --####-- 0x00, // -------- 0x3C, // --####-- 0x06, // -----##- 0x3E, // --#####- 0x66, // -##--##- 0x66, // -##--##- 0x3E, // --#####- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 508 0x01fc 0x03, // ------## 0x06, // -----##- 0x00, // -------- 0x0F, // ----#### 0x1C, // ---###-- 0x3C, // --####-- 0x6C, // -##-##-- 0x6F, // -##-#### 0x7C, // -#####-- 0x6C, // -##-##-- 0x6C, // -##-##-- 0x6F, // -##-#### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 509 0x01fd 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x6E, // -##-###- 0x1B, // ---##-## 0x1B, // ---##-## 0x7F, // -####### 0xD8, // ##-##--- 0xD8, // ##-##--- 0x77, // -###-### 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 510 0x01fe 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x6E, // -##-###- 0x6E, // -##-###- 0x7E, // -######- 0x76, // -###-##- 0x76, // -###-##- 0x66, // -##--##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- // 511 0x01ff 0x00, // -------- 0x0E, // ----###- 0x0C, // ----##-- 0x18, // ---##--- 0x00, // -------- 0x3E, // --#####- 0x66, // -##--##- 0x6E, // -##-###- 0x7E, // -######- 0x76, // -###-##- 0x66, // -##--##- 0x7C, // -#####-- 0x00, // -------- 0x00, // -------- 0x00, // -------- 0x00, // -------- };
118-c-c-installer
trunk/source/confont512.c
C
gpl2
175,054
/* The whole code you can see here was written by Lupo96 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <ogcsys.h> #include <gccore.h> #include <ogc/isfs.h> #include "../build/00000000_app.h" #include "../build/00000001_app.h" #include "../build/00000002_app.h" #include "../build/title_tmd.h" #include "../build/31313843_tik.h" void delete_channel_118() { s32 ret; ret = ISFS_Delete("/title/00010001/31313843/content/00000000.app"); if (ret < 0) { printf("\nCan't delete content 0"); } else { printf("\nContent 0 successfully deleted!"); } ret = ISFS_Delete("/title/00010001/31313843/content/00000001.app"); if (ret < 0) { printf("\nCan't delete content 1"); } else { printf("\nContent 1 successfully deleted!"); } ret = ISFS_Delete("/title/00010001/31313843/content/00000002.app"); if (ret < 0) { printf("\nCan't delete content 2"); } else { printf("\nContent 2 successfully deleted!"); } ret = ISFS_Delete("/title/00010001/31313843/content/title.tmd"); if (ret < 0) { printf("\nCan't delete title"); } else { printf("\nTitle successfully deleted!"); } ret = ISFS_Delete("/ticket/00010001/31313843.tik"); if (ret < 0) { printf("\nCan't delete ticket"); } else { printf("\nTicket successfully deleted!"); } printf("\nDone.\n"); } void createdir_channel_118() { s32 ret; ret = ISFS_CreateDir("/title/00010001/31313843", 0, 3, 3, 1); if (ret < 0) { printf("\nCannot create 118Channel main directory, ret = %d", ret); } ret = ISFS_CreateDir("/title/00010001/31313843/content", 0, 3, 3, 0); if (ret < 0) { printf("\nCannot create 118Channel content directory, ret = %d", ret); } ret = ISFS_CreateDir("/title/00010001/31313843/data", 0, 3, 3, 0); if (ret < 0) { printf("\nCannot create 118Channel data directory, ret = %d", ret); } printf("\nDone.\n"); } void check_channel_118() { s32 ret; ret = ISFS_Open("/ticket/00010001/31313843.tik", ISFS_OPEN_READ); if (ret < 0) { printf("\nThe 118 Channel is not installed yet!\n"); printf("Creating directory structure... "); createdir_channel_118(); } else { ISFS_Close(ret); printf("Uninstalling previous version of the 118 Channel...\n"); delete_channel_118(); } } void install_all(const u8 *source, char* destination, u32 filesize) { s32 ret; ISFS_CreateFile(destination, 0, 3, 3, 0); s32 fd = ISFS_Open(destination, ISFS_OPEN_RW); ret = ISFS_Write(fd, source, filesize); if (ret < 0 ) { ISFS_Close(fd); printf("Write failed. ret %d\n",ret); printf("Write of content app failed. "); } ISFS_Close(fd); } void install_channel_118() { ISFS_Initialize(); printf("Checking if 118 Channel is installed...\n\n"); check_channel_118(); printf("Installing 118 Channel...\n\n"); printf("Writing /title/00010001/31313843/content/00000000.app... "); install_all(_00000000_app, "/title/00010001/31313843/content/00000000.app", _00000000_app_size); printf("done.\nWriting /title/00010001/31313843/content/00000001.app... "); install_all(_00000001_app, "/title/00010001/31313843/content/00000001.app", _00000001_app_size); printf("done.\nWriting /title/00010001/31313843/content/00000002.app... "); install_all(_00000002_app, "/title/00010001/31313843/content/00000002.app", _00000002_app_size); printf("done.\nWriting /title/00010001/31313843/content/title.tmd... "); install_all(title_tmd, "/title/00010001/31313843/content/title.tmd", title_tmd_size); printf("done.\nWriting /ticket/00010001/31313843.tik... "); install_all(_31313843_tik, "/ticket/00010001/31313843.tik", _31313843_tik_size); printf("done.\n"); }
118-c-c-installer
trunk/source/C118_install.c
C
gpl2
3,737
/* Rijndael Block Cipher - rijndael.c Written by Mike Scott 21st April 1999 mike@compapp.dcu.ie Permission for free direct or derivative use is granted subject to compliance with any conditions that the originators of the algorithm place on its exploitation. */ #include <stdio.h> #include <string.h> #define u8 unsigned char /* 8 bits */ #define u32 unsigned long /* 32 bits */ #define u64 unsigned long long /* rotates x one bit to the left */ #define ROTL(x) (((x)>>7)|((x)<<1)) /* Rotates 32-bit word left by 1, 2 or 3 byte */ #define ROTL8(x) (((x)<<8)|((x)>>24)) #define ROTL16(x) (((x)<<16)|((x)>>16)) #define ROTL24(x) (((x)<<24)|((x)>>8)) /* Fixed Data */ static u8 InCo[4]={0xB,0xD,0x9,0xE}; /* Inverse Coefficients */ static u8 fbsub[256]; static u8 rbsub[256]; static u8 ptab[256],ltab[256]; static u32 ftable[256]; static u32 rtable[256]; static u32 rco[30]; /* Parameter-dependent data */ int Nk,Nb,Nr; u8 fi[24],ri[24]; u32 fkey[120]; u32 rkey[120]; static u32 pack(u8 *b) { /* pack bytes into a 32-bit Word */ return ((u32)b[3]<<24)|((u32)b[2]<<16)|((u32)b[1]<<8)|(u32)b[0]; } static void unpack(u32 a,u8 *b) { /* unpack bytes from a word */ b[0]=(u8)a; b[1]=(u8)(a>>8); b[2]=(u8)(a>>16); b[3]=(u8)(a>>24); } static u8 xtime(u8 a) { u8 b; if (a&0x80) b=0x1B; else b=0; a<<=1; a^=b; return a; } static u8 bmul(u8 x,u8 y) { /* x.y= AntiLog(Log(x) + Log(y)) */ if (x && y) return ptab[(ltab[x]+ltab[y])%255]; else return 0; } static u32 SubByte(u32 a) { u8 b[4]; unpack(a,b); b[0]=fbsub[b[0]]; b[1]=fbsub[b[1]]; b[2]=fbsub[b[2]]; b[3]=fbsub[b[3]]; return pack(b); } static u8 product(u32 x,u32 y) { /* dot product of two 4-byte arrays */ u8 xb[4],yb[4]; unpack(x,xb); unpack(y,yb); return bmul(xb[0],yb[0])^bmul(xb[1],yb[1])^bmul(xb[2],yb[2])^bmul(xb[3],yb[3]); } static u32 InvMixCol(u32 x) { /* matrix Multiplication */ u32 y,m; u8 b[4]; m=pack(InCo); b[3]=product(m,x); m=ROTL24(m); b[2]=product(m,x); m=ROTL24(m); b[1]=product(m,x); m=ROTL24(m); b[0]=product(m,x); y=pack(b); return y; } u8 ByteSub(u8 x) { u8 y=ptab[255-ltab[x]]; /* multiplicative inverse */ x=y; x=ROTL(x); y^=x; x=ROTL(x); y^=x; x=ROTL(x); y^=x; x=ROTL(x); y^=x; y^=0x63; return y; } void gentables(void) { /* generate tables */ int i; u8 y,b[4]; /* use 3 as primitive root to generate power and log tables */ ltab[0]=0; ptab[0]=1; ltab[1]=0; ptab[1]=3; ltab[3]=1; for (i=2;i<256;i++) { ptab[i]=ptab[i-1]^xtime(ptab[i-1]); ltab[ptab[i]]=i; } /* affine transformation:- each bit is xored with itself shifted one bit */ fbsub[0]=0x63; rbsub[0x63]=0; for (i=1;i<256;i++) { y=ByteSub((u8)i); fbsub[i]=y; rbsub[y]=i; } for (i=0,y=1;i<30;i++) { rco[i]=y; y=xtime(y); } /* calculate forward and reverse tables */ for (i=0;i<256;i++) { y=fbsub[i]; b[3]=y^xtime(y); b[2]=y; b[1]=y; b[0]=xtime(y); ftable[i]=pack(b); y=rbsub[i]; b[3]=bmul(InCo[0],y); b[2]=bmul(InCo[1],y); b[1]=bmul(InCo[2],y); b[0]=bmul(InCo[3],y); rtable[i]=pack(b); } } void gkey(int nb,int nk,char *key) { /* blocksize=32*nb bits. Key=32*nk bits */ /* currently nb,bk = 4, 6 or 8 */ /* key comes as 4*Nk bytes */ /* Key Scheduler. Create expanded encryption key */ int i,j,k,m,N; int C1,C2,C3; u32 CipherKey[8]; Nb=nb; Nk=nk; /* Nr is number of rounds */ if (Nb>=Nk) Nr=6+Nb; else Nr=6+Nk; C1=1; if (Nb<8) { C2=2; C3=3; } else { C2=3; C3=4; } /* pre-calculate forward and reverse increments */ for (m=j=0;j<nb;j++,m+=3) { fi[m]=(j+C1)%nb; fi[m+1]=(j+C2)%nb; fi[m+2]=(j+C3)%nb; ri[m]=(nb+j-C1)%nb; ri[m+1]=(nb+j-C2)%nb; ri[m+2]=(nb+j-C3)%nb; } N=Nb*(Nr+1); for (i=j=0;i<Nk;i++,j+=4) { CipherKey[i]=pack((u8 *)&key[j]); } for (i=0;i<Nk;i++) fkey[i]=CipherKey[i]; for (j=Nk,k=0;j<N;j+=Nk,k++) { fkey[j]=fkey[j-Nk]^SubByte(ROTL24(fkey[j-1]))^rco[k]; if (Nk<=6) { for (i=1;i<Nk && (i+j)<N;i++) fkey[i+j]=fkey[i+j-Nk]^fkey[i+j-1]; } else { for (i=1;i<4 &&(i+j)<N;i++) fkey[i+j]=fkey[i+j-Nk]^fkey[i+j-1]; if ((j+4)<N) fkey[j+4]=fkey[j+4-Nk]^SubByte(fkey[j+3]); for (i=5;i<Nk && (i+j)<N;i++) fkey[i+j]=fkey[i+j-Nk]^fkey[i+j-1]; } } /* now for the expanded decrypt key in reverse order */ for (j=0;j<Nb;j++) rkey[j+N-Nb]=fkey[j]; for (i=Nb;i<N-Nb;i+=Nb) { k=N-Nb-i; for (j=0;j<Nb;j++) rkey[k+j]=InvMixCol(fkey[i+j]); } for (j=N-Nb;j<N;j++) rkey[j-N+Nb]=fkey[j]; } /* There is an obvious time/space trade-off possible here. * * Instead of just one ftable[], I could have 4, the other * * 3 pre-rotated to save the ROTL8, ROTL16 and ROTL24 overhead */ void encrypt(char *buff) { int i,j,k,m; u32 a[8],b[8],*x,*y,*t; for (i=j=0;i<Nb;i++,j+=4) { a[i]=pack((u8 *)&buff[j]); a[i]^=fkey[i]; } k=Nb; x=a; y=b; /* State alternates between a and b */ for (i=1;i<Nr;i++) { /* Nr is number of rounds. May be odd. */ /* if Nb is fixed - unroll this next loop and hard-code in the values of fi[] */ for (m=j=0;j<Nb;j++,m+=3) { /* deal with each 32-bit element of the State */ /* This is the time-critical bit */ y[j]=fkey[k++]^ftable[(u8)x[j]]^ ROTL8(ftable[(u8)(x[fi[m]]>>8)])^ ROTL16(ftable[(u8)(x[fi[m+1]]>>16)])^ ROTL24(ftable[x[fi[m+2]]>>24]); } t=x; x=y; y=t; /* swap pointers */ } /* Last Round - unroll if possible */ for (m=j=0;j<Nb;j++,m+=3) { y[j]=fkey[k++]^(u32)fbsub[(u8)x[j]]^ ROTL8((u32)fbsub[(u8)(x[fi[m]]>>8)])^ ROTL16((u32)fbsub[(u8)(x[fi[m+1]]>>16)])^ ROTL24((u32)fbsub[x[fi[m+2]]>>24]); } for (i=j=0;i<Nb;i++,j+=4) { unpack(y[i],(u8 *)&buff[j]); x[i]=y[i]=0; /* clean up stack */ } return; } void decrypt(char *buff) { int i,j,k,m; u32 a[8],b[8],*x,*y,*t; for (i=j=0;i<Nb;i++,j+=4) { a[i]=pack((u8 *)&buff[j]); a[i]^=rkey[i]; } k=Nb; x=a; y=b; /* State alternates between a and b */ for (i=1;i<Nr;i++) { /* Nr is number of rounds. May be odd. */ /* if Nb is fixed - unroll this next loop and hard-code in the values of ri[] */ for (m=j=0;j<Nb;j++,m+=3) { /* This is the time-critical bit */ y[j]=rkey[k++]^rtable[(u8)x[j]]^ ROTL8(rtable[(u8)(x[ri[m]]>>8)])^ ROTL16(rtable[(u8)(x[ri[m+1]]>>16)])^ ROTL24(rtable[x[ri[m+2]]>>24]); } t=x; x=y; y=t; /* swap pointers */ } /* Last Round - unroll if possible */ for (m=j=0;j<Nb;j++,m+=3) { y[j]=rkey[k++]^(u32)rbsub[(u8)x[j]]^ ROTL8((u32)rbsub[(u8)(x[ri[m]]>>8)])^ ROTL16((u32)rbsub[(u8)(x[ri[m+1]]>>16)])^ ROTL24((u32)rbsub[x[ri[m+2]]>>24]); } for (i=j=0;i<Nb;i++,j+=4) { unpack(y[i],(u8 *)&buff[j]); x[i]=y[i]=0; /* clean up stack */ } return; } void aes_set_key(u8 *key) { gentables(); gkey(4, 4, (char *)key); } // CBC mode decryption void aes_decrypt(u8 *iv, u8 *inbuf, u8 *outbuf, unsigned long long len) { u8 block[16]; unsigned int blockno = 0, i; // debug_printf("aes_decrypt(%p, %p, %p, %lld)\n", iv, inbuf, outbuf, len); for (blockno = 0; blockno <= (len / sizeof(block)); blockno++) { unsigned int fraction; if (blockno == (len / sizeof(block))) { // last block fraction = len % sizeof(block); if (fraction == 0) break; memset(block, 0, sizeof(block)); } else fraction = 16; // debug_printf("block %d: fraction = %d\n", blockno, fraction); memcpy(block, inbuf + blockno * sizeof(block), fraction); decrypt((char *)block); u8 *ctext_ptr; if (blockno == 0) ctext_ptr = iv; else ctext_ptr = inbuf + (blockno-1) * sizeof(block); for(i=0; i < fraction; i++) outbuf[blockno * sizeof(block) + i] = ctext_ptr[i] ^ block[i]; // debug_printf("Block %d output: ", blockno); // hexdump(outbuf + blockno*sizeof(block), 16); } } // CBC mode encryption void aes_encrypt(u8 *iv, u8 *inbuf, u8 *outbuf, unsigned long long len) { u8 block[16]; unsigned int blockno = 0, i; // debug_printf("aes_decrypt(%p, %p, %p, %lld)\n", iv, inbuf, outbuf, len); for (blockno = 0; blockno <= (len / sizeof(block)); blockno++) { unsigned int fraction; if (blockno == (len / sizeof(block))) { // last block fraction = len % sizeof(block); if (fraction == 0) break; memset(block, 0, sizeof(block)); } else fraction = 16; // debug_printf("block %d: fraction = %d\n", blockno, fraction); memcpy(block, inbuf + blockno * sizeof(block), fraction); for(i=0; i < fraction; i++) block[i] = inbuf[blockno * sizeof(block) + i] ^ iv[i]; encrypt((char *)block); memcpy(iv, block, sizeof(block)); memcpy(outbuf + blockno * sizeof(block), block, sizeof(block)); // debug_printf("Block %d output: ", blockno); // hexdump(outbuf + blockno*sizeof(block), 16); } }
118-c-c-installer
trunk/source/rijndael.c
C
gpl2
9,748
#include <gccore.h> void aes_set_key(u8 *key); void aes_decrypt(u8 *iv, u8 *inbuf, u8 *outbuf, unsigned long long len); void aes_encrypt(u8 *iv, u8 *inbuf, u8 *outbuf, unsigned long long len);
118-c-c-installer
trunk/source/rijndael.h
C
gpl2
199
#ifndef _VIDEO_H_ #define _VIDEO_H_ #include <pngu.h> /* Prototypes */ void Con_Init(u32, u32, u32, u32); void Con_Clear(void); void Con_ClearLine(void); void Con_FgColor(u32, u8); void Con_BgColor(u32, u8); void Con_FillRow(u32, u32, u8); void Con_SetPosition(int col, int row); void Video_Configure(GXRModeObj *); void Video_SetMode(void); void Video_Clear(s32); void Video_DrawPng(IMGCTX, PNGUPROP, u16, u16); void Video_SetWide(); void FgColor(int color); void BgColor(int color); void DefaultColor(); bool ScreenShot(char *fname); int Video_AllocBg(); void Video_SaveBgRGBA(); s32 Video_SaveBg(void *img); void Video_DrawBg(); void Video_GetBG(int x, int y, char *img, int width, int height); void Video_CompositeRGBA(int x, int y, char *img, int width, int height); void Video_DrawRGBA(int x, int y, char *img, int width, int height); void RGBA_to_YCbYCr(char *dest, char *img, int width, int height); extern GXRModeObj* _Video_GetVMode(); void* _Video_GetFB(int n); void _Video_SetFB(void *fb); void _Video_SyncFB(); extern int __console_scroll; void __console_enable(void *fb); void __console_flush(int retrace_min); void Gui_Console_Enable(); s32 CON_InitTr(GXRModeObj *rmode, s32 conXOrigin,s32 conYOrigin,s32 conWidth,s32 conHeight, s32 bgColor); #endif
118-c-c-installer
trunk/source/video.h
C
gpl2
1,315
// Copyright 2010 Joseph Jordan <joe.ftpii@psychlaw.com.au> // This code is licensed to you under the terms of the GNU GPL, version 2; // see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt #include <gccore.h> #include <ogc/machine/processor.h> #include <string.h> #include "iospatch.h" #define HAVE_AHBPROT ((*(vu32*)0xcd800064 == 0xFFFFFFFF) ? 1 : 0) #define MEM_REG_BASE 0xd8b4000 #define MEM_PROT (MEM_REG_BASE + 0x20a) static void disable_memory_protection() { write32(MEM_PROT, read32(MEM_PROT) & 0x0000FFFF); } static u32 apply_patch(char *name, const u8 *old, u32 old_size, const u8 *patch, u32 patch_size, u32 patch_offset) { u8 *ptr_start = (u8*)*((u32*)0x80003134), *ptr_end = (u8*)0x94000000; u32 found = 0; u8 *location = NULL; while (ptr_start < (ptr_end - patch_size)) { if (!memcmp(ptr_start, old, old_size)) { found++; location = ptr_start + patch_offset; u8 *start = location; u32 i; for (i = 0; i < patch_size; i++) { *location++ = patch[i]; } DCFlushRange((u8 *)(((u32)start) >> 5 << 5), (patch_size >> 5 << 5) + 64); ICInvalidateRange((u8 *)(((u32)start) >> 5 << 5), (patch_size >> 5 << 5) + 64); } ptr_start++; } return found; } static const u8 di_readlimit_old[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7E, 0xD4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08 }; static const u8 di_readlimit_patch[] = { 0x7e, 0xd4 }; const u8 isfs_permissions_old[] = { 0x42, 0x8B, 0xD0, 0x01, 0x25, 0x66 }; const u8 isfs_permissions_patch[] = { 0x42, 0x8B, 0xE0, 0x01, 0x25, 0x66 }; static const u8 setuid_old[] = { 0xD1, 0x2A, 0x1C, 0x39 }; static const u8 setuid_patch[] = { 0x46, 0xC0 }; const u8 es_identify_old[] = { 0x28, 0x03, 0xD1, 0x23 }; const u8 es_identify_patch[] = { 0x00, 0x00 }; const u8 hash_old[] = { 0x20, 0x07, 0x23, 0xA2 }; const u8 hash_patch[] = { 0x00 }; const u8 new_hash_old[] = { 0x20, 0x07, 0x4B, 0x0B }; u32 IOSPATCH_Apply() { u32 count = 0; if (HAVE_AHBPROT) { disable_memory_protection(); count += apply_patch("di_readlimit", di_readlimit_old, sizeof(di_readlimit_old), di_readlimit_patch, sizeof(di_readlimit_patch), 12); count += apply_patch("isfs_permissions", isfs_permissions_old, sizeof(isfs_permissions_old), isfs_permissions_patch, sizeof(isfs_permissions_patch), 0); count += apply_patch("es_setuid", setuid_old, sizeof(setuid_old), setuid_patch, sizeof(setuid_patch), 0); count += apply_patch("es_identify", es_identify_old, sizeof(es_identify_old), es_identify_patch, sizeof(es_identify_patch), 2); count += apply_patch("hash_check", hash_old, sizeof(hash_old), hash_patch, sizeof(hash_patch), 1); count += apply_patch("new_hash_check", new_hash_old, sizeof(new_hash_old), hash_patch, sizeof(hash_patch), 1); } return count; }
118-c-c-installer
trunk/source/iospatch.c
C
gpl2
3,143
#ifndef _HTTP_H_ #define _HTTP_H_ #include <gctypes.h> #define TCP_CONNECT_TIMEOUT 5000 #define TCP_BLOCK_SIZE (16 * 1024) #define TCP_BLOCK_RECV_TIMEOUT 4000 #define TCP_BLOCK_SEND_TIMEOUT 4000 s32 tcp_socket (void); s32 tcp_connect (char *host, const u16 port); char * tcp_readln (const s32 s, const u16 max_length, const u64 start_time, const u16 timeout); bool tcp_read (const s32 s, u8 **buffer, const u32 length); bool tcp_write (const s32 s, const u8 *buffer, const u32 length); #define HTTP_TIMEOUT 300000 typedef enum { HTTPR_OK, HTTPR_ERR_CONNECT, HTTPR_ERR_REQUEST, HTTPR_ERR_STATUS, HTTPR_ERR_TOOBIG, HTTPR_ERR_RECEIVE } http_res; bool http_request (const char *url, const u32 max_size); bool http_get_result (u32 *http_status, u8 **content, u32 *length); #endif
118-c-c-installer
trunk/source/http.h
C
gpl2
789
typedef struct { unsigned long state[5]; unsigned long count[2]; unsigned char buffer[64]; } SHA1_CTX; void SHA1Transform(unsigned long state[5], unsigned char buffer[64]); void SHA1Init(SHA1_CTX* context); void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len); void SHA1Final(unsigned char digest[20], SHA1_CTX* context); void SHA1(unsigned char *ptr, unsigned int size, unsigned char *outbuf);
118-c-c-installer
trunk/source/sha1.h
C
gpl2
430
// by oggzee #ifndef _UTIL_H #define _UTIL_H #include <stdlib.h> // bool... #include <gctypes.h> // bool... #include "mem.h" #include "debug.h" #define STRCOPY(DEST,SRC) strcopy(DEST,SRC,sizeof(DEST)) char* strcopy(char *dest, const char *src, int size); #define STRAPPEND(DST,SRC) strappend(DST,SRC,sizeof(DST)) char *strappend(char *dest, char *src, int size); bool str_replace(char *str, char *olds, char *news, int size); bool str_replace_all(char *str, char *olds, char *news, int size); bool str_replace_tag_val(char *str, char *tag, char *val); bool trimsplit(char *line, char *part1, char *part2, char delim, int size); char* split_tokens(char *dest, char *src, char *delim, int size); #define D_S(A) A, sizeof(A) /* void util_init(); void util_clear(); void* LARGE_memalign(size_t align, size_t size); void LARGE_free(void *ptr); size_t LARGE_used(); void memstat2(); #define SAFE_FREE(P) if(P){free(P);P=NULL;} */ void wiilight(int enable); #include "memcheck.h" /* #ifndef _MEMCHECK_H #define memstat() do{}while(0) #define memcheck() do{}while(0) #define memcheck_ptr(B,P) do{}while(0) #endif */ #define MAX_USORT_MAP 1024 extern int usort_map[MAX_USORT_MAP]; extern int ufont_map[]; int map_ufont(int c); int mbs_len(char *s); bool mbs_trunc(char *mbs, int n); char*mbs_align(const char *str, int n); int mbs_coll(char *a, char *b); int mbs_len_valid(char *s); char *mbs_copy(char *dest, char *src, int size); int con_char_len(int c); int con_len(char *s); bool con_trunc(char *s, int n); char*con_align(const char *str, int n); static inline u32 _be32(const u8 *p) { return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; } static inline u32 _le32(const void *d) { const u8 *p = d; return (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; } static inline u32 _le16(const void *d) { const u8 *p = d; return (p[1] << 8) | p[0]; } void hex_dump1(void *p, int size); void hex_dump2(void *p, int size); void hex_dump3(void *p, int size); typedef struct SoundInfo { void *dsp_data; int size; int channels; int rate; int loop; } SoundInfo; void parse_banner_title(void *banner, u8 *title, s32 lang); void parse_banner_snd(void *banner, SoundInfo *snd); void printf_(const char *fmt, ...); void printf_x(const char *fmt, ...); void printf_h(const char *fmt, ...); int mkpath(const char *s, int mode); #endif
118-c-c-installer
trunk/source/util.h
C
gpl2
2,469
/* http -- http convenience functions Copyright (C) 2008 bushing This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <malloc.h> #include <string.h> #include <stdio.h> #include <unistd.h> #include <ogcsys.h> #include <network.h> #include <ogc/lwp_watchdog.h> #include <sys/types.h> #include <sys/errno.h> #include <fcntl.h> #include "http.h" char *http_host; u16 http_port; char *http_path; u32 http_max_size; http_res result; u32 http_status; u32 content_length; u8 *http_data; s32 tcp_socket (void) { s32 s, res; s = net_socket (PF_INET, SOCK_STREAM, 0); if (s < 0) { printf ("net_socket failed: %d\n", s); return s; } res = net_fcntl (s, F_GETFL, 0); if (res < 0) { printf ("F_GETFL failed: %d\n", res); net_close (s); return res; } res = net_fcntl (s, F_SETFL, res | 4); if (res < 0) { printf ("F_SETFL failed: %d\n", res); net_close (s); return res; } return s; } s32 tcp_connect (char *host, const u16 port) { struct hostent *hp; struct sockaddr_in sa; s32 s, res; s64 t; hp = net_gethostbyname (host); if (!hp || !(hp->h_addrtype == PF_INET)) { printf ("net_gethostbyname failed: %d\n", errno); return errno; } s = tcp_socket (); if (s < 0) return s; memset (&sa, 0, sizeof (struct sockaddr_in)); sa.sin_family= PF_INET; sa.sin_len = sizeof (struct sockaddr_in); sa.sin_port= htons (port); memcpy ((char *) &sa.sin_addr, hp->h_addr_list[0], hp->h_length); t = gettime (); while (true) { if (ticks_to_millisecs (diff_ticks (t, gettime ())) > TCP_CONNECT_TIMEOUT) { printf ("tcp_connect timeout\n"); net_close (s); return -ETIMEDOUT; } res = net_connect (s, (struct sockaddr *) &sa, sizeof (struct sockaddr_in)); if (res < 0) { if (res == -EISCONN) break; if (res == -EINPROGRESS || res == -EALREADY) { usleep (20 * 1000); continue; } printf ("net_connect failed: %d\n", res); net_close (s); return res; } break; } return s; } char * tcp_readln (const s32 s, const u16 max_length, const u64 start_time, const u16 timeout) { char *buf; u16 c; s32 res; char *ret; buf = (char *) memalign (32, max_length); c = 0; ret = NULL; while (true) { if (ticks_to_millisecs (diff_ticks (start_time, gettime ())) > timeout) break; res = net_read (s, &buf[c], 1); if ((res == 0) || (res == -EAGAIN)) { usleep (20 * 1000); continue; } if (res < 0) { printf ("tcp_readln failed: %d\n", res); break; } if ((c > 0) && (buf[c - 1] == '\r') && (buf[c] == '\n')) { if (c == 1) { ret = strdup (""); break; } ret = strndup (buf, c - 1); break; } c++; if (c == max_length) break; } free (buf); return ret; } bool tcp_read (const s32 s, u8 **buffer, const u32 length) { u8 *p; u32 step, left, block, received; s64 t; s32 res; step = 0; p = *buffer; left = length; received = 0; t = gettime (); while (left) { if (ticks_to_millisecs (diff_ticks (t, gettime ())) > TCP_BLOCK_RECV_TIMEOUT) { printf ("tcp_read timeout\n"); break; } block = left; if (block > 2048) block = 2048; res = net_read (s, p, block); if ((res == 0) || (res == -EAGAIN)) { usleep (20 * 1000); continue; } if (res < 0) { printf ("net_read failed: %d\n", res); break; } received += res; left -= res; p += res; if ((received / TCP_BLOCK_SIZE) > step) { t = gettime (); step++; } } return left == 0; } bool tcp_write (const s32 s, const u8 *buffer, const u32 length) { const u8 *p; u32 step, left, block, sent; s64 t; s32 res; step = 0; p = buffer; left = length; sent = 0; t = gettime (); while (left) { if (ticks_to_millisecs (diff_ticks (t, gettime ())) > TCP_BLOCK_SEND_TIMEOUT) { printf ("tcp_write timeout\n"); break; } block = left; if (block > 2048) block = 2048; res = net_write (s, p, block); if ((res == 0) || (res == -56)) { usleep (20 * 1000); continue; } if (res < 0) { printf ("net_write failed: %d\n", res); break; } sent += res; left -= res; p += res; if ((sent / TCP_BLOCK_SIZE) > step) { t = gettime (); step++; } } return left == 0; } bool http_split_url (char **host, char **path, const char *url) { const char *p; char *c; if (strncasecmp (url, "http://", 7)) return false; p = url + 7; c = strchr (p, '/'); if (c[0] == 0) return false; *host = strndup (p, c - p); *path = strdup (c); return true; } bool http_request (const char *url, const u32 max_size) { int linecount; if (!http_split_url(&http_host, &http_path, url)) return false; http_port = 80; http_max_size = max_size; http_status = 404; content_length = 0; http_data = NULL; int s = tcp_connect (http_host, http_port); // printf("tcp_connect(%s, %hu) = %d\n", http_host, http_port, s); if (s < 0) { result = HTTPR_ERR_CONNECT; return false; } char *request = (char *) memalign (32, 1024); char *r = request; r += sprintf (r, "GET %s HTTP/1.1\r\n", http_path); r += sprintf (r, "Host: %s\r\n", http_host); r += sprintf (r, "Cache-Control: no-cache\r\n\r\n"); // printf("request = %s\n", request); bool b = tcp_write (s, (u8 *) request, strlen (request)); // printf("tcp_write returned %d\n", b); free (request); linecount = 0; for (linecount=0; linecount < 32; linecount++) { char *line = tcp_readln (s, 0xff, gettime(), (u16)HTTP_TIMEOUT); // printf("tcp_readln returned %p (%s)\n", line, line?line:"(null)"); if (!line) { http_status = 404; result = HTTPR_ERR_REQUEST; break; } if (strlen (line) < 1) { free (line); line = NULL; break; } sscanf (line, "HTTP/1.%*u %u", &http_status); sscanf (line, "Content-Length: %u", &content_length); free (line); line = NULL; } // printf("content_length = %d, status = %d, linecount = %d\n", content_length, http_status, linecount); if (linecount == 32 || !content_length) http_status = 404; if (http_status != 200) { result = HTTPR_ERR_STATUS; net_close (s); return false; } if (content_length > http_max_size) { result = HTTPR_ERR_TOOBIG; net_close (s); return false; } http_data = (u8 *) memalign (32, content_length); b = tcp_read (s, &http_data, content_length); if (!b) { free (http_data); http_data = NULL; result = HTTPR_ERR_RECEIVE; net_close (s); return false; } result = HTTPR_OK; net_close (s); return true; } bool http_get_result (u32 *_http_status, u8 **content, u32 *length) { if (http_status) *_http_status = http_status; if (result == HTTPR_OK) { *content = http_data; *length = content_length; } else { *content = NULL; *length = 0; } free (http_host); free (http_path); return true; }
118-c-c-installer
trunk/source/http.c
C
gpl2
7,332
s32 what_to_do();
118-c-c-installer
trunk/source/Install_Uninstall.h
C
gpl2
17
#include <sys/unistd.h> #include <wiiuse/wpad.h> void Reboot(); void waitforbuttonpress(u32 *out, u32 *outGC); void Init_Console(); void printheadline(); void set_highlight(bool highlight); void Con_ClearLine(); s32 Init_SD(); s32 Init_USB(); void Close_SD(); void Close_USB();
118-c-c-installer
trunk/source/tools.h
C
gpl2
294
s32 Wad_GetTMD_and_Certs(char *filename, void **ptmd, u32 *tmdlen, void **certs, u32 *certslen); s32 Wad_Install(char *filename, bool installticket); bool check_WAD(char *filename, u32 version, u32 revision);
118-c-c-installer
trunk/source/wad.h
C
gpl2
210
#include <stdio.h> #include <ogcsys.h> #include <stdlib.h> #include <malloc.h> #include "mem.h" #include "video.h" //#include "cfg.h" #include "png.h" /* Video variables */ static void *framebuffer0 = NULL; static void *framebuffer1 = NULL; static void *framebuffer = NULL; static int framebuffer_size; static GXRModeObj *vmode = NULL; static GXRModeObj vmode_non_wide; static int video_wide; void *bg_buf_rgba = NULL; void *bg_buf_ycbr = NULL; int con_inited = 0; void _Con_Clear(void); //void Con_Init(u32 x, u32 y, u32 w, u32 h) //{ // /* Create console in the framebuffer */ // if (CFG.console_transparent) { // CON_InitTr(vmode, x, y, w, h, CONSOLE_BG_COLOR); // } else { // CON_InitEx(vmode, x, y, w, h); // } // _Con_Clear(); // con_inited = 1; //} void _Con_Clear(void) { DefaultColor(); /* Clear console */ printf("\x1b[2J"); fflush(stdout); } void Con_Clear(void) { __console_flush(0); _Con_Clear(); } void Con_ClearLine(void) { s32 cols, rows; u32 cnt; printf("\r"); fflush(stdout); /* Get console metrics */ CON_GetMetrics(&cols, &rows); /* Erase line */ for (cnt = 1; cnt < cols; cnt++) { printf(" "); fflush(stdout); } printf("\r"); fflush(stdout); } void Con_FgColor(u32 color, u8 bold) { /* Set foreground color */ printf("\x1b[%u;%um", color + 30, bold); fflush(stdout); } void Con_BgColor(u32 color, u8 bold) { /* Set background color */ printf("\x1b[%u;%um", color + 40, bold); fflush(stdout); } void Con_SetPosition(int col, int row) { /* Move to specified pos */ printf("\x1b[%u;%uH", row, col); fflush(stdout); } void Con_FillRow(u32 row, u32 color, u8 bold) { s32 cols, rows; u32 cnt; /* Set color */ printf("\x1b[%u;%um", color + 40, bold); fflush(stdout); /* Get console metrics */ CON_GetMetrics(&cols, &rows); /* Save current row and col */ printf("\x1b[s"); fflush(stdout); /* Move to specified row */ printf("\x1b[%u;0H", row); fflush(stdout); /* Fill row */ for (cnt = 0; cnt < cols; cnt++) { printf(" "); fflush(stdout); } /* Load saved row and col */ printf("\x1b[u"); fflush(stdout); /* Set default color */ Con_BgColor(0, 0); Con_FgColor(7, 1); } void Video_Configure(GXRModeObj *rmode) { /* Configure the video subsystem */ VIDEO_Configure(rmode); /* Setup video */ VIDEO_SetBlack(FALSE); VIDEO_Flush(); VIDEO_WaitVSync(); if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync(); } // allocate a MAX size frambuffer, so that it // can accomodate all video mode changes void *Video_Allocate_MAX_Framebuffer(GXRModeObj *vmode, bool mem2) { int w, h; void *buf; w = vmode->fbWidth; h = MAX(vmode->xfbHeight, VI_MAX_HEIGHT_PAL); framebuffer_size = VIDEO_PadFramebufferWidth(w) * h * VI_DISPLAY_PIX_SZ; if (mem2) { buf = LARGE_memalign(32, framebuffer_size); } else { buf = memalign(32, framebuffer_size); } if (buf) { memset(buf, 0, framebuffer_size); DCFlushRange(buf, framebuffer_size); } return buf; } //void Video_SetWide() //{ // if (CFG.widescreen && video_wide) return; // if (!CFG.widescreen && !video_wide) return; // if (!vmode) return; // // change required // if (CFG.widescreen) { // vmode->viWidth = 678; // vmode->viXOrigin = ((VI_MAX_WIDTH_NTSC - 678) / 2); // } else { // *vmode = vmode_non_wide; // } // video_wide = CFG.widescreen; // Video_Configure(vmode); //} void Video_SetMode(void) { if (vmode) return; // already set?! /* Select preferred video mode */ vmode = VIDEO_GetPreferredMode(NULL); // save non-wide vmode vmode_non_wide = *vmode; // widescreen mode video_wide = CONF_GetAspectRatio(); if (video_wide) { vmode->viWidth = 678; vmode->viXOrigin = ((VI_MAX_WIDTH_NTSC - 678) / 2); } /* Allocate memory for the framebuffer */ //framebuffer0 = MEM_K0_TO_K1(SYS_AllocateFramebuffer(vmode)); //framebuffer1 = MEM_K0_TO_K1(SYS_AllocateFramebuffer(vmode)); framebuffer0 = MEM_K0_TO_K1(Video_Allocate_MAX_Framebuffer(vmode, true)); framebuffer1 = MEM_K0_TO_K1(Video_Allocate_MAX_Framebuffer(vmode, true)); framebuffer = framebuffer0; /* Clear the screen */ Video_Clear(COLOR_BLACK); // Set Next framebuffer VIDEO_SetNextFramebuffer(framebuffer); /* Configure the video subsystem */ Video_Configure(vmode); } void Video_Close() { void *fb = Video_Allocate_MAX_Framebuffer(vmode, false); VIDEO_SetBlack(TRUE); if (fb) { framebuffer = MEM_K0_TO_K1(fb); Video_Clear(COLOR_BLACK); VIDEO_SetNextFramebuffer(framebuffer); } VIDEO_Flush(); VIDEO_WaitVSync(); } void Video_Clear(s32 color) { VIDEO_ClearFrameBuffer(vmode, framebuffer, color); } void Video_DrawPng(IMGCTX ctx, PNGUPROP imgProp, u16 x, u16 y) { PNGU_DECODE_TO_COORDS_YCbYCr(ctx, x, y, imgProp.imgWidth, imgProp.imgHeight, vmode->fbWidth, vmode->xfbHeight, framebuffer); } GXRModeObj* _Video_GetVMode() { return vmode; } void* _Video_GetFB(int n) { switch(n) { case 0: return framebuffer0; case 1: return framebuffer1; } return framebuffer; } void _Video_SetFB(void *fb) { framebuffer = fb; } void _Video_SyncFB() { VIDEO_SetNextFramebuffer(framebuffer); VIDEO_Flush(); VIDEO_WaitVSync(); if (framebuffer != framebuffer0) { memcpy(framebuffer0, framebuffer, framebuffer_size); framebuffer = framebuffer0; VIDEO_SetNextFramebuffer(framebuffer); VIDEO_Flush(); VIDEO_WaitVSync(); } } void FgColor(int color) { Con_FgColor(color & 7, color > 7 ? 1 : 0); } void BgColor(int color) { Con_BgColor(color & 7, color > 7 ? 1 : 0); } /*void DefaultColor() { FgColor(CONSOLE_FG_COLOR); BgColor(CONSOLE_BG_COLOR); }*/ #define BACKGROUND_WIDTH 640 #define BACKGROUND_HEIGHT 480 /** (from GRRLIB) * Make a PNG screenshot on the SD card. * @return True if every thing worked, false otherwise. */ bool ScreenShot(char *fname) { IMGCTX pngContext; int ErrorCode = -1; void *fb = VIDEO_GetCurrentFramebuffer(); if((pngContext = PNGU_SelectImageFromDevice(fname))) { ErrorCode = PNGU_EncodeFromYCbYCr(pngContext, BACKGROUND_WIDTH, BACKGROUND_HEIGHT, fb, 0); PNGU_ReleaseImageContext(pngContext); } return !ErrorCode; } void Video_DrawBg() { //Video_DrawRGBA(0, 0, bg_buf_rgba, vmode->fbWidth, vmode->xfbHeight); //Video_DrawRGBA(0, 0, bg_buf_rgba, BACKGROUND_WIDTH, BACKGROUND_HEIGHT); memcpy(framebuffer, bg_buf_ycbr, BACKGROUND_WIDTH * BACKGROUND_HEIGHT * 2); } int Video_AllocBg() { if (bg_buf_rgba == NULL) { bg_buf_rgba = LARGE_memalign(32, BACKGROUND_WIDTH * BACKGROUND_HEIGHT * 4); if (!bg_buf_rgba) return -1; } if (bg_buf_ycbr == NULL) { bg_buf_ycbr = LARGE_memalign(32, BACKGROUND_WIDTH * BACKGROUND_HEIGHT * 2); if (!bg_buf_ycbr) return -1; } return 0; } void Video_SaveBgRGBA() { RGBA_to_YCbYCr(bg_buf_ycbr, bg_buf_rgba, BACKGROUND_WIDTH, BACKGROUND_HEIGHT); } s32 Video_SaveBg(void *img) { IMGCTX ctx = NULL; PNGUPROP imgProp; s32 ret; /* Select PNG data */ ctx = PNGU_SelectImageFromBuffer(img); if (!ctx) { ret = -1; goto out; } /* Get image properties */ ret = PNGU_GetImageProperties(ctx, &imgProp); if (ret != PNGU_OK) { ret = -1; goto out; } Video_AllocBg(); /* Decode image */ //PNGU_DECODE_TO_COORDS_RGBA8(ctx, 0, 0, imgProp.imgWidth, imgProp.imgHeight, 255, // vmode->fbWidth, vmode->xfbHeight, bg_buf_rgba); PNGU_DECODE_TO_COORDS_RGBA8(ctx, 0, 0, imgProp.imgWidth, imgProp.imgHeight, 255, BACKGROUND_WIDTH, BACKGROUND_HEIGHT, bg_buf_rgba); Video_SaveBgRGBA(); /* Success */ ret = 0; out: /* Free memory */ if (ctx) PNGU_ReleaseImageContext(ctx); return ret; } void Video_GetBG(int x, int y, char *img, int width, int height) { int ix, iy; char *c, *bg; if (!bg_buf_rgba) return; c = img; for (iy=0; iy<height; iy++) { bg = (char*)bg_buf_rgba + (y+iy)*(vmode->fbWidth * 4) + x*4; for (ix=0; ix<width; ix++) { *((int*)c) = *((int*)bg); c += 4; bg += 4; } } } // destination: img void Video_CompositeRGBA(int x, int y, char *img, int width, int height) { int ix, iy; char *c, *bg, a; if (!bg_buf_rgba) return; c = img; for (iy=0; iy<height; iy++) { bg = (char*)bg_buf_rgba + (y+iy)*(vmode->fbWidth * 4) + x*4; for (ix=0; ix<width; ix++) { a = c[3]; png_composite(c[0], c[0], a, bg[0]); // r png_composite(c[1], c[1], a, bg[1]); // g png_composite(c[2], c[2], a, bg[2]); // b c += 4; bg += 4; } } } void RGBA_to_YCbYCr(char *dest, char *img, int width, int height) { int ix, iy, buffWidth; char *ip = img; buffWidth = width / 2; for (iy=0; iy<height; iy++) { for (ix=0; ix<width/2; ix++) { ((PNGU_u32 *)dest)[iy*buffWidth+ix] = PNGU_RGB8_TO_YCbYCr (ip[0], ip[1], ip[2], ip[4], ip[5], ip[6]); ip += 8; } } } void Video_DrawRGBA(int x, int y, char *img, int width, int height) { int ix, iy, buffWidth; char *ip = img; buffWidth = vmode->fbWidth / 2; for (iy=0; iy<height; iy++) { for (ix=0; ix<width/2; ix++) { ((PNGU_u32 *)framebuffer)[(y+iy)*buffWidth+x/2+ix] = PNGU_RGB8_TO_YCbYCr (ip[0], ip[1], ip[2], ip[4], ip[5], ip[6]); ip += 8; } } }
118-c-c-installer
trunk/source/video.c
C
gpl2
9,422
#include <stdio.h> #include <string.h> #include <malloc.h> #include <ogcsys.h> #include "sha1.h" #include "wad.h" #include "IOSPatcher.h" #include "tools.h" #define BLOCK_SIZE 2048 #define round_up(x,n) (-(-(x) & -(n))) #define TITLE_UPPER(x) ( (u32)((x) >> 32) ) #define TITLE_LOWER(x) ((u32)(x)) /* 'WAD Header' structure */ typedef struct { /* Header length */ u32 header_len; /* WAD type */ u16 type; u16 padding; /* Data length */ u32 certs_len; u32 crl_len; u32 tik_len; u32 tmd_len; u32 data_len; u32 footer_len; } ATTRIBUTE_PACKED wadHeader; s32 __Wad_ReadFile(FILE *fp, void *outbuf, u32 offset, u32 len) { s32 ret; /* Seek to offset */ fseek(fp, offset, SEEK_SET); /* Read data */ ret = fread(outbuf, len, 1, fp); if (ret < 0) return ret; return 0; } s32 __Wad_ReadAlloc(FILE *fp, void **outbuf, u32 offset, u32 len) { void *buffer = NULL; s32 ret; /* Allocate memory */ buffer = memalign(32, len); if (!buffer) return -1; /* Read file */ ret = __Wad_ReadFile(fp, buffer, offset, len); if (ret < 0) { free(buffer); return ret; } DCFlushRange(buffer, len); /* Set pointer */ *outbuf = buffer; return 0; } s32 Wad_Read_into_memory(char *filename, IOS **ios, u32 iosnr, u32 revision) { s32 ret; FILE *fp = NULL; wadHeader *header = NULL; ret = Init_IOS(ios); if (ret < 0) { printf("Out of memory\n"); goto err; } fp = fopen(filename, "rb"); if (!fp) { printf("Could not open file: %s\n", filename); ret = -1; goto err; } tmd *tmd_data = NULL; u32 cnt, offset = 0; /* WAD header */ ret = __Wad_ReadAlloc(fp, (void *)&header, offset, sizeof(wadHeader)); if (ret < 0) { printf("Error reading the header, ret = %d\n", ret); goto err; } else offset += round_up(header->header_len, 64); if (header->certs_len == 0 || header->tik_len == 0 || header->tmd_len == 0) { printf("Error: Certs, ticket and/or tmd has size 0\n"); printf("Certs size: %u, ticket size: %u, tmd size: %u\n", header->certs_len, header->tik_len, header->tmd_len); ret = -1; goto err; } /* WAD certificates */ (*ios)->certs_size = header->certs_len; ret = __Wad_ReadAlloc(fp, (void *)&(*ios)->certs, offset, header->certs_len); if (ret < 0) { printf("Error reading the certs, ret = %d\n", ret); goto err; } else offset += round_up(header->certs_len, 64); if(!IS_VALID_SIGNATURE((signed_blob *)(*ios)->certs)) { printf("Error: Bad certs signature!\n"); ret = -1; goto err; } /* WAD crl */ (*ios)->crl_size = header->crl_len; if (header->crl_len) { ret = __Wad_ReadAlloc(fp, (void *)&(*ios)->crl, offset, header->crl_len); if (ret < 0) { printf("Error reading the crl, ret = %d\n", ret); goto err; } else offset += round_up(header->crl_len, 64); } else { (*ios)->crl = NULL; } (*ios)->ticket_size = header->tik_len; /* WAD ticket */ ret = __Wad_ReadAlloc(fp, (void *)&(*ios)->ticket, offset, header->tik_len); if (ret < 0) { printf("Error reading the ticket, ret = %d\n", ret); goto err; } else offset += round_up(header->tik_len, 64); if(!IS_VALID_SIGNATURE((signed_blob *)(*ios)->ticket)) { printf("Error: Bad ticket signature!\n"); ret = -1; goto err; } (*ios)->tmd_size = header->tmd_len; /* WAD TMD */ ret = __Wad_ReadAlloc(fp, (void *)&(*ios)->tmd, offset, header->tmd_len); if (ret < 0) { printf("Error reading the tmd, ret = %d\n", ret); goto err; } else offset += round_up(header->tmd_len, 64); if(!IS_VALID_SIGNATURE((signed_blob *)(*ios)->tmd)) { printf("Error: Bad TMD signature!\n"); ret = -1; goto err; } /* Get TMD info */ tmd_data = (tmd *)SIGNATURE_PAYLOAD((*ios)->tmd); printf("Checking titleid and revision...\n"); if (TITLE_UPPER(tmd_data->title_id) != 1 || TITLE_LOWER(tmd_data->title_id) != iosnr) { printf("IOS wad has titleid: %08x%08x but expected was: %08x%08x\n", TITLE_UPPER(tmd_data->title_id), TITLE_LOWER(tmd_data->title_id), 1, iosnr); ret = -1; goto err; } if (tmd_data->title_version != revision) { printf("IOS wad has revision: %u but expected was: %u\n", tmd_data->title_version, revision); ret = -1; goto err; } ret = set_content_count(*ios, tmd_data->num_contents); if (ret < 0) { printf("Out of memory\n"); goto err; } printf("Loading contents"); for (cnt = 0; cnt < tmd_data->num_contents; cnt++) { printf("."); tmd_content *content = &tmd_data->contents[cnt]; /* Encrypted content size */ (*ios)->buffer_size[cnt] = round_up((u32)content->size, 64); (*ios)->encrypted_buffer[cnt] = memalign(32, (*ios)->buffer_size[cnt]); (*ios)->decrypted_buffer[cnt] = memalign(32, (*ios)->buffer_size[cnt]); if (!(*ios)->encrypted_buffer[cnt] || !(*ios)->decrypted_buffer[cnt]) { printf("Out of memory\n"); ret = -1; goto err; } ret = __Wad_ReadFile(fp, (*ios)->encrypted_buffer[cnt], offset, (*ios)->buffer_size[cnt]); if (ret < 0) { printf("Error reading content #%u, ret = %d\n", cnt, ret); goto err; } offset += (*ios)->buffer_size[cnt]; } printf("done\n"); printf("Reading file into memory complete.\n"); printf("Decrypting IOS...\n"); decrypt_IOS(*ios); tmd_content *p_cr = TMD_CONTENTS(tmd_data); sha1 hash; int i; printf("Checking hashes...\n"); for (i=0;i < (*ios)->content_count;i++) { SHA1((*ios)->decrypted_buffer[i], (u32)p_cr[i].size, hash); if (memcmp(p_cr[i].hash, hash, sizeof hash) != 0) { printf("Wrong hash for content #%u\n", i); ret = -1; goto err; } } goto out; err: free_IOS(ios); out: if (header) free(header); if (fp) fclose(fp); return ret; }
118-c-c-installer
trunk/source/wad.c
C
gpl2
5,633
/*------------------------------------------------------------- uninstall.c -- title uninstallation Copyright (C) 2008 tona Unless other credit specified This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1.The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2.Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3.This notice may not be removed or altered from any source distribution. -------------------------------------------------------------*/ #include <stdio.h> #include <gccore.h> #include "uninstall.h" /* Many additional functions appear in the original version of this file from AnyTitle Deleter. They are not needed for this app and require many additional files to work, so they have been removed.*/ s32 Uninstall_DeleteTitle(u32 title_u, u32 title_l) { s32 ret; char filepath[256]; sprintf(filepath, "/title/%08x/%08x", title_u, title_l); /* Remove title */ printf("\t\t- Deleting title file %s...", filepath); fflush(stdout); ret = ISFS_Delete(filepath); if (ret < 0) printf("\n\tError! ISFS_Delete(ret = %d)\n", ret); else printf(" OK!\n"); return ret; } s32 Uninstall_DeleteTicket(u32 title_u, u32 title_l) { s32 ret; char filepath[256]; sprintf(filepath, "/ticket/%08x/%08x.tik", title_u, title_l); /* Delete ticket */ printf("\t\t- Deleting ticket file %s...", filepath); fflush(stdout); ret = ISFS_Delete(filepath); if (ret < 0) printf("\n\tTicket delete failed (No ticket?) %d\n", ret); else printf(" OK!\n"); return ret; } void Uninstall_118Channel_all(){ s32 ret; ret = ISFS_Delete("/title/00010001/31313843/content/00000000.app"); if (ret < 0) { printf("\nCan't delete content 0"); } else { printf("\nContent 0 successfully deleted!"); } ret = ISFS_Delete("/title/00010001/31313843/content/00000001.app"); if (ret < 0) { printf("\nCan't delete content 1"); } else { printf("\nContent 1 successfully deleted!"); } ret = ISFS_Delete("/title/00010001/31313843/content/00000002.app"); if (ret < 0) { printf("\nCan't delete content 2"); } else { printf("\nContent 2 successfully deleted!"); } ret = ISFS_Delete("/title/00010001/31313843/content/title.tmd"); if (ret < 0) { printf("\nCan't delete title"); } else { printf("\nTitle successfully deleted!"); } ret = ISFS_Delete("/ticket/00010001/31313843.tik"); if (ret < 0) { printf("\nCan't delete ticket"); } else { printf("\nTicket successfully deleted!"); } ret = ISFS_Delete("/title/00010001/31313843/content"); if (ret < 0) { printf("\nCan't delete content directory"); } else { printf("\nContent directory successfully deleted!"); } ret = ISFS_Delete("/title/00010001/31313843/data"); if (ret < 0) { printf("\nCan't delete data directory"); } else { printf("\nData directory successfully deleted!"); } ret = ISFS_Delete("/title/00010001/31313843"); if (ret < 0) { printf("\nCan't delete main directory"); } else { printf("\nMain directory successfully deleted!"); } printf("\nDone.\n"); }
118-c-c-installer
trunk/source/uninstall.c
C
gpl2
3,689
/*------------------------------------------------------------- uninstall.h -- title uninstallation Copyright (C) 2008 tona Unless other credit specified This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1.The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2.Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3.This notice may not be removed or altered from any source distribution. -------------------------------------------------------------*/ #ifndef _UNINSTALL_H_ #define _UNINSTALL_H_ /* Function list altered from original */ s32 Uninstall_DeleteTicket(u32 title_u, u32 title_l); s32 Uninstall_DeleteTitle(u32 title_u, u32 title_l); void Uninstall_118Channel_all(); #endif
118-c-c-installer
trunk/source/uninstall.h
C
gpl2
1,305
#ifndef __CONSOLE_H__ #define __CONSOLE_H__ #define FONT_XSIZE 8 #define FONT_YSIZE 16 #define FONT_XFACTOR 1 #define FONT_YFACTOR 1 #define FONT_XGAP 0 #define FONT_YGAP 0 #define TAB_SIZE 4 typedef struct _console_data_s { void *destbuffer; unsigned char *font; int con_xres,con_yres,con_stride; int target_x,target_y, tgt_stride; int cursor_row,cursor_col; int saved_row,saved_col; int con_rows, con_cols; unsigned int foreground,background; } console_data_s; extern int __console_write(struct _reent *r,int fd,const char *ptr,size_t len); extern void __console_init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride); extern void __console_flush(int retrace_min); typedef struct unifont_header { char head_tag[8]; // UNIFONT\0 u32 max_idx; // 0xFFFF u32 reserve[2]; char index_tag[4]; // INDX u32 index[0xFFFF+1]; // 24 bit: offset in 16 byte units; 8 bit: len (0,1,2) char glyph_tag[4]; // GLYP u32 glyph_size; // GLYPH DATA // char end_tag[4] // END\0 } unifont_header; extern struct unifont_header *unifont; extern u8 *unifont_glyph; int console_set_unifont(void *buf, int size); int console_load_unifont(char *fname); //extern const devoptab_t dotab_stdout; #endif
118-c-c-installer
trunk/source/console.h
C
gpl2
1,292
(function(){ var _1,_2=""; if(typeof (inPipe)!="undefined"){ _1=true; } for(var i=0;i<16;i++){ _2+=String.fromCharCode(Math.floor(Math.random()*26)+97); } window[_2]={}; if(_1){ pipeListBadge=window[_2]; } var $=window[_2]; $.f=function(){ return {runFunction:[],timeoutCount:10,inpipe:(typeof (inPipe)!="undefined")?true:false,init:function(_5){ var _6=document.getElementsByTagName("SCRIPT"); for(var i=0;i<_6.length;i++){ var _8=(this.inpipe)?_6[i].id:_6[i].src; if(_8.match(_5)){ $.a={}; if(_6[i].innerHTML){ $.a=$.f.parseJson(_6[i].innerHTML); } $.w=document.createElement("DIV"); _6[i].parentNode.insertBefore($.w,_6[i]); _6[i].parentNode.removeChild(_6[i]); $.f.buildStructure(); break; } } },parseJson:function(_9){ this.parseJson.data=_9; if(typeof _9!=="string"){ return {"err":"trying to parse a non-string JSON object"}; } try{ var f=Function(["var document,top,self,window,parent,Number,Date,Object,Function,","Array,String,Math,RegExp,Image,ActiveXObject;","return (",_9.replace(/<\!--.+-->/gim,"").replace(/\bfunction\b/g,"function&shy;"),");"].join("")); return f(); } catch(e){ return {"err":"trouble parsing JSON object"}; } },buildStructure:function(){ $.d={"title":"&nbsp;","height":"300px","width":"100%","border":"none","margin":"0","padding":"0","containerPadding":"0","evenBackgroundColor":"transparent","oddBackgroundColor":"transparent","pipesTitleFontSize":"inherit","pipesDescriptionFontSize":"12px","count":25}; var _b=""; if(this.inpipe){ $.d.width="100%"; $.d.height="100%"; $.a.count=25; $.a.hideHeader="true"; }else{ _b="overflow:auto;overflow-x:hidden;"; var _c=document.getElementById("YUIcontainer"); if(_c==null){ $.f.createSSLink("http://yui.yahooapis.com/2.4.1/build/container/assets/container.css","YUIcontainer"); } } for(var k in $.d){ if($.a[k]===undefined){ $.a[k]=$.d[k]; } } $.w.className=_2; if($.a.addClassName!==undefined){ try{ $.w.className+=" "+$.a.addClassName; } catch(eClassName){ } } if($.a.id!==undefined){ try{ $.w.id=$.a.id; } catch(eId){ } } if($.a.width!==undefined){ try{ if($.a.width.indexOf("px")==-1&&$.a.width.indexOf("%")==-1&&$.a.width.indexOf("em")==-1){ $.a.width=$.a.width+"px"; } $.w.style.width=$.a.width; } catch(eWidth){ } } if($.a.height!==undefined){ try{ if($.a.height.indexOf("px")==-1&&$.a.height.indexOf("%")==-1&&$.a.height.indexOf("em")==-1){ $.a.height=$.a.height+"px"; } } catch(eHeight){ } } var ns=document.createElement("style"); document.getElementsByTagName("head")[0].appendChild(ns); if(!window.createPopup){ ns.appendChild(document.createTextNode("")); } var s=document.styleSheets[document.styleSheets.length-1]; var _10={"":"{zoom:1;position:"+$.a.position+";top:"+$.a.top+";left:"+$.a.left+";width:"+$.a.width+";height:"+$.a.height+";background-color:"+$.a.backgroundColor+";border:"+$.a.border+";font:"+$.a.font+";margin:"+$.a.margin+";padding:"+$.a.padding+";}","a":"{cursor:pointer;text-decoration:none;color:"+$.a.color+";}","a.yba":"{background:transparent url(http://3.bp.blogspot.com/-wsIqUGbMUyk/TchLsqCK3QI/AAAAAAAACmU/udeV22bGZ78/s400/blgo.png) 0 0 no-repeat;_background-image:url(http://l.yimg.com/a/i/us/pps/pipes-16.gif);float:left;height:16px;margin:5px 0 0 0px;width:16px;}","div.ybad":"{display:inline;height:16px;font-size:9px;font-weight:bold;line-height:22px;color:inherit;}","a.gt":"{position:absolute;height:16px;display:none;color:inherit;font-size:9px;font-weight:bold;line-height:22px;right:12px;cursor:pointer;text-decoration:underline;}","div.gts":"{position:absolute;height:16px;display:none;color:inherit;font-size:12px;font-weight:bold;line-height:20px;right:2px;cursor:none;text-decoration:none;}","a.ybaa":"{color:inherit;text-decoration:underline}","sup.ybas":"{font-size:100%;color:inherit}","a.ybt":"{font-weight:bold;color:"+$.a.headlineColor+";}","div.ybx":"{visibility:hidden;background-color:transparent;margin:"+$.a.containerPadding+";padding:0;position:relative;}","div.ybr":"{zoom:1;position:relative;display:block;font-size:1em;margin:3px 0 0 0;padding:0pt;width:100%;"+_b+"}","div.ybf":"{display:none;width:100%;background-color:transparent;height:20px;margin:0;padding:0;position:relative}","div.ybr li.ybi":"{background-color:"+$.a.evenBackgroundColor+";margin:0;padding:5px 5px 5px 0;list-style:none;list-style-position:outside;overflow:hidden;text-indent:0}","div.ybr li.ybi.odd":"{background-color:"+$.a.oddBackgroundColor+";}","h3.ybh":"{margin:0;padding:0;font-weight:bold;background-color:"+$.a.headerBackgroundColor+";}","h3.ybt":"{margin:0;padding:0;position:relative;}","div.PBajaxwait":"{position:relative;display:block;width:100%;height:100%;margin-top:-"+$.a.containerPadding+";background: #eee url('http://l.yimg.com/a/i/us/pps/logo_ani_1.gif') 50% 50% no-repeat;opacity:0.75;filter:alpha(opacity=75);}",".pipesImgdescription":"{display:block;width:100%;height:auto;color:"+$.a.descriptionColor+";}",".pipesImgdescription .pipesThumbnail":"{position:relative;float:left;background: url(http://4.bp.blogspot.com/-LOOjBWkPDOU/TcgzCKbFr1I/AAAAAAAACmE/RkFjOZVgkoU/s400/blogger.gif) no-repeat top center;border: 0px;height:72px;width:72px;overflow:hidden;margin: 0px 8px 0px 0px;}",".pipesImgdescription .pipesThumbnail img":"{position:static;width:82px;min-height:72px;border:0px solid #eee}",".pipesImgdescription .pipesTitle":"{font-size:"+$.a.pipesTitleFontSize+";font-weight:bold;padding-bottom:3px;width:100%;}",".pipesImgdescription .pipesDescription":"{font-size:"+$.a.pipesDescriptionFontSize+";}",".pipesHolder":"{padding:0px; margin:10px 0px 0px 0px;}",".pipesText":"{zoom:1;margin-left: 55px;}","ul":"{display:block;overflow:hidden;position:relative;width:300000px;z-index:2;padding:0;margin:auto;}","ul.pipesSmallthumb li":"{border:1px solid #eee;display:none;float:left;height:32px;list-style-image:none;list-style-position:outside;list-style-type:none;overflow:hidden;padding:2px;width:32px;}","ul.pipesSmallthumb li:hover":"{border:1px solid red;}","ul.pipesSmallthumb":"{margin: 10px 0 0;padding:0;width:auto;}","ul.pipesSmallthumb li a img":"{height:32px;width:32px;cursor:pointer;border: 0px;position:static;left:inherit;right:inherit;}",".ybf":"{display:none!important;}"}; var _11={"gin div.hd":"{background-color:#eee;border:none}"}; var _12=""; for(var r in _10){ var _14="."+_2+" "+r; if(window.createPopup){ _12+=_14+_10[r]; }else{ var _15=document.createTextNode(_14+_10[r]); ns.appendChild(_15); } } for(var r in _11){ var _14="#"+_2+r; if(window.createPopup){ _12+=_14+_11[r]; }else{ var _15=document.createTextNode(_14+_11[r]); ns.appendChild(_15); } } if(window.createPopup){ s.cssText=_12; } $.w.ajaxwait=document.createElement("DIV"); $.w.ajaxwait.className="PBajaxwait"; $.w.c=document.createElement("DIV"); $.w.c.className="ybx"; $.w.h=document.createElement("h3"); $.w.h.className="ybh"; if($.a.hideHeader!==undefined){ try{ $.w.h.style.display="none"; } catch(eHideHeader){ } } $.w.t=document.createElement("A"); $.w.t.className="ybt"; $.w.t.innerHTML=$.a.title; $.w.t.target="_blank"; $.w.h.appendChild($.w.t); $.w.c.appendChild($.w.h); $.w.r=document.createElement("DIV"); $.w.r.className="ybr"; $.w.c.appendChild($.w.r); $.w.dtf=document.createElement("div"); $.w.dtf.className="ybf"; $.w.dtf.innerHTML="<a href=\"http://helplogger.blogspot.com\" class=\"yba\"></a> &nbsp;<div class=\"ybad\">Powered by <a class=\"ybaa\" href=\"http://helplogger.blogspot.com\">Helplogger</a><sup class=\"ybas\">e</sup></div><a class=\"gt\">Get This</a><div class=\"gts\">&#187;</div>"; var _16=$.w.dtf.getElementsByTagName("a"); this.getThisDiv=_16[2]; var _17=$.w.dtf.getElementsByTagName("div"); this.getThisDivArrow=_17[1]; $.w.ajaxwait.appendChild($.w.c); $.w.ajaxwait.appendChild($.w.dtf); $.w.appendChild($.w.ajaxwait); if(!this.inpipe){ if($.a.localJson===undefined){ $.f.runSearch(); }else{ $.f.renderResult($.a.localJson); } } },runCalledFromPipe:function(){ $.f.renderResult(jsondata); },runSearch:function(){ $.f.callback="pipesCallback"; pipesCallback=function(r){ if(pipesCallBackArr[r.value.requesturl]){ for(var e=0;e<pipesCallBackArr[r.value.requesturl].length;e++){ if(pipesCallBackArr[r.value.requesturl][e]){ pipesCallBackArr[r.value.requesturl][e].f.renderResult(r); pipesCallBackArr[r.value.requesturl][e]=null; } } } }; var _1a="http://pipes.yahoo.com/pipes/pipe.info?_id="+$.a.pipe_id; var url="http://run.pipes.yahoo.com/pipes/pipe.run?_id="+$.a.pipe_id+"&_render=badge&_callback="+$.f.callback; this.queryparams=""; for(var key in $.a.pipe_params){ if($.a.pipe_params[key]===null){ continue; } url+="&"+encodeURIComponent(key)+"="+encodeURIComponent($.a.pipe_params[key]); this.queryparams+="&"+decodeURIComponent(key)+"="+decodeURIComponent($.a.pipe_params[key]); } $.w.t.href=_1a; if(typeof (pipesCallBackArr)=="undefined"){ pipesCallBackArr=[]; } if(typeof (pipesCallBackArr[url])=="undefined"){ pipesCallBackArr[url]=[]; } pipesCallBackArr[url].push($); if(typeof (YAHOO)=="undefined"||!YAHOO||typeof (YAHOO.util)=="undefined"||!YAHOO.util){ var _1d=document.getElementById("yui"); if(_1d==null){ $.f.runScript("http://yui.yahooapis.com/2.3.1/build/utilities/utilities.js","yui"); } } $.f.runScript(url,_2); },renderResult:function(r){ if(r.value.published==""){ var t=$.w.h.cloneNode(true); t.innerHTML=r.value.title; $.w.h.parentNode.replaceChild(t,$.w.h); $.w.h=t; this.getThisDiv.style.display="none"; this.getThisDivArrow.style.display="none"; }else{ var t=$.w.t.cloneNode(true); t.innerHTML=r.value.title; $.w.t.parentNode.replaceChild(t,$.w.t); $.w.t=t; } this.listbadge.init(r); },runScript:function(url,id){ var s=document.createElement("script"); s.id=id; s.type="text/javascript"; s.src=url; document.getElementsByTagName("head")[0].appendChild(s); },createSSLink:function(url,id){ var l=document.createElement("link"); l.id=id; l.rel="stylesheet"; l.type="text/css"; l.href=url; document.getElementsByTagName("head")[0].appendChild(l); },removeScript:function(id){ if(document.getElementById(id)){ var s=document.getElementById(id); s.parentNode.removeChild(s); } },getthisfuncInside:function(){ YAHOO.util.Dom.addClass(document.body,"yui-skin-sam"); var _28=(_1)?pid:$.a.pipe_id; var _29=(_1)?"":$.f.queryparams; if(this.getitnow==undefined){ this.getitnow=new YAHOO.widget.Panel(_2+"gin",{width:"420px",fixedcenter:true,constraintoviewport:true,underlay:"none",close:true,visible:false,draggable:true,modal:true,iframe:true,zIndex:"11111"}); this.getitnow.setHeader("<div style=\"border:none;font:bold 16px arial;color:#626262;text-align:left;padding-left:5px\">Get this Yahoo! Pipes<sup>&trade;</sup> Badge <div style=\"position:absolute;right:35px;letter-spacing:4px;top:3px;\"><a style=\"font-size:11px;color:#626262;\" href=\"http://pipes.yahoo.com/pipes/badgedocs\" target=\"_blank\">HELP</a></div></div>"); this.getitnow.setBody("<iframe width=\"415\" height=\"350\" allowtransparency=\"true\" marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"no\" src=\"http://pipes.yahoo.com/pipes/badge.config?page=1&_btype=list&_id="+_28+_29+"\"></iframe>"); this.getitnow.render(document.body); YAHOO.util.Event.addListener(_2+"ginClose","click",this.getitnow.hide,this.getitnow,true); } this.getitnow.show(); },getthisfuncOutside:function(){ var _2a=(_1)?pid:$.a.pipe_id; var _2b=(_1)?"":$.f.queryparams; var url="http://pipes.yahoo.com/pipes/badge.config?page=1&_btype=list&_id="+_2a+_2b; window.open(url); },listbadge:{init:function(r){ if(typeof (YAHOO)=="undefined"){ $.f.timeoutCount--; if($.f.timeoutCount==0){ }else{ window.setTimeout(function(){ $.f.listbadge.init(r); },1000); } return; } YAHOO.util.Dom.removeClass($.w.ajaxwait,"PBajaxwait"); if(!$.f.inpipe){ var _2e=document.getElementById("YUICscript"); if(_2e==null){ $.f.runScript("http://yui.yahooapis.com/2.4.1/build/container/container-min.js","YUICscript"); } $.w.dtf.style.display="block"; if(r.value.published!=""){ this.checkViewport(); } } YAHOO.util.Event.addListener(window,"resize",this.resized,this,true); var w=$.w.r.offsetWidth; if(!$.f.inpipe){ var _30=(parseInt($.a.containerPadding,10)*2); var h=$.w.offsetHeight-$.w.h.offsetHeight-$.w.dtf.offsetHeight-_30-5; if(h>0){ $.w.r.style.height=h+"px"; } } this.w=w; this.remove(); if(r&&r.value&&r.value.items&&r.value.items.length){ this.startnum=0; this.orglen=r.value.items.length; this.countby=$.a.count; this.results=r; var _32=(this.orglen<this.countby)?this.orglen:this.countby; this.create(this.startnum,_32); this.startnum=this.countby; }else{ var t=$.w.r.cloneNode(true); t.innerHTML="<h4>No results</h4>"; $.w.r.parentNode.replaceChild(t,$.w.r); $.w.r=t; } YAHOO.util.Dom.setStyle($.w.c,"visibility","visible"); },checkViewport:function(){ YAHOO.util.Event.removeListener($.f.getThisDiv,"click"); if(YAHOO.util.Dom.getViewportWidth()>=422&&YAHOO.util.Dom.getViewportHeight()>=415){ YAHOO.util.Event.addListener($.f.getThisDiv,"click",$.f.getthisfuncInside,this,true); }else{ YAHOO.util.Event.addListener($.f.getThisDiv,"click",$.f.getthisfuncOutside,this,true); } },resized:function(){ if(this.currheight!=document.documentElement.clientHeight&&this.currheight!=""){ this.checkViewport(); } this.currheight=document.documentElement.clientHeight; },createDescription:function(_34,_35){ var _36=(_34.smallimg==undefined)?"":"<img src='"+_34.smallimg+"' />"; var _37=(_35=="imgBadge")?"":"<div class='pipesThumbnail'>"+_36+"</div>"; var _38=(_36==""||_35=="imgBadge")?"style='margin-left:0px;'":"style='margin-left:55px;'"; var _39="<div class='pipesImgdescription'><div class='pipesHolder'>"+_37+"<div class='pipesText' "+_38+"><div class='pipesTitle'><a href='"+_34.link+"' target='_self'>"+_34.title+"</a></div><div class='pipesDescription'>"+_34.description+"</div><ul class='pipesSmallthumb'></ul></div></div></div>"; return _39; },createDescThumbs:function(obj,w,_3c){ var _3d=obj.getElementsByTagName("ul"); this.smallthumbholder=_3d[0]; var ww=w-55; this.smallitemimgcount=Math.round(ww/50); var _3f=""; var _40=(this.smallitemimgcount>_3c.usethisimgarr.length)?_3c.usethisimgarr.length:this.smallitemimgcount; for(var x=1;x<_40;x++){ _3f+="<li><a href="+_3c.usethisimgarr[x].url+" target='_blank'><img src='"+_3c.usethisimgarr[x].url+"'</a></li>"; } if(_3f==""){ this.smallthumbholder.style.marginTop="0px"; }else{ var t=this.smallthumbholder.cloneNode(true); t.innerHTML=_3f; this.smallthumbholder.parentNode.replaceChild(t,this.smallthumbholder); this.smallthumbholder=t; var _43=this.smallthumbholder.getElementsByTagName("img"); this.thumbnails=_43; for(i=0;i<_43.length;i++){ new this.makeGrow(_43[i]); } } },makeGrow:function(img){ var _45=null; var _46=img; var _47,w,h; var _4a=function(obj){ _47=YAHOO.util.Dom.getXY(_46); w=parseInt(YAHOO.util.Dom.getStyle(_46,"width")); h=parseInt(YAHOO.util.Dom.getStyle(_46,"height")); _45=obj.cloneNode(false); _45.style.position="absolute"; _45.style.width="32px"; _45.style.height="32px"; _45.style.top=_47[1]+"px"; _45.style.left=_47[0]+"px"; _45.style.zIndex="999"; _45.style.display="none"; _45.style.padding="2px"; _45.style.border="1px solid #eee"; _45.className="clonedSmallImg"; YAHOO.util.Event.addListener(_45,"mouseout"); document.body.appendChild(_45); _4c(); }; var _4c=function(e){ if(_45==null){ _4a(_46); return; } _45.style.display="inline"; var _4e=new YAHOO.util.Anim(_45,{width:{to:200},height:{to:200}},0.6,YAHOO.util.Easing.backOut); var _4f=_4e.getEl(); _4e.onTween.subscribe(function(){ var nx=_47[0]-((_4f.offsetWidth-w)>>1); var ny=_47[1]-((_4f.offsetHeight-h)>>1); if(nx<0){ nx=0; } if(ny<0){ ny=0; } YAHOO.util.Dom.setXY(_4f,[nx,ny]); }); _4e.animate(); $.f.listbadge.growAnim=_4e; YAHOO.util.Event.addListener(_45,"mouseout",_52); }; var _52=function(){ if($.f.listbadge.growAnim.isAnimated()==true){ window.setTimeout(function(){ _52(); },50); return; } YAHOO.util.Event.removeListener(_45,"mouseout"); var _53=new YAHOO.util.Anim(_45,{width:{to:32},height:{to:32}},0.2); var _54=_53.getEl(); _53.onTween.subscribe(function(){ var nx=_47[0]-((_54.offsetWidth-w)>>1); var ny=_47[1]-((_54.offsetHeight-h)>>1); if(nx<0){ nx=0; } if(ny<0){ ny=0; } YAHOO.util.Dom.setXY(_54,[nx,ny]); }); _53.onComplete.subscribe(function(){ var _57=_53.getEl(); _57.style.display="none"; }); _53.animate(); }; YAHOO.util.Event.addListener(_46,"mouseover",_4c); },remove:function(){ $.w.r.innerHTML=""; },create:function(_58,_59){ for(var i=_58;i<_59;i++){ var _5b=this.results.value.items[i]; var _5c=_5b.media.regular.length; var _5d=_5b.media.thumbnails.length; var _5e=(_5c>_5d)?_5b.media.regular:_5b.media.thumbnails; _5b.usethisimgarr=_5e; if(_5e.length!=0){ if(_5b.media.thumbnails.length!=0){ _5b.smallimg=_5b.media.thumbnails[0].url; }else{ _5b.smallimg=_5e[0].url; } } var li=document.createElement("LI"); this.li=li; li.className="ybi"; if(i%2){ li.className+=" odd"; } li.innerHTML=this.createDescription(_5b); this.createDescThumbs(this.li,this.w,_5b); var _60=li.getElementsByTagName("div")[2]; var _61=li.getElementsByTagName("div")[3]; var _62=li.getElementsByTagName("div")[4]; var _63=li.getElementsByTagName("div")[5]; if(_60.innerHTML!=""){ YAHOO.util.Dom.setStyle(_60,"margin-right","8px"); } YAHOO.util.Dom.setStyle(_61,"margin-left","0px"); $.w.r.appendChild(li); } if($.f.inpipe){ if(this.orglen>_59||_58!=0){ this.pagDiv=document.createElement("div"); this.pagDiv.className="paginate"; } if(this.orglen>_59){ var _64=document.createElement("a"); _64.innerHTML="Next >"; YAHOO.util.Event.addListener(_64,"click",this.next_pag,this,true); this.pagDiv.appendChild(_64); } if(_58!=0){ var _65=document.createElement("a"); _65.innerHTML="< Prev"; if(this.orglen>_59){ _65.style.right="40px"; _65.style.position="absolute"; }else{ _65.style.right=""; _65.style.position=""; } YAHOO.util.Event.addListener(_65,"click",this.prev_pag,this,true); this.pagDiv.appendChild(_65); } if(this.orglen>_59||_58!=0){ $.w.r.appendChild(this.pagDiv); this.pagDiv=null; } } },prev_pag:function(){ this.remove(); var _66=this.startorg-this.countby; var _67=_66+this.countby; if(_67>=this.orglen){ _67=this.orglen; } this.create(_66,_67); location.href="#"; this.startnum=_67; this.startorg=_66; },next_pag:function(){ this.remove(); var _68=this.startnum; var _69=this.countby+_68; if(_69>=this.orglen){ _69=this.orglen; } this.create(_68,_69); location.href="#"; this.startnum=_69; this.startorg=_68; }}}; }(); var _6a=/listbadge.js$/; var _6b=function(){ $.f.init(_6a); }; if(_1){ _6b(); }else{ if(typeof window.addEventListener!=="undefined"){ if(window.opera){ _6b(); }else{ window.addEventListener("load",_6b,false); } }else{ if(typeof window.attachEvent!=="undefined"){ window.attachEvent("onload",_6b); } } } })();
01themes
trunk/lol.js
JavaScript
asf20
18,577
// ---------------------------------------- // SHOW RECENT POSTS // ---------------------------------------- // Mod by MyDigitalLemon // Original by blogsolute.com // ---------------------------------------- function showrecentposts(json) { for (var i = 0; i < numposts; i++) { var entry = json.feed.entry[i]; var posttitle = entry.title.$t; var posturl; if (i == json.feed.entry.length) break; for (var k = 0; k < entry.link.length; k++) { if (entry.link[k].rel == 'alternate') { posturl = entry.link[k].href; break; } } posttitle = posttitle.link(posturl); var readmorelink = "...."; readmorelink = readmorelink.link(posturl); var postdate = entry.published.$t; var cdyear = postdate.substring(0,4); var cdmonth = postdate.substring(5,7); var cdday = postdate.substring(8,10); var monthnames = new Array(); monthnames[1] = "Jan"; monthnames[2] = "Feb"; monthnames[3] = "Mar"; monthnames[4] = "Apr"; monthnames[5] = "May"; monthnames[6] = "Jun"; monthnames[7] = "Jul"; monthnames[8] = "Aug"; monthnames[9] = "Sep"; monthnames[10] = "Oct"; monthnames[11] = "Nov"; monthnames[12] = "Dec"; if ("content" in entry) { var postcontent = entry.content.$t;} else if ("summary" in entry) { var postcontent = entry.summary.$t;} else var postcontent = ""; var re = /<\S[^>]*>/g; postcontent = postcontent.replace(re, ""); document.write('<div class="mtrpw">'); if (standardstyling) document.write('<br/>'); document.write(posttitle); if (showpostdate == true) document.write(' - ' + monthnames[parseInt(cdmonth,10)] + ' ' + cdday + ' ' + cdyear); document.write('</div><div class="mtrpwsumm">'); if (showpostsummary == true) { if (standardstyling) document.write(''); if (postcontent.length < numchars) { if (standardstyling) document.write('<i>'); document.write(postcontent); if (standardstyling) document.write('</i>');} else { if (standardstyling) document.write(''); postcontent = postcontent.substring(0, numchars); var quoteEnd = postcontent.lastIndexOf(" "); postcontent = postcontent.substring(0,quoteEnd); document.write(postcontent + ' ' + readmorelink); if (standardstyling) document.write('');} } document.write('</div>'); if (standardstyling) document.write(''); } if (!standardstyling) document.write('<div class="bbwidgetfooter">'); if (standardstyling) document.write(''); document.write(''); if (!standardstyling) document.write(''); }
01themes
trunk/recent-posts-with-snippets.js
JavaScript
asf20
2,639
function showrecentpostswiththumbs(json) {document.write('<ul class="recent_posts_with_thumbs">'); for (var i = 0; i < numposts; i++) {var entry = json.feed.entry[i];var posttitle = entry.title.$t;var posturl;if (i == json.feed.entry.length) break;for (var k = 0; k < entry.link.length;k++){ if(entry.link[k].rel=='replies'&&entry.link[k].type=='text/html'){var commenttext=entry.link[k].title;var commenturl=entry.link[k].href;} if (entry.link[k].rel == 'alternate') {posturl = entry.link[k].href;break;}}var thumburl;try {thumburl=entry.media$thumbnail.url;}catch (error) { s=entry.content.$t;a=s.indexOf("<img");b=s.indexOf("src=\"",a);c=s.indexOf("\"",b+5);d=s.substr(b+5,c-b-5);if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!="")){ thumburl=d;} else thumburl='http://1.bp.blogspot.com/_u4gySN2ZgqE/SosvnavWq0I/AAAAAAAAArk/yL95WlyTqr0/s400/noimage.png'; } var postdate = entry.published.$t;var cdyear = postdate.substring(0,4);var cdmonth = postdate.substring(5,7);var cdday = postdate.substring(8,10);var monthnames = new Array();monthnames[1] = "Jan";monthnames[2] = "Feb";monthnames[3] = "Mar";monthnames[4] = "Apr";monthnames[5] = "May";monthnames[6] = "Jun";monthnames[7] = "Jul";monthnames[8] = "Aug";monthnames[9] = "Sep";monthnames[10] = "Oct";monthnames[11] = "Nov";monthnames[12] = "Dec";document.write('<li class="clearfix">'); if(showpostthumbnails==true) document.write('<img class="recent_thumb" src="'+thumburl+'"/>'); document.write('<b><a href="'+posturl+'" target ="_top">'+posttitle+'</a></b><br>'); if ("content" in entry) { var postcontent = entry.content.$t;} else if ("summary" in entry) { var postcontent = entry.summary.$t;} else var postcontent = ""; var re = /<\S[^>]*>/g; postcontent = postcontent.replace(re, ""); if (showpostsummary == true) { if (postcontent.length < numchars) { document.write('<i>'); document.write(postcontent); document.write('</i>');} else { document.write('<i>'); postcontent = postcontent.substring(0, numchars); var quoteEnd = postcontent.lastIndexOf(" "); postcontent = postcontent.substring(0,quoteEnd); document.write(postcontent + '...'); document.write('</i>');} } var towrite='';var flag=0; document.write('<br><strong>'); if(showpostdate==true) {towrite=towrite+monthnames[parseInt(cdmonth,10)]+'-'+cdday+' - '+cdyear;flag=1;} if(showcommentnum==true) { if (flag==1) {towrite=towrite+' | ';} if(commenttext=='1 Comments') commenttext='1 Comment'; if(commenttext=='0 Comments') commenttext='No Comments'; commenttext = '<a href="'+commenturl+'" target ="_top">'+commenttext+'</a>'; towrite=towrite+commenttext; flag=1; ; } if(displaymore==true) { if (flag==1) towrite=towrite+' | '; towrite=towrite+'<a href="'+posturl+'" class="url" target ="_top">More -></a>'; flag=1; ; } document.write(towrite); document.write('</strong></li>'); if(displayseparator==true) if (i!=(numposts-1)) document.write('<hr size=0.5>'); }document.write('</ul>'); }
01themes
trunk/recentpostswiththumbnailsv3.js
JavaScript
asf20
3,055
(function(){ var _1,_2=""; if(typeof (inPipe)!="undefined"){ _1=true; } for(var i=0;i<16;i++){ _2+=String.fromCharCode(Math.floor(Math.random()*26)+97); } window[_2]={}; if(_1){ pipeListBadge=window[_2]; } var $=window[_2]; $.f=function(){ return {runFunction:[],timeoutCount:10,inpipe:(typeof (inPipe)!="undefined")?true:false,init:function(_5){ var _6=document.getElementsByTagName("SCRIPT"); for(var i=0;i<_6.length;i++){ var _8=(this.inpipe)?_6[i].id:_6[i].src; if(_8.match(_5)){ $.a={}; if(_6[i].innerHTML){ $.a=$.f.parseJson(_6[i].innerHTML); } $.w=document.createElement("DIV"); _6[i].parentNode.insertBefore($.w,_6[i]); _6[i].parentNode.removeChild(_6[i]); $.f.buildStructure(); break; } } },parseJson:function(_9){ this.parseJson.data=_9; if(typeof _9!=="string"){ return {"err":"trying to parse a non-string JSON object"}; } try{ var f=Function(["var document,top,self,window,parent,Number,Date,Object,Function,","Array,String,Math,RegExp,Image,ActiveXObject;","return (",_9.replace(/<\!--.+-->/gim,"").replace(/\bfunction\b/g,"function&shy;"),");"].join("")); return f(); } catch(e){ return {"err":"trouble parsing JSON object"}; } },buildStructure:function(){ $.d={"title":"&nbsp;","height":"300px","width":"100%","border":"none","margin":"0","padding":"0","containerPadding":"0","evenBackgroundColor":"transparent","oddBackgroundColor":"transparent","pipesTitleFontSize":"inherit","pipesDescriptionFontSize":"12px","count":25}; var _b=""; if(this.inpipe){ $.d.width="100%"; $.d.height="100%"; $.a.count=25; $.a.hideHeader="true"; }else{ _b="overflow:auto;overflow-x:hidden;"; var _c=document.getElementById("YUIcontainer"); if(_c==null){ $.f.createSSLink("http://yui.yahooapis.com/2.4.1/build/container/assets/container.css","YUIcontainer"); } } for(var k in $.d){ if($.a[k]===undefined){ $.a[k]=$.d[k]; } } $.w.className=_2; if($.a.addClassName!==undefined){ try{ $.w.className+=" "+$.a.addClassName; } catch(eClassName){ } } if($.a.id!==undefined){ try{ $.w.id=$.a.id; } catch(eId){ } } if($.a.width!==undefined){ try{ if($.a.width.indexOf("px")==-1&&$.a.width.indexOf("%")==-1&&$.a.width.indexOf("em")==-1){ $.a.width=$.a.width+"px"; } $.w.style.width=$.a.width; } catch(eWidth){ } } if($.a.height!==undefined){ try{ if($.a.height.indexOf("px")==-1&&$.a.height.indexOf("%")==-1&&$.a.height.indexOf("em")==-1){ $.a.height=$.a.height+"px"; } } catch(eHeight){ } } var ns=document.createElement("style"); document.getElementsByTagName("head")[0].appendChild(ns); if(!window.createPopup){ ns.appendChild(document.createTextNode("")); } var s=document.styleSheets[document.styleSheets.length-1]; var _10={"":"{zoom:1;position:"+$.a.position+";top:"+$.a.top+";left:"+$.a.left+";width:"+$.a.width+";height:"+$.a.height+";background-color:"+$.a.backgroundColor+";border:"+$.a.border+";font:"+$.a.font+";margin:"+$.a.margin+";padding:"+$.a.padding+";}","a":"{cursor:pointer;text-decoration:none;color:"+$.a.color+";}","a.yba":"{background:transparent url(http://3.bp.blogspot.com/-wsIqUGbMUyk/TchLsqCK3QI/AAAAAAAACmU/udeV22bGZ78/s400/blgo.png) 0 0 no-repeat;_background-image:url(http://l.yimg.com/a/i/us/pps/pipes-16.gif);float:left;height:16px;margin:5px 0 0 0px;width:16px;}","div.ybad":"{display:inline;height:16px;font-size:9px;font-weight:bold;line-height:22px;color:inherit;}","a.gt":"{position:absolute;height:16px;display:none;color:inherit;font-size:9px;font-weight:bold;line-height:22px;right:12px;cursor:pointer;text-decoration:underline;}","div.gts":"{position:absolute;height:16px;display:none;color:inherit;font-size:12px;font-weight:bold;line-height:20px;right:2px;cursor:none;text-decoration:none;}","a.ybaa":"{color:inherit;text-decoration:underline}","sup.ybas":"{font-size:100%;color:inherit}","a.ybt":"{font-weight:bold;color:"+$.a.headlineColor+";}","div.ybx":"{visibility:hidden;background-color:transparent;margin:"+$.a.containerPadding+";padding:0;position:relative;}","div.ybr":"{zoom:1;position:relative;display:block;font-size:1em;margin:3px 0 0 0;padding:0pt;width:100%;"+_b+"}","div.ybf":"{display:none;width:100%;background-color:transparent;height:20px;margin:0;padding:0;position:relative}","div.ybr li.ybi":"{background-color:"+$.a.evenBackgroundColor+";margin:0;padding:5px 5px 5px 0;list-style:none;list-style-position:outside;overflow:hidden;text-indent:0}","div.ybr li.ybi.odd":"{background-color:"+$.a.oddBackgroundColor+";}","h3.ybh":"{margin:0;padding:0;font-weight:bold;background-color:"+$.a.headerBackgroundColor+";}","h3.ybt":"{margin:0;padding:0;position:relative;}","div.PBajaxwait":"{position:relative;display:block;width:100%;height:100%;margin-top:-"+$.a.containerPadding+";background: #eee url('http://l.yimg.com/a/i/us/pps/logo_ani_1.gif') 50% 50% no-repeat;opacity:0.75;filter:alpha(opacity=75);}",".pipesImgdescription":"{display:block;width:100%;height:auto;color:"+$.a.descriptionColor+";}",".pipesImgdescription .pipesThumbnail":"{position:relative;float:left;background: url(http://4.bp.blogspot.com/-LOOjBWkPDOU/TcgzCKbFr1I/AAAAAAAACmE/RkFjOZVgkoU/s400/blogger.gif) no-repeat top center;border: 0px;height:72px;width:72px;overflow:hidden;margin: 0px 8px 0px 0px;}",".pipesImgdescription .pipesThumbnail img":"{position:static;width:82px;min-height:72px;border:0px solid #eee}",".pipesImgdescription .pipesTitle":"{font-size:"+$.a.pipesTitleFontSize+";font-weight:bold;padding-bottom:3px;width:100%;}",".pipesImgdescription .pipesDescription":"{font-size:"+$.a.pipesDescriptionFontSize+";}",".pipesHolder":"{padding:0px; margin:10px 0px 0px 0px;}",".pipesText":"{zoom:1;margin-left: 55px;}","ul":"{display:block;overflow:hidden;position:relative;width:300000px;z-index:2;padding:0;margin:auto;}","ul.pipesSmallthumb li":"{border:1px solid #eee;display:none;float:left;height:32px;list-style-image:none;list-style-position:outside;list-style-type:none;overflow:hidden;padding:2px;width:32px;}","ul.pipesSmallthumb li:hover":"{border:1px solid red;}","ul.pipesSmallthumb":"{margin: 10px 0 0;padding:0;width:auto;}","ul.pipesSmallthumb li a img":"{height:32px;width:32px;cursor:pointer;border: 0px;position:static;left:inherit;right:inherit;}",".ybf":"{display:none!important;}"}; var _11={"gin div.hd":"{background-color:#eee;border:none}"}; var _12=""; for(var r in _10){ var _14="."+_2+" "+r; if(window.createPopup){ _12+=_14+_10[r]; }else{ var _15=document.createTextNode(_14+_10[r]); ns.appendChild(_15); } } for(var r in _11){ var _14="#"+_2+r; if(window.createPopup){ _12+=_14+_11[r]; }else{ var _15=document.createTextNode(_14+_11[r]); ns.appendChild(_15); } } if(window.createPopup){ s.cssText=_12; } $.w.ajaxwait=document.createElement("DIV"); $.w.ajaxwait.className="PBajaxwait"; $.w.c=document.createElement("DIV"); $.w.c.className="ybx"; $.w.h=document.createElement("h3"); $.w.h.className="ybh"; if($.a.hideHeader!==undefined){ try{ $.w.h.style.display="none"; } catch(eHideHeader){ } } $.w.t=document.createElement("A"); $.w.t.className="ybt"; $.w.t.innerHTML=$.a.title; $.w.t.target="_blank"; $.w.h.appendChild($.w.t); $.w.c.appendChild($.w.h); $.w.r=document.createElement("DIV"); $.w.r.className="ybr"; $.w.c.appendChild($.w.r); $.w.dtf=document.createElement("div"); $.w.dtf.className="ybf"; $.w.dtf.innerHTML="<a href=\"http://helplogger.blogspot.com\" class=\"yba\"></a> &nbsp;<div class=\"ybad\">Powered by <a class=\"ybaa\" href=\"http://helplogger.blogspot.com\">Helplogger</a><sup class=\"ybas\">e</sup></div><a class=\"gt\">Get This</a><div class=\"gts\">&#187;</div>"; var _16=$.w.dtf.getElementsByTagName("a"); this.getThisDiv=_16[2]; var _17=$.w.dtf.getElementsByTagName("div"); this.getThisDivArrow=_17[1]; $.w.ajaxwait.appendChild($.w.c); $.w.ajaxwait.appendChild($.w.dtf); $.w.appendChild($.w.ajaxwait); if(!this.inpipe){ if($.a.localJson===undefined){ $.f.runSearch(); }else{ $.f.renderResult($.a.localJson); } } },runCalledFromPipe:function(){ $.f.renderResult(jsondata); },runSearch:function(){ $.f.callback="pipesCallback"; pipesCallback=function(r){ if(pipesCallBackArr[r.value.requesturl]){ for(var e=0;e<pipesCallBackArr[r.value.requesturl].length;e++){ if(pipesCallBackArr[r.value.requesturl][e]){ pipesCallBackArr[r.value.requesturl][e].f.renderResult(r); pipesCallBackArr[r.value.requesturl][e]=null; } } } }; var _1a="http://pipes.yahoo.com/pipes/pipe.info?_id="+$.a.pipe_id; var url="http://run.pipes.yahoo.com/pipes/pipe.run?_id="+$.a.pipe_id+"&_render=badge&_callback="+$.f.callback; this.queryparams=""; for(var key in $.a.pipe_params){ if($.a.pipe_params[key]===null){ continue; } url+="&"+encodeURIComponent(key)+"="+encodeURIComponent($.a.pipe_params[key]); this.queryparams+="&"+decodeURIComponent(key)+"="+decodeURIComponent($.a.pipe_params[key]); } $.w.t.href=_1a; if(typeof (pipesCallBackArr)=="undefined"){ pipesCallBackArr=[]; } if(typeof (pipesCallBackArr[url])=="undefined"){ pipesCallBackArr[url]=[]; } pipesCallBackArr[url].push($); if(typeof (YAHOO)=="undefined"||!YAHOO||typeof (YAHOO.util)=="undefined"||!YAHOO.util){ var _1d=document.getElementById("yui"); if(_1d==null){ $.f.runScript("http://yui.yahooapis.com/2.3.1/build/utilities/utilities.js","yui"); } } $.f.runScript(url,_2); },renderResult:function(r){ if(r.value.published==""){ var t=$.w.h.cloneNode(true); t.innerHTML=r.value.title; $.w.h.parentNode.replaceChild(t,$.w.h); $.w.h=t; this.getThisDiv.style.display="none"; this.getThisDivArrow.style.display="none"; }else{ var t=$.w.t.cloneNode(true); t.innerHTML=r.value.title; $.w.t.parentNode.replaceChild(t,$.w.t); $.w.t=t; } this.listbadge.init(r); },runScript:function(url,id){ var s=document.createElement("script"); s.id=id; s.type="text/javascript"; s.src=url; document.getElementsByTagName("head")[0].appendChild(s); },createSSLink:function(url,id){ var l=document.createElement("link"); l.id=id; l.rel="stylesheet"; l.type="text/css"; l.href=url; document.getElementsByTagName("head")[0].appendChild(l); },removeScript:function(id){ if(document.getElementById(id)){ var s=document.getElementById(id); s.parentNode.removeChild(s); } },getthisfuncInside:function(){ YAHOO.util.Dom.addClass(document.body,"yui-skin-sam"); var _28=(_1)?pid:$.a.pipe_id; var _29=(_1)?"":$.f.queryparams; if(this.getitnow==undefined){ this.getitnow=new YAHOO.widget.Panel(_2+"gin",{width:"420px",fixedcenter:true,constraintoviewport:true,underlay:"none",close:true,visible:false,draggable:true,modal:true,iframe:true,zIndex:"11111"}); this.getitnow.setHeader("<div style=\"border:none;font:bold 16px arial;color:#626262;text-align:left;padding-left:5px\">Get this Yahoo! Pipes<sup>&trade;</sup> Badge <div style=\"position:absolute;right:35px;letter-spacing:4px;top:3px;\"><a style=\"font-size:11px;color:#626262;\" href=\"http://pipes.yahoo.com/pipes/badgedocs\" target=\"_blank\">HELP</a></div></div>"); this.getitnow.setBody("<iframe width=\"415\" height=\"350\" allowtransparency=\"true\" marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"no\" src=\"http://pipes.yahoo.com/pipes/badge.config?page=1&_btype=list&_id="+_28+_29+"\"></iframe>"); this.getitnow.render(document.body); YAHOO.util.Event.addListener(_2+"ginClose","click",this.getitnow.hide,this.getitnow,true); } this.getitnow.show(); },getthisfuncOutside:function(){ var _2a=(_1)?pid:$.a.pipe_id; var _2b=(_1)?"":$.f.queryparams; var url="http://pipes.yahoo.com/pipes/badge.config?page=1&_btype=list&_id="+_2a+_2b; window.open(url); },listbadge:{init:function(r){ if(typeof (YAHOO)=="undefined"){ $.f.timeoutCount--; if($.f.timeoutCount==0){ }else{ window.setTimeout(function(){ $.f.listbadge.init(r); },1000); } return; } YAHOO.util.Dom.removeClass($.w.ajaxwait,"PBajaxwait"); if(!$.f.inpipe){ var _2e=document.getElementById("YUICscript"); if(_2e==null){ $.f.runScript("http://yui.yahooapis.com/2.4.1/build/container/container-min.js","YUICscript"); } $.w.dtf.style.display="block"; if(r.value.published!=""){ this.checkViewport(); } } YAHOO.util.Event.addListener(window,"resize",this.resized,this,true); var w=$.w.r.offsetWidth; if(!$.f.inpipe){ var _30=(parseInt($.a.containerPadding,10)*2); var h=$.w.offsetHeight-$.w.h.offsetHeight-$.w.dtf.offsetHeight-_30-5; if(h>0){ $.w.r.style.height=h+"px"; } } this.w=w; this.remove(); if(r&&r.value&&r.value.items&&r.value.items.length){ this.startnum=0; this.orglen=r.value.items.length; this.countby=$.a.count; this.results=r; var _32=(this.orglen<this.countby)?this.orglen:this.countby; this.create(this.startnum,_32); this.startnum=this.countby; }else{ var t=$.w.r.cloneNode(true); t.innerHTML="<h4>No results</h4>"; $.w.r.parentNode.replaceChild(t,$.w.r); $.w.r=t; } YAHOO.util.Dom.setStyle($.w.c,"visibility","visible"); },checkViewport:function(){ YAHOO.util.Event.removeListener($.f.getThisDiv,"click"); if(YAHOO.util.Dom.getViewportWidth()>=422&&YAHOO.util.Dom.getViewportHeight()>=415){ YAHOO.util.Event.addListener($.f.getThisDiv,"click",$.f.getthisfuncInside,this,true); }else{ YAHOO.util.Event.addListener($.f.getThisDiv,"click",$.f.getthisfuncOutside,this,true); } },resized:function(){ if(this.currheight!=document.documentElement.clientHeight&&this.currheight!=""){ this.checkViewport(); } this.currheight=document.documentElement.clientHeight; },createDescription:function(_34,_35){ var _36=(_34.smallimg==undefined)?"":"<img src='"+_34.smallimg+"' />"; var _37=(_35=="imgBadge")?"":"<div class='pipesThumbnail'>"+_36+"</div>"; var _38=(_36==""||_35=="imgBadge")?"style='margin-left:0px;'":"style='margin-left:55px;'"; var _39="<div class='pipesImgdescription'><div class='pipesHolder'>"+_37+"<div class='pipesText' "+_38+"><div class='pipesTitle'><a href='"+_34.link+"' target='_self'>"+_34.title+"</a></div><div class='pipesDescription'>"+_34.description+"</div><ul class='pipesSmallthumb'></ul></div></div></div>"; return _39; },createDescThumbs:function(obj,w,_3c){ var _3d=obj.getElementsByTagName("ul"); this.smallthumbholder=_3d[0]; var ww=w-55; this.smallitemimgcount=Math.round(ww/50); var _3f=""; var _40=(this.smallitemimgcount>_3c.usethisimgarr.length)?_3c.usethisimgarr.length:this.smallitemimgcount; for(var x=1;x<_40;x++){ _3f+="<li><a href="+_3c.usethisimgarr[x].url+" target='_blank'><img src='"+_3c.usethisimgarr[x].url+"'</a></li>"; } if(_3f==""){ this.smallthumbholder.style.marginTop="0px"; }else{ var t=this.smallthumbholder.cloneNode(true); t.innerHTML=_3f; this.smallthumbholder.parentNode.replaceChild(t,this.smallthumbholder); this.smallthumbholder=t; var _43=this.smallthumbholder.getElementsByTagName("img"); this.thumbnails=_43; for(i=0;i<_43.length;i++){ new this.makeGrow(_43[i]); } } },makeGrow:function(img){ var _45=null; var _46=img; var _47,w,h; var _4a=function(obj){ _47=YAHOO.util.Dom.getXY(_46); w=parseInt(YAHOO.util.Dom.getStyle(_46,"width")); h=parseInt(YAHOO.util.Dom.getStyle(_46,"height")); _45=obj.cloneNode(false); _45.style.position="absolute"; _45.style.width="32px"; _45.style.height="32px"; _45.style.top=_47[1]+"px"; _45.style.left=_47[0]+"px"; _45.style.zIndex="999"; _45.style.display="none"; _45.style.padding="2px"; _45.style.border="1px solid #eee"; _45.className="clonedSmallImg"; YAHOO.util.Event.addListener(_45,"mouseout"); document.body.appendChild(_45); _4c(); }; var _4c=function(e){ if(_45==null){ _4a(_46); return; } _45.style.display="inline"; var _4e=new YAHOO.util.Anim(_45,{width:{to:200},height:{to:200}},0.6,YAHOO.util.Easing.backOut); var _4f=_4e.getEl(); _4e.onTween.subscribe(function(){ var nx=_47[0]-((_4f.offsetWidth-w)>>1); var ny=_47[1]-((_4f.offsetHeight-h)>>1); if(nx<0){ nx=0; } if(ny<0){ ny=0; } YAHOO.util.Dom.setXY(_4f,[nx,ny]); }); _4e.animate(); $.f.listbadge.growAnim=_4e; YAHOO.util.Event.addListener(_45,"mouseout",_52); }; var _52=function(){ if($.f.listbadge.growAnim.isAnimated()==true){ window.setTimeout(function(){ _52(); },50); return; } YAHOO.util.Event.removeListener(_45,"mouseout"); var _53=new YAHOO.util.Anim(_45,{width:{to:32},height:{to:32}},0.2); var _54=_53.getEl(); _53.onTween.subscribe(function(){ var nx=_47[0]-((_54.offsetWidth-w)>>1); var ny=_47[1]-((_54.offsetHeight-h)>>1); if(nx<0){ nx=0; } if(ny<0){ ny=0; } YAHOO.util.Dom.setXY(_54,[nx,ny]); }); _53.onComplete.subscribe(function(){ var _57=_53.getEl(); _57.style.display="none"; }); _53.animate(); }; YAHOO.util.Event.addListener(_46,"mouseover",_4c); },remove:function(){ $.w.r.innerHTML=""; },create:function(_58,_59){ for(var i=_58;i<_59;i++){ var _5b=this.results.value.items[i]; var _5c=_5b.media.regular.length; var _5d=_5b.media.thumbnails.length; var _5e=(_5c>_5d)?_5b.media.regular:_5b.media.thumbnails; _5b.usethisimgarr=_5e; if(_5e.length!=0){ if(_5b.media.thumbnails.length!=0){ _5b.smallimg=_5b.media.thumbnails[0].url; }else{ _5b.smallimg=_5e[0].url; } } var li=document.createElement("LI"); this.li=li; li.className="ybi"; if(i%2){ li.className+=" odd"; } li.innerHTML=this.createDescription(_5b); this.createDescThumbs(this.li,this.w,_5b); var _60=li.getElementsByTagName("div")[2]; var _61=li.getElementsByTagName("div")[3]; var _62=li.getElementsByTagName("div")[4]; var _63=li.getElementsByTagName("div")[5]; if(_60.innerHTML!=""){ YAHOO.util.Dom.setStyle(_60,"margin-right","8px"); } YAHOO.util.Dom.setStyle(_61,"margin-left","0px"); $.w.r.appendChild(li); } if($.f.inpipe){ if(this.orglen>_59||_58!=0){ this.pagDiv=document.createElement("div"); this.pagDiv.className="paginate"; } if(this.orglen>_59){ var _64=document.createElement("a"); _64.innerHTML="Next >"; YAHOO.util.Event.addListener(_64,"click",this.next_pag,this,true); this.pagDiv.appendChild(_64); } if(_58!=0){ var _65=document.createElement("a"); _65.innerHTML="< Prev"; if(this.orglen>_59){ _65.style.right="40px"; _65.style.position="absolute"; }else{ _65.style.right=""; _65.style.position=""; } YAHOO.util.Event.addListener(_65,"click",this.prev_pag,this,true); this.pagDiv.appendChild(_65); } if(this.orglen>_59||_58!=0){ $.w.r.appendChild(this.pagDiv); this.pagDiv=null; } } },prev_pag:function(){ this.remove(); var _66=this.startorg-this.countby; var _67=_66+this.countby; if(_67>=this.orglen){ _67=this.orglen; } this.create(_66,_67); location.href="#"; this.startnum=_67; this.startorg=_66; },next_pag:function(){ this.remove(); var _68=this.startnum; var _69=this.countby+_68; if(_69>=this.orglen){ _69=this.orglen; } this.create(_68,_69); location.href="#"; this.startnum=_69; this.startorg=_68; }}}; }(); var _6a=/listbadge.js$/; var _6b=function(){ $.f.init(_6a); }; if(_1){ _6b(); }else{ if(typeof window.addEventListener!=="undefined"){ if(window.opera){ _6b(); }else{ window.addEventListener("load",_6b,false); } }else{ if(typeof window.attachEvent!=="undefined"){ window.attachEvent("onload",_6b); } } } })();
01themes
trunk/listbadge.js
JavaScript
asf20
18,577
package com.androidsaga; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.util.Log; public class ConstantUtil{ public static final Integer NORMAL_SAGA = 0; public static final Integer GOODMAN_SAGA = 1; public static final Integer SCIENCE_SAGA = 2; public static final Integer OTAKU_SAGA = 3; public static final Integer UNCLE_SAGA = 4; public static final Integer GOKATERA_SAGA = 5; public static final Integer STATUS_DEAD = -1; public static final Integer STATUS_NORMAL = 0; public static final Integer STATUS_SLEEP = 1; public static final Integer STATUS_BATH = 2; public static final Integer STATUS_EXERCISE = 3; public static final Integer BLUE_THRSHOLD = 60; public static final Integer BLACK_THRESHOLD = 40; public static final Integer PRESENT_MOVE_STEP = 1; public static final Float SATISFACTION_DEFAULT = 80.f; public static final String ENCODING = "UTF-8"; public static final Float OTAKU_TIME = 7200.f; //2 hours public static final Float[] SATISFY_STEP = {-0.005f, 0.f, 0.05f, -0.005f}; public static final Float[] SICK_STEP = {0.0045f, -0.001f, -0.05f, -0.1f}; public static final Float[] HUNGRY_STEP = {0.005f, 0.0005f, 0.005f, 0.05f}; public static final Float[] DIRTY_STEP = {0.01f, 0.f, -0.2f, 0.05f}; public static final Float[] OTAKU_STEP = {0.005f, 0.005f, 0.005f, -0.1f}; public static final Integer AUTO_SLEEP_TIME = 1800; public static final Float DIRTY_AFFECT_SICK = 50.f; public static final Float HUNGRY_AFFECT_SICK = 50.f; public static final Float DIRTY_AFFECT_SATISFY = 40.f; public static final Float HUNGRY_AFFECT_SATISFY = 30.f; public static final Float SICK_AFFECT_SATISFY = 40.f; public static final String DATA_PATH = "saga.dat"; public static final String DEFAULT_SHARED_PREF = "com.androidsaga_preferences"; public static final String KEY_CHARACTOR = "charactor"; public static final String KEY_STATUS = "status"; public static final String KEY_TOTAL_TIME = "total_time"; public static final String KEY_LEVEL = "level"; public static final String KEY_SATISFY = "satisfy"; public static final String KEY_HUNGRY = "hungry"; public static final String KEY_DIRTY = "dirty"; public static final String KEY_SICK = "sick"; public static final String KEY_OTAKU = "otaku"; public static final String KEY_INELEGANT = "inelegant"; public static final String KEY_SCIENTIST = "scientist"; public static final String KEY_STRANGE = "strange"; public static final String KEY_IDLE_SECONDS = "idle_seconds"; public static final String KEY_AFTER_EXERCISE = "after_exercise"; public static final String KEY_SLEEP_SECONDS = "sleep_seconds"; public static final String KEY_IS_RUNNING = "is_running"; public static final String KEY_LAST_CLOSE = "last_close"; public static final Float FEED_VALUE = -15.f; public static final int[] NOTICE_ID = {1222, 1223, 1224}; public static int CUR_NOTICE = 0; public static final int NOTICE_DEAD = 1; public static final int NOTICE_HUNGRY = 2; public static final int NOTICE_SICK = 3; public static Bitmap scaleButtonBitmap(Context ctx, int resourceID, int scaleWidth, int scaleHeight){ Bitmap origBitmap = BitmapFactory.decodeResource( ctx.getResources(), resourceID); Log.i("saga", Integer.toString(scaleWidth)+","+ Integer.toString(origBitmap.getWidth())); if(scaleWidth >= origBitmap.getWidth()){ return origBitmap; } Bitmap scaledBitmap = Bitmap.createScaledBitmap(origBitmap, scaleWidth, scaleHeight, true); return scaledBitmap; } public static void setNotify(Context ctx, Data data){ final NotificationManager manager = (NotificationManager)ctx.getSystemService(Context.NOTIFICATION_SERVICE); SharedPreferences prefs = ctx.getSharedPreferences( ConstantUtil.DEFAULT_SHARED_PREF, Context.MODE_PRIVATE); if(!prefs.getBoolean(ctx.getString(R.string.allow_notify_key), true)){ return; } Notification notify = new Notification(); if(CUR_NOTICE != 0) manager.cancel(NOTICE_ID[CUR_NOTICE-1]); PendingIntent intent = PendingIntent.getActivity(ctx, 0, new Intent(ctx, SagaActivity.class), 0); notify.icon = R.drawable.homebtn; notify.when = System.currentTimeMillis(); notify.ledARGB = Color.RED; notify.ledOnMS = 1000; notify.flags = Notification.FLAG_SHOW_LIGHTS; if(data.status == ConstantUtil.STATUS_DEAD){ notify.ledOffMS = 0; notify.tickerText = ctx.getString(R.string.notify_dead); notify.setLatestEventInfo(ctx, ctx.getString(R.string.notify_title), ctx.getString(R.string.notify_dead), intent); CUR_NOTICE = NOTICE_DEAD; manager.notify(NOTICE_ID[CUR_NOTICE-1], notify); return; } if(data.hungry > 80){ notify.ledOffMS = 2000; notify.tickerText = ctx.getString(R.string.notify_hungry); notify.setLatestEventInfo(ctx, ctx.getString(R.string.notify_title), ctx.getString(R.string.notify_hungry), intent); CUR_NOTICE = NOTICE_HUNGRY; manager.notify(NOTICE_ID[CUR_NOTICE-1], notify); return; } if(data.sick > 80){ notify.ledOffMS = 2000; notify.tickerText = ctx.getString(R.string.notify_sick); notify.setLatestEventInfo(ctx, ctx.getString(R.string.notify_title), ctx.getString(R.string.notify_sick), intent); CUR_NOTICE = NOTICE_SICK; manager.notify(NOTICE_ID[CUR_NOTICE-1], notify); return; } } }
0skillz63-umm
src/com/androidsaga/ConstantUtil.java
Java
epl
5,799
package com.androidsaga; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Random; import android.content.Context; import android.content.SharedPreferences; import android.util.Log; public class Data extends Object{ public Integer charactor; public Integer status; public Integer totalTime; public Integer level; public Float satisfaction; public Float hungry; public Float dirty; public Float sick; public Float otaku; public Float inelegant; public Float scientist; public Float strange; public Float hungryStep; public Float sickStep; public Float dirtyStep; public Float satisfyStep; public Float otakuStep; protected HashMap<String, Integer> materialList = new HashMap<String, Integer>(); public Integer idleSeconds = 0; public Integer afterLastExercise = 0; public Integer sleepSeconds = 0; private Integer prefSleepPeriod; Context ctx; Random rnd = new Random(); public Data(Context ctx){ this.ctx = ctx; loadData(); } public void clearIdleSeconds(){ idleSeconds = 0; } public void clearOtakuSeconds(){ afterLastExercise = 0; } public void setDirtyStep(Float step){ dirtyStep = step; } public void setSickStep(Float step){ sickStep = step; } public void setHungryStep(Float step){ hungryStep = step; } public void updateSatisfaction(Float delta){ if(hungry > ConstantUtil.HUNGRY_AFFECT_SATISFY){ delta -= hungryStep*0.5f; } if(sick > ConstantUtil.SICK_AFFECT_SATISFY){ delta -= sickStep*0.5f; } if(dirty > ConstantUtil.DIRTY_AFFECT_SATISFY){ delta -= dirtyStep*0.5f; } satisfaction += delta; if(satisfaction < 0.f){ satisfaction = 0.f; } else if(satisfaction > 100.f){ satisfaction = 100.f; } } public void updateSick(float delta){ if(hungry > ConstantUtil.HUNGRY_AFFECT_SICK){ delta += hungryStep*0.5f; } if(dirty > ConstantUtil.DIRTY_AFFECT_SICK){ delta += dirtyStep*0.5f; } sick += delta; if(sick < 0.f){ sick = 0.f; } else if(sick > 100.f){ sick = 100.f; charactor = ConstantUtil.STATUS_DEAD; } } public void increaseTotalTime(Integer sec){ totalTime += sec; if(status == ConstantUtil.STATUS_SLEEP){ sleepSeconds += sec; } if(status == ConstantUtil.STATUS_NORMAL){ idleSeconds += sec; } //update level if(level*level*3600 < totalTime) ++level; } public void updateHungry(Float delta){ hungry += delta; if(hungry < 0.f){ hungry = 0.f; } else if(hungry > 100.f){ hungry = 100.f; charactor = ConstantUtil.STATUS_DEAD; } } public void updateDirty(Float delta){ dirty += delta; if(dirty < 0.f){ dirty = 0.f; } else if(dirty > 100.f){ dirty = 100.f; } } public void updateOtaku(Float delta){ otaku += delta; } public void updateInelegant(Float delta){ inelegant += delta; } public void updateStrange(Float delta){ strange += delta; } public void updateScientist(Float delta){ scientist += delta; } public void updatePerSecond(){ //if saga is dead, no action if(charactor == ConstantUtil.STATUS_DEAD){ return; } increaseTotalTime(1); //too much idle time updateSatisfaction(satisfyStep); updateDirty(dirtyStep); updateHungry(hungryStep); updateSick(sickStep); //to much time without exercise if(afterLastExercise >= ConstantUtil.OTAKU_TIME){ updateOtaku(otakuStep); } } public void autoSwitchStatus(){ if(status == ConstantUtil.STATUS_SLEEP && sleepSeconds > prefSleepPeriod){ status = ConstantUtil.STATUS_NORMAL; idleSeconds = 0; } else if(status == ConstantUtil.STATUS_EXERCISE){ status = ConstantUtil.NORMAL_SAGA; idleSeconds = 0; } else if(status == ConstantUtil.STATUS_NORMAL){ //auto-sleep if(idleSeconds > ConstantUtil.AUTO_SLEEP_TIME){ status = ConstantUtil.STATUS_SLEEP; idleSeconds = 0; } else if(dirty > 50){ status = ConstantUtil.STATUS_BATH; idleSeconds = 0; } } else if(status == ConstantUtil.STATUS_BATH){ if(rnd.nextBoolean()){ status = ConstantUtil.STATUS_NORMAL; idleSeconds = 0; } } setStatusStep(); } public void onHome(){ idleSeconds = 0; status = ConstantUtil.STATUS_NORMAL; setStatusStep(); } public void onFeed(){ idleSeconds = 0; updateHungry(ConstantUtil.FEED_VALUE); } public void onBath(){ idleSeconds = 0; status = ConstantUtil.STATUS_BATH; setStatusStep(); } public void onHospital(){ idleSeconds = 0; updateSick(-15.f); } public void setStatusStep(){ satisfyStep = ConstantUtil.SATISFY_STEP[status]; sickStep = ConstantUtil.SICK_STEP[status]; hungryStep = ConstantUtil.HUNGRY_STEP[status]; dirtyStep = ConstantUtil.DIRTY_STEP[status]; otakuStep = ConstantUtil.OTAKU_STEP[status]; } public void updateForPeriod(Integer period){ //if saga is dead, no action if(charactor == ConstantUtil.STATUS_DEAD){ return; } increaseTotalTime(period); //too much idle time updateSatisfaction(satisfyStep*period); updateSick(sickStep*period); updateHungry(hungryStep*period); updateDirty(dirtyStep*period); //to much time without exercise if(afterLastExercise >= ConstantUtil.OTAKU_TIME){ updateOtaku(otakuStep*period); } } public void clearData(boolean clearAll){ otaku = inelegant = scientist = strange = 0.f; if(clearAll){ charactor = ConstantUtil.NORMAL_SAGA; status = ConstantUtil.STATUS_NORMAL; totalTime = 0; level = 0; satisfaction = ConstantUtil.SATISFACTION_DEFAULT; hungry = 0.f; sick = 0.f; dirty = 0.f; } saveData(); } public void saveData(){ SharedPreferences.Editor editor = ctx.getSharedPreferences( ConstantUtil.DEFAULT_SHARED_PREF, Context.MODE_PRIVATE).edit(); editor.putInt(ConstantUtil.KEY_CHARACTOR, charactor); editor.putInt(ConstantUtil.KEY_STATUS, status); editor.putInt(ConstantUtil.KEY_TOTAL_TIME, totalTime); editor.putInt(ConstantUtil.KEY_LEVEL, level); editor.putFloat(ConstantUtil.KEY_SATISFY, satisfaction); editor.putFloat(ConstantUtil.KEY_HUNGRY, hungry); editor.putFloat(ConstantUtil.KEY_DIRTY, dirty); editor.putFloat(ConstantUtil.KEY_SICK, sick); editor.putFloat(ConstantUtil.KEY_OTAKU, otaku); editor.putFloat(ConstantUtil.KEY_INELEGANT, inelegant); editor.putFloat(ConstantUtil.KEY_SCIENTIST, scientist); editor.putFloat(ConstantUtil.KEY_STRANGE, strange); editor.putInt(ConstantUtil.KEY_AFTER_EXERCISE, afterLastExercise); editor.putInt(ConstantUtil.KEY_IDLE_SECONDS, idleSeconds); editor.putInt(ConstantUtil.KEY_SLEEP_SECONDS, sleepSeconds); editor.commit(); } public void loadData(){ SharedPreferences prefs = ctx.getSharedPreferences( ConstantUtil.DEFAULT_SHARED_PREF, Context.MODE_PRIVATE); charactor = prefs.getInt(ConstantUtil.KEY_CHARACTOR, ConstantUtil.NORMAL_SAGA); status = prefs.getInt(ConstantUtil.KEY_STATUS, ConstantUtil.STATUS_NORMAL); totalTime = prefs.getInt(ConstantUtil.KEY_TOTAL_TIME, 0); level = prefs.getInt(ConstantUtil.KEY_LEVEL, 0); satisfaction = prefs.getFloat(ConstantUtil.KEY_SATISFY, ConstantUtil.SATISFACTION_DEFAULT); hungry = prefs.getFloat(ConstantUtil.KEY_HUNGRY, 0.f); dirty = prefs.getFloat(ConstantUtil.KEY_DIRTY, 0.f); sick = prefs.getFloat(ConstantUtil.KEY_SICK, 0.f); otaku = prefs.getFloat(ConstantUtil.KEY_OTAKU, 0.f); scientist = prefs.getFloat(ConstantUtil.KEY_SCIENTIST, 0.f); inelegant = prefs.getFloat(ConstantUtil.KEY_INELEGANT, 0.f); strange = prefs.getFloat(ConstantUtil.KEY_STRANGE, 0.f); idleSeconds = prefs.getInt(ConstantUtil.KEY_IDLE_SECONDS, 0); afterLastExercise = prefs.getInt(ConstantUtil.KEY_AFTER_EXERCISE, 0); sleepSeconds = prefs.getInt(ConstantUtil.KEY_SLEEP_SECONDS, 0); prefSleepPeriod = Integer.parseInt(prefs.getString(ctx.getString(R.string.selected_sleep_option), ctx.getString(R.string.sleep_default_value))); setStatusStep(); Boolean allowRunBackground = prefs.getBoolean(ctx.getString(R.string.run_background_key), true); Boolean isRunning = prefs.getBoolean(ConstantUtil.KEY_IS_RUNNING, false); if((!isRunning) && allowRunBackground){ Long elapsedTime = prefs.getLong(ConstantUtil.KEY_LAST_CLOSE, System.currentTimeMillis()); elapsedTime = (System.currentTimeMillis() - elapsedTime) / 1000; updateForPeriod(elapsedTime.intValue()); } } public void setRunningFlag(boolean isRunning){ SharedPreferences.Editor editor = ctx.getSharedPreferences( ConstantUtil.DEFAULT_SHARED_PREF, Context.MODE_PRIVATE).edit(); if(isRunning){ editor.putBoolean(ConstantUtil.KEY_IS_RUNNING, true); } else { editor.putBoolean(ConstantUtil.KEY_IS_RUNNING, false); editor.putLong(ConstantUtil.KEY_LAST_CLOSE, System.currentTimeMillis()); } editor.commit(); } public Integer getMaterialCount(String name){ if(!materialList.containsKey(name)){ return -1; } return (materialList.get(name)); } public void addMaterial(String name){ if(materialList.containsKey(name)){ Integer curAmount = materialList.remove(name); materialList.put(name, curAmount+1); } else{ materialList.put(name, 1); } } public Integer useMaterial(String name, Integer amount){ if(getMaterialCount(name) < amount){ return -1; } Integer curAmount = materialList.remove(name); curAmount -= amount; if(curAmount > 0){ materialList.put(name, curAmount); } return 1; } }
0skillz63-umm
src/com/androidsaga/Data.java
Java
epl
9,906
package com.androidsaga; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.util.Log; import android.widget.RemoteViews; public class SagaWidget extends AppWidgetProvider{ @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager,int[] appWidgetIds) { UpdateService.updateAppWidgetIds(appWidgetIds); context.startService(new Intent(context, UpdateService.class)); Log.v("tag", "update"); } @Override public void onReceive(Context context, Intent intent){ super.onReceive(context, intent); } public static RemoteViews updateAppWidget(Context context) { RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.saga_widget_layout); Data data = new Data(context); data.autoSwitchStatus(); views.setTextViewText(R.id.widget_level, data.level.toString()); views.setTextViewText(R.id.widget_satisfy, data.satisfaction.toString()); views.setTextViewText(R.id.widget_hungry, data.hungry.toString()); views.setTextViewText(R.id.widget_dirty, data.dirty.toString()); views.setTextViewText(R.id.widget_sick, data.sick.toString()); data.saveData(); data.setRunningFlag(false); ConstantUtil.setNotify(context, data); Intent detailIntent = new Intent(context, SagaActivity.class); PendingIntent pending = PendingIntent.getActivity(context, 0, detailIntent, 0); views.setOnClickPendingIntent(R.id.widget_saga_imageView, pending); data = null; return views; } }
0skillz63-umm
src/com/androidsaga/SagaWidget.java
Java
epl
1,894
package com.androidsaga; import android.os.Bundle; import android.preference.PreferenceActivity; public class SagaPreferenceActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); this.addPreferencesFromResource(R.xml.preference); } }
0skillz63-umm
src/com/androidsaga/SagaPreferenceActivity.java
Java
epl
336
package com.androidsaga; import android.graphics.Bitmap; public class AutoPresent { //present id, each present has its own identical id //this id is used as key to search in the database public Integer presentID; //present pic and gray-level pic public Bitmap presentPic = null; public Bitmap presentGrayPic = null; //current place: will be moved every frame public Integer x; public Integer y; public Float rotation; public Boolean hasPresentNow = false; }
0skillz63-umm
src/com/androidsaga/AutoPresent.java
Java
epl
499
package com.androidsaga; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Alert{ public static void showAlert(String title, String msg, Context ctx) { AlertDialog.Builder builder = new AlertDialog.Builder(ctx); builder.setMessage(msg); builder.setTitle(title); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); AlertDialog ad = builder.create(); ad.show(); } }
0skillz63-umm
src/com/androidsaga/Alert.java
Java
epl
810
package com.androidsaga; import android.app.Activity; import android.app.NotificationManager; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.graphics.*; import android.os.Bundle; import android.util.DisplayMetrics; import android.util.Log; import android.view.View.*; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.Window; import android.widget.*; public class SagaActivity extends Activity { /** Called when the activity is first created. **/ private ImageView MainView; private ImageView HomeBtn; private ImageView BathBtn; private ImageView FeedBtn; private ImageView ExerciseBtn; private ImageView QABtn; private ImageView SleepBtn; private ImageView HospitalBtn; private ImageView PresentBtn; private TextView SayView; private Integer width; private Integer height; private Bitmap MainImage; private Data sagaData; private Thread updateThr; boolean running = false; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature( Window.FEATURE_NO_TITLE ); setContentView(R.layout.main); MainView = (ImageView)findViewById(R.id.MainView); SayView = (TextView)findViewById(R.id.SayView); SayView.setText("Hello"); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); width = dm.widthPixels; height = dm.heightPixels; int btnSize = width / 8; SayView.setHeight(height / 6); SayView.setWidth(7*width / 8); height -= (40 + height/6 + btnSize); //set main view size according to resolution MainImage = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); MainView.setImageBitmap(MainImage); HomeBtn = (ImageView)findViewById(R.id.HomeButton); BathBtn = (ImageView)findViewById(R.id.BathButton); FeedBtn = (ImageView)findViewById(R.id.FeedButton); ExerciseBtn = (ImageView)findViewById(R.id.ExerciseButton); QABtn = (ImageView)findViewById(R.id.QAButton); SleepBtn = (ImageView)findViewById(R.id.SleepButton); HospitalBtn = (ImageView)findViewById(R.id.HospitalButton); PresentBtn = (ImageView)findViewById(R.id.PresentButton); //add button image HomeBtn.setImageBitmap(ConstantUtil.scaleButtonBitmap( this, R.drawable.homebtn, btnSize, btnSize)); BathBtn.setImageBitmap(ConstantUtil.scaleButtonBitmap( this, R.drawable.bathbtn, btnSize, btnSize)); FeedBtn.setImageBitmap(ConstantUtil.scaleButtonBitmap( this, R.drawable.feedbtn, btnSize, btnSize)); ExerciseBtn.setImageBitmap(ConstantUtil.scaleButtonBitmap( this, R.drawable.exercisebtn, btnSize, btnSize)); QABtn.setImageBitmap(ConstantUtil.scaleButtonBitmap( this, R.drawable.qabtn, btnSize, btnSize)); SleepBtn.setImageBitmap(ConstantUtil.scaleButtonBitmap( this, R.drawable.sleepbtn, btnSize, btnSize)); HospitalBtn.setImageBitmap(ConstantUtil.scaleButtonBitmap( this, R.drawable.hospitalbtn, btnSize, btnSize)); PresentBtn.setImageBitmap(ConstantUtil.scaleButtonBitmap( this, R.drawable.presentbtn, btnSize, btnSize)); sagaData = new Data(this); sagaData.setRunningFlag(true); running = true; updateThr = new Thread(){ @Override public void run(){ while(true){ if(running){ sagaData.updatePerSecond(); Log.i("Saga", "update"); } try{ Thread.sleep(1000); } catch(Exception e){ e.printStackTrace(); } } } }; updateThr.start(); ConstantUtil.setNotify(this, sagaData); Alert.showAlert("Saga", sagaData.totalTime.toString(), this); } @Override public boolean onCreateOptionsMenu(Menu menu){ MenuInflater inflater = this.getMenuInflater(); inflater.inflate(R.menu.mainmenu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item){ if(item.getItemId() == R.id.menu_prefs){ Intent intent = new Intent() .setClass(this, com.androidsaga.SagaPreferenceActivity.class); this.startActivityForResult(intent, 0); } else if(item.getItemId() == R.id.menu_clearall){ sagaData.clearData(true); } return true; } @Override public void onActivityResult(int reqCode, int resCode, Intent data){ super.onActivityResult(reqCode, resCode, data); } @Override public void onPause(){ super.onPause(); running = false; sagaData.saveData(); sagaData.setRunningFlag(false); } @Override public void onResume(){ super.onResume(); if(ConstantUtil.CUR_NOTICE != 0){ final NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); manager.cancel(ConstantUtil.NOTICE_ID[ConstantUtil.CUR_NOTICE-1]); ConstantUtil.CUR_NOTICE = 0; } sagaData.loadData(); running = true; sagaData.setRunningFlag(true); } @Override public void onDestroy(){ super.onDestroy(); updateThr = null; } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } public void clickHome(View target) { Alert.showAlert("Saga", "Home", this); sagaData.onHome(); } public void clickBath(View target) { Alert.showAlert("Saga", "Bath", this); sagaData.onBath(); } public void clickHospital(View target) { Alert.showAlert("Saga", "Hospital", this); sagaData.onHospital(); } public void clickFeed(View target) { Alert.showAlert("Saga", "Feed", this); sagaData.onFeed(); } public void clickPresent(View target) { Alert.showAlert("Saga", "Present", this); } public void clickExercise(View target) { Alert.showAlert("Saga", "Exercise", this); } public void clickQA(View target) { Alert.showAlert("Saga", "Answer Question", this); } public void clickSleep(View target) { Alert.showAlert("Saga", "Sleep", this); } }
0skillz63-umm
src/com/androidsaga/SagaActivity.java
Java
epl
6,915
package com.androidsaga; import java.util.LinkedList; import java.util.Queue; import android.app.AlarmManager; import android.app.PendingIntent; import android.app.Service; import android.appwidget.AppWidgetManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.text.format.Time; import android.widget.RemoteViews; public class UpdateService extends Service implements Runnable { private static Queue<Integer> sAppWidgetIds = new LinkedList<Integer>(); public static final String ACTION_UPDATE_ALL = "com.androidsaga.UPDATE_ALL"; private static boolean sThreadRunning = false; private static Object sLock = new Object(); @Override public IBinder onBind(Intent arg0) { // TODO Auto-generated method stub return null; } public static void updateAppWidgetIds(int[] appWidgetIds){ synchronized (sLock) { for (int appWidgetId : appWidgetIds) { sAppWidgetIds.add(appWidgetId); } } } public static int getNextWidgetId(){ synchronized (sLock) { if (sAppWidgetIds.peek() == null) { return AppWidgetManager.INVALID_APPWIDGET_ID; } else { return sAppWidgetIds.poll(); } } } private static boolean hasMoreUpdates() { synchronized (sLock) { boolean hasMore = !sAppWidgetIds.isEmpty(); if (!hasMore) { sThreadRunning = false; } return hasMore; } } @Override public void onCreate() { super.onCreate(); } @Override public void onStart(Intent intent, int startId) { super.onStart(intent, startId); if (null != intent) { if (ACTION_UPDATE_ALL.equals(intent.getAction())) { AppWidgetManager widget = AppWidgetManager.getInstance(this); updateAppWidgetIds(widget.getAppWidgetIds(new ComponentName(this, SagaWidget.class))); } } synchronized (sLock) { if (!sThreadRunning) { sThreadRunning=true; new Thread(this).start(); } } } public void run() { AppWidgetManager appWidgetManager=AppWidgetManager.getInstance(this); RemoteViews updateViews=null; while (hasMoreUpdates()) { int appWidgetId=getNextWidgetId(); updateViews = SagaWidget.updateAppWidget(this); if (updateViews != null) { appWidgetManager.updateAppWidget(appWidgetId, updateViews); } } Intent updateIntent=new Intent(ACTION_UPDATE_ALL); updateIntent.setClass(this, UpdateService.class); PendingIntent pending=PendingIntent.getService(this, 0, updateIntent, 0); Time time = new Time(); long nowMillis = System.currentTimeMillis(); long updatePeriod = Long.parseLong(getSharedPreferences( ConstantUtil.DEFAULT_SHARED_PREF, Context.MODE_PRIVATE). getString(getString(R.string.selected_auto_update_option), getString(R.string.auto_update_default_value))); time.set(nowMillis+updatePeriod); long updateTimes = time.toMillis(true); AlarmManager alarm=(AlarmManager)getSystemService(Context.ALARM_SERVICE); alarm.set(AlarmManager.RTC_WAKEUP, updateTimes, pending); stopSelf(); } }
0skillz63-umm
src/com/androidsaga/UpdateService.java
Java
epl
3,393
package com.androidsaga; import android.app.Activity; import android.os.Bundle; import android.view.Window; public class QuizActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature( Window.FEATURE_NO_TITLE ); setContentView(R.layout.main); } }
0skillz63-umm
src/com/androidsaga/QuizActivity.java
Java
epl
389
/* * Copyright (C) 2009 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ch_linghu.fanfoudroid; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceScreen; import android.util.Log; import com.ch_linghu.fanfoudroid.app.Preferences; import com.ch_linghu.fanfoudroid.http.HttpClient; import com.ch_linghu.fanfoudroid.ui.module.MyTextView; public class PreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //禁止横屏 if (TwitterApplication.mPref.getBoolean( Preferences.FORCE_SCREEN_ORIENTATION_PORTRAIT, false)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } // TODO: is this a hack? setResult(RESULT_OK); addPreferencesFromResource(R.xml.preferences); } @Override protected void onResume() { super.onResume(); // Set up a listener whenever a key changes getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); } @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { return super.onPreferenceTreeClick(preferenceScreen, preference); } public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if ( key.equalsIgnoreCase(Preferences.NETWORK_TYPE) ) { HttpClient httpClient = TwitterApplication.mApi.getHttpClient(); String type = sharedPreferences.getString(Preferences.NETWORK_TYPE, ""); if (type.equalsIgnoreCase(getString(R.string.pref_network_type_cmwap))) { Log.d("LDS", "Set proxy for cmwap mode."); httpClient.setProxy("10.0.0.172", 80, "http"); } else { Log.d("LDS", "No proxy."); httpClient.removeProxy(); } } else if ( key.equalsIgnoreCase(Preferences.UI_FONT_SIZE)) { MyTextView.setFontSizeChanged(true); } } }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/PreferencesActivity.java
Java
asf20
3,039
package com.ch_linghu.fanfoudroid.app; import java.util.HashMap; import android.graphics.Bitmap; public class MemoryImageCache implements ImageCache { private HashMap<String, Bitmap> mCache; public MemoryImageCache() { mCache = new HashMap<String, Bitmap>(); } @Override public Bitmap get(String url) { synchronized(this) { Bitmap bitmap = mCache.get(url); if (bitmap == null){ return mDefaultBitmap; }else{ return bitmap; } } } @Override public void put(String url, Bitmap bitmap) { synchronized(this) { mCache.put(url, bitmap); } } public void putAll(MemoryImageCache imageCache) { synchronized(this) { // TODO: is this thread safe? mCache.putAll(imageCache.mCache); } } }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/app/MemoryImageCache.java
Java
asf20
831
/* * Copyright (C) 2009 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ch_linghu.fanfoudroid.app; public class Preferences { public static final String USERNAME_KEY = "username"; public static final String PASSWORD_KEY = "password"; public static final String CHECK_UPDATES_KEY = "check_updates"; public static final String CHECK_UPDATE_INTERVAL_KEY = "check_update_interval"; public static final String VIBRATE_KEY = "vibrate"; public static final String TIMELINE_ONLY_KEY = "timeline_only"; public static final String REPLIES_ONLY_KEY = "replies_only"; public static final String DM_ONLY_KEY = "dm_only"; public static String RINGTONE_KEY = "ringtone"; public static final String RINGTONE_DEFAULT_KEY = "content://settings/system/notification_sound"; public static final String LAST_TWEET_REFRESH_KEY = "last_tweet_refresh"; public static final String LAST_DM_REFRESH_KEY = "last_dm_refresh"; public static final String LAST_FOLLOWERS_REFRESH_KEY = "last_followers_refresh"; public static final String TWITTER_ACTIVITY_STATE_KEY = "twitter_activity_state"; public static final String USE_PROFILE_IMAGE = "use_profile_image"; public static final String PHOTO_PREVIEW = "photo_preview"; public static final String FORCE_SHOW_ALL_IMAGE = "force_show_all_image"; public static final String RT_PREFIX_KEY = "rt_prefix"; public static final String RT_INSERT_APPEND = "rt_insert_append"; // 转发时光标放置在开始还是结尾 public static final String NETWORK_TYPE = "network_type"; // DEBUG标记 public static final String DEBUG = "debug"; // 当前用户相关信息 public static final String CURRENT_USER_ID = "current_user_id"; public static final String CURRENT_USER_SCREEN_NAME = "current_user_screenname"; public static final String UI_FONT_SIZE = "ui_font_size"; public static final String USE_ENTER_SEND = "use_enter_send"; public static final String USE_GESTRUE = "use_gestrue"; public static final String USE_SHAKE = "use_shake"; public static final String FORCE_SCREEN_ORIENTATION_PORTRAIT = "force_screen_orientation_portrait"; }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/app/Preferences.java
Java
asf20
2,782
package com.ch_linghu.fanfoudroid.app; import android.text.Spannable; import android.text.method.LinkMovementMethod; import android.text.method.MovementMethod; import android.view.MotionEvent; import android.widget.TextView; public class TestMovementMethod extends LinkMovementMethod { private double mY; private boolean mIsMoving = false; @Override public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) { /* int action = event.getAction(); if (action == MotionEvent.ACTION_MOVE) { double deltaY = mY - event.getY(); mY = event.getY(); Log.d("foo", deltaY + ""); if (Math.abs(deltaY) > 1) { mIsMoving = true; } } else if (action == MotionEvent.ACTION_DOWN) { mIsMoving = false; mY = event.getY(); } else if (action == MotionEvent.ACTION_UP) { boolean wasMoving = mIsMoving; mIsMoving = false; if (wasMoving) { return true; } } */ return super.onTouchEvent(widget, buffer, event); } public static MovementMethod getInstance() { if (sInstance == null) sInstance = new TestMovementMethod(); return sInstance; } private static TestMovementMethod sInstance; }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/app/TestMovementMethod.java
Java
asf20
1,336
package com.ch_linghu.fanfoudroid.app; import android.app.Activity; import android.content.Intent; import android.widget.Toast; import com.ch_linghu.fanfoudroid.LoginActivity; import com.ch_linghu.fanfoudroid.R; import com.ch_linghu.fanfoudroid.fanfou.RefuseError; import com.ch_linghu.fanfoudroid.http.HttpAuthException; import com.ch_linghu.fanfoudroid.http.HttpException; import com.ch_linghu.fanfoudroid.http.HttpRefusedException; import com.ch_linghu.fanfoudroid.http.HttpServerException; public class ExceptionHandler { private Activity mActivity; public ExceptionHandler(Activity activity) { mActivity = activity; } public void handle(HttpException e) { Throwable cause = e.getCause(); if (null == cause) return; // Handle Different Exception if (cause instanceof HttpAuthException) { // 用户名/密码错误 Toast.makeText(mActivity, R.string.error_not_authorized, Toast.LENGTH_LONG).show(); Intent intent = new Intent(mActivity, LoginActivity.class); mActivity.startActivity(intent); // redirect to the login activity } else if (cause instanceof HttpServerException) { // 服务器暂时无法响应 Toast.makeText(mActivity, R.string.error_not_authorized, Toast.LENGTH_LONG).show(); } else if (cause instanceof HttpAuthException) { //FIXME: 集中处理用户名/密码验证错误,返回到登录界面 } else if (cause instanceof HttpRefusedException) { // 服务器拒绝请求,如没有权限查看某用户信息 RefuseError error = ((HttpRefusedException) cause).getError(); switch (error.getErrorCode()) { // TODO: finish it case -1: default: Toast.makeText(mActivity, error.getMessage(), Toast.LENGTH_LONG).show(); break; } } } private void handleCause() { } }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/app/ExceptionHandler.java
Java
asf20
2,064
/* * Copyright (C) 2009 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ch_linghu.fanfoudroid.app; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.lang.ref.SoftReference; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; import android.util.Log; import com.ch_linghu.fanfoudroid.TwitterApplication; import com.ch_linghu.fanfoudroid.http.HttpException; import com.ch_linghu.fanfoudroid.http.Response; /** * Manages retrieval and storage of icon images. Use the put method to download * and store images. Use the get method to retrieve images from the manager. */ public class ImageManager implements ImageCache { private static final String TAG = "ImageManager"; // 饭否目前最大宽度支持596px, 超过则同比缩小 // 最大高度为1192px, 超过从中截取 public static final int DEFAULT_COMPRESS_QUALITY = 90; public static final int IMAGE_MAX_WIDTH = 596; public static final int IMAGE_MAX_HEIGHT = 1192; private Context mContext; // In memory cache. private Map<String, SoftReference<Bitmap>> mCache; // MD5 hasher. private MessageDigest mDigest; public static Bitmap drawableToBitmap(Drawable drawable) { Bitmap bitmap = Bitmap .createBitmap( drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable .getIntrinsicHeight()); drawable.draw(canvas); return bitmap; } public ImageManager(Context context) { mContext = context; mCache = new HashMap<String, SoftReference<Bitmap>>(); try { mDigest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { // This shouldn't happen. throw new RuntimeException("No MD5 algorithm."); } } public void setContext(Context context) { mContext = context; } private String getHashString(MessageDigest digest) { StringBuilder builder = new StringBuilder(); for (byte b : digest.digest()) { builder.append(Integer.toHexString((b >> 4) & 0xf)); builder.append(Integer.toHexString(b & 0xf)); } return builder.toString(); } // MD5 hases are used to generate filenames based off a URL. private String getMd5(String url) { mDigest.update(url.getBytes()); return getHashString(mDigest); } // Looks to see if an image is in the file system. private Bitmap lookupFile(String url) { String hashedUrl = getMd5(url); FileInputStream fis = null; try { fis = mContext.openFileInput(hashedUrl); return BitmapFactory.decodeStream(fis); } catch (FileNotFoundException e) { // Not there. return null; } finally { if (fis != null) { try { fis.close(); } catch (IOException e) { // Ignore. } } } } /** * Downloads a file * @param url * @return * @throws HttpException */ public Bitmap downloadImage(String url) throws HttpException { Log.d(TAG, "Fetching image: " + url); Response res = TwitterApplication.mApi.getHttpClient().get(url); return BitmapFactory.decodeStream(new BufferedInputStream(res.asStream())); } public Bitmap downloadImage2(String url) throws HttpException { Log.d(TAG, "[NEW]Fetching image: " + url); final Response res = TwitterApplication.mApi.getHttpClient().get(url); String file = writeToFile(res.asStream(), getMd5(url)); return BitmapFactory.decodeFile(file); } /** * 下载远程图片 -> 转换为Bitmap -> 写入缓存器. * @param url * @param quality image quality 1~100 * @throws HttpException */ public void put(String url, int quality, boolean forceOverride) throws HttpException { if (!forceOverride && contains(url)) { // Image already exists. return; // TODO: write to file if not present. } Bitmap bitmap = downloadImage(url); if (bitmap != null) { put(url, bitmap, quality); // file cache } else { Log.w(TAG, "Retrieved bitmap is null."); } } /** * 重载 put(String url, int quality) * @param url * @throws HttpException */ public void put(String url) throws HttpException { put(url, DEFAULT_COMPRESS_QUALITY, false); } /** * 将本地File -> 转换为Bitmap -> 写入缓存器. * 如果图片大小超过MAX_WIDTH/MAX_HEIGHT, 则将会对图片缩放. * * @param file * @param quality 图片质量(0~100) * @param forceOverride * @throws IOException */ public void put(File file, int quality, boolean forceOverride) throws IOException { if (!file.exists()) { Log.w(TAG, file.getName() + " is not exists."); return; } if (!forceOverride && contains(file.getPath())) { // Image already exists. Log.d(TAG, file.getName() + " is exists"); return; // TODO: write to file if not present. } Bitmap bitmap = BitmapFactory.decodeFile(file.getPath()); //bitmap = resizeBitmap(bitmap, MAX_WIDTH, MAX_HEIGHT); if (bitmap == null) { Log.w(TAG, "Retrieved bitmap is null."); } else { put(file.getPath(), bitmap, quality); } } /** * 将Bitmap写入缓存器. * @param filePath file path * @param bitmap * @param quality 1~100 */ public void put(String file, Bitmap bitmap, int quality) { synchronized (this) { mCache.put(file, new SoftReference<Bitmap>(bitmap)); } writeFile(file, bitmap, quality); } /** * 重载 put(String file, Bitmap bitmap, int quality) * @param filePath file path * @param bitmap * @param quality 1~100 */ @Override public void put(String file, Bitmap bitmap) { put(file, bitmap, DEFAULT_COMPRESS_QUALITY); } /** * 将Bitmap写入本地缓存文件. * @param file URL/PATH * @param bitmap * @param quality */ private void writeFile(String file, Bitmap bitmap, int quality) { if (bitmap == null) { Log.w(TAG, "Can't write file. Bitmap is null."); return; } BufferedOutputStream bos = null; try { String hashedUrl = getMd5(file); bos = new BufferedOutputStream( mContext.openFileOutput(hashedUrl, Context.MODE_PRIVATE)); bitmap.compress(Bitmap.CompressFormat.JPEG, quality, bos); // PNG Log.d(TAG, "Writing file: " + file); } catch (IOException ioe) { Log.e(TAG, ioe.getMessage()); } finally { try { if (bos != null) { bitmap.recycle(); bos.flush(); bos.close(); } //bitmap.recycle(); } catch (IOException e) { Log.e(TAG, "Could not close file."); } } } private String writeToFile(InputStream is, String filename) { Log.d("LDS", "new write to file"); BufferedInputStream in = null; BufferedOutputStream out = null; try { in = new BufferedInputStream(is); out = new BufferedOutputStream( mContext.openFileOutput(filename, Context.MODE_PRIVATE)); byte[] buffer = new byte[1024]; int l; while ((l = in.read(buffer)) != -1) { out.write(buffer, 0, l); } } catch (IOException ioe) { ioe.printStackTrace(); } finally { try { if (in != null) in.close(); if (out != null) { Log.d("LDS", "new write to file to -> " + filename); out.flush(); out.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } return mContext.getFilesDir() + "/" + filename; } public Bitmap get(File file) { return get(file.getPath()); } /** * 判断缓存着中是否存在该文件对应的bitmap */ public boolean isContains(String file) { return mCache.containsKey(file); } /** * 获得指定file/URL对应的Bitmap,首先找本地文件,如果有直接使用,否则去网上获取 * @param file file URL/file PATH * @param bitmap * @param quality * @throws HttpException */ public Bitmap safeGet(String file) throws HttpException { Bitmap bitmap = lookupFile(file); // first try file. if (bitmap != null) { synchronized (this) { // memory cache mCache.put(file, new SoftReference<Bitmap>(bitmap)); } return bitmap; } else { //get from web String url = file; bitmap = downloadImage2(url); // 注释掉以测试新的写入文件方法 //put(file, bitmap); // file Cache return bitmap; } } /** * 从缓存器中读取文件 * @param file file URL/file PATH * @param bitmap * @param quality */ public Bitmap get(String file) { SoftReference<Bitmap> ref; Bitmap bitmap; // Look in memory first. synchronized (this) { ref = mCache.get(file); } if (ref != null) { bitmap = ref.get(); if (bitmap != null) { return bitmap; } } // Now try file. bitmap = lookupFile(file); if (bitmap != null) { synchronized (this) { mCache.put(file, new SoftReference<Bitmap>(bitmap)); } return bitmap; } //TODO: why? //upload: see profileImageCacheManager line 96 Log.w(TAG, "Image is missing: " + file); // return the default photo return mDefaultBitmap; } public boolean contains(String url) { return get(url) != mDefaultBitmap; } public void clear() { String[] files = mContext.fileList(); for (String file : files) { mContext.deleteFile(file); } synchronized (this) { mCache.clear(); } } public void cleanup(HashSet<String> keepers) { String[] files = mContext.fileList(); HashSet<String> hashedUrls = new HashSet<String>(); for (String imageUrl : keepers) { hashedUrls.add(getMd5(imageUrl)); } for (String file : files) { if (!hashedUrls.contains(file)) { Log.d(TAG, "Deleting unused file: " + file); mContext.deleteFile(file); } } } /** * Compress and resize the Image * * <br /> * 因为不论图片大小和尺寸如何, 饭否都会对图片进行一次有损压缩, 所以本地压缩应该 * 考虑图片将会被二次压缩所造成的图片质量损耗 * * @param targetFile * @param quality, 0~100, recommend 100 * @return * @throws IOException */ public File compressImage(File targetFile, int quality) throws IOException { String filepath = targetFile.getAbsolutePath(); // 1. Calculate scale int scale = 1; BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeFile(filepath, o); if (o.outWidth > IMAGE_MAX_WIDTH || o.outHeight > IMAGE_MAX_HEIGHT) { scale = (int) Math.pow( 2.0, (int) Math.round(Math.log(IMAGE_MAX_WIDTH / (double) Math.max(o.outHeight, o.outWidth)) / Math.log(0.5))); //scale = 2; } Log.d(TAG, scale + " scale"); // 2. File -> Bitmap (Returning a smaller image) o.inJustDecodeBounds = false; o.inSampleSize = scale; Bitmap bitmap = BitmapFactory.decodeFile(filepath, o); // 2.1. Resize Bitmap //bitmap = resizeBitmap(bitmap, IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT); // 3. Bitmap -> File writeFile(filepath, bitmap, quality); // 4. Get resized Image File String filePath = getMd5(targetFile.getPath()); File compressedImage = mContext.getFileStreamPath(filePath); return compressedImage; } /** * 保持长宽比缩小Bitmap * * @param bitmap * @param maxWidth * @param maxHeight * @param quality 1~100 * @return */ public Bitmap resizeBitmap(Bitmap bitmap, int maxWidth, int maxHeight) { int originWidth = bitmap.getWidth(); int originHeight = bitmap.getHeight(); // no need to resize if (originWidth < maxWidth && originHeight < maxHeight) { return bitmap; } int newWidth = originWidth; int newHeight = originHeight; // 若图片过宽, 则保持长宽比缩放图片 if (originWidth > maxWidth) { newWidth = maxWidth; double i = originWidth * 1.0 / maxWidth; newHeight = (int) Math.floor(originHeight / i); bitmap = Bitmap.createScaledBitmap(bitmap, newWidth, newHeight, true); } // 若图片过长, 则从中部截取 if (newHeight > maxHeight) { newHeight = maxHeight; int half_diff = (int)((originHeight - maxHeight) / 2.0); bitmap = Bitmap.createBitmap(bitmap, 0, half_diff, newWidth, newHeight); } Log.d(TAG, newWidth + " width"); Log.d(TAG, newHeight + " height"); return bitmap; } }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/app/ImageManager.java
Java
asf20
16,006
package com.ch_linghu.fanfoudroid.app; import android.graphics.Bitmap; import android.widget.ImageView; import com.ch_linghu.fanfoudroid.TwitterApplication; import com.ch_linghu.fanfoudroid.app.LazyImageLoader.ImageLoaderCallback; public class SimpleImageLoader { public static void display(final ImageView imageView, String url) { imageView.setTag(url); imageView.setImageBitmap(TwitterApplication.mImageLoader .get(url, createImageViewCallback(imageView, url))); } public static ImageLoaderCallback createImageViewCallback(final ImageView imageView, String url) { return new ImageLoaderCallback() { @Override public void refresh(String url, Bitmap bitmap) { if (url.equals(imageView.getTag())) { imageView.setImageBitmap(bitmap); } } }; } }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/app/SimpleImageLoader.java
Java
asf20
912
package com.ch_linghu.fanfoudroid.app; import java.lang.Thread.State; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import android.graphics.Bitmap; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import com.ch_linghu.fanfoudroid.TwitterApplication; import com.ch_linghu.fanfoudroid.http.HttpException; public class LazyImageLoader { private static final String TAG = "ProfileImageCacheManager"; public static final int HANDLER_MESSAGE_ID = 1; public static final String EXTRA_BITMAP = "extra_bitmap"; public static final String EXTRA_IMAGE_URL = "extra_image_url"; private ImageManager mImageManager = new ImageManager( TwitterApplication.mContext); private BlockingQueue<String> mUrlList = new ArrayBlockingQueue<String>(50); private CallbackManager mCallbackManager = new CallbackManager(); private GetImageTask mTask = new GetImageTask(); /** * 取图片, 可能直接从cache中返回, 或下载图片后返回 * * @param url * @param callback * @return */ public Bitmap get(String url, ImageLoaderCallback callback) { Bitmap bitmap = ImageCache.mDefaultBitmap; if (mImageManager.isContains(url)) { bitmap = mImageManager.get(url); } else { // bitmap不存在,启动Task进行下载 mCallbackManager.put(url, callback); startDownloadThread(url); } return bitmap; } private void startDownloadThread(String url) { if (url != null) { addUrlToDownloadQueue(url); } // Start Thread State state = mTask.getState(); if (Thread.State.NEW == state) { mTask.start(); // first start } else if (Thread.State.TERMINATED == state) { mTask = new GetImageTask(); // restart mTask.start(); } } private void addUrlToDownloadQueue(String url) { if (!mUrlList.contains(url)) { try { mUrlList.put(url); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } // Low-level interface to get ImageManager public ImageManager getImageManager() { return mImageManager; } private class GetImageTask extends Thread { private volatile boolean mTaskTerminated = false; private static final int TIMEOUT = 3 * 60; private boolean isPermanent = true; @Override public void run() { try { while (!mTaskTerminated) { String url; if (isPermanent) { url = mUrlList.take(); } else { url = mUrlList.poll(TIMEOUT, TimeUnit.SECONDS); // waiting if (null == url) { break; } // no more, shutdown } // Bitmap bitmap = ImageCache.mDefaultBitmap; final Bitmap bitmap = mImageManager.safeGet(url); // use handler to process callback final Message m = handler.obtainMessage(HANDLER_MESSAGE_ID); Bundle bundle = m.getData(); bundle.putString(EXTRA_IMAGE_URL, url); bundle.putParcelable(EXTRA_BITMAP, bitmap); handler.sendMessage(m); } } catch (HttpException ioe) { Log.e(TAG, "Get Image failed, " + ioe.getMessage()); } catch (InterruptedException e) { Log.w(TAG, e.getMessage()); } finally { Log.v(TAG, "Get image task terminated."); mTaskTerminated = true; } } @SuppressWarnings("unused") public boolean isPermanent() { return isPermanent; } @SuppressWarnings("unused") public void setPermanent(boolean isPermanent) { this.isPermanent = isPermanent; } @SuppressWarnings("unused") public void shutDown() throws InterruptedException { mTaskTerminated = true; } } Handler handler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case HANDLER_MESSAGE_ID: final Bundle bundle = msg.getData(); String url = bundle.getString(EXTRA_IMAGE_URL); Bitmap bitmap = (Bitmap) (bundle.get(EXTRA_BITMAP)); // callback mCallbackManager.call(url, bitmap); break; default: // do nothing. } } }; public interface ImageLoaderCallback { void refresh(String url, Bitmap bitmap); } public static class CallbackManager { private static final String TAG = "CallbackManager"; private ConcurrentHashMap<String, List<ImageLoaderCallback>> mCallbackMap; public CallbackManager() { mCallbackMap = new ConcurrentHashMap<String, List<ImageLoaderCallback>>(); } public void put(String url, ImageLoaderCallback callback) { Log.v(TAG, "url=" + url); if (!mCallbackMap.containsKey(url)) { Log.v(TAG, "url does not exist, add list to map"); mCallbackMap.put(url, new ArrayList<ImageLoaderCallback>()); //mCallbackMap.put(url, Collections.synchronizedList(new ArrayList<ImageLoaderCallback>())); } mCallbackMap.get(url).add(callback); Log.v(TAG, "Add callback to list, count(url)=" + mCallbackMap.get(url).size()); } public void call(String url, Bitmap bitmap) { Log.v(TAG, "call url=" + url); List<ImageLoaderCallback> callbackList = mCallbackMap.get(url); if (callbackList == null) { // FIXME: 有时会到达这里,原因我还没想明白 Log.e(TAG, "callbackList=null"); return; } for (ImageLoaderCallback callback : callbackList) { if (callback != null) { callback.refresh(url, bitmap); } } callbackList.clear(); mCallbackMap.remove(url); } } }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/app/LazyImageLoader.java
Java
asf20
6,721
package com.ch_linghu.fanfoudroid.app; import android.graphics.Bitmap; import com.ch_linghu.fanfoudroid.R; import com.ch_linghu.fanfoudroid.TwitterApplication; public interface ImageCache { public static Bitmap mDefaultBitmap = ImageManager.drawableToBitmap(TwitterApplication.mContext.getResources().getDrawable(R.drawable.user_default_photo)); public Bitmap get(String url); public void put(String url, Bitmap bitmap); }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/app/ImageCache.java
Java
asf20
443
/* * Copyright (C) 2009 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ch_linghu.fanfoudroid.data; import java.util.Date; import org.json.JSONException; import org.json.JSONObject; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import com.ch_linghu.fanfoudroid.R; import com.ch_linghu.fanfoudroid.TwitterApplication; import com.ch_linghu.fanfoudroid.fanfou.Status; import com.ch_linghu.fanfoudroid.util.DateTimeHelper; import com.ch_linghu.fanfoudroid.util.TextHelper; public class Tweet extends Message implements Parcelable { private static final String TAG = "Tweet"; public com.ch_linghu.fanfoudroid.fanfou.User user; public String source; public String prevId; private int statusType = -1; // @see StatusTable#TYPE_* public void setStatusType(int type) { statusType = type; } public int getStatusType() { return statusType; } public Tweet(){} public static Tweet create(Status status){ Tweet tweet = new Tweet(); tweet.id = status.getId(); //转义符放到getSimpleTweetText里去处理,这里不做处理 tweet.text = status.getText(); tweet.createdAt = status.getCreatedAt(); tweet.favorited = status.isFavorited()?"true":"false"; tweet.truncated = status.isTruncated()?"true":"false"; tweet.inReplyToStatusId = status.getInReplyToStatusId(); tweet.inReplyToUserId = status.getInReplyToUserId(); tweet.inReplyToScreenName = status.getInReplyToScreenName(); tweet.screenName = TextHelper.getSimpleTweetText(status.getUser().getScreenName()); tweet.profileImageUrl = status.getUser().getProfileImageURL().toString(); tweet.userId = status.getUser().getId(); tweet.user = status.getUser(); tweet.thumbnail_pic = status.getThumbnail_pic(); tweet.bmiddle_pic = status.getBmiddle_pic(); tweet.original_pic = status.getOriginal_pic(); tweet.source = TextHelper.getSimpleTweetText(status.getSource()); return tweet; } public static Tweet createFromSearchApi(JSONObject jsonObject) throws JSONException { Tweet tweet = new Tweet(); tweet.id = jsonObject.getString("id") + ""; //转义符放到getSimpleTweetText里去处理,这里不做处理 tweet.text = jsonObject.getString("text"); tweet.createdAt = DateTimeHelper.parseSearchApiDateTime(jsonObject.getString("created_at")); tweet.favorited = jsonObject.getString("favorited"); tweet.truncated = jsonObject.getString("truncated"); tweet.inReplyToStatusId = jsonObject.getString("in_reply_to_status_id"); tweet.inReplyToUserId = jsonObject.getString("in_reply_to_user_id"); tweet.inReplyToScreenName = jsonObject.getString("in_reply_to_screen_name"); tweet.screenName = TextHelper.getSimpleTweetText(jsonObject.getString("from_user")); tweet.profileImageUrl = jsonObject.getString("profile_image_url"); tweet.userId = jsonObject.getString("from_user_id"); tweet.source = TextHelper.getSimpleTweetText(jsonObject.getString("source")); return tweet; } public static String buildMetaText(StringBuilder builder, Date createdAt, String source, String replyTo) { builder.setLength(0); builder.append(DateTimeHelper.getRelativeDate(createdAt)); builder.append(" "); builder.append(TwitterApplication.mContext.getString(R.string.tweet_source_prefix)); builder.append(source); if (!TextUtils.isEmpty(replyTo)) { builder.append(" " + TwitterApplication.mContext.getString(R.string.tweet_reply_to_prefix)); builder.append(replyTo); builder.append(TwitterApplication.mContext.getString(R.string.tweet_reply_to_suffix)); } return builder.toString(); } // For interface Parcelable public int describeContents() { return 0; } public void writeToParcel(Parcel out, int flags) { out.writeString(id); out.writeString(text); out.writeValue(createdAt); //Date out.writeString(screenName); out.writeString(favorited); out.writeString(inReplyToStatusId); out.writeString(inReplyToUserId); out.writeString(inReplyToScreenName); out.writeString(screenName); out.writeString(profileImageUrl); out.writeString(thumbnail_pic); out.writeString(bmiddle_pic); out.writeString(original_pic); out.writeString(userId); out.writeString(source); } public static final Parcelable.Creator<Tweet> CREATOR = new Parcelable.Creator<Tweet>() { public Tweet createFromParcel(Parcel in) { return new Tweet(in); } public Tweet[] newArray(int size) { // return new Tweet[size]; throw new UnsupportedOperationException(); } }; public Tweet(Parcel in) { id = in.readString(); text = in.readString(); createdAt = (Date) in.readValue(Date.class.getClassLoader()); screenName = in.readString(); favorited = in.readString(); inReplyToStatusId = in.readString(); inReplyToUserId = in.readString(); inReplyToScreenName = in.readString(); screenName = in.readString(); profileImageUrl = in.readString(); thumbnail_pic = in.readString(); bmiddle_pic = in.readString(); original_pic = in.readString(); userId = in.readString(); source = in.readString(); } @Override public String toString() { return "Tweet [source=" + source + ", id=" + id + ", screenName=" + screenName + ", text=" + text + ", profileImageUrl=" + profileImageUrl + ", createdAt=" + createdAt + ", userId=" + userId + ", favorited=" + favorited + ", inReplyToStatusId=" + inReplyToStatusId + ", inReplyToUserId=" + inReplyToUserId + ", inReplyToScreenName=" + inReplyToScreenName + "]"; } }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/data/Tweet.java
Java
asf20
6,410
package com.ch_linghu.fanfoudroid.data; import android.database.Cursor; public interface BaseContent { long insert(); int delete(); int update(); Cursor select(); }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/data/BaseContent.java
Java
asf20
184
package com.ch_linghu.fanfoudroid.data; import com.ch_linghu.fanfoudroid.fanfou.DirectMessage; import com.ch_linghu.fanfoudroid.fanfou.User; import com.ch_linghu.fanfoudroid.util.TextHelper; public class Dm extends Message { @SuppressWarnings("unused") private static final String TAG = "Dm"; public boolean isSent; public static Dm create(DirectMessage directMessage, boolean isSent){ Dm dm = new Dm(); dm.id = directMessage.getId(); dm.text = directMessage.getText(); dm.createdAt = directMessage.getCreatedAt(); dm.isSent = isSent; User user = dm.isSent ? directMessage.getRecipient() : directMessage.getSender(); dm.screenName = TextHelper.getSimpleTweetText(user.getScreenName()); dm.userId = user.getId(); dm.profileImageUrl = user.getProfileImageURL().toString(); return dm; } }
061304011116lyj-b
src/com/ch_linghu/fanfoudroid/data/Dm.java
Java
asf20
884