Add runelite_callback opcode to cache

Also move the RL Instructions from the script assembler to cache too, so it can be reused by the updater. The api Opcodes class has no use in the public api and so is removed.
This commit is contained in:
Adam
2021-10-23 12:00:21 -04:00
parent 533bcd26be
commit 1443d5a34d
5 changed files with 546 additions and 562 deletions

View File

@@ -28,9 +28,8 @@ package net.runelite.cache.script;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static net.runelite.cache.script.Opcodes.*;
public class Instructions public class Instructions implements Opcodes
{ {
private final Map<Integer, Instruction> instructions = new HashMap<>(); private final Map<Integer, Instruction> instructions = new HashMap<>();
private final Map<String, Instruction> instructionsByName = new HashMap<>(); private final Map<String, Instruction> instructionsByName = new HashMap<>();

File diff suppressed because it is too large Load Diff

View File

@@ -22,12 +22,9 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.script; package net.runelite.cache.script;
import static net.runelite.api.Opcodes.RUNELITE_EXECUTE; public class RuneLiteInstructions extends Instructions implements RuneLiteOpcodes
import net.runelite.cache.script.Instructions;
public class RuneLiteInstructions extends Instructions
{ {
@Override @Override
public void init() public void init()

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, Adam <Adam@sigterm.info> * Copyright (c) 2021, Adam <Adam@sigterm.info>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -22,25 +22,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.api; package net.runelite.cache.script;
/** public interface RuneLiteOpcodes extends Opcodes
* Utility class containing ASM opcodes used by the RuneLite client.
*/
public class Opcodes
{ {
/**
* opcode used to return from scripts.
*/
public static final int RETURN = 21;
/**
* opcode used to invoke scripts.
*/
public static final int INVOKE = 40;
/** /**
* RuneLite execution opcode used to inject scripts. * RuneLite execution opcode used to inject scripts.
*/ */
public static final int RUNELITE_EXECUTE = 6599; int RUNELITE_EXECUTE = 6599;
} }

View File

@@ -31,6 +31,7 @@ import java.io.IOException;
import net.runelite.cache.IndexType; import net.runelite.cache.IndexType;
import net.runelite.cache.definitions.ScriptDefinition; import net.runelite.cache.definitions.ScriptDefinition;
import net.runelite.cache.definitions.savers.ScriptSaver; import net.runelite.cache.definitions.savers.ScriptSaver;
import net.runelite.cache.script.RuneLiteInstructions;
import net.runelite.cache.script.assembler.Assembler; import net.runelite.cache.script.assembler.Assembler;
import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;