Initial commit

This commit is contained in:
Aurelien Labate 2019-12-26 17:22:34 +01:00
commit 39ea96f0f2
10 changed files with 897 additions and 0 deletions

370
FXItoG1R/converter.php Normal file
View File

@ -0,0 +1,370 @@
<?php
ini_set("display_errors",0);
if(isset($_FILES['file']['name']))
{
require_once('../common/functions.php');
//format
if(isset($_POST['format']) && ($_POST['format']=="g1r" || $_POST['format']=="g1m") )
{
$format = $_POST['format'];
}
else
$format = "g1r";
//Get and decode FXI
$InFile = file_get_contents($_FILES['file']['tmp_name']);
$InFileSize = strlen($InFile);
$InFile = fxiDecode($InFile);
//Search for blocks (TXT, pictures or other)
$nbrPrgm = 0;
$textSize = 0;
$prgms = "";
for($i = 0 ; $i < $InFileSize*2; $i+=2)
{
//TXT
if(substr($InFile, $i, 6) == "545854" && substr($InFile,$i+8,4)=="5047")// TXT.PG
{
$valide = true;
//title : ([^\xff]{1,8})
$title = "";
for($j = $i+20 ; $j < $i+20+16; $j+=2)
{
if($InFile[$j].$InFile[$j+1] == "ff")
break;
else
$title.= $InFile[$j].$InFile[$j+1];
}
$title = str_pad($title, 16, '0', STR_PAD_RIGHT);
// echo "Title hex : ".$title."\nTitle ascii : \"".pack('H*',$title)."\"\n\n";
$titleLen = strlen($title)/2;
// \xff{16,23} : (16+8-$titleLen) FF
$Offset = $j;
for($j=$j ; $j < $i+68; $j++)
{
if($InFile[$j]!='f')
{
$valide = false;
break;
}
}
// (NL|BN)
if($valide && (substr($InFile,$i+68,4)!='4e4c' && substr($InFile,$i+68,4)!='424e'))
$valide = false;
// \xff{12} : (16+8-$titleLen) FF
if($valide)
{
for($j=$i+72 ; $j < $i+96; $j++)
{
if($InFile[$j]!='f')
{
$valide = false;
break;
}
}
}
//get prgm content
if($valide)
{
$text ="00000000000000000000";
for($j = $i+96 ; $j < $InFileSize*2; $j+=2)
{
if($InFile[$j].$InFile[$j+1]=='ff')
{
break;
}
else
{
$text.=$InFile[$j].$InFile[$j+1];
}
}
//calcul taille texte
$tailleText = strlen($text)/2;
$tailleText= $tailleText + (4-$tailleText%4);
$textSize += $tailleText+44;
$tailleTextHex = str_pad(dechex($tailleText), 8, '0', STR_PAD_LEFT);
//arrondi la taille a 4
$text = str_pad($text, $tailleText*2, '0', STR_PAD_RIGHT);
}
//validation prgm
if($valide)
{
$prgms .= "50524f4752414d0000000000000000000000000173797374656d0000".$title."01".$tailleTextHex."000000".$text;
$nbrPrgm++;
}
}
//Picture block
if(substr($InFile, $i, 6) == "494d47" && substr($InFile,$i+8,4)=="5043")
{
$valide = true;
//title : ([^\xff]{1,8})
$title = "";
for($j = $i+20 ; $j < $i+20+16; $j+=2)
{
if($InFile[$j].$InFile[$j+1] == "ff")
break;
else
$title.= $InFile[$j].$InFile[$j+1];
}
$title = str_pad($title, 16, '0', STR_PAD_RIGHT);
$titleLen = strlen($title)/2;
$picId = $title[14].$title[15];
// \xff{16,23} : (16+8-$titleLen) FF
$Offset = $j;
for($j=$j ; $j < $i+52; $j++)
{
if($InFile[$j]!='f')
{
$valide = false;
break;
}
}
// (DRUWF)
if($valide && (substr($InFile,$i+52,10)!='4452555746'))
$valide = false;
// \xff{13}
if($valide)
{
for($j=$i+70 ; $j < $i+96; $j++)
{
if($InFile[$j]!='f')
{
$valide = false;
break;
}
}
}
//get prgm content
if($valide)
{
$pics ="";
for($j = $i+96 ; $j < $i+8224+96; $j++)
{
$pics.=$InFile[$j];
}
$picsArray = getFxiPic($pics);
//fusion des couleurs (rouge/bleu/vert/blanc => noir/blanc)
//rouge
foreach($picsArray[0] as $key => $value)
{
$g1mPicsArray[0][$key]=$value;
}
//bleu
foreach($picsArray[1] as $key => $value)
{
$g1mPicsArray[0][$key]|=$value;
}
//vert
foreach($picsArray[2] as $key => $value)
{
$g1mPicsArray[0][$key]|=$value;
}
//blanc
foreach($picsArray[3] as $key => $value)
{
$g1mPicsArray[1][$key]=$value;
}
//test
// echo $picsArray[3][0];exit;
//generating g1m block
$text ="5049435455524520".$picId."00000000000000000000016d61696e0000000050494354".$picId."0000000700000800000000";
$color = 0;
$j =0;
while($color < 2)
{
$text .= str_pad(dechex($g1mPicsArray[$color][$j]), 2, '0', STR_PAD_LEFT);
$j++;
if($j > 1023)
{
$color++;
$j = 0;
}
}
//calcul taille texte
$tailleText = strlen($text)/2;
$tailleText= $tailleText + (4-$tailleText%4);
$textSize += $tailleText;
//arrondi la taille a 4
$text = str_pad($text, $tailleText*2, '0', STR_PAD_RIGHT);
$prgms.=$text;
//validation
$nbrPrgm++;
}
}
//MSC1  : TXT graph 100
elseif(substr($InFile, $i, 14) == "4d435331000000" && $InFile[$i+18].$InFile[$i+19]=="01")
{
$valide = true;
//title : ([^\xff]{1,8})
$title = "";
for($j = $i+20 ; $j < $i+20+16; $j+=2)
{
if($InFile[$j].$InFile[$j+1] == "ff")
break;
else
$title.= $InFile[$j].$InFile[$j+1];
}
$title = str_pad($title, 16, '0', STR_PAD_RIGHT);
// echo "Title hex : ".$title."\nTitle ascii : \"".pack('H*',$title)."\"\n\n";exit;
$titleLen = strlen($title)/2;
// \xff{16,23} : (16+8-$titleLen) FF
$Offset = $j;
for($j=$j ; $j < $i+76; $j++)
{
if($InFile[$j]!='f')
{
$valide = false;
break;
}
}
//get prgm content
if($valide)
{
$text ="00000000000000000000";
for($j = $i+96 ; $j < $InFileSize*2; $j+=2)
{
if($InFile[$j].$InFile[$j+1]=='ff')
{
break;
}
else
{
$text.=$InFile[$j].$InFile[$j+1];
}
}
//calcul taille texte
$tailleText = strlen($text)/2;
$tailleText= $tailleText + (4-$tailleText%4);
$textSize += $tailleText+44;
$tailleTextHex = str_pad(dechex($tailleText), 8, '0', STR_PAD_LEFT);
//arrondi la taille a 4
$text = str_pad($text, $tailleText*2, '0', STR_PAD_RIGHT);
}
//validation prgm
if($valide)
{
$prgms .= "50524f4752414d0000000000000000000000000173797374656d0000".$title."01".$tailleTextHex."000000".$text;
$nbrPrgm++;
}
}
//MSC1  : MAT graph 100
elseif(substr($InFile, $i, 14) == "4d435331000000" && $InFile[$i+18].$InFile[$i+19]=="06")
{
$valide = true;
//title : ([^\xff]{1,8})
$title = "";
for($j = $i+20 ; $j < $i+20+16; $j+=2)
{
if($InFile[$j].$InFile[$j+1] == "ff")
break;
else
$title.= $InFile[$j].$InFile[$j+1];
}
$title = str_pad($title, 16, '0', STR_PAD_RIGHT);
$letter = $title[8].$title[9];
// echo "Title hex : ".$title."\nTitle ascii : \"".pack('H*',$title)."\" ; letter : ".$letter."\n\n";exit;
$titleLen = strlen($title)/2;
// \xff{16,23} : (16+8-$titleLen) FF
$Offset = $j;
for($j=$j ; $j < $i+76; $j++)
{
if($InFile[$j]!='f')
{
$valide = false;
break;
}
}
//get content size
$contentSize = substr($InFile, $i+10, 8);
$contentSize = hexdec($contentSize);
//get matrix height
$matrixHeight = $InFile[$i+92].$InFile[$i+93];
//get matrix width
$matrixWidth = $InFile[$i+96].$InFile[$i+97];
//get prgm content
if($valide)
{
//contenu
$matrixContent= substr($InFile, $i+108, ($contentSize-16)*2);
//ajouter 3*00 apres 9eme puis au 9+3 +9
$matrixContentSize = strlen($matrixContent);
for($j=18 ; $j < $matrixContentSize; $j+=18)
{
if(isset($matrixContent[$j]))
{
$matrixContent = substr($matrixContent,0,$j)."000000".substr($matrixContent,$j,$matrixContentSize-$j);
$matrixContentSize+=6;
$j+=6;
}
else
break;
}
//calcul taille texte
$tailleText = strlen($matrixContent)/2;
$tailleText= $tailleText + (4-$tailleText%4) + 16;
$textSize += $tailleText + 44;
$tailleTextHex = str_pad(dechex($tailleText), 8, '0', STR_PAD_LEFT);
//arrondi la taille a 4
$matrixContent = str_pad($matrixContent, ($tailleText-16)*2, '0', STR_PAD_RIGHT);
//contenu finale
$prgms .=
"4d415420".$letter."0000000000000000000000".
"000000016d61696e000000004d41545f".
$letter."00000006". $tailleTextHex ."00000000000000".
"0000000000". $matrixHeight ."00". $matrixWidth ."00000000". $matrixContent;
}
//validation prgm
if($valide)
{
$nbrPrgm++;
}
}
}
// echo $InFile;exit;
//G1M generating
//filesize calculation
// $filesize = 32 + $textSize + 44*$nbrPrgm;
$filesize = 32 + $textSize;
if($filesize > 0xFFFFFFFF)
{
error("File too big.", "Fichier trop gros.");
}
//OFFSET 0xE : last filesize byte + 65(0x41) and NOT (inverted)
$offset0xE = $filesize + 0x41;
$offset0xE = 0xFFFFFFFF - $offset0xE;
$offset0xE = dechex($offset0xE);
$offset0xE = str_pad($offset0xE, 2, '0', STR_PAD_LEFT);
$offset0xE = substr($offset0xE, -2); // take the last byte
//OFFSET 0x10 : filesize NOT (inverted)
$offset0x10 = 0xFFFFFFFF - $filesize;
$offset0x10 = dechex($offset0x10);// to hex
$offset0x10 = str_pad($offset0x10, 8, '0', STR_PAD_LEFT);
//OFFSET 0x14 : last filesize byte + 184(0xB8) and NOT (inverted)
$offset0x14 = $filesize + 0xB8;
$offset0x14 = 0xFFFFFFFF - $offset0x14;
$offset0x14 = dechex($offset0x14);
$offset0x14 = str_pad($offset0x14, 2, '0', STR_PAD_LEFT);
$offset0x14 = substr($offset0x14, -2);
//OFFSET 0x14 : last filesize byte + 184(0xB8) and NOT (inverted)
$offset0x1E = $nbrPrgm;
$offset0x1E = 0xFFFF - $offset0x1E;
$offset0x1E = dechex($offset0x1E);
$offset0x1E = str_pad($offset0x1E, 4, '0', STR_PAD_LEFT);
//making
$fileContent = pack('H*',
"aaacbdaf90889a8dceffefffefff".$offset0xE."fe".
$offset0x10.$offset0x14."000000000000000000".$offset0x1E.
$prgms
);
//sending
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment;filename="'.substr($_FILES['file']['name'],0,-4).'.'.$format.'"');
header('Cache-Control: max-age=0');
$fh = fopen('php://output', 'wb');
fwrite($fh, $fileContent);
fclose($fh);
}
else
{
header("Location: ../");
}
?>

