Skip to content

Commit

Permalink
feat: #206 support
Browse files Browse the repository at this point in the history
Yoinked from Displee#13
  • Loading branch information
notmeta committed Aug 13, 2022
1 parent a7183a3 commit 5a42865
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/displee/editor/controller/MainController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,13 @@ class MainController : Initializable {
try {
CS2Reader.readCS2ScriptNewFormat(data, id, config.unscrambled, config.disableSwitches, config.disableLongs)
} catch(e: Throwable) {
error++
if (error >= 2) {
break
// error++
// if (error >= 2) {
// break
// }
if (config.version == 179) {
println(e)
println("id $id")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dawn/cs2/FlowBlocksGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private void processFlowBlock(FlowBlock block) {
ExpressionNode value = stack.pop();
ExpressionNode index = CS2Type.cast(stack.pop(), CS2Type.INT);
block.write(new PopableNode(new ArrayStoreNode(intInstr.getConstant(), index, value)));
} else if (opcode == 47) {
} else if (opcode == 47 || opcode == 49) {
stack.push(new VariableLoadNode(GlobalVariable.VARC_STRING(intInstr.getConstant())));
} else if (opcode == 106) {
stack.push(new VariableLoadNode(GlobalVariable.find("CLAN", intInstr.getConstant(), CS2Type.INT)));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dawn/cs2/ast/GlobalVariable.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public AbstractInstruction generateLoadInstruction() {
op = Opcodes.LOAD_VARC;
break;
case "STRING":
op = Opcodes.LOAD_VARCSTR;
op = Opcodes.LOAD_VARCSTR_NEW;
break;
//These are READONLY, some are not even used
case "CLANDEF_STRING115":
Expand Down
1 change: 1 addition & 0 deletions src/main/java/dawn/cs2/instructions/Opcodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class Opcodes {
public static final int STORE_VARP = 2;
public static final int LOAD_VARC = 42;
public static final int LOAD_VARCSTR = 47;
public static final int LOAD_VARCSTR_NEW = 49;
public static final int STORE_VARC = 43;
public static final int LOAD_VARPBIT = 25;
public static final int SWITCH = 51;
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/cs2/opcode/database/osrs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,8 @@

7006 cs2method7006 void

10034 cs2Method10034 string int arg0 int arg1 string string2 string string3
10035 cs2Method10035 int arg0

# OSRS
21000 setPosition void int x int y
Expand Down
18 changes: 17 additions & 1 deletion src/main/resources/cs2/opcode/unscramble/179.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@
1117 1117
1118 1118
1119 1119
1130 1130
1434 1434
6231 6231
3178 3178
3500 3500
1707 1707
4213 4213
6232 6232
1928 1928

1131 1131
3212 3212
3214 3214
1120 1120
1200 1200
1201 1201
Expand Down Expand Up @@ -407,6 +420,8 @@
3207 3207
3208 3208
3209 3209
3213 3213
3215 3215
3300 3300
3301 3301
3302 3302
Expand Down Expand Up @@ -830,6 +845,7 @@
6304 6304
6305 6305
6306 6306
6307 6307
6405 6405
6406 6406
6500 6500
Expand Down Expand Up @@ -1084,4 +1100,4 @@
7454 7454
7455 7455
7456 7456
7460 7460
7460 7460

0 comments on commit 5a42865

Please sign in to comment.