cache: sound effect parsing
This commit is contained in:
93
cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect1Loader.java
vendored
Normal file
93
cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect1Loader.java
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.cache.definitions.loaders.sound;
|
||||
|
||||
import net.runelite.cache.definitions.sound.SoundEffect1Definition;
|
||||
import net.runelite.cache.definitions.sound.SoundEffect2Definition;
|
||||
import net.runelite.cache.io.InputStream;
|
||||
|
||||
public class SoundEffect1Loader
|
||||
{
|
||||
private final SoundEffect2Loader se2Loader = new SoundEffect2Loader();
|
||||
private final SoundEffect3Loader se3Loader = new SoundEffect3Loader();
|
||||
|
||||
public SoundEffect1Definition load(InputStream in)
|
||||
{
|
||||
SoundEffect1Definition se = new SoundEffect1Definition();
|
||||
|
||||
load(se, in);
|
||||
|
||||
return se;
|
||||
}
|
||||
|
||||
private void load(SoundEffect1Definition se, InputStream var1)
|
||||
{
|
||||
se.field1181 = se2Loader.load(var1);
|
||||
se.field1173 = se2Loader.load(var1);
|
||||
int var2 = var1.readUnsignedByte();
|
||||
if (var2 != 0)
|
||||
{
|
||||
var1.setOffset(var1.getOffset() - 1);
|
||||
se.field1174 = se2Loader.load(var1);
|
||||
se.field1193 = se2Loader.load(var1);
|
||||
}
|
||||
|
||||
var2 = var1.readUnsignedByte();
|
||||
if (var2 != 0)
|
||||
{
|
||||
var1.setOffset(var1.getOffset() - 1);
|
||||
se.field1183 = se2Loader.load(var1);
|
||||
se.field1192 = se2Loader.load(var1);
|
||||
}
|
||||
|
||||
var2 = var1.readUnsignedByte();
|
||||
if (var2 != 0)
|
||||
{
|
||||
var1.setOffset(var1.getOffset() - 1);
|
||||
se.field1178 = se2Loader.load(var1);
|
||||
se.field1175 = se2Loader.load(var1);
|
||||
}
|
||||
|
||||
for (int var3 = 0; var3 < 10; ++var3)
|
||||
{
|
||||
int var4 = var1.readUnsignedShortSmart();
|
||||
if (var4 == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
se.field1180[var3] = var4;
|
||||
se.field1179[var3] = var1.readShortSmart();
|
||||
se.field1177[var3] = var1.readUnsignedShortSmart();
|
||||
}
|
||||
|
||||
se.field1187 = var1.readUnsignedShortSmart();
|
||||
se.field1184 = var1.readUnsignedShortSmart();
|
||||
se.field1176 = var1.readUnsignedShort();
|
||||
se.field1188 = var1.readUnsignedShort();
|
||||
se.field1186 = new SoundEffect2Definition();
|
||||
se.field1182 = se3Loader.load(var1, se.field1186);
|
||||
}
|
||||
}
|
||||
62
cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect2Loader.java
vendored
Normal file
62
cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect2Loader.java
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.cache.definitions.loaders.sound;
|
||||
|
||||
import net.runelite.cache.definitions.sound.SoundEffect2Definition;
|
||||
import net.runelite.cache.io.InputStream;
|
||||
|
||||
public class SoundEffect2Loader
|
||||
{
|
||||
public SoundEffect2Definition load(InputStream in)
|
||||
{
|
||||
SoundEffect2Definition se = new SoundEffect2Definition();
|
||||
|
||||
load(se, in);
|
||||
|
||||
return se;
|
||||
}
|
||||
|
||||
private void load(SoundEffect2Definition se, InputStream var1)
|
||||
{
|
||||
se.field1087 = var1.readUnsignedByte();
|
||||
se.field1088 = var1.readInt();
|
||||
se.field1089 = var1.readInt();
|
||||
this.method1144(se, var1);
|
||||
}
|
||||
|
||||
final void method1144(SoundEffect2Definition se, InputStream var1)
|
||||
{
|
||||
se.field1092 = var1.readUnsignedByte();
|
||||
se.field1086 = new int[se.field1092];
|
||||
se.field1090 = new int[se.field1092];
|
||||
|
||||
for (int var2 = 0; var2 < se.field1092; ++var2)
|
||||
{
|
||||
se.field1086[var2] = var1.readUnsignedShort();
|
||||
se.field1090[var2] = var1.readUnsignedShort();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
95
cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect3Loader.java
vendored
Normal file
95
cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect3Loader.java
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.cache.definitions.loaders.sound;
|
||||
|
||||
import net.runelite.cache.definitions.sound.SoundEffect2Definition;
|
||||
import net.runelite.cache.definitions.sound.SoundEffect3Definition;
|
||||
import net.runelite.cache.io.InputStream;
|
||||
|
||||
public class SoundEffect3Loader
|
||||
{
|
||||
private final SoundEffect2Loader se2Loader = new SoundEffect2Loader();
|
||||
|
||||
public SoundEffect3Definition load(InputStream in, SoundEffect2Definition var2)
|
||||
{
|
||||
SoundEffect3Definition se = new SoundEffect3Definition();
|
||||
|
||||
load(se, in, var2);
|
||||
|
||||
return se;
|
||||
}
|
||||
|
||||
private void load(SoundEffect3Definition se, InputStream var1, SoundEffect2Definition var2)
|
||||
{
|
||||
int var3 = var1.readUnsignedByte();
|
||||
se.field1155[0] = var3 >> 4;
|
||||
se.field1155[1] = var3 & 15;
|
||||
if (var3 != 0)
|
||||
{
|
||||
se.field1156[0] = var1.readUnsignedShort();
|
||||
se.field1156[1] = var1.readUnsignedShort();
|
||||
int var4 = var1.readUnsignedByte();
|
||||
|
||||
int var5;
|
||||
int var6;
|
||||
for (var5 = 0; var5 < 2; ++var5)
|
||||
{
|
||||
for (var6 = 0; var6 < se.field1155[var5]; ++var6)
|
||||
{
|
||||
se.field1154[var5][0][var6] = var1.readUnsignedShort();
|
||||
se.field1159[var5][0][var6] = var1.readUnsignedShort();
|
||||
}
|
||||
}
|
||||
|
||||
for (var5 = 0; var5 < 2; ++var5)
|
||||
{
|
||||
for (var6 = 0; var6 < se.field1155[var5]; ++var6)
|
||||
{
|
||||
if ((var4 & 1 << var5 * 4 << var6) != 0)
|
||||
{
|
||||
se.field1154[var5][1][var6] = var1.readUnsignedShort();
|
||||
se.field1159[var5][1][var6] = var1.readUnsignedShort();
|
||||
}
|
||||
else
|
||||
{
|
||||
se.field1154[var5][1][var6] = se.field1154[var5][0][var6];
|
||||
se.field1159[var5][1][var6] = se.field1159[var5][0][var6];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (var4 != 0 || se.field1156[1] != se.field1156[0])
|
||||
{
|
||||
se2Loader.method1144(var2, var1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int[] var7 = se.field1156;
|
||||
se.field1156[1] = 0;
|
||||
var7[0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
62
cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffectLoader.java
vendored
Normal file
62
cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffectLoader.java
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.cache.definitions.loaders.sound;
|
||||
|
||||
import net.runelite.cache.definitions.sound.SoundEffectDefinition;
|
||||
import net.runelite.cache.definitions.sound.SoundEffect1Definition;
|
||||
import net.runelite.cache.io.InputStream;
|
||||
|
||||
public class SoundEffectLoader
|
||||
{
|
||||
public SoundEffectDefinition load(byte[] b)
|
||||
{
|
||||
SoundEffectDefinition se = new SoundEffectDefinition();
|
||||
InputStream in = new InputStream(b);
|
||||
|
||||
load(se, in);
|
||||
|
||||
return se;
|
||||
}
|
||||
|
||||
private void load(SoundEffectDefinition se, InputStream var1)
|
||||
{
|
||||
for (int var2 = 0; var2 < 10; ++var2)
|
||||
{
|
||||
int var3 = var1.readUnsignedByte();
|
||||
if (var3 != 0)
|
||||
{
|
||||
var1.setOffset(var1.getOffset() - 1);
|
||||
|
||||
SoundEffect1Loader se1Loader = new SoundEffect1Loader();
|
||||
SoundEffect1Definition se1 = se1Loader.load(var1);
|
||||
|
||||
se.field1008[var2] = se1;
|
||||
}
|
||||
}
|
||||
|
||||
se.field1006 = var1.readUnsignedShort();
|
||||
se.field1009 = var1.readUnsignedShort();
|
||||
}
|
||||
}
|
||||
55
cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect1Definition.java
vendored
Normal file
55
cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect1Definition.java
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.cache.definitions.sound;
|
||||
|
||||
public class SoundEffect1Definition
|
||||
{
|
||||
public SoundEffect2Definition field1173;
|
||||
public SoundEffect2Definition field1174;
|
||||
public SoundEffect2Definition field1175;
|
||||
public int field1176 = 500;
|
||||
public int[] field1177 = new int[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
};
|
||||
public SoundEffect2Definition field1178;
|
||||
public int[] field1179 = new int[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
};
|
||||
public int[] field1180 = new int[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
};
|
||||
public SoundEffect2Definition field1181;
|
||||
public SoundEffect3Definition field1182;
|
||||
public SoundEffect2Definition field1183;
|
||||
public int field1184 = 100;
|
||||
public SoundEffect2Definition field1186;
|
||||
public int field1187 = 0;
|
||||
public int field1188 = 0;
|
||||
public SoundEffect2Definition field1192;
|
||||
public SoundEffect2Definition field1193;
|
||||
}
|
||||
48
cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect2Definition.java
vendored
Normal file
48
cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect2Definition.java
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.cache.definitions.sound;
|
||||
|
||||
public class SoundEffect2Definition
|
||||
{
|
||||
public int field1085;
|
||||
public int[] field1086 = new int[2];
|
||||
public int field1087;
|
||||
public int field1088;
|
||||
public int field1089;
|
||||
public int[] field1090 = new int[2];
|
||||
public int field1091;
|
||||
public int field1092 = 2;
|
||||
public int field1093;
|
||||
public int field1094;
|
||||
public int field1095;
|
||||
|
||||
public SoundEffect2Definition()
|
||||
{
|
||||
this.field1086[0] = 0;
|
||||
this.field1086[1] = '\uffff';
|
||||
this.field1090[0] = 0;
|
||||
this.field1090[1] = '\uffff';
|
||||
}
|
||||
}
|
||||
33
cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect3Definition.java
vendored
Normal file
33
cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect3Definition.java
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.cache.definitions.sound;
|
||||
|
||||
public class SoundEffect3Definition
|
||||
{
|
||||
public int[][][] field1154 = new int[2][2][4];
|
||||
public int[] field1155 = new int[2];
|
||||
public int[] field1156 = new int[2];
|
||||
public int[][][] field1159 = new int[2][2][4];
|
||||
}
|
||||
32
cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffectDefinition.java
vendored
Normal file
32
cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffectDefinition.java
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.cache.definitions.sound;
|
||||
|
||||
public class SoundEffectDefinition
|
||||
{
|
||||
public int field1006;
|
||||
public SoundEffect1Definition[] field1008 = new SoundEffect1Definition[10];
|
||||
public int field1009;
|
||||
}
|
||||
@@ -152,13 +152,13 @@ public class Archive
|
||||
|
||||
if (this.getWhirlpool() != null && !Arrays.equals(this.getWhirlpool(), res.whirlpool))
|
||||
{
|
||||
logger.warn("whirlpool mismatch for archive {}", this);
|
||||
logger.warn("whirlpool mismatch for archive {}", this.getArchiveId());
|
||||
}
|
||||
|
||||
if (res.revision != -1 && this.getRevision() != res.revision)
|
||||
{
|
||||
// compressed data doesn't always include a revision, but check it if it does
|
||||
logger.warn("revision mismatch for archive {}", this);
|
||||
logger.warn("revision mismatch for archive {}", this.getArchiveId());
|
||||
}
|
||||
|
||||
setCompression(res.compression);
|
||||
|
||||
81
cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java
vendored
Normal file
81
cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.cache;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import net.runelite.cache.definitions.loaders.sound.SoundEffectLoader;
|
||||
import net.runelite.cache.definitions.sound.SoundEffectDefinition;
|
||||
import net.runelite.cache.fs.Archive;
|
||||
import net.runelite.cache.fs.Index;
|
||||
import net.runelite.cache.fs.Store;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SoundEffectsDumperTest
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(SoundEffectsDumperTest.class);
|
||||
|
||||
private final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder folder = StoreLocation.getTemporaryFolder();
|
||||
|
||||
@Test
|
||||
public void test() throws IOException
|
||||
{
|
||||
File dumpDir = folder.newFolder();
|
||||
int count = 0;
|
||||
|
||||
try (Store store = new Store(StoreLocation.LOCATION))
|
||||
{
|
||||
store.load();
|
||||
|
||||
Index index = store.getIndex(IndexType.SOUNDEFFECTS);
|
||||
|
||||
for (Archive archive : index.getArchives())
|
||||
{
|
||||
assert archive.getFiles().size() == 1;
|
||||
|
||||
net.runelite.cache.fs.File file = archive.getFiles().get(0);
|
||||
|
||||
SoundEffectLoader soundEffectLoader = new SoundEffectLoader();
|
||||
SoundEffectDefinition soundEffect = soundEffectLoader.load(file.getContents());
|
||||
|
||||
Files.write(gson.toJson(soundEffect), new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("Dumped {} sound effects to {}", count, dumpDir);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user