50
FXItoG1R/index.html Normal file
View File

@ -0,0 +1,50 @@
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Fxi to g1r converter</title>
<link rel="stylesheet" type="text/css" href="../common/style.css?100313" />
<script type="text/javascript">//Google analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39078814-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="headerBar">
<a class="Cell CellL" href="http://wiki.planet-casio.com/tools/EactMaker">
<h1>Fxi to g1r converter</h1>
</a>
<a class="Cell CellR casiopeiaLink" href="http://www.casiopeia.net/forum/">
<strong>Casiopeia</strong>
</a>
<a class="Cell CellR PClink" href="http://www.planet-casio.com/Fr/">
<strong>Planète Casio</strong>
</a>
<a class="Cell CellR" href="http://wiki.planet-casio.com/">
<strong>Casio Universal Wiki</strong>
</a>
</div>
<div id="loadBox" style="display:block;">
<form method="post" action="converter.php" enctype="multipart/form-data">
<h4>Convert Fxi to g1r</h4><br/>
<input type="file" name="file" accept=".fxi"/><br/>
Format : <select name="format">
<option value="g1r">.g1r</option>
<option value="g1m">.g1m</option>
</select><br/><br/>
<input type="submit"/>
</form>
</div>
<div id="footer">
Developed by Ziqumu for <a href="http://www.planet-casio.com/Fr/">Planete Casio</a> and <a href='http://www.casiopeia.net/'>Casiopeia</a>
</div>
</body>
</html>

