Merge remote-tracking branch 'origin/master'

This commit is contained in:
Owain van Brakel
2021-12-17 11:45:55 +01:00
6 changed files with 20 additions and 48 deletions

View File

@@ -1 +0,0 @@
http://oldschool17.runescape.com/

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -38,13 +38,13 @@ public class RuneliteMenuEntry extends AbstractInjector
public void inject()
{
addInvoke();
addInvokeBare();
addInvoke("newRuneliteMenuEntry", true);
addInvoke("newBareRuneliteMenuEntry", false);
addSwap(InjectUtil.findMethod(inject, "incrementMenuEntries"));
addSwap(InjectUtil.findMethod(inject, "decrementMenuEntries"));
}
private void addInvoke()
private void addInvoke(String methodName, boolean iload)
{
ClassFile runeliteMenuEntryVanilla = inject.vanilla.findClass(RUNELITE_MENU_ENTRY);
@@ -53,8 +53,7 @@ public class RuneliteMenuEntry extends AbstractInjector
.findClass("Client")
);
Method copy = clientVanilla.findMethod("newRuneliteMenuEntry");
copy.setPublic();
Method copy = clientVanilla.findMethod(methodName);
final Code code = new Code(copy);
code.setMaxStack(3);
@@ -65,33 +64,15 @@ public class RuneliteMenuEntry extends AbstractInjector
ins.add(new New(instructions, runeliteMenuEntryVanilla.getPoolClass()));
ins.add(new Dup(instructions));
if (iload)
{
ins.add(new ILoad(instructions, 0));
ins.add(new InvokeSpecial(instructions, new net.runelite.asm.pool.Method(runeliteMenuEntryVanilla.getPoolClass(), "<init>", new Signature("(I)V"))));
ins.add(new Return(instructions, InstructionType.ARETURN));
}
private void addInvokeBare()
else
{
ClassFile runeliteMenuEntryVanilla = inject.vanilla.findClass(RUNELITE_MENU_ENTRY);
final ClassFile clientVanilla = inject.toVanilla(
inject.getDeobfuscated()
.findClass("Client")
);
Method copy = clientVanilla.findMethod("newBareRuneliteMenuEntry");
copy.setPublic();
final Code code = new Code(copy);
code.setMaxStack(3);
copy.setCode(code);
final Instructions instructions = code.getInstructions();
final List<Instruction> ins = instructions.getInstructions();
ins.add(new New(instructions, runeliteMenuEntryVanilla.getPoolClass()));
ins.add(new Dup(instructions));
ins.add(new InvokeSpecial(instructions, new net.runelite.asm.pool.Method(runeliteMenuEntryVanilla.getPoolClass(), "<init>", new Signature("()V"))));
}
ins.add(new Return(instructions, InstructionType.ARETURN));
}

View File

@@ -647,7 +647,7 @@ public interface Client extends GameEngine
* Create a new menu entry
* @return the newly created menu entry
*/
MenuEntry createMenuEntry(String option, String target, int identifier, int opcode, int param1, int param2);
MenuEntry createMenuEntry(String option, String target, int identifier, int opcode, int param1, int param2, boolean forceLeftClick);
/**
* Gets an array of currently open right-click menu entries that can be

View File

@@ -168,6 +168,7 @@ import net.runelite.rs.api.RSWidget;
import net.runelite.rs.api.RSWorld;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
@Mixin(RSClient.class)
public abstract class RSClientMixin implements RSClient
@@ -799,18 +800,18 @@ public abstract class RSClientMixin implements RSClient
@Inject
public static RSRuneLiteMenuEntry newBareRuneliteMenuEntry()
{
return null;
throw new NotImplementedException();
}
@Inject
public static RSRuneLiteMenuEntry newRuneliteMenuEntry(int idx)
{
return null;
throw new NotImplementedException();
}
@Inject
@Override
public MenuEntry createMenuEntry(String option, String target, int identifier, int opcode, int param1, int param2)
public MenuEntry createMenuEntry(String option, String target, int identifier, int opcode, int param1, int param2, boolean forceLeftClick)
{
RSRuneLiteMenuEntry menuEntry = newBareRuneliteMenuEntry();
@@ -821,6 +822,7 @@ public abstract class RSClientMixin implements RSClient
menuEntry.setParam0(param1);
menuEntry.setParam1(param2);
menuEntry.setConsumer(null);
menuEntry.setForceLeftClick(forceLeftClick);
return menuEntry;
}

View File

@@ -16,16 +16,6 @@ public class RuneLiteMenuEntry implements MenuEntry
this.idx = idx;
}
public void test(int idx)
{
new RuneLiteMenuEntry(idx);
}
public void test2()
{
new RuneLiteMenuEntry();
}
public Consumer getConsumer()
{
return consumer;