- 积分
- 257
- 实力分
- 点
- 金钱数
- 两
- 技术分
- 分
- 贡献分
- 分
|
发表于 2005-9-27 10:01:45
|
显示全部楼层
解析资源的算法:
try
{
System.gc();
InputStream inputstream = getClass().getResourceAsStream("Resource.A5U95.bin");
if(s == null)
{
s = new byte[210];
inputstream.read(s);
j1 = 210;
}
System.gc();
n = new byte[1661];
System.gc();
p = new byte[1714];
System.gc();
for(int i2 = 0; i2 < 70; i2++)
{
if(!_fldgoto[i2] || k[i2] != null)
continue;
System.gc();
int j2 = i2 * 3;
int k2 = (s[j2++] & 0xff) + ((s[j2++] & 0xff) << 8) + ((s[j2++] & 0xff) << 16);
int l2;
if(i2 < 69)
l2 = ((s[j2++] & 0xff) + ((s[j2++] & 0xff) << 8) + ((s[j2++] & 0xff) << 16)) - k2;
else
l2 = 25173 - k2;
if(k2 > j1)
{
inputstream.skip(k2 - j1);
j1 = k2;
}
inputstream.read(n, 0, l2);
U = 0;
q = 0;
_mthcase(0x89504e47);
_mthcase(0xd0a1a0a);
_mthcase(13);
_mthcase(0x49484452);
int i3 = _mthcase();
_mthcase(i3 & 0x3ff);
_mthcase(i3 >> 10 & 0x3ff);
p[U++] = (byte)(1 << (i3 >> 20 & 0x3));
int j3 = i3 >> 22 & 0x3;
p[U++] = (byte)(j3 == 0 ? 0 : 3);
p[U++] = 0;
p[U++] = 0;
p[U++] = 0;
_mthcase(0);
if(j3 != 0 && j3 == 1)
{
_mthcase(9);
_mthcase(0x504c5445);
_mthcase(0);
_mthcase(65535);
p[U++] = -1;
_mthcase(0);
}
if((i3 & 0x1000000) > 0)
{
_mthcase(1);
_mthcase(0x74524e53);
p[U++] = 0;
_mthcase(0);
}
j3 = l2 - q - 0;
_mthcase(j3);
_mthcase(0x49444154);
System.gc();
System.arraycopy(n, q, p, U, j3);
U += j3;
_mthcase(0);
_mthcase(0);
_mthcase(0x49454e44);
_mthcase(0);
k[i2] = Image.createImage(p, 0, U);
j1 += l2;
_mthtry(++k1, b);
}
inputstream.close();
}
catch(Exception exception) { }
两个用到的函数:
public static void _mthcase(int i)
{
p[U++] = (byte)(i >> 24);
p[U++] = (byte)(i >> 16);
p[U++] = (byte)(i >> 8);
p[U++] = (byte)i;
}
public static int _mthcase()
{
return (n[q++] & 0xff) << 24 | (n[q++] & 0xff) << 16 | (n[q++] & 0xff) << 8 | n[q++] & 0xff;
}
[ 本帖最后由 小毛 于 2005-9-27 10:03 编辑 ] |
|