19
G1MtoG1R/converter.php Normal file
View File

@ -0,0 +1,19 @@
<?php
ini_set("display_errors",0);
if(isset($_FILES['file']['name']))
{
//Get the file
$InFile = file_get_contents($_FILES['file']['tmp_name']);
//sending
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment;filename='.substr($_FILES['file']['name'],0,-4).'.g1r');
header('Cache-Control: max-age=0');
$fh = fopen('php://output', 'wb');
fwrite($fh, $InFile);
fclose($fh);
}
else
{
header("Location: ../");
}
?>

51
G1MtoG1R/index.html Normal file
View File

@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>g1m to g1r converter</title>
<link rel="stylesheet" type="text/css" href="../common/style.css?100313" />
<script type="text/javascript">//Google analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39078814-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="headerBar">
<a class="Cell CellL" href="http://wiki.planet-casio.com/tools/EactMaker">
<h1>g1m to g1r converter</h1>
</a>
<a class="Cell CellR casiopeiaLink" href="http://www.casiopeia.net/forum/">
<strong>Casiopeia</strong>
</a>
<a class="Cell CellR PClink" href="http://www.planet-casio.com/Fr/">
<strong>Planète Casio</strong>
</a>
<a class="Cell CellR" href="http://wiki.planet-casio.com/">
<strong>Casio Universal Wiki</strong>
</a>
</div>
<div id="loadBox" style="display:block;">
<form method="post" action="converter.php" enctype="multipart/form-data">
<h4>Convert g1m to g1r</h4><br/>
<input type="file" name="file" accept=".g1m"/><br/>
<input type="submit"/>
</form>
<p>Cet utilitaire ne fait que rennomer votre fichier .g1m en .g1r, aucune autre action n'est effectué. Vous pouvez donc très bien le faire depuis votre ordinateur, mais si vous ne savez pas comment alors cet (in)utilitaire est fait pour vous !</p>
<p>This tool only rename your .g1m file to .g1r, no other action is made. You can easily do the same on your computer, but if you don't know how to do it, then this (useless) tool is made for you !</p>
</div>
<div id="footer">
Developed by Ziqumu for <a href="http://www.planet-casio.com/Fr/">Planete Casio</a> and <a href='http://www.casiopeia.net/'>Casiopeia</a>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</body>
</html>

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2013-2019 Aurélien Labate <aurelien@labate.me>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

