Add zoom plugin

This commit is contained in:
Adam
2018-01-27 13:05:53 -05:00
parent 7e4bbf66cb
commit f8baca7be5
10 changed files with 810 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2018 Abex
* 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.client.plugins.zoom;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "zoom",
name = "Zoom Unlimiter",
description = "Configuration for the camera zoom limit"
)
public interface ZoomConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not the zoom limit is reduced"
)
default boolean enabled()
{
return false;
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2018 Abex
* Copyright (c) 2018, 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.client.plugins.zoom;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Inject;
import com.google.inject.Provides;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.events.ScriptEvent;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor(
name = "Camera zoom unlimiter"
)
@Slf4j
public class ZoomPlugin extends Plugin
{
private static final int INCREASED_RESIZABLE_ZOOM_LIMIT = 70;
private static final int INCREASED_FIXED_ZOOM_LIMIT = 95;
@Inject
private Client client;
@Inject
private ZoomConfig zoomConfig;
@Provides
ZoomConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(ZoomConfig.class);
}
@Subscribe
public void onScriptEvent(ScriptEvent event)
{
if (!zoomConfig.enabled())
{
return;
}
switch (event.getEventName())
{
case "fixedOuterZoomLimit":
popAndReplace(INCREASED_FIXED_ZOOM_LIMIT);
break;
case "resizableOuterZoomLimit":
popAndReplace(INCREASED_RESIZABLE_ZOOM_LIMIT);
break;
}
}
private void popAndReplace(int newValue)
{
int[] intStack = client.getIntStack();
int intStackSize = client.getIntStackSize();
intStack[intStackSize - 1] = newValue;
}
}

View File

@@ -0,0 +1 @@
775947F74263107B801155B8D1DB27DBA42F08CE7A14CB07526C5D88288D89F5

View File

