我正在重新开发这款android游戏,并将精灵全部放在一个名为gt的文件中,这是apk中的代码,它将我认为是字节代码文件的代码转换为实际图像。
它需要一个参数,即该文件的路径。
Java并不是我真正的语言,所以我希望有人可以帮助我弄清楚这段代码在做什么,以及如何使用它将文件转换为可以编辑为png的文件。
这是相应的源代码:
public static void readGraphicsTable(String paramString)
{
InputStream localInputStream = Util.getResourceAsStream(paramString);
if (localInputStream == null)
{
HG.logWarning("Config file not found: " + paramString);
return;
}
int j;
int k;
for (;;)
{
try
{
paramString = new DataInputStream(localInputStream);
j = paramString.readShort();
k = paramString.readShort();
if ((j != 18260) && (k != 1281))
{
try
{
localInputStream.close();
return;
}
catch (Throwable paramString)
{
return;
}
createFontOffsets();
}
}
catch (Throwable paramString)
{
label156:
paramString = paramString;
HG.handleError(paramString, "Gfx.readGraphicsTable()");
try
{
localInputStream.close();
return;
}
catch (Throwable paramString)
{
return;
}
k = paramString.readShort();
colors = new int[k];
j = 0;
if (j >= k) {
continue;
}
colors[j] = paramString.readInt();
j += 1;
continue;
k = paramString.readShort();
fonts = new Font[k];
fontOffsets = (int[][])Array.newInstance(Integer.TYPE, new int[] { k, 4 });
j = 0;
if (j >= k) {
continue;
}
m = paramString.readByte();
if (m != -1) {
continue;
}
fonts[j] = Font.getDefaultFont();
fontOffsets[j][0] = paramString.readByte();
fontOffsets[j][1] = paramString.readByte();
fontOffsets[j][2] = paramString.readByte();
fontOffsets[j][3] = paramString.readByte();
j += 1;
continue;
fonts[j] = Font.getFont(m & 0x60, m & 0x7, m & 0x18);
continue;
}
finally {}
j = paramString.readShort();
if (j == -1) {
break label1144;
}
k = paramString.readShort();
switch (j)
{
case 17231:
paramString.skip(k);
}
}
for (;;)
{
int m;
try
{
localInputStream.close();
throw paramString;
k = paramString.readShort();
imageTable = new short[k + 4][];
images = new Image[k + 4];
j = 0;
if (j < k)
{
m = (short)paramString.readByte();
if (m == -1) {
break label1160;
}
arrayOfShort = imageTable;
arrayOfShort1 = new short[12];
arrayOfShort[j] = arrayOfShort1;
m = (short)(m << 8);
if ((m & 0x200) != 0)
{
int i = paramString.readShort();
System.arraycopy(imageTable[i], 0, arrayOfShort1, 0, arrayOfShort1.length);
arrayOfShort1[7] = ((short)(arrayOfShort1[7] | m));
arrayOfShort1[10] = i;
break label1160;
}
n = paramString.readByte();
int i1 = paramString.readByte();
arrayOfShort1[7] = ((short)(m | n));
arrayOfShort1[2] = ((short)(i1 >> 4 & 0xF));
arrayOfShort1[3] = ((short)(i1 >> 0 & 0xF));
arrayOfShort1[4] = ((short)paramString.readByte());
arrayOfShort1[5] = paramString.readShort();
arrayOfShort1[6] = paramString.readShort();
arrayOfShort1[8] = paramString.readShort();
paramString.readUTF();
if ((m & 0x100) == 0) {
break label1160;
}
arrayOfShort1[10] = paramString.readShort();
arrayOfShort1[11] = ((short)paramString.readByte());
break label1160;
}
short[][] arrayOfShort = imageTable;
short[] arrayOfShort1 = new short[12];
arrayOfShort['?'] = arrayOfShort1;
arrayOfShort1[7] = 0;
arrayOfShort1[10] = 0;
arrayOfShort1[2] = 1;
arrayOfShort1[3] = 1;
arrayOfShort1[4] = 3;
arrayOfShort1[5] = 0;
arrayOfShort1[6] = 0;
arrayOfShort1[8] = 0;
arrayOfShort = imageTable;
arrayOfShort1 = new short[12];
arrayOfShort['?'] = arrayOfShort1;
arrayOfShort1[7] = 0;
arrayOfShort1[10] = 0;
arrayOfShort1[2] = 1;
arrayOfShort1[3] = 1;
arrayOfShort1[4] = 3;
arrayOfShort1[5] = 0;
arrayOfShort1[6] = 0;
arrayOfShort1[8] = 0;
arrayOfShort = imageTable;
arrayOfShort1 = new short[12];
arrayOfShort['?'] = arrayOfShort1;
arrayOfShort1[7] = 0;
arrayOfShort1[10] = 0;
arrayOfShort1[2] = 4;
arrayOfShort1[3] = 1;
arrayOfShort1[4] = 3;
arrayOfShort1[5] = 0;
arrayOfShort1[6] = 0;
arrayOfShort1[8] = 0;
arrayOfShort = imageTable;
arrayOfShort1 = new short[12];
arrayOfShort['?'] = arrayOfShort1;
arrayOfShort1[7] = 0;
arrayOfShort1[10] = 0;
arrayOfShort1[2] = 1;
arrayOfShort1[3] = 1;
arrayOfShort1[4] = 3;
arrayOfShort1[5] = 0;
arrayOfShort1[6] = 0;
arrayOfShort1[8] = 0;
break;
k = paramString.readShort();
frameTable = new short[k * 7];
j = 0;
break label1167;
frameTable[(m + 2)] = ((short)paramString.readUnsignedByte());
frameTable[(m + 3)] = ((short)paramString.readUnsignedByte());
frameTable[(m + 0)] = ((short)paramString.readUnsignedByte());
frameTable[(m + 1)] = ((short)paramString.readUnsignedByte());
frameTable[(m + 4)] = ((short)paramString.readByte());
frameTable[(m + 5)] = ((short)paramString.readByte());
frameTable[(m + 6)] = ((short)paramString.readByte());
break label1208;
frameTable[(m + 2)] = paramString.readShort();
frameTable[(m + 3)] = paramString.readShort();
frameTable[(m + 0)] = paramString.readShort();
frameTable[(m + 1)] = paramString.readShort();
frameTable[(m + 4)] = paramString.readShort();
frameTable[(m + 5)] = paramString.readShort();
frameTable[(m + 6)] = ((short)paramString.readByte());
break label1208;
m = paramString.readShort();
animationTable = new short[m][];
j = 0;
if (j >= m) {
break;
}
int n = paramString.readShort();
arrayOfShort = animationTable;
arrayOfShort1 = new short[n + 2];
arrayOfShort[j] = arrayOfShort1;
k = 0;
if (k >= n + 2) {
break label1215;
}
arrayOfShort1[k] = paramString.readShort();
k += 1;
continue;
paramString.skip(k);
break;
try
{
label1144:
localInputStream.close();
return;
}
catch (Throwable paramString)
{
return;
}
}
catch (Throwable localThrowable)
{
continue;
}
break label156;
label1160:
j += 1;
continue;
label1167:
while (j < k)
{
m = j * 7;
switch (8)
{
}
label1208:
j += 1;
}
break;
label1215:
j += 1;
}
}