86
PicViewer/converter.php Normal file
View File

@ -0,0 +1,86 @@
<?php
ini_set("display_errors",1);
if(isset($_FILES['file']['name']) && !empty($_FILES['file']['name']))
{
require_once('../common/functions.php');
//detection du format
$format = strtolower(substr($_FILES['file']['name'],-3));
//get size
if(!is_numeric($_POST['size']) || $_POST['size']<1 || $_POST['size']>9)
{
$size=3;
}
else $size=$_POST['size'];
//get colors
if(isset($_POST['blackAndWhite']) && $format=="fxi")
{
$colors =array(array(0,0,0),array(0, 0, 0),array(0, 0, 0),array(255, 255, 255)) ;
//0 = rouge
//1 = bleu
//2 = vert
//3 = white
}
elseif($format=="fxi")
// else
{
$colors =array(array(255,0,0),array(0, 0, 255),array(0, 128, 0),array(255, 255, 255));
//0 = rouge => black
//1 = bleu => black
//2 = vert => black
//3 = white => white
}
else
{
$colors =array(array(0,0,0),array(255, 255, 255),array(255, 255, 255),array(255, 255, 255)) ;
}
//getfile
$InFile = file_get_contents($_FILES['file']['tmp_name']);
$InFileSize = strlen($InFile);
if($format == 'fxi')
{
//decode fxi & to hex
$InFile = fxiDecode($InFile);
//search for pic block
for($i = 0 ; $i < $InFileSize*2; $i+=2)
{
if(substr($InFile, $i, 6) == "494d47" && substr($InFile,$i+8,4)=="5043")
{
$pics ="";
for($j = $i+96 ; $j < $i+8224+96; $j++)
{
$pics.=$InFile[$j];
}
$picsArray = getFxiPic($pics);
writePics($picsArray, $colors, $size);
exit;
}
}
}
elseif($format == 'g1r' || $format == 'g1m' || $format == 'g2m')
{
//to hex
$InFile = bin2hex($InFile);
//search for pic block
for($i = 0 ; $i < $InFileSize*2; $i+=2)
{
if(substr($InFile, $i, 16) == "5049435455524520" && substr($InFile,$i+18,46)=="00000000000000000000016d61696e0000000050494354" && substr($InFile,$i+66,22)=="0000000700000800000000")
{
$pics ="";
for($j = $i+88 ; $j < $i+4096+88; $j++)
{
$pics.=$InFile[$j];
}
$picsArray = getG1mPic($pics);
writePics($picsArray, $colors, $size);
exit;
}
}
echo "Aucune image trouvée";exit;
}
}
else
{
header('Location : ../');
}
?>