@@ -0,0 +1,451 @@
.id 909
.int_stack_count 2
.string_stack_count 0
.int_var_count 15
.string_var_count 0
load_int 73
load_int 73
iload 1
load_int 10551298
get_enum_value
istore 2
load_int 73
load_int 73
iload 1
load_int 10551306
get_enum_value
istore 3
load_int 73
load_int 73
iload 1
load_int 10551301
get_enum_value
istore 4
load_int 73
load_int 73
iload 1
load_int 10551308
get_enum_value
istore 5
load_int 103
load_int 105
load_int 1135
iload 1
get_enum_value
istore 6
load_int 103
load_int 105
load_int 1136
iload 1
get_enum_value
istore 7
load_int 0
istore 8
load_int 0
istore 9
load_int 0
istore 10
load_int 0
istore 11
load_int 0
istore 12
load_int 0
istore 13
get_varbit 4606
load_int 0
if_icmpne LABEL52
jump LABEL198
LABEL52:
get_varbit 4606
load_int 2
if_icmpeq LABEL56
jump LABEL70
LABEL56:
load_int 256
load_int 180
6200
load_int 256
load_int 180
set_zoom_distance
load_int 0
load_int 0
load_int 0
load_int 0
6202
load_int 50
set_camera_focal_point_height
jump LABEL83
LABEL70:
load_int 256
load_int 256
6200
load_int 256
load_int 256
set_zoom_distance
load_int 256
load_int 256
load_int 256
load_int 256
6202
load_int 50
set_camera_focal_point_height
LABEL83:
iload 2
load_int -1
if_icmpne LABEL87
jump LABEL197
LABEL87:
iload 3
load_int -1
if_icmpne LABEL91
jump LABEL197
LABEL91:
get_viewport_size
istore 9
istore 8
iload 8
iload 9
load_int 0
load_int 0
iload 2
widget_put_size_widget
iload 8
iload 9
load_int 0
load_int 0
iload 3
widget_put_size_widget
iload 4
load_int -1
if_icmpne LABEL110
jump LABEL187
LABEL110:
iload 5
load_int -1
if_icmpne LABEL114
jump LABEL187
LABEL114:
iload 0
widget_get_width_widget
istore 10
iload 0
widget_get_height_widget
istore 11
iload 10
iload 8
isub
istore 12
iload 11
iload 9
isub
istore 13
iload 12
load_int 0
if_icmplt LABEL132
jump LABEL134
LABEL132:
load_int 0
istore 12
LABEL134:
iload 13
load_int 0
if_icmplt LABEL138
jump LABEL140
LABEL138:
load_int 0
istore 13
LABEL140:
iload 6
iload 12
load_int 2
idiv
isub
iload 7
iload 13
load_int 2
idiv
isub
istore 7
istore 6
iload 6
load_int 0
if_icmplt LABEL156
jump LABEL158
LABEL156:
load_int 0
istore 6
LABEL158:
iload 7
load_int 0
if_icmplt LABEL162
jump LABEL164
LABEL162:
load_int 0
istore 7
LABEL164:
iload 6
iload 7
load_int 1
load_int 1
iload 4
widget_put_size_widget
iload 6
iload 7
load_int 1
load_int 1
iload 5
widget_put_size_widget
iload 1
load_int 73
load_int 73
iload 1
load_int 10551307
get_enum_value
iload 5
iload 6
iload 7
invoke 910
jump LABEL197
LABEL187:
iload 1
load_int 73
load_int 73
iload 1
load_int 10551307
get_enum_value
iload 3
load_int 0
load_int 0
invoke 910
LABEL197:
jump LABEL293
LABEL198:
load_int 0
load_int 0
6200
load_int 0
load_int 0
load_int 0
load_int 0
6202
get_varc 73
load_int 195
load_string "fixedOuterZoomLimit"
runelite_callback
if_icmpge LABEL210
jump LABEL226
LABEL210:
get_varc 73
load_int 700
if_icmple LABEL214
jump LABEL226
LABEL214:
get_varc 74
load_int 175
load_string "resizableOuterZoomLimit"
runelite_callback
if_icmpge LABEL218
jump LABEL226
LABEL218:
get_varc 74
load_int 715
if_icmple LABEL222
jump LABEL226
LABEL222:
get_varc 73
get_varc 74
invoke 42
jump LABEL229
LABEL226:
load_int 256
load_int 320
invoke 42
LABEL229:
get_viewport_size
istore 9
istore 8
iload 2
load_int -1
if_icmpne LABEL236
jump LABEL293
LABEL236:
iload 3
load_int -1
if_icmpne LABEL240
jump LABEL293
LABEL240:
iload 8
iload 9
load_int 0
load_int 0
iload 2
widget_put_size_widget
iload 8
iload 9
load_int 0
load_int 0
iload 3
widget_put_size_widget
iload 4
load_int -1
if_icmpne LABEL256
jump LABEL283
LABEL256:
iload 5
load_int -1
if_icmpne LABEL260
jump LABEL283
LABEL260:
iload 6
iload 7
load_int 1
load_int 1
iload 4
widget_put_size_widget
iload 6
iload 7
load_int 1
load_int 1
iload 5
widget_put_size_widget
iload 1
load_int 73
load_int 73
iload 1
load_int 10551307
get_enum_value
iload 5
iload 6
iload 7
invoke 910
jump LABEL293
LABEL283:
iload 1
load_int 73
load_int 73
iload 1
load_int 10551307
get_enum_value
iload 3
load_int 0
load_int 0
invoke 910
LABEL293:
load_int 73
load_int 73
iload 1
load_int 10551309
get_enum_value
istore 14
iload 14
load_int -1
if_icmpne LABEL303
jump LABEL347
LABEL303:
invoke 1972
load_int 0
if_icmpeq LABEL307
jump LABEL341
LABEL307:
iload 14
widget_get_index_widget
load_int 1
if_icmpeq LABEL312
jump LABEL341
LABEL312:
get_varc 173
load_int -2
if_icmpeq LABEL316
jump LABEL323
LABEL316:
load_int 512
load_int 0
load_int 0
load_int 1
iload 14
widget_put_size_widget
jump LABEL340
LABEL323:
get_varc 173
load_int -3
if_icmpeq LABEL327
jump LABEL334
LABEL327:
load_int 0
load_int 0
load_int 1
load_int 1
iload 14
widget_put_size_widget
jump LABEL340
LABEL334:
load_int 512
load_int 334
load_int 0
load_int 0
iload 14
widget_put_size_widget
LABEL340:
jump LABEL347
LABEL341:
load_int 512
load_int 334
load_int 0
load_int 0
iload 14
widget_put_size_widget
LABEL347:
load_int 73
load_int 73
iload 1
load_int 10551311
get_enum_value
istore 14
iload 14
load_int -1
if_icmpne LABEL357
jump LABEL390
LABEL357:
load_int 73
load_int 73
iload 1
load_int 10551303
get_enum_value
widget_get_index_widget
load_int 1
if_icmpeq LABEL366
jump LABEL384
LABEL366:
get_varbit 4692
load_int 0
if_icmpne LABEL370
jump LABEL377
LABEL370:
load_int 0
load_int 0
load_int 2
load_int 0
iload 14
widget_put_position_widget
jump LABEL383
LABEL377:
load_int 0
load_int 36
load_int 2
load_int 0
iload 14
widget_put_position_widget
LABEL383:
jump LABEL390
LABEL384:
load_int 0
load_int 0
load_int 2
load_int 0
iload 14
widget_put_position_widget
LABEL390:
iload 0
iload 1
invoke 920
return

