cache: Store ID in ScriptLoader
This commit is contained in:
@@ -38,6 +38,7 @@ public class ScriptLoader
|
|||||||
public ScriptDefinition load(int id, byte[] b)
|
public ScriptDefinition load(int id, byte[] b)
|
||||||
{
|
{
|
||||||
ScriptDefinition def = new ScriptDefinition();
|
ScriptDefinition def = new ScriptDefinition();
|
||||||
|
def.setId(id);
|
||||||
InputStream in = new InputStream(b);
|
InputStream in = new InputStream(b);
|
||||||
|
|
||||||
in.setOffset(in.getLength() - 2);
|
in.setOffset(in.getLength() - 2);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class ScriptSaverTest
|
|||||||
instructions.init();
|
instructions.init();
|
||||||
ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE));
|
ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE));
|
||||||
byte[] saved = new ScriptSaver().save(script);
|
byte[] saved = new ScriptSaver().save(script);
|
||||||
ScriptDefinition loadedScripot = new ScriptLoader().load(42, saved);
|
ScriptDefinition loadedScripot = new ScriptLoader().load(0, saved);
|
||||||
assertEquals(script, loadedScripot);
|
assertEquals(script, loadedScripot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ public class ScriptSaverTest
|
|||||||
instructions.init();
|
instructions.init();
|
||||||
ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE_UNICODE));
|
ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE_UNICODE));
|
||||||
byte[] saved = new ScriptSaver().save(script);
|
byte[] saved = new ScriptSaver().save(script);
|
||||||
ScriptDefinition loadedScripot = new ScriptLoader().load(42, saved);
|
ScriptDefinition loadedScripot = new ScriptLoader().load(0, saved);
|
||||||
assertEquals(script, loadedScripot);
|
assertEquals(script, loadedScripot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class DisassemblerTest
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptDefinition script = loader.load(0, contents);
|
ScriptDefinition script = loader.load(archive.getArchiveId(), contents);
|
||||||
|
|
||||||
File outFile = new File(outDir, archive.getArchiveId() + ".rs2asm");
|
File outFile = new File(outDir, archive.getArchiveId() + ".rs2asm");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user