50
PicViewer/index.html Normal file
View File

@ -0,0 +1,50 @@
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Picture Viewer</title>
<link rel="stylesheet" type="text/css" href="../common/style.css?100313" />
<script type="text/javascript">//Google analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39078814-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="headerBar">
<a class="Cell CellL" href="http://wiki.planet-casio.com/tools/EactMaker">
<h1>Picture Viewer</h1>
</a>
<a class="Cell CellR casiopeiaLink" href="http://www.casiopeia.net/forum/">
<strong>Casiopeia</strong>
</a>
<a class="Cell CellR PClink" href="http://www.planet-casio.com/Fr/">
<strong>Planète Casio</strong>
</a>
<a class="Cell CellR" href="http://wiki.planet-casio.com/">
<strong>Casio Universal Wiki</strong>
</a>
</div>
<div id="loadBox">
<form method="post" action="converter.php" enctype="multipart/form-data">
<h4>Read fxi/g1m/g2m/g1r pictures</h4><br/>
<input type="file" name="file" accept=".g1m,.g2m,.fxi,.g1r"/><br/>
<label for="blackAndWhite">Black and white : </label><input type="checkbox" id="blackAndWhite" name="blackAndWhite" checked="checked"/><br/>
Zoom : &times;<input type="text" name="size" maxlength="1" size="1" value="3" checked="checked"/><br/>
<input type="submit"/>
</form>
</div>
<div id="footer">
Developed by Ziqumu for <a href="http://www.planet-casio.com/Fr/">Planete Casio</a> and <a href='http://www.casiopeia.net/'>Casiopeia</a>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</body>
</html>

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# G1R/FXI tools
Set of web tools to convert and manipulate fxi, g1r and g1m files.
This tool has originally been created by Ziqumu (aka Alabate) in 2013 for [Planète Casio](https://www.planet-casio.com/Fr/forums/topic12023-1-Quelques-outils-en-ligne.html).
* FXItoG1R : Convert an old FXI file to the newer format G1R
* G1MtoG1R : Rename a G1M file to G1R.. because it's not so easy for everyone!
* PicViewer : Find the first image of an FXI or G1R file and display it
## Thanks to
* [Casetta projet](http://casetta.tuxfamily.org/)
* Simon Lothar

188
common/functions.php Normal file
View File

@ -0,0 +1,188 @@
<?php
$Fxi2RawArray = array(
255 => "18", 254 => "19", 253 => "1a", 252 => "1b", 251 => "1c",
250 => "1d", 249 => "1e", 248 => "1f", 247 => "10", 246 => "11",
245 => "12", 244 => "13", 243 => "14", 242 => "15", 241 => "16",
240 => "17", 239 => "08", 238 => "09", 237 => "0a", 236 => "0b",
235 => "0c", 234 => "0d", 233 => "0e", 232 => "0f", 231 => "00",
230 => "01", 229 => "02", 228 => "03", 227 => "04", 226 => "05",
225 => "06", 224 => "07", 223 => "38", 222 => "39", 221 => "3a",
220 => "3b", 219 => "3c", 218 => "3d", 217 => "3e", 216 => "3f",
215 => "30", 214 => "31", 213 => "32", 212 => "33", 211 => "34",
210 => "35", 209 => "36", 208 => "37", 207 => "28", 206 => "29",
205 => "2a", 204 => "2b", 203 => "2c", 202 => "2d", 201 => "2e",
200 => "2f", 199 => "20", 198 => "21", 197 => "22", 196 => "23",
195 => "24", 194 => "25", 193 => "26", 192 => "27", 191 => "58",
190 => "59", 189 => "5a", 188 => "5b", 187 => "5c", 186 => "5d",
185 => "5e", 184 => "5f", 183 => "50", 182 => "51", 181 => "52",
180 => "53", 179 => "54", 178 => "55", 177 => "56", 176 => "57",
175 => "48", 174 => "49", 173 => "4a", 172 => "4b", 171 => "4c",
170 => "4d", 169 => "4e", 168 => "4f", 167 => "40", 166 => "41",
165 => "42", 164 => "43", 163 => "44", 162 => "45", 161 => "46",
160 => "47", 159 => "78", 158 => "79", 157 => "7a", 156 => "7b",
155 => "7c", 154 => "7d", 153 => "7e", 152 => "7f", 151 => "70",
150 => "71", 149 => "72", 148 => "73", 147 => "74", 146 => "75",
145 => "76", 144 => "77", 143 => "68", 142 => "69", 141 => "6a",
140 => "6b", 139 => "6c", 138 => "6d", 137 => "6e", 136 => "6f",
135 => "60", 134 => "61", 133 => "62", 132 => "63", 131 => "64",
130 => "65", 129 => "66", 128 => "67", 127 => "98", 126 => "99",
125 => "9a", 124 => "9b", 123 => "9c", 122 => "9d", 121 => "9e",
120 => "9f", 119 => "90", 118 => "91", 117 => "92", 116 => "93",
115 => "94", 114 => "95", 113 => "96", 112 => "97", 111 => "88",
110 => "89", 109 => "8a", 108 => "8b", 107 => "8c", 106 => "8d",
105 => "8e", 104 => "8f", 103 => "80", 102 => "81", 101 => "82",
100 => "83", 99 => "84", 98 => "85", 97 => "86", 96 => "87",
95 => "b8", 94 => "b9", 93 => "ba", 92 => "bb", 91 => "bc",
90 => "bd", 89 => "be", 88 => "bf", 87 => "b0", 86 => "b1",
85 => "b2", 84 => "b3", 83 => "b4", 82 => "b5", 81 => "b6",
80 => "b7", 79 => "a8", 78 => "a9", 77 => "aa", 76 => "ab",
75 => "ac", 74 => "ad", 73 => "ae", 72 => "af", 71 => "a0",
70 => "a1", 69 => "a2", 68 => "a3", 67 => "a4", 66 => "a5",
65 => "a6", 64 => "a7", 63 => "d8", 62 => "d9", 61 => "da",
60 => "db", 59 => "dc", 58 => "dd", 57 => "de", 56 => "df",
55 => "d0", 54 => "d1", 53 => "d2", 52 => "d3", 51 => "d4",
50 => "d5", 49 => "d6", 48 => "d7", 47 => "c8", 46 => "c9",
45 => "ca", 44 => "cb", 43 => "cc", 42 => "cd", 41 => "ce",
40 => "cf", 39 => "c0", 38 => "c1", 37 => "c2", 36 => "c3",
35 => "c4", 34 => "c5", 33 => "c6", 32 => "c7", 31 => "f8",
30 => "f9", 29 => "fa", 28 => "fb", 27 => "fc", 26 => "fd",
25 => "fe", 24 => "ff", 23 => "f0", 22 => "f1", 21 => "f2",
20 => "f3", 19 => "f4", 18 => "f5", 17 => "f6", 16 => "f7",
15 => "e8", 14 => "e9", 13 => "ea", 12 => "eb", 11 => "ec",
10 => "ed", 9 => "ee", 8 => "ef", 7 => "e0", 6 => "e1",
5 => "e2", 4 => "e3", 3 => "e4", 2 => "e5", 1 => "e6",
0 => "e7",
);
function fxiDecode($text)
{
global $Fxi2RawArray;
$fileSize = strlen($text);
$Return="";
for($i = 0 ; $i < $fileSize; $i++)
{
if(isset($Fxi2RawArray[ord($text[$i])]))
{
$Return.= $Fxi2RawArray[ord($text[$i])];
}
else
{
echo "Erreur : caractere non reconnu (erreur impossible)";exit;
}
}
return $Return;
}
function getFxiPic($text) //transform fxi pic an array of 4 array reprent all 4 colors. array of colors are coded like a g1m sheet (natural organisation : one bit represente one pixel) ; color order : Blue, orange, green, white
{
$textSize = strlen($text);
$actuelColor = 0;
$x = 15;
$y = 63;
for($i = 8 ; $i < $textSize; $i+=2)
{
//changement de couleur
if($i >=($actuelColor*2056+2056) )
{
$actuelColor++;
$i+=8;
$x = 15;
$y = 63;
}
//changement de colonne
if($y<0)
{
$y=63;
$x--;
}
//enregistrement de la case
$Return[$actuelColor][$y*16+$x] = hexdec($text[$i].$text[$i+1]);
$y--;
}
return $Return;
}
function getG1mPic($text) //transform G1m pic an array of 4 array reprent all 2 colors. array of colors are coded like a g1m sheet (natural organisation : one bit represente one pixel) ; color order : Blue, orange, green, white
{
$textSize = strlen($text);
$actuelColor = 0;
$i = 0;
while($actuelColor < 2 && $actuelColor*2048+$i<$textSize)
{
if($i >= 2048 )
{
$i = 0;
$actuelColor++;
}
$Return[$actuelColor][$i/2] = hexdec($text[$actuelColor*2048+$i].$text[$actuelColor*2048+$i+1]);
$i+=2;
}
// print_r($Return);exit;
return $Return;
}
//color=array(array(255,0,0),array(0, 0, 255),array(0, 128, 0),array(66, 174, 9))
function imageResizeAlpha($src, $coef)
{
$w = imagesx($src)*$coef;
$h = imagesy($src)*$coef;
$temp = imagecreatetruecolor($w, $h);
imagealphablending($temp, false);
imagesavealpha($temp, true);
$trans_layer_overlay = imagecolorallocatealpha($temp, 0, 0, 0, 127);
imagefill($temp, 0, 0, $trans_layer_overlay);
imagecopyresized($temp, $src, 0, 0, 0, 0, $w, $h, imagesx($src), imagesy($src));
return $temp;
}
//=array(array(255,0,0),array(0, 0, 255),array(0, 128, 0),array(66, 174, 9))
// $actualPic = 1;
//0 = rouge
//1 = bleu
//2 = vert
//3 = white
function writePics($pics, $colors, $size=3)
{
$nbrPics = count($pics);
// header("Content-type: image/png");
$image = imagecreate(128,64);
$fond = imagecolorallocate($image, 255,255,255);
imagecolortransparent($image,$fond);
for($actualPic = 0 ; $actualPic < $nbrPics; $actualPic++)
{
// echo $actualPic;
$AColor = imagecolorallocate($image, $colors[$actualPic][0], $colors[$actualPic][1], $colors[$actualPic][2]);
for($xy = 0 ; $xy < 1024; $xy++)
{
$y = (int)($xy/16);
$x = ($xy%16)*8;
if($pics[$actualPic][$xy]&1)//00000001
ImageSetPixel($image, $x+7, $y, $AColor);
if(($pics[$actualPic][$xy]&2)>>1)//00000010
ImageSetPixel($image, $x+6, $y, $AColor);
if(($pics[$actualPic][$xy]&4)>>2)//00000100
ImageSetPixel($image, $x+5, $y, $AColor);
if(($pics[$actualPic][$xy]&8)>>3)//00001000
ImageSetPixel($image, $x+4, $y, $AColor);
if(($pics[$actualPic][$xy]&16)>>4)//00010000
ImageSetPixel($image, $x+3, $y, $AColor);
if(($pics[$actualPic][$xy]&32)>>5)//00100000
ImageSetPixel($image, $x+2, $y, $AColor);
if(($pics[$actualPic][$xy]&64)>>6)//01000000
ImageSetPixel($image, $x+1, $y, $AColor);
if(($pics[$actualPic][$xy]&128)>>7)//10000000
ImageSetPixel($image, $x, $y, $AColor);
}
}
//resizing
if($size >=2)
{
$image = imageResizeAlpha($image,$size);
}
//senging
imagepng($image);
}
?>

48
common/style.css Normal file
View File

@ -0,0 +1,48 @@
body{margin:0;padding:0;background-color:#f6f6f6;font-family:sans-serif;min-width:950px;}
p{text-align:justify;font-size:11pt;}
/* header bar : title and links */
#headerBar{text-align:center;background-color:#ffffff;border:solid #a7d7f9 1px;width:95%;margin:15px auto;height:40px; box-shadow: 2px 2px 15px #d0d0d0;}
#headerBar div{margin:0;padding:0;color:red;}
#headerBar .Cell{height:40px;display:inline-block}
#headerBar .CellR{border-left:solid #a7d7f9 1px;float:right;}
#headerBar .CellL{border-right:solid #a7d7f9 1px;float:left;}
#headerBar a{color:#000;text-decoration:none;}
#headerBar a:hover{background-color:#ecfbfe;color:#120447; }
#headerBar .PClink:hover{color:#be1717;background-color:#fce9e9;border:solid #be1717 1px;margin:-1px -1px 0 0;}
#headerBar .casiopeiaLink:hover{color:#4283c6;background-color:#e2eef6;border:solid #4283c6 1px;margin:-1px -1px 0 0;}
#headerBar h1{font-weight:normal;font-family:sans-serif;font-size:26px;margin:5px 10px 0 10px;}
#headerBar strong{display:inline-block;font-weight:normal;font-size:18px;margin:9px 10px 0 10px;}
/* loadbox to get file to load */
#loadBox{display:block;width:40%;margin: 0 auto;padding:10px;box-shadow: 2px 2px 15px #d0d0d0;background-color:white;border:solid #a7d7f9 1px;text-align:center;}
#loadBox a{text-decoration:none;color:#0d90d4;margin-top:5px;display:inline-block;}
#loadBox h4{margin:0;padding:0;}
#loadBox a:hover{text-decoration:underline;}
/* errorBox error msg box */
#errorBox{overflow:hidden;display:none;width:90%;margin: 30px auto;padding:10px;box-shadow: 2px 2px 15px #d0d0d0;background-color:white;border:solid #a7d7f9 1px;text-align:center;}
#errorBox h3{margin:0;padding:0;font-size:1.2em;color:red;font-weight:normal;}
#errorBox a{text-decoration:none;color:#0d90d4;margin-top:5px;display:block;}
#errorBox a:hover{text-decoration:underline;}
/* settings Bar : name format and eventual password */
#settingsBar{width:95%;height:25px;margin:auto;text-align:center;margin-bottom:15px;}
#settingsBar .title{float:left;}
#settingsBar .format{float:right;}
#settingsBar .centralInput{display:none;}
/* #eactmaker the textarea and menu in top and in bottom */
#eactmaker{width:95%;margin: 0 auto;padding:0;box-shadow: 2px 2px 15px #d0d0d0;}
#eactmaker .buttons{background-color:white;height:33px;width:100%;border:solid #a7d7f9 1px;margin:0 auto;padding:0;}
#eactmaker .buttons.top{display:none;}
#eactmaker .buttons a{float:left;border-right:solid 1px #dddddd;margin:0;height:26px;padding:7px 15px 0 15px;text-decoration:none;color:#7b7b7b;display:none;}
#eactmaker .buttons a.img{padding:0 10px;height:33px;}/*comportement of the link for img */
#eactmaker .buttons a.img div{display:inline-block;height:33px;}
#eactmaker .buttons a:hover{color:#0d90d4;background-color:#ecfbfe;}
#eactmaker .buttons .right{border-left:1px solid #dddddd;border-right:0;float:right;}
#eactmaker .buttons input{border-style:solid;border-width:0 1px 0 1;background:none;display:inline-block;margin:0;height:33px;padding:0px 15px 0 15px;color:#7b7b7b;font-size:1.0em;font-weight:bold;cursor:pointer;}
#eactmaker .buttons input:hover{color:#0d90d4;background-color:#ecfbfe;}
#eactmaker #charsTab{background-color:#f3fdfe;width:100%;border:solid #a7d7f9 1px;margin:-1px auto 0 auto;padding:0;display:none;}
#eactmaker #charsTab div{margin:10px auto;position:relative;}
#eactmaker #charsTab a{position:absolute;display:block;width:23px;height:29px;}
#eactmaker #charsTab a:hover{border:solid #a7d7f9 1px;}
#eactmaker textarea{vertical-align: middle;width:100%;font-size:1.3em;border:solid #a7d7f9 1px;padding:0;max-width:100%;min-width:100%;min-height:30px;margin:-1px 0 -1px 0;}
#footer{font-size:10px;color:grey;float:right;width:100%;text-align:center;margin-top:15px;}
#footer a{color:grey;}
#footer a:hover{text-decoration:none;}