View File

@@ -0,0 +1 @@
3DAFC5BFBE17305C5FA503EB6D749299500F9FAF6549309649C3AC5CEC4A8FCC

View File

@@ -0,0 +1,70 @@
.id 1048
.int_stack_count 3
.string_stack_count 0
.int_var_count 8
.string_var_count 0
get_varbit 4606
load_int 0
if_icmpne LABEL4
jump LABEL5
LABEL4:
return
LABEL5:
load_int 320
istore 3
load_int 256
istore 4
iload 1
widget_get_width_widget
iload 0
widget_get_width_widget
isub
istore 5
load_int 0
iload 2
invoke 1045
istore 2
iload 1
widget_get_width_widget
iload 0
widget_get_width_widget
isub
iload 2
invoke 1046
istore 2
load_int 715
load_int 175
load_string "resizableOuterZoomLimit"
runelite_callback
isub
istore 6
load_int 700
load_int 195
load_string "fixedOuterZoomLimit"
runelite_callback
isub
istore 7
iload 2
iload 6
imul
iload 5
idiv
load_int 175
load_string "resizableOuterZoomLimit"
runelite_callback
iadd
istore 3
iload 2
iload 7
imul
iload 5
idiv
load_int 195
load_string "fixedOuterZoomLimit"
runelite_callback
iadd
istore 4
iload 4
iload 3
invoke 42
return

View File

@@ -0,0 +1 @@
91C88AB544E934FB542E358885AB7A0F467D19E03595EDDFC9209FF02BFE5A5F

View File

@@ -0,0 +1,67 @@
.id 1049
.int_stack_count 0
.string_stack_count 0
.int_var_count 6
.string_var_count 0
load_int 715
load_int 175
load_string "resizableOuterZoomLimit"
runelite_callback
isub
istore 0
load_int 700
load_int 195
load_string "fixedOuterZoomLimit"
runelite_callback
isub
istore 1
load_int 17104904
widget_get_width_widget
load_int 17104909
widget_get_width_widget
isub
istore 2
load_int 0
istore 3
load_int 0
istore 4
get_viewport_size
istore 4
istore 3
load_int 0
istore 5
iload 3
load_int 334
if_icmpgt LABEL27
jump LABEL36
LABEL27:
get_varc 74
load_int 175
load_string "resizableOuterZoomLimit"
runelite_callback
isub
iload 2
imul
iload 0
idiv
istore 5
jump LABEL44
LABEL36:
get_varc 73
load_int 195
load_string "fixedOuterZoomLimit"
runelite_callback
isub
iload 2
imul
iload 1
idiv
istore 5
LABEL44:
iload 5
load_int 0
load_int 0
load_int 0
load_int 17104909
widget_put_position_widget
return

View File

@@ -0,0 +1 @@
E9536E0A6FD51C058A40D644FD0AD28A93778FD53873601DCCE04C97DD835BB0

View File

@@ -0,0 +1,87 @@
.id 42
.int_stack_count 2
.string_stack_count 0
.int_var_count 6
.string_var_count 0
get_varbit 4606
load_int 0
if_icmpne LABEL4
jump LABEL5
LABEL4:
return
LABEL5:
load_int 700
iload 0
invoke 1046
istore 0
load_int 195
load_string "fixedOuterZoomLimit"
runelite_callback
iload 0
invoke 1045
istore 0
load_int 715
iload 1
invoke 1046
istore 1
load_int 175
load_string "resizableOuterZoomLimit"
runelite_callback
iload 1
invoke 1045
istore 1
iload 0
iload 1
set_zoom_distance
load_int 0
istore 2
load_int 0
istore 3
get_viewport_size
istore 3
istore 2
iload 3
load_int 334
isub
istore 4
iload 4
load_int 0
if_icmplt LABEL39
jump LABEL42
LABEL39:
load_int 0
istore 4
jump LABEL48
LABEL42:
iload 4
load_int 100
if_icmpgt LABEL46
jump LABEL48
LABEL46:
load_int 100
istore 4
LABEL48:
iload 0
iload 1
iload 0
isub
iload 4
imul
load_int 100
idiv
iadd
istore 5
load_int 25
load_int 25
iload 5
imul
load_int 256
idiv
iadd
set_camera_focal_point_height
iload 0
iload 1
put_varc 74
put_varc 73
invoke 1049
return