Skip to content

Commit

Permalink
Merge pull request #11 from Displee/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Displee authored Sep 30, 2021
2 parents 9a6f294 + 8ab2079 commit 66e8faa
Show file tree
Hide file tree
Showing 7 changed files with 423 additions and 101 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ plugins {
}

archivesBaseName = 'cs2-editor'
version = '1.2'

version = '1.3'

repositories {
jcenter()
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/dawn/cs2/FlowBlocksGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ private void processFlowBlock(FlowBlock block) {
LinkedList<ExpressionNode> expressions = new LinkedList<>();
while (stack.getSize() > 0) {
ExpressionNode expr = stack.pop();
if (expr.getType() == CS2Type.UNKNOWN)
if (expr.getType() == CS2Type.UNKNOWN) {
throw new DecompilerException("Unknown return type");
// assert !expr.getType().isStructure() : "no support yet for returning structs together with other values";
}
// assert !expr.getType().isStructure() : "no support yet for returning structs together with other values";
expressions.addFirst(expr);
}
block.write(new ReturnNode(new ExpressionList(expressions)));
Expand All @@ -240,8 +241,9 @@ private void processFlowBlock(FlowBlock block) {
stack.push(new BuildStringNode(exprs));
} else if (opcode == Opcodes.CALL_CS2) {
FunctionInfo info = decompiler.getScriptsDatabase().getInfo(intInstr.getConstant());
if (info == null)
throw new DecompilerException("No documentation for:" + instruction);
if (info == null) {
throw new DecompilerException("Function for opcode " + instruction.getOpcode() + " is missing.");
}
analyzeActualArgOrder(info, stack.copy());
int ret = this.analyzeCall(info, block, stack, ptr, true, false, false, intInstr.getConstant(), false);
if (ret != -1)
Expand Down Expand Up @@ -303,6 +305,9 @@ private void processFlowBlock(FlowBlock block) {
boolean dynamicArgTypes = false;
boolean dynamicResultType = false;
FunctionInfo info = decompiler.getOpcodesDatabase().getInfo(instruction.getOpcode());
if (info == null) {
throw new DecompilerException("Function for opcode " + instruction.getOpcode() + " is missing.");
}
if ((opcode >= 1400 && opcode < 1499) || (opcode >= 2400 && opcode < 2499)) {
analyzeDelegate(stack, opcode);
dynamicArgTypes = true; //
Expand All @@ -317,9 +322,6 @@ private void processFlowBlock(FlowBlock block) {
// break;
// }
}
if (info == null)
throw new DecompilerException("No documentation for:" + instruction);

dynamicArgTypes |= opcode == 3400 || opcode == 3409 || opcode == 3412 || opcode == 3414; //datamap contains/lookup value checks
if (!dynamicArgTypes) {
analyzeActualArgOrder(info, stack.copy());
Expand Down
Binary file modified src/main/resources/cs2/attr.types.txt
Binary file not shown.
Loading

0 comments on commit 66e8faa

Please sign in to comment.