/[LeafOK_CVS]/pvpgn-1.7.4/utils/bin/listitem.php
ViewVC logotype

Contents of /pvpgn-1.7.4/utils/bin/listitem.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sat Jul 12 10:01:45 2008 UTC (17 years, 8 months ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Update

1 <?
2
3 if (!isset($_SERVER["argc"]) || $_SERVER["argc"] != 2)
4 {
5 echo "Error usage\n";
6 exit(1);
7 }
8
9 $data_file = $_SERVER["argv"][1];
10 $item_p1 = 0x4a;
11 $item_p2 = 0x4d;
12 $item_uid_offset = 12;
13 $item_uid_length = 4;
14
15 $data = file_get_contents($data_file);
16
17 $pos = strrpos($data_file, "/");
18 if ($pos === false)
19 {
20 $char = $data_file;
21 }
22 else
23 {
24 $char = substr($data_file, $pos + 1);
25 }
26
27 $last_pos = 0;
28
29 for($cur_pos = 0; $cur_pos < strlen($data); $cur_pos++)
30 {
31 if (ord($data[$cur_pos]) == $item_p1 && ord($data[$cur_pos + 1]) == $item_p2)
32 {
33 if (($last_pos > 0) && ($cur_pos - $last_pos >= 2 + $item_uid_offset + $item_uid_length))
34 {
35 $item_name = "";
36 for ($i = 0; $i < 3; $i++)
37 {
38 $item_name .= chr(ord($data[$last_pos + 9 + $i]) / 16 + ord($data[$last_pos + 10 + $i]) % 16 * 16);
39 }
40
41 $item_uid = substr($data, $last_pos + 2 + $item_uid_offset, $item_uid_length);
42
43 printf("%s\t", $item_name);
44
45 for ($i = 0; $i < strlen($item_uid); $i++)
46 {
47 printf("%x%x", ord($item_uid[$i])/16, ord($item_uid[$i])%16);
48 }
49
50 printf("\t%s\n", $char);
51 }
52 else if (($last_pos > 0) && ($cur_pos - $last_pos == 14))
53 {
54 $item_name = "";
55 for ($i = 0; $i < 3; $i++)
56 {
57 $item_name .= chr(ord($data[$last_pos + 9 + $i]) / 16 + ord($data[$last_pos + 10 + $i]) % 16 * 16);
58 }
59
60 if (ereg("^r[0-9]{2}$", $item_name, $regs))
61 {
62 printf("%s\t00000000\t%s\n", $item_name, $char);
63 }
64 }
65
66 $last_pos = $cur_pos;
67 }
68 }
69 ?>

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1