11 |
void chg(int x, int y, int z, boolean b1, boolean b2, boolean b3); |
void chg(int x, int y, int z, boolean b1, boolean b2, boolean b3); |
12 |
}; |
}; |
13 |
|
|
14 |
private FileInputStream in; |
private RandomAccessFile in; |
|
private FileOutputStream out; |
|
15 |
private Listener chg; |
private Listener chg; |
16 |
|
|
17 |
static final byte[] imps2 = new byte[] { |
static final byte[] imps2 = new byte[] { |
18 |
(byte)0xf3, (byte)0xc8, (byte)0xf3, (byte)0x64, (byte)0xf3, (byte)0x50 |
(byte)0xf3, (byte)0xc8, (byte)0xf3, (byte)0x64, (byte)0xf3, (byte)0x50 |
19 |
}; |
}; |
20 |
public PS2Reader(String file) throws IOException { |
public PS2Reader(String file) throws IOException { |
21 |
out = new FileOutputStream(file); |
in = new RandomAccessFile(file, "rw"); |
22 |
in = new FileInputStream(out.getFD()); |
in.write(imps2); |
|
out.write(imps2); |
|
23 |
} |
} |
24 |
|
|
25 |
public int x; |
public int x; |
52 |
b2 = (buf[0] & 2) != 0; |
b2 = (buf[0] & 2) != 0; |
53 |
b3 = (buf[0] & 4) != 0; |
b3 = (buf[0] & 4) != 0; |
54 |
|
|
55 |
chg.chg(x, y, z, b1, b2, b3); |
if(chg != null) |
56 |
|
chg.chg(x, y, z, b1, b2, b3); |
57 |
|
} |
58 |
|
|
59 |
|
public void print() { |
60 |
|
System.out.println(""+x+"\t"+y+"\t"+z+"\t"+b1+ |
61 |
|
"\t"+b2+"\t"+b3); |
62 |
|
} |
63 |
|
|
64 |
|
static public void main(String[] argv) throws Exception { |
65 |
|
PS2Reader r = new PS2Reader(argv[0]); |
66 |
|
while(true) { |
67 |
|
r.read(); |
68 |
|
r.print(); |
69 |
|
} |
70 |
} |
} |
71 |
|
|
72 |
} |
} |