diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..e7f5fa79 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,211 @@ +root = true + +[*] +charset = utf-8 +trim_trailing_whitespace = true + +[*.{c,h,cpp,hpp}] + +# Indentation and spacing +indent_size = 4 +indent_style = tab +tab_width = 4 + +[*.cs] + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +indent_style = tab +tab_width = 4 + +# New line preferences +end_of_line = crlf +insert_final_newline = false + +#### .NET Coding Conventions #### + +# Organize usings +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = true + +# this. and Me. preferences +dotnet_style_qualification_for_event = false:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_property = false:silent + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent + +# Expression-level preferences +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion + +# Field preferences +dotnet_style_readonly_field = true:suggestion + +# Parameter preferences +dotnet_code_quality_unused_parameters = all:suggestion + +#### C# Coding Conventions #### + +# var preferences +csharp_style_var_elsewhere = true:suggestion +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion + +# Expression-bodied members +csharp_style_expression_bodied_accessors = true:suggestion +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:suggestion +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_local_functions = true:suggestion +csharp_style_expression_bodied_methods = true:silent +csharp_style_expression_bodied_operators = true:suggestion +csharp_style_expression_bodied_properties = true:suggestion + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_prefer_switch_expression = true:suggestion + +# Null-checking preferences +csharp_style_conditional_delegate_call = true:suggestion + +# Modifier preferences +csharp_prefer_static_local_function = true:suggestion +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent + +# Code-block preferences +csharp_prefer_braces = true:suggestion +csharp_prefer_simple_using_statement = true:suggestion + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace:error + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +#### Naming styles #### + +# Naming rules + +dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i + +dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case + +# Symbol specifications + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.required_modifiers = + +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +# Naming styles + +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.required_suffix = +dotnet_naming_style.begins_with_i.word_separator = +dotnet_naming_style.begins_with_i.capitalization = pascal_case + +#### Warnings #### + +# CS8509: The switch expression does not handle all possible values of its input type (it is not exhaustive). +dotnet_diagnostic.CS8509.severity = none diff --git a/Makefile b/Makefile index f169682b..750027d5 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +.PHONY: all clean debug clean_debug release clean_release update docker_all docker_debug docker_release podman_all podman_debug podman_release dist + all: debug release dist clean: clean_debug clean_release @@ -27,12 +29,44 @@ clean_release: update: cd ReClass.NET && make update +docker_all: + make docker_debug + make docker_release + make dist + +docker_debug: + cd ReClass.NET_Launcher && make docker_debug + cd ReClass.NET && make docker_debug + docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc_multilib:latest bash -c "cd NativeCore/Unix && make debug" + +docker_release: + cd ReClass.NET_Launcher && make docker_release + cd ReClass.NET && make docker_release + docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc_multilib:latest bash -c "cd NativeCore/Unix && make release" + +podman_all: + make podman_debug + make podman_release + make dist + +podman_debug: + cd ReClass.NET_Launcher && make podman_debug + cd ReClass.NET && make podman_debug + podman container run --rm -v ${PWD}:/build:z -w /build gcc_multilib:latest bash -c "cd NativeCore/Unix && make debug" + +podman_release: + cd ReClass.NET_Launcher && make podman_release + cd ReClass.NET && make podman_release + podman container run --rm -v ${PWD}:/build:z -w /build gcc_multilib:latest bash -c "cd NativeCore/Unix && make release" + dist: test -d build || mkdir -p build cp -r ReClass.NET/bin/* build/ cp -r ReClass.NET_Launcher/bin/* build/ - cp NativeCore/Unix/build/debug/NativeCore.so build/Debug/x64 - cp NativeCore/Unix/build/release/NativeCore.so build/Release/x64 + cp NativeCore/Unix/build/debug/x86/NativeCore.so build/Debug/x86 + cp NativeCore/Unix/build/debug/x64/NativeCore.so build/Debug/x64 + cp NativeCore/Unix/build/release/x86/NativeCore.so build/Release/x86 + cp NativeCore/Unix/build/release/x64/NativeCore.so build/Release/x64 test -d build/Debug/x86/Plugins || mkdir build/Debug/x86/Plugins test -d build/Debug/x64/Plugins || mkdir build/Debug/x64/Plugins test -d build/Release/x86/Plugins || mkdir build/Release/x86/Plugins diff --git a/NativeCore/Dependencies/distorm/COPYING.txt b/NativeCore/Dependencies/distorm/COPYING.txt index 4f365ddc..9046eba5 100644 --- a/NativeCore/Dependencies/distorm/COPYING.txt +++ b/NativeCore/Dependencies/distorm/COPYING.txt @@ -1,6 +1,6 @@ :[diStorm3}: The ultimate disassembler library. -Copyright (c) 2003-2016, Gil Dabah +Copyright (c) 2003-2021, Gil Dabah All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/NativeCore/Dependencies/distorm/include/distorm.h b/NativeCore/Dependencies/distorm/include/distorm.h index d99bbc39..b0467bae 100644 --- a/NativeCore/Dependencies/distorm/include/distorm.h +++ b/NativeCore/Dependencies/distorm/include/distorm.h @@ -1,4 +1,4 @@ -/* diStorm 3.4.0 */ +/* diStorm 3.5.3 */ /* distorm.h @@ -6,7 +6,7 @@ distorm.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -33,29 +33,27 @@ This library is licensed under the BSD license. See the file COPYING. #undef SUPPORT_64BIT_OFFSET #endif -/* If your compiler doesn't support stdint.h, define your own 64 bits type. */ -#ifdef SUPPORT_64BIT_OFFSET - #ifdef _MSC_VER - #define OFFSET_INTEGER unsigned __int64 - #else - #include - #define OFFSET_INTEGER uint64_t - #endif +#ifndef _MSC_VER +#include #else - /* 32 bit offsets are used. */ - #define OFFSET_INTEGER unsigned long +/* Since MSVC < 2010 isn't shipped with stdint.h, + * here are those from MSVC 2017, which also match + * those in tinycc/libc. */ +typedef signed char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef long long int64_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; #endif -#ifdef _MSC_VER -/* Since MSVC isn't shipped with stdint.h, we will have our own: */ -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -typedef signed __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef signed __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef signed __int8 int8_t; -typedef unsigned __int8 uint8_t; +#ifdef SUPPORT_64BIT_OFFSET +#define OFFSET_INTEGER uint64_t +#else +/* 32 bit offsets are used. */ +#define OFFSET_INTEGER uint32_t #endif /* Support C++ compilers */ @@ -67,10 +65,10 @@ typedef unsigned __int8 uint8_t; /* *** Helper Macros *** */ /* Get the ISC of the instruction, used with the definitions below. */ -#define META_GET_ISC(meta) (((meta) >> 3) & 0x1f) -#define META_SET_ISC(di, isc) (((di)->meta) |= ((isc) << 3)) +#define META_GET_ISC(meta) (((meta) >> 8) & 0x1f) +#define META_SET_ISC(di, isc) (((di)->meta) |= ((isc) << 8)) /* Get the flow control flags of the instruction, see 'features for decompose' below. */ -#define META_GET_FC(meta) ((meta) & 0x7) +#define META_GET_FC(meta) ((meta) & 0xf) /* Get the target address of a branching instruction. O_PC operand type. */ #define INSTRUCTION_GET_TARGET(di) ((_OffsetType)(((di)->addr + (di)->imm.addr + (di)->size))) @@ -91,7 +89,7 @@ typedef unsigned __int8 uint8_t; #define FLAG_GET_OPSIZE(flags) (((flags) >> 8) & 3) #define FLAG_GET_ADDRSIZE(flags) (((flags) >> 10) & 3) /* To get the LOCK/REPNZ/REP prefixes. */ -#define FLAG_GET_PREFIX(flags) ((flags) & 7) +#define FLAG_GET_PREFIX(flags) (((unsigned int)((int16_t)flags)) & 7) /* Indicates whether the instruction is privileged. */ #define FLAG_GET_PRIVILEGED(flags) (((flags) & FLAG_PRIVILEGED_INSTRUCTION) != 0) @@ -99,10 +97,10 @@ typedef unsigned __int8 uint8_t; * Macros to extract segment registers from 'segment': */ #define SEGMENT_DEFAULT 0x80 -#define SEGMENT_SET(di, seg) ((di->segment) |= seg) #define SEGMENT_GET(segment) (((segment) == R_NONE) ? R_NONE : ((segment) & 0x7f)) -#define SEGMENT_IS_DEFAULT(segment) (((segment) & SEGMENT_DEFAULT) == SEGMENT_DEFAULT) - +#define SEGMENT_GET_UNSAFE(segment) ((segment) & 0x7f) +#define SEGMENT_IS_DEFAULT(segment) (((int8_t)segment) < -1) /* Quick check it's a negative number that isn't -1, so it's (0x80 | SEGREG). */ +#define SEGMENT_IS_DEFAULT_OR_NONE(segment) (((uint8_t)(segment)) > 0x80) /* Decodes modes of the disassembler, 16 bits or 32 bits or 64 bits for AMD64, x86-64. */ typedef enum { Decode16Bits = 0, Decode32Bits = 1, Decode64Bits = 2 } _DecodeType; @@ -110,7 +108,8 @@ typedef enum { Decode16Bits = 0, Decode32Bits = 1, Decode64Bits = 2 } _DecodeTyp typedef OFFSET_INTEGER _OffsetType; typedef struct { - _OffsetType codeOffset, nextOffset; /* nextOffset is OUT only. */ + _OffsetType codeOffset, addrMask; + _OffsetType nextOffset; /* nextOffset is OUT only. */ const uint8_t* code; int codeLen; /* Using signed integer makes it easier to detect an underflow. */ _DecodeType dt; @@ -243,6 +242,8 @@ typedef struct { uint16_t opcode; /* Up to four operands per instruction, ignored if ops[n].type == O_NONE. */ _Operand ops[OPERANDS_NO]; + /* Number of valid ops entries. */ + uint8_t opsNo; /* Size of the whole instruction in bytes. */ uint8_t size; /* Segment information of memory indirection, default segment, or overriden one, can be -1. Use SEGMENT macros. */ @@ -251,8 +252,8 @@ typedef struct { uint8_t base, scale; uint8_t dispSize; /* Meta defines the instruction set class, and the flow control flags. Use META macros. */ - uint8_t meta; - /* The CPU flags that the instruction operates upon. */ + uint16_t meta; + /* The CPU flags that the instruction operates upon, set only with DF_FILL_EFLAGS enabled, otherwise 0. */ uint16_t modifiedFlagsMask, testedFlagsMask, undefinedFlagsMask; } _DInst; @@ -271,11 +272,11 @@ typedef struct { * This structure holds all information the disassembler generates per instruction. */ typedef struct { + _OffsetType offset; /* Start offset of the decoded instruction. */ + unsigned int size; /* Size of decoded instruction in bytes. */ _WString mnemonic; /* Mnemonic of decoded instruction, prefixed if required by REP, LOCK etc. */ _WString operands; /* Operands of the decoded instruction, up to 3 operands, comma-seperated. */ _WString instructionHex; /* Hex dump - little endian, including prefixes. */ - unsigned int size; /* Size of decoded instruction in bytes. */ - _OffsetType offset; /* Start offset of the decoded instruction. */ } _DecodedInst; #endif /* DISTORM_LIGHT */ @@ -285,7 +286,7 @@ typedef struct { #define RM_CX 2 /* CL, CH, CX, ECX, RCX */ #define RM_DX 4 /* DL, DH, DX, EDX, RDX */ #define RM_BX 8 /* BL, BH, BX, EBX, RBX */ -#define RM_SP 0x10 /* SPL, SP, ESP, RSP */ +#define RM_SP 0x10 /* SPL, SP, ESP, RSP */ #define RM_BP 0x20 /* BPL, BP, EBP, RBP */ #define RM_SI 0x40 /* SIL, SI, ESI, RSI */ #define RM_DI 0x80 /* DIL, DI, EDI, RDI */ @@ -303,6 +304,7 @@ typedef struct { #define RM_R13 0x80000 /* R13B, R13W, R13D, R13 */ #define RM_R14 0x100000 /* R14B, R14W, R14D, R14 */ #define RM_R15 0x200000 /* R15B, R15W, R15D, R15 */ +#define RM_SEG 0x400000 /* CS, SS, DS, ES, FS, GS */ /* RIP should be checked using the 'flags' field and FLAG_RIP_RELATIVE. * Segments should be checked using the segment macros. @@ -384,8 +386,21 @@ typedef struct { #define DF_STOP_ON_INT 0x100 /* The decoder will stop and return to the caller when any of the 'CMOVxx' instruction was decoded. */ #define DF_STOP_ON_CMOV 0x200 +/* The decoder will stop and return to the caller when it encounters the HLT instruction. */ +#define DF_STOP_ON_HLT 0x400 +/* The decoder will stop and return to the caller when it encounters a privileged instruction. */ +#define DF_STOP_ON_PRIVILEGED 0x800 +/* The decoder will stop and return to the caller when an instruction couldn't be decoded. */ +#define DF_STOP_ON_UNDECODEABLE 0x1000 +/* The decoder will not synchronize to the next byte after the previosuly decoded instruction, instead it will start decoding at the next byte. */ +#define DF_SINGLE_BYTE_STEP 0x2000 +/* The decoder will fill in the eflags fields for the decoded instruction. */ +#define DF_FILL_EFLAGS 0x4000 +/* The decoder will use the addrMask in CodeInfo structure instead of DF_MAXIMUM_ADDR16/32. */ +#define DF_USE_ADDR_MASK 0x8000 + /* The decoder will stop and return to the caller when any flow control instruction was decoded. */ -#define DF_STOP_ON_FLOW_CONTROL (DF_STOP_ON_CALL | DF_STOP_ON_RET | DF_STOP_ON_SYS | DF_STOP_ON_UNC_BRANCH | DF_STOP_ON_CND_BRANCH | DF_STOP_ON_INT | DF_STOP_ON_CMOV) +#define DF_STOP_ON_FLOW_CONTROL (DF_STOP_ON_CALL | DF_STOP_ON_RET | DF_STOP_ON_SYS | DF_STOP_ON_UNC_BRANCH | DF_STOP_ON_CND_BRANCH | DF_STOP_ON_INT | DF_STOP_ON_CMOV | DF_STOP_ON_HLT) /* Indicates the instruction is not a flow-control instruction. */ #define FC_NONE 0 @@ -406,9 +421,11 @@ typedef struct { #define FC_INT 6 /* Indicates the instruction is one of: CMOVxx. */ #define FC_CMOV 7 +/* Indicates the instruction is HLT. */ +#define FC_HLT 8 /* Return code of the decoding function. */ -typedef enum { DECRES_NONE, DECRES_SUCCESS, DECRES_MEMORYERR, DECRES_INPUTERR, DECRES_FILTERED } _DecodeResult; +typedef enum { DECRES_NONE, DECRES_SUCCESS, DECRES_MEMORYERR, DECRES_INPUTERR } _DecodeResult; /* Define the following interface functions only for outer projects. */ #if !(defined(DISTORM_STATIC) || defined(DISTORM_DYNAMIC)) @@ -431,7 +448,7 @@ typedef enum { DECRES_NONE, DECRES_SUCCESS, DECRES_MEMORYERR, DECRES_INPUTERR, D * Notes: 1)The minimal size of maxInstructions is 15. * 2)You will have to synchronize the offset,code and length by yourself if you pass code fragments and not a complete code block! */ - + /* distorm_decompose * See more documentation online at the GitHub project's wiki. * diff --git a/NativeCore/Dependencies/distorm/include/mnemonics.h b/NativeCore/Dependencies/distorm/include/mnemonics.h index 32d71be8..3f982705 100644 --- a/NativeCore/Dependencies/distorm/include/mnemonics.h +++ b/NativeCore/Dependencies/distorm/include/mnemonics.h @@ -4,7 +4,7 @@ mnemonics.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -41,245 +41,245 @@ extern const _WRegister _REGISTERS[]; #define GET_MNEMONIC_NAME(m) ((_WMnemonic*)&_MNEMONICS[(m)])->p typedef enum { - I_UNDEFINED = 0, I_AAA = 66, I_AAD = 389, I_AAM = 384, I_AAS = 76, I_ADC = 31, I_ADD = 11, I_ADDPD = 3132, - I_ADDPS = 3125, I_ADDSD = 3146, I_ADDSS = 3139, I_ADDSUBPD = 6416, I_ADDSUBPS = 6426, - I_AESDEC = 9231, I_AESDECLAST = 9248, I_AESENC = 9189, I_AESENCLAST = 9206, - I_AESIMC = 9172, I_AESKEYGENASSIST = 9817, I_AND = 41, I_ANDNPD = 3043, I_ANDNPS = 3035, - I_ANDPD = 3012, I_ANDPS = 3005, I_ARPL = 111, I_BLENDPD = 9394, I_BLENDPS = 9375, - I_BLENDVPD = 7641, I_BLENDVPS = 7631, I_BOUND = 104, I_BSF = 4368, I_BSR = 4380, - I_BSWAP = 960, I_BT = 872, I_BTC = 934, I_BTR = 912, I_BTS = 887, I_CALL = 456, - I_CALL_FAR = 260, I_CBW = 228, I_CDQ = 250, I_CDQE = 239, I_CLC = 492, I_CLD = 512, - I_CLFLUSH = 4351, I_CLGI = 1855, I_CLI = 502, I_CLTS = 541, I_CMC = 487, I_CMOVA = 694, - I_CMOVAE = 663, I_CMOVB = 656, I_CMOVBE = 686, I_CMOVG = 754, I_CMOVGE = 738, - I_CMOVL = 731, I_CMOVLE = 746, I_CMOVNO = 648, I_CMOVNP = 723, I_CMOVNS = 708, - I_CMOVNZ = 678, I_CMOVO = 641, I_CMOVP = 716, I_CMOVS = 701, I_CMOVZ = 671, - I_CMP = 71, I_CMPEQPD = 4471, I_CMPEQPS = 4392, I_CMPEQSD = 4629, I_CMPEQSS = 4550, - I_CMPLEPD = 4489, I_CMPLEPS = 4410, I_CMPLESD = 4647, I_CMPLESS = 4568, I_CMPLTPD = 4480, - I_CMPLTPS = 4401, I_CMPLTSD = 4638, I_CMPLTSS = 4559, I_CMPNEQPD = 4510, I_CMPNEQPS = 4431, - I_CMPNEQSD = 4668, I_CMPNEQSS = 4589, I_CMPNLEPD = 4530, I_CMPNLEPS = 4451, - I_CMPNLESD = 4688, I_CMPNLESS = 4609, I_CMPNLTPD = 4520, I_CMPNLTPS = 4441, - I_CMPNLTSD = 4678, I_CMPNLTSS = 4599, I_CMPORDPD = 4540, I_CMPORDPS = 4461, - I_CMPORDSD = 4698, I_CMPORDSS = 4619, I_CMPS = 301, I_CMPUNORDPD = 4498, I_CMPUNORDPS = 4419, - I_CMPUNORDSD = 4656, I_CMPUNORDSS = 4577, I_CMPXCHG = 898, I_CMPXCHG16B = 6395, - I_CMPXCHG8B = 6384, I_COMISD = 2801, I_COMISS = 2793, I_CPUID = 865, I_CQO = 255, - I_CRC32 = 9280, I_CVTDQ2PD = 6809, I_CVTDQ2PS = 3329, I_CVTPD2DQ = 6819, I_CVTPD2PI = 2703, - I_CVTPD2PS = 3255, I_CVTPH2PS = 4183, I_CVTPI2PD = 2517, I_CVTPI2PS = 2507, - I_CVTPS2DQ = 3339, I_CVTPS2PD = 3245, I_CVTPS2PH = 4193, I_CVTPS2PI = 2693, - I_CVTSD2SI = 2723, I_CVTSD2SS = 3275, I_CVTSI2SD = 2537, I_CVTSI2SS = 2527, - I_CVTSS2SD = 3265, I_CVTSS2SI = 2713, I_CVTTPD2DQ = 6798, I_CVTTPD2PI = 2636, - I_CVTTPS2DQ = 3349, I_CVTTPS2PI = 2625, I_CVTTSD2SI = 2658, I_CVTTSS2SI = 2647, - I_CWD = 245, I_CWDE = 233, I_DAA = 46, I_DAS = 56, I_DEC = 86, I_DIV = 1646, - I_DIVPD = 3521, I_DIVPS = 3514, I_DIVSD = 3535, I_DIVSS = 3528, I_DPPD = 9637, - I_DPPS = 9624, I_EMMS = 4122, I_ENTER = 340, I_EXTRACTPS = 9502, I_EXTRQ = 4158, - I_F2XM1 = 1192, I_FABS = 1123, I_FADD = 1023, I_FADDP = 1549, I_FBLD = 1601, - I_FBSTP = 1607, I_FCHS = 1117, I_FCLEX = 7311, I_FCMOVB = 1376, I_FCMOVBE = 1392, - I_FCMOVE = 1384, I_FCMOVNB = 1445, I_FCMOVNBE = 1463, I_FCMOVNE = 1454, I_FCMOVNU = 1473, - I_FCMOVU = 1401, I_FCOM = 1035, I_FCOMI = 1512, I_FCOMIP = 1623, I_FCOMP = 1041, - I_FCOMPP = 1563, I_FCOS = 1311, I_FDECSTP = 1238, I_FDIV = 1061, I_FDIVP = 1594, - I_FDIVR = 1067, I_FDIVRP = 1586, I_FEDISI = 1488, I_FEMMS = 574, I_FENI = 1482, - I_FFREE = 1527, I_FIADD = 1317, I_FICOM = 1331, I_FICOMP = 1338, I_FIDIV = 1361, - I_FIDIVR = 1368, I_FILD = 1418, I_FIMUL = 1324, I_FINCSTP = 1247, I_FINIT = 7326, - I_FIST = 1432, I_FISTP = 1438, I_FISTTP = 1424, I_FISUB = 1346, I_FISUBR = 1353, - I_FLD = 1074, I_FLD1 = 1141, I_FLDCW = 1098, I_FLDENV = 1090, I_FLDL2E = 1155, - I_FLDL2T = 1147, I_FLDLG2 = 1170, I_FLDLN2 = 1178, I_FLDPI = 1163, I_FLDZ = 1186, - I_FMUL = 1029, I_FMULP = 1556, I_FNCLEX = 7303, I_FNINIT = 7318, I_FNOP = 1111, - I_FNSAVE = 7333, I_FNSTCW = 7288, I_FNSTENV = 7271, I_FNSTSW = 7348, I_FPATAN = 1213, - I_FPREM = 1256, I_FPREM1 = 1230, I_FPTAN = 1206, I_FRNDINT = 1288, I_FRSTOR = 1519, - I_FSAVE = 7341, I_FSCALE = 1297, I_FSETPM = 1496, I_FSIN = 1305, I_FSINCOS = 1279, - I_FSQRT = 1272, I_FST = 1079, I_FSTCW = 7296, I_FSTENV = 7280, I_FSTP = 1084, - I_FSTSW = 7356, I_FSUB = 1048, I_FSUBP = 1579, I_FSUBR = 1054, I_FSUBRP = 1571, - I_FTST = 1129, I_FUCOM = 1534, I_FUCOMI = 1504, I_FUCOMIP = 1614, I_FUCOMP = 1541, - I_FUCOMPP = 1409, I_FXAM = 1135, I_FXCH = 1105, I_FXRSTOR = 9914, I_FXRSTOR64 = 9923, - I_FXSAVE = 9886, I_FXSAVE64 = 9894, I_FXTRACT = 1221, I_FYL2X = 1199, I_FYL2XP1 = 1263, - I_GETSEC = 633, I_HADDPD = 4203, I_HADDPS = 4211, I_HLT = 482, I_HSUBPD = 4237, - I_HSUBPS = 4245, I_IDIV = 1651, I_IMUL = 117, I_IN = 447, I_INC = 81, I_INS = 123, - I_INSERTPS = 9569, I_INSERTQ = 4165, I_INT = 367, I_INT_3 = 360, I_INT1 = 476, - I_INTO = 372, I_INVD = 555, I_INVEPT = 8306, I_INVLPG = 1727, I_INVLPGA = 1869, - I_INVPCID = 8323, I_INVVPID = 8314, I_IRET = 378, I_JA = 166, I_JAE = 147, - I_JB = 143, I_JBE = 161, I_JCXZ = 427, I_JECXZ = 433, I_JG = 202, I_JGE = 192, - I_JL = 188, I_JLE = 197, I_JMP = 462, I_JMP_FAR = 467, I_JNO = 138, I_JNP = 183, - I_JNS = 174, I_JNZ = 156, I_JO = 134, I_JP = 179, I_JRCXZ = 440, I_JS = 170, - I_JZ = 152, I_LAHF = 289, I_LAR = 522, I_LDDQU = 7016, I_LDMXCSR = 9944, I_LDS = 335, - I_LEA = 223, I_LEAVE = 347, I_LES = 330, I_LFENCE = 4287, I_LFS = 917, I_LGDT = 1703, - I_LGS = 922, I_LIDT = 1709, I_LLDT = 1668, I_LMSW = 1721, I_LODS = 313, I_LOOP = 421, - I_LOOPNZ = 406, I_LOOPZ = 414, I_LSL = 527, I_LSS = 907, I_LTR = 1674, I_LZCNT = 4385, - I_MASKMOVDQU = 7141, I_MASKMOVQ = 7131, I_MAXPD = 3581, I_MAXPS = 3574, I_MAXSD = 3595, - I_MAXSS = 3588, I_MFENCE = 4313, I_MINPD = 3461, I_MINPS = 3454, I_MINSD = 3475, - I_MINSS = 3468, I_MONITOR = 1771, I_MOV = 218, I_MOVAPD = 2481, I_MOVAPS = 2473, - I_MOVBE = 9273, I_MOVD = 3942, I_MOVDDUP = 2208, I_MOVDQ2Q = 6544, I_MOVDQA = 3968, - I_MOVDQU = 3976, I_MOVHLPS = 2173, I_MOVHPD = 2367, I_MOVHPS = 2359, I_MOVLHPS = 2350, - I_MOVLPD = 2190, I_MOVLPS = 2182, I_MOVMSKPD = 2837, I_MOVMSKPS = 2827, I_MOVNTDQ = 6871, - I_MOVNTDQA = 7917, I_MOVNTI = 952, I_MOVNTPD = 2578, I_MOVNTPS = 2569, I_MOVNTQ = 6863, - I_MOVNTSD = 2596, I_MOVNTSS = 2587, I_MOVQ = 3948, I_MOVQ2DQ = 6535, I_MOVS = 295, - I_MOVSD = 2132, I_MOVSHDUP = 2375, I_MOVSLDUP = 2198, I_MOVSS = 2125, I_MOVSX = 939, - I_MOVSXD = 10027, I_MOVUPD = 2117, I_MOVUPS = 2109, I_MOVZX = 927, I_MPSADBW = 9650, - I_MUL = 1641, I_MULPD = 3192, I_MULPS = 3185, I_MULSD = 3206, I_MULSS = 3199, - I_MWAIT = 1780, I_NEG = 1636, I_NOP = 581, I_NOT = 1631, I_OR = 27, I_ORPD = 3075, - I_ORPS = 3069, I_OUT = 451, I_OUTS = 128, I_PABSB = 7710, I_PABSD = 7740, I_PABSW = 7725, - I_PACKSSDW = 3871, I_PACKSSWB = 3703, I_PACKUSDW = 7938, I_PACKUSWB = 3781, - I_PADDB = 7226, I_PADDD = 7256, I_PADDQ = 6503, I_PADDSB = 6952, I_PADDSW = 6969, - I_PADDUSB = 6642, I_PADDUSW = 6661, I_PADDW = 7241, I_PALIGNR = 9432, I_PAND = 6629, - I_PANDN = 6687, I_PAUSE = 10035, I_PAVGB = 6702, I_PAVGUSB = 2100, I_PAVGW = 6747, - I_PBLENDVB = 7621, I_PBLENDW = 9413, I_PCLMULQDQ = 9669, I_PCMPEQB = 4065, - I_PCMPEQD = 4103, I_PCMPEQQ = 7898, I_PCMPEQW = 4084, I_PCMPESTRI = 9748, - I_PCMPESTRM = 9725, I_PCMPGTB = 3724, I_PCMPGTD = 3762, I_PCMPGTQ = 8109, - I_PCMPGTW = 3743, I_PCMPISTRI = 9794, I_PCMPISTRM = 9771, I_PEXTRB = 9451, - I_PEXTRD = 9468, I_PEXTRQ = 9476, I_PEXTRW = 6333, I_PF2ID = 1936, I_PF2IW = 1929, - I_PFACC = 2050, I_PFADD = 1999, I_PFCMPEQ = 2057, I_PFCMPGE = 1960, I_PFCMPGT = 2006, - I_PFMAX = 2015, I_PFMIN = 1969, I_PFMUL = 2066, I_PFNACC = 1943, I_PFPNACC = 1951, - I_PFRCP = 1976, I_PFRCPIT1 = 2022, I_PFRCPIT2 = 2073, I_PFRSQIT1 = 2032, I_PFRSQRT = 1983, - I_PFSUB = 1992, I_PFSUBR = 2042, I_PHADDD = 7397, I_PHADDSW = 7414, I_PHADDW = 7380, - I_PHMINPOSUW = 8281, I_PHSUBD = 7473, I_PHSUBSW = 7490, I_PHSUBW = 7456, I_PI2FD = 1922, - I_PI2FW = 1915, I_PINSRB = 9552, I_PINSRD = 9590, I_PINSRQ = 9598, I_PINSRW = 6316, - I_PMADDUBSW = 7433, I_PMADDWD = 7095, I_PMAXSB = 8196, I_PMAXSD = 8213, I_PMAXSW = 6986, - I_PMAXUB = 6670, I_PMAXUD = 8247, I_PMAXUW = 8230, I_PMINSB = 8128, I_PMINSD = 8145, - I_PMINSW = 6924, I_PMINUB = 6612, I_PMINUD = 8179, I_PMINUW = 8162, I_PMOVMSKB = 6553, - I_PMOVSXBD = 7776, I_PMOVSXBQ = 7797, I_PMOVSXBW = 7755, I_PMOVSXDQ = 7860, - I_PMOVSXWD = 7818, I_PMOVSXWQ = 7839, I_PMOVZXBD = 8004, I_PMOVZXBQ = 8025, - I_PMOVZXBW = 7983, I_PMOVZXDQ = 8088, I_PMOVZXWD = 8046, I_PMOVZXWQ = 8067, - I_PMULDQ = 7881, I_PMULHRSW = 7560, I_PMULHRW = 2083, I_PMULHUW = 6762, I_PMULHW = 6781, - I_PMULLD = 8264, I_PMULLW = 6518, I_PMULUDQ = 7076, I_POP = 22, I_POPA = 98, - I_POPCNT = 4360, I_POPF = 277, I_POR = 6941, I_PREFETCH = 1894, I_PREFETCHNTA = 2424, - I_PREFETCHT0 = 2437, I_PREFETCHT1 = 2449, I_PREFETCHT2 = 2461, I_PREFETCHW = 1904, - I_PSADBW = 7114, I_PSHUFB = 7363, I_PSHUFD = 4010, I_PSHUFHW = 4018, I_PSHUFLW = 4027, - I_PSHUFW = 4002, I_PSIGNB = 7509, I_PSIGND = 7543, I_PSIGNW = 7526, I_PSLLD = 7046, - I_PSLLDQ = 9869, I_PSLLQ = 7061, I_PSLLW = 7031, I_PSRAD = 6732, I_PSRAW = 6717, - I_PSRLD = 6473, I_PSRLDQ = 9852, I_PSRLQ = 6488, I_PSRLW = 6458, I_PSUBB = 7166, - I_PSUBD = 7196, I_PSUBQ = 7211, I_PSUBSB = 6890, I_PSUBSW = 6907, I_PSUBUSB = 6574, - I_PSUBUSW = 6593, I_PSUBW = 7181, I_PSWAPD = 2092, I_PTEST = 7651, I_PUNPCKHBW = 3802, - I_PUNPCKHDQ = 3848, I_PUNPCKHQDQ = 3917, I_PUNPCKHWD = 3825, I_PUNPCKLBW = 3634, - I_PUNPCKLDQ = 3680, I_PUNPCKLQDQ = 3892, I_PUNPCKLWD = 3657, I_PUSH = 16, - I_PUSHA = 91, I_PUSHF = 270, I_PXOR = 7003, I_RCL = 977, I_RCPPS = 2975, I_RCPSS = 2982, - I_RCR = 982, I_RDFSBASE = 9904, I_RDGSBASE = 9934, I_RDMSR = 600, I_RDPMC = 607, - I_RDRAND = 10048, I_RDTSC = 593, I_RDTSCP = 1886, I_RET = 325, I_RETF = 354, - I_ROL = 967, I_ROR = 972, I_ROUNDPD = 9318, I_ROUNDPS = 9299, I_ROUNDSD = 9356, - I_ROUNDSS = 9337, I_RSM = 882, I_RSQRTPS = 2937, I_RSQRTSS = 2946, I_SAHF = 283, - I_SAL = 997, I_SALC = 394, I_SAR = 1002, I_SBB = 36, I_SCAS = 319, I_SETA = 807, - I_SETAE = 780, I_SETB = 774, I_SETBE = 800, I_SETG = 859, I_SETGE = 845, I_SETL = 839, - I_SETLE = 852, I_SETNO = 767, I_SETNP = 832, I_SETNS = 819, I_SETNZ = 793, - I_SETO = 761, I_SETP = 826, I_SETS = 813, I_SETZ = 787, I_SFENCE = 4343, I_SGDT = 1691, - I_SHL = 987, I_SHLD = 876, I_SHR = 992, I_SHRD = 892, I_SHUFPD = 6358, I_SHUFPS = 6350, - I_SIDT = 1697, I_SKINIT = 1861, I_SLDT = 1657, I_SMSW = 1715, I_SQRTPD = 2877, - I_SQRTPS = 2869, I_SQRTSD = 2893, I_SQRTSS = 2885, I_STC = 497, I_STD = 517, - I_STGI = 1849, I_STI = 507, I_STMXCSR = 9973, I_STOS = 307, I_STR = 1663, I_SUB = 51, - I_SUBPD = 3401, I_SUBPS = 3394, I_SUBSD = 3415, I_SUBSS = 3408, I_SWAPGS = 1878, - I_SYSCALL = 532, I_SYSENTER = 614, I_SYSEXIT = 624, I_SYSRET = 547, I_TEST = 206, - I_TZCNT = 4373, I_UCOMISD = 2764, I_UCOMISS = 2755, I_UD2 = 569, I_UNPCKHPD = 2318, - I_UNPCKHPS = 2308, I_UNPCKLPD = 2276, I_UNPCKLPS = 2266, I_VADDPD = 3161, - I_VADDPS = 3153, I_VADDSD = 3177, I_VADDSS = 3169, I_VADDSUBPD = 6436, I_VADDSUBPS = 6447, - I_VAESDEC = 9239, I_VAESDECLAST = 9260, I_VAESENC = 9197, I_VAESENCLAST = 9218, - I_VAESIMC = 9180, I_VAESKEYGENASSIST = 9834, I_VANDNPD = 3060, I_VANDNPS = 3051, - I_VANDPD = 3027, I_VANDPS = 3019, I_VBLENDPD = 9403, I_VBLENDPS = 9384, I_VBLENDVPD = 9703, - I_VBLENDVPS = 9692, I_VBROADCASTF128 = 7694, I_VBROADCASTSD = 7680, I_VBROADCASTSS = 7666, - I_VCMPEQPD = 5110, I_VCMPEQPS = 4708, I_VCMPEQSD = 5914, I_VCMPEQSS = 5512, - I_VCMPEQ_OSPD = 5291, I_VCMPEQ_OSPS = 4889, I_VCMPEQ_OSSD = 6095, I_VCMPEQ_OSSS = 5693, - I_VCMPEQ_UQPD = 5197, I_VCMPEQ_UQPS = 4795, I_VCMPEQ_UQSD = 6001, I_VCMPEQ_UQSS = 5599, - I_VCMPEQ_USPD = 5400, I_VCMPEQ_USPS = 4998, I_VCMPEQ_USSD = 6204, I_VCMPEQ_USSS = 5802, - I_VCMPFALSEPD = 5232, I_VCMPFALSEPS = 4830, I_VCMPFALSESD = 6036, I_VCMPFALSESS = 5634, - I_VCMPFALSE_OSPD = 5441, I_VCMPFALSE_OSPS = 5039, I_VCMPFALSE_OSSD = 6245, - I_VCMPFALSE_OSSS = 5843, I_VCMPGEPD = 5259, I_VCMPGEPS = 4857, I_VCMPGESD = 6063, - I_VCMPGESS = 5661, I_VCMPGE_OQPD = 5471, I_VCMPGE_OQPS = 5069, I_VCMPGE_OQSD = 6275, - I_VCMPGE_OQSS = 5873, I_VCMPGTPD = 5269, I_VCMPGTPS = 4867, I_VCMPGTSD = 6073, - I_VCMPGTSS = 5671, I_VCMPGT_OQPD = 5484, I_VCMPGT_OQPS = 5082, I_VCMPGT_OQSD = 6288, - I_VCMPGT_OQSS = 5886, I_VCMPLEPD = 5130, I_VCMPLEPS = 4728, I_VCMPLESD = 5934, - I_VCMPLESS = 5532, I_VCMPLE_OQPD = 5317, I_VCMPLE_OQPS = 4915, I_VCMPLE_OQSD = 6121, - I_VCMPLE_OQSS = 5719, I_VCMPLTPD = 5120, I_VCMPLTPS = 4718, I_VCMPLTSD = 5924, - I_VCMPLTSS = 5522, I_VCMPLT_OQPD = 5304, I_VCMPLT_OQPS = 4902, I_VCMPLT_OQSD = 6108, - I_VCMPLT_OQSS = 5706, I_VCMPNEQPD = 5153, I_VCMPNEQPS = 4751, I_VCMPNEQSD = 5957, - I_VCMPNEQSS = 5555, I_VCMPNEQ_OQPD = 5245, I_VCMPNEQ_OQPS = 4843, I_VCMPNEQ_OQSD = 6049, - I_VCMPNEQ_OQSS = 5647, I_VCMPNEQ_OSPD = 5457, I_VCMPNEQ_OSPS = 5055, I_VCMPNEQ_OSSD = 6261, - I_VCMPNEQ_OSSS = 5859, I_VCMPNEQ_USPD = 5345, I_VCMPNEQ_USPS = 4943, I_VCMPNEQ_USSD = 6149, - I_VCMPNEQ_USSS = 5747, I_VCMPNGEPD = 5210, I_VCMPNGEPS = 4808, I_VCMPNGESD = 6014, - I_VCMPNGESS = 5612, I_VCMPNGE_UQPD = 5413, I_VCMPNGE_UQPS = 5011, I_VCMPNGE_UQSD = 6217, - I_VCMPNGE_UQSS = 5815, I_VCMPNGTPD = 5221, I_VCMPNGTPS = 4819, I_VCMPNGTSD = 6025, - I_VCMPNGTSS = 5623, I_VCMPNGT_UQPD = 5427, I_VCMPNGT_UQPS = 5025, I_VCMPNGT_UQSD = 6231, - I_VCMPNGT_UQSS = 5829, I_VCMPNLEPD = 5175, I_VCMPNLEPS = 4773, I_VCMPNLESD = 5979, - I_VCMPNLESS = 5577, I_VCMPNLE_UQPD = 5373, I_VCMPNLE_UQPS = 4971, I_VCMPNLE_UQSD = 6177, - I_VCMPNLE_UQSS = 5775, I_VCMPNLTPD = 5164, I_VCMPNLTPS = 4762, I_VCMPNLTSD = 5968, - I_VCMPNLTSS = 5566, I_VCMPNLT_UQPD = 5359, I_VCMPNLT_UQPS = 4957, I_VCMPNLT_UQSD = 6163, - I_VCMPNLT_UQSS = 5761, I_VCMPORDPD = 5186, I_VCMPORDPS = 4784, I_VCMPORDSD = 5990, - I_VCMPORDSS = 5588, I_VCMPORD_SPD = 5387, I_VCMPORD_SPS = 4985, I_VCMPORD_SSD = 6191, - I_VCMPORD_SSS = 5789, I_VCMPTRUEPD = 5279, I_VCMPTRUEPS = 4877, I_VCMPTRUESD = 6083, - I_VCMPTRUESS = 5681, I_VCMPTRUE_USPD = 5497, I_VCMPTRUE_USPS = 5095, I_VCMPTRUE_USSD = 6301, - I_VCMPTRUE_USSS = 5899, I_VCMPUNORDPD = 5140, I_VCMPUNORDPS = 4738, I_VCMPUNORDSD = 5944, - I_VCMPUNORDSS = 5542, I_VCMPUNORD_SPD = 5330, I_VCMPUNORD_SPS = 4928, I_VCMPUNORD_SSD = 6134, - I_VCMPUNORD_SSS = 5732, I_VCOMISD = 2818, I_VCOMISS = 2809, I_VCVTDQ2PD = 6841, - I_VCVTDQ2PS = 3360, I_VCVTPD2DQ = 6852, I_VCVTPD2PS = 3296, I_VCVTPS2DQ = 3371, - I_VCVTPS2PD = 3285, I_VCVTSD2SI = 2744, I_VCVTSD2SS = 3318, I_VCVTSI2SD = 2558, - I_VCVTSI2SS = 2547, I_VCVTSS2SD = 3307, I_VCVTSS2SI = 2733, I_VCVTTPD2DQ = 6829, - I_VCVTTPS2DQ = 3382, I_VCVTTSD2SI = 2681, I_VCVTTSS2SI = 2669, I_VDIVPD = 3550, - I_VDIVPS = 3542, I_VDIVSD = 3566, I_VDIVSS = 3558, I_VDPPD = 9643, I_VDPPS = 9630, - I_VERR = 1679, I_VERW = 1685, I_VEXTRACTF128 = 9538, I_VEXTRACTPS = 9513, - I_VFMADD132PD = 8409, I_VFMADD132PS = 8396, I_VFMADD132SD = 8435, I_VFMADD132SS = 8422, - I_VFMADD213PD = 8689, I_VFMADD213PS = 8676, I_VFMADD213SD = 8715, I_VFMADD213SS = 8702, - I_VFMADD231PD = 8969, I_VFMADD231PS = 8956, I_VFMADD231SD = 8995, I_VFMADD231SS = 8982, - I_VFMADDSUB132PD = 8348, I_VFMADDSUB132PS = 8332, I_VFMADDSUB213PD = 8628, - I_VFMADDSUB213PS = 8612, I_VFMADDSUB231PD = 8908, I_VFMADDSUB231PS = 8892, - I_VFMSUB132PD = 8461, I_VFMSUB132PS = 8448, I_VFMSUB132SD = 8487, I_VFMSUB132SS = 8474, - I_VFMSUB213PD = 8741, I_VFMSUB213PS = 8728, I_VFMSUB213SD = 8767, I_VFMSUB213SS = 8754, - I_VFMSUB231PD = 9021, I_VFMSUB231PS = 9008, I_VFMSUB231SD = 9047, I_VFMSUB231SS = 9034, - I_VFMSUBADD132PD = 8380, I_VFMSUBADD132PS = 8364, I_VFMSUBADD213PD = 8660, - I_VFMSUBADD213PS = 8644, I_VFMSUBADD231PD = 8940, I_VFMSUBADD231PS = 8924, - I_VFNMADD132PD = 8514, I_VFNMADD132PS = 8500, I_VFNMADD132SD = 8542, I_VFNMADD132SS = 8528, - I_VFNMADD213PD = 8794, I_VFNMADD213PS = 8780, I_VFNMADD213SD = 8822, I_VFNMADD213SS = 8808, - I_VFNMADD231PD = 9074, I_VFNMADD231PS = 9060, I_VFNMADD231SD = 9102, I_VFNMADD231SS = 9088, - I_VFNMSUB132PD = 8570, I_VFNMSUB132PS = 8556, I_VFNMSUB132SD = 8598, I_VFNMSUB132SS = 8584, - I_VFNMSUB213PD = 8850, I_VFNMSUB213PS = 8836, I_VFNMSUB213SD = 8878, I_VFNMSUB213SS = 8864, - I_VFNMSUB231PD = 9130, I_VFNMSUB231PS = 9116, I_VFNMSUB231SD = 9158, I_VFNMSUB231SS = 9144, - I_VHADDPD = 4219, I_VHADDPS = 4228, I_VHSUBPD = 4253, I_VHSUBPS = 4262, I_VINSERTF128 = 9525, - I_VINSERTPS = 9579, I_VLDDQU = 7023, I_VLDMXCSR = 9963, I_VMASKMOVDQU = 7153, - I_VMASKMOVPD = 7971, I_VMASKMOVPS = 7959, I_VMAXPD = 3610, I_VMAXPS = 3602, - I_VMAXSD = 3626, I_VMAXSS = 3618, I_VMCALL = 1735, I_VMCLEAR = 10011, I_VMFUNC = 1803, - I_VMINPD = 3490, I_VMINPS = 3482, I_VMINSD = 3506, I_VMINSS = 3498, I_VMLAUNCH = 1743, - I_VMLOAD = 1833, I_VMMCALL = 1824, I_VMOVAPD = 2498, I_VMOVAPS = 2489, I_VMOVD = 3954, - I_VMOVDDUP = 2256, I_VMOVDQA = 3984, I_VMOVDQU = 3993, I_VMOVHLPS = 2217, - I_VMOVHPD = 2404, I_VMOVHPS = 2395, I_VMOVLHPS = 2385, I_VMOVLPD = 2236, I_VMOVLPS = 2227, - I_VMOVMSKPD = 2858, I_VMOVMSKPS = 2847, I_VMOVNTDQ = 6880, I_VMOVNTDQA = 7927, - I_VMOVNTPD = 2615, I_VMOVNTPS = 2605, I_VMOVQ = 3961, I_VMOVSD = 2165, I_VMOVSHDUP = 2413, - I_VMOVSLDUP = 2245, I_VMOVSS = 2157, I_VMOVUPD = 2148, I_VMOVUPS = 2139, I_VMPSADBW = 9659, - I_VMPTRLD = 10002, I_VMPTRST = 6407, I_VMREAD = 4150, I_VMRESUME = 1753, I_VMRUN = 1817, - I_VMSAVE = 1841, I_VMULPD = 3221, I_VMULPS = 3213, I_VMULSD = 3237, I_VMULSS = 3229, - I_VMWRITE = 4174, I_VMXOFF = 1763, I_VMXON = 10020, I_VORPD = 3088, I_VORPS = 3081, - I_VPABSB = 7717, I_VPABSD = 7747, I_VPABSW = 7732, I_VPACKSSDW = 3881, I_VPACKSSWB = 3713, - I_VPACKUSDW = 7948, I_VPACKUSWB = 3791, I_VPADDB = 7233, I_VPADDD = 7263, - I_VPADDQ = 6510, I_VPADDSB = 6960, I_VPADDSW = 6977, I_VPADDUSW = 6651, I_VPADDW = 7248, - I_VPALIGNR = 9441, I_VPAND = 6635, I_VPANDN = 6694, I_VPAVGB = 6709, I_VPAVGW = 6754, - I_VPBLENDVB = 9714, I_VPBLENDW = 9422, I_VPCLMULQDQ = 9680, I_VPCMPEQB = 4074, - I_VPCMPEQD = 4112, I_VPCMPEQQ = 7907, I_VPCMPEQW = 4093, I_VPCMPESTRI = 9759, - I_VPCMPESTRM = 9736, I_VPCMPGTB = 3733, I_VPCMPGTD = 3771, I_VPCMPGTQ = 8118, - I_VPCMPGTW = 3752, I_VPCMPISTRI = 9805, I_VPCMPISTRM = 9782, I_VPERM2F128 = 9287, - I_VPERMILPD = 7592, I_VPERMILPS = 7581, I_VPEXTRB = 9459, I_VPEXTRD = 9484, - I_VPEXTRQ = 9493, I_VPEXTRW = 6341, I_VPHADDD = 7405, I_VPHADDSW = 7423, I_VPHADDW = 7388, - I_VPHMINPOSUW = 8293, I_VPHSUBD = 7481, I_VPHSUBSW = 7499, I_VPHSUBW = 7464, - I_VPINSRB = 9560, I_VPINSRD = 9606, I_VPINSRQ = 9615, I_VPINSRW = 6324, I_VPMADDUBSW = 7444, - I_VPMADDWD = 7104, I_VPMAXSB = 8204, I_VPMAXSD = 8221, I_VPMAXSW = 6994, I_VPMAXUB = 6678, - I_VPMAXUD = 8255, I_VPMAXUW = 8238, I_VPMINSB = 8136, I_VPMINSD = 8153, I_VPMINSW = 6932, - I_VPMINUB = 6620, I_VPMINUD = 8187, I_VPMINUW = 8170, I_VPMOVMSKB = 6563, - I_VPMOVSXBD = 7786, I_VPMOVSXBQ = 7807, I_VPMOVSXBW = 7765, I_VPMOVSXDQ = 7870, - I_VPMOVSXWD = 7828, I_VPMOVSXWQ = 7849, I_VPMOVZXBD = 8014, I_VPMOVZXBQ = 8035, - I_VPMOVZXBW = 7993, I_VPMOVZXDQ = 8098, I_VPMOVZXWD = 8056, I_VPMOVZXWQ = 8077, - I_VPMULDQ = 7889, I_VPMULHRSW = 7570, I_VPMULHUW = 6771, I_VPMULHW = 6789, - I_VPMULLD = 8272, I_VPMULLW = 6526, I_VPMULUDQ = 7085, I_VPOR = 6946, I_VPSADBW = 7122, - I_VPSHUFB = 7371, I_VPSHUFD = 4036, I_VPSHUFHW = 4045, I_VPSHUFLW = 4055, - I_VPSIGNB = 7517, I_VPSIGND = 7551, I_VPSIGNW = 7534, I_VPSLLD = 7053, I_VPSLLDQ = 9877, - I_VPSLLQ = 7068, I_VPSLLW = 7038, I_VPSRAD = 6739, I_VPSRAW = 6724, I_VPSRLD = 6480, - I_VPSRLDQ = 9860, I_VPSRLQ = 6495, I_VPSRLW = 6465, I_VPSUBB = 7173, I_VPSUBD = 7203, - I_VPSUBQ = 7218, I_VPSUBSB = 6898, I_VPSUBSW = 6915, I_VPSUBUSB = 6583, I_VPSUBUSW = 6602, - I_VPSUBW = 7188, I_VPTEST = 7658, I_VPUNPCKHBW = 3813, I_VPUNPCKHDQ = 3859, - I_VPUNPCKHQDQ = 3929, I_VPUNPCKHWD = 3836, I_VPUNPCKLBW = 3645, I_VPUNPCKLDQ = 3691, - I_VPUNPCKLQDQ = 3904, I_VPUNPCKLWD = 3668, I_VPXOR = 7009, I_VRCPPS = 2989, - I_VRCPSS = 2997, I_VROUNDPD = 9327, I_VROUNDPS = 9308, I_VROUNDSD = 9365, - I_VROUNDSS = 9346, I_VRSQRTPS = 2955, I_VRSQRTSS = 2965, I_VSHUFPD = 6375, - I_VSHUFPS = 6366, I_VSQRTPD = 2910, I_VSQRTPS = 2901, I_VSQRTSD = 2928, I_VSQRTSS = 2919, - I_VSTMXCSR = 9992, I_VSUBPD = 3430, I_VSUBPS = 3422, I_VSUBSD = 3446, I_VSUBSS = 3438, - I_VTESTPD = 7612, I_VTESTPS = 7603, I_VUCOMISD = 2783, I_VUCOMISS = 2773, - I_VUNPCKHPD = 2339, I_VUNPCKHPS = 2328, I_VUNPCKLPD = 2297, I_VUNPCKLPS = 2286, - I_VXORPD = 3117, I_VXORPS = 3109, I_VZEROALL = 4140, I_VZEROUPPER = 4128, - I_WAIT = 10042, I_WBINVD = 561, I_WRFSBASE = 9953, I_WRGSBASE = 9982, I_WRMSR = 586, - I_XABORT = 1007, I_XADD = 946, I_XBEGIN = 1015, I_XCHG = 212, I_XEND = 1811, - I_XGETBV = 1787, I_XLAT = 400, I_XOR = 61, I_XORPD = 3102, I_XORPS = 3095, - I_XRSTOR = 4295, I_XRSTOR64 = 4303, I_XSAVE = 4271, I_XSAVE64 = 4278, I_XSAVEOPT = 4321, - I_XSAVEOPT64 = 4331, I_XSETBV = 1795, I__3DNOW = 10056 + I_UNDEFINED = 0, I_AAA = 66, I_AAD = 388, I_AAM = 383, I_AAS = 76, I_ADC = 31, I_ADD = 11, I_ADDPD = 3143, + I_ADDPS = 3136, I_ADDSD = 3157, I_ADDSS = 3150, I_ADDSUBPD = 6427, I_ADDSUBPS = 6437, + I_AESDEC = 9242, I_AESDECLAST = 9259, I_AESENC = 9200, I_AESENCLAST = 9217, + I_AESIMC = 9183, I_AESKEYGENASSIST = 9828, I_AND = 41, I_ANDNPD = 3054, I_ANDNPS = 3046, + I_ANDPD = 3023, I_ANDPS = 3016, I_ARPL = 111, I_BLENDPD = 9405, I_BLENDPS = 9386, + I_BLENDVPD = 7652, I_BLENDVPS = 7642, I_BOUND = 104, I_BSF = 4379, I_BSR = 4391, + I_BSWAP = 959, I_BT = 871, I_BTC = 933, I_BTR = 911, I_BTS = 886, I_CALL = 455, + I_CALL_FAR = 260, I_CBW = 228, I_CDQ = 250, I_CDQE = 239, I_CLAC = 1786, I_CLC = 491, + I_CLD = 511, I_CLFLUSH = 4362, I_CLGI = 1866, I_CLI = 501, I_CLTS = 540, I_CMC = 486, + I_CMOVA = 693, I_CMOVAE = 662, I_CMOVB = 655, I_CMOVBE = 685, I_CMOVG = 753, + I_CMOVGE = 737, I_CMOVL = 730, I_CMOVLE = 745, I_CMOVNO = 647, I_CMOVNP = 722, + I_CMOVNS = 707, I_CMOVNZ = 677, I_CMOVO = 640, I_CMOVP = 715, I_CMOVS = 700, + I_CMOVZ = 670, I_CMP = 71, I_CMPEQPD = 4482, I_CMPEQPS = 4403, I_CMPEQSD = 4640, + I_CMPEQSS = 4561, I_CMPLEPD = 4500, I_CMPLEPS = 4421, I_CMPLESD = 4658, I_CMPLESS = 4579, + I_CMPLTPD = 4491, I_CMPLTPS = 4412, I_CMPLTSD = 4649, I_CMPLTSS = 4570, I_CMPNEQPD = 4521, + I_CMPNEQPS = 4442, I_CMPNEQSD = 4679, I_CMPNEQSS = 4600, I_CMPNLEPD = 4541, + I_CMPNLEPS = 4462, I_CMPNLESD = 4699, I_CMPNLESS = 4620, I_CMPNLTPD = 4531, + I_CMPNLTPS = 4452, I_CMPNLTSD = 4689, I_CMPNLTSS = 4610, I_CMPORDPD = 4551, + I_CMPORDPS = 4472, I_CMPORDSD = 4709, I_CMPORDSS = 4630, I_CMPS = 301, I_CMPUNORDPD = 4509, + I_CMPUNORDPS = 4430, I_CMPUNORDSD = 4667, I_CMPUNORDSS = 4588, I_CMPXCHG = 897, + I_CMPXCHG16B = 6406, I_CMPXCHG8B = 6395, I_COMISD = 2812, I_COMISS = 2804, + I_CPUID = 864, I_CQO = 255, I_CRC32 = 9291, I_CVTDQ2PD = 6820, I_CVTDQ2PS = 3340, + I_CVTPD2DQ = 6830, I_CVTPD2PI = 2714, I_CVTPD2PS = 3266, I_CVTPH2PS = 4194, + I_CVTPI2PD = 2528, I_CVTPI2PS = 2518, I_CVTPS2DQ = 3350, I_CVTPS2PD = 3256, + I_CVTPS2PH = 4204, I_CVTPS2PI = 2704, I_CVTSD2SI = 2734, I_CVTSD2SS = 3286, + I_CVTSI2SD = 2548, I_CVTSI2SS = 2538, I_CVTSS2SD = 3276, I_CVTSS2SI = 2724, + I_CVTTPD2DQ = 6809, I_CVTTPD2PI = 2647, I_CVTTPS2DQ = 3360, I_CVTTPS2PI = 2636, + I_CVTTSD2SI = 2669, I_CVTTSS2SI = 2658, I_CWD = 245, I_CWDE = 233, I_DAA = 46, + I_DAS = 56, I_DEC = 86, I_DIV = 1645, I_DIVPD = 3532, I_DIVPS = 3525, I_DIVSD = 3546, + I_DIVSS = 3539, I_DPPD = 9648, I_DPPS = 9635, I_EMMS = 4133, I_ENTER = 340, + I_EXTRACTPS = 9513, I_EXTRQ = 4169, I_F2XM1 = 1191, I_FABS = 1122, I_FADD = 1022, + I_FADDP = 1548, I_FBLD = 1600, I_FBSTP = 1606, I_FCHS = 1116, I_FCLEX = 7322, + I_FCMOVB = 1375, I_FCMOVBE = 1391, I_FCMOVE = 1383, I_FCMOVNB = 1444, I_FCMOVNBE = 1462, + I_FCMOVNE = 1453, I_FCMOVNU = 1472, I_FCMOVU = 1400, I_FCOM = 1034, I_FCOMI = 1511, + I_FCOMIP = 1622, I_FCOMP = 1040, I_FCOMPP = 1562, I_FCOS = 1310, I_FDECSTP = 1237, + I_FDIV = 1060, I_FDIVP = 1593, I_FDIVR = 1066, I_FDIVRP = 1585, I_FEDISI = 1487, + I_FEMMS = 573, I_FENI = 1481, I_FFREE = 1526, I_FIADD = 1316, I_FICOM = 1330, + I_FICOMP = 1337, I_FIDIV = 1360, I_FIDIVR = 1367, I_FILD = 1417, I_FIMUL = 1323, + I_FINCSTP = 1246, I_FINIT = 7337, I_FIST = 1431, I_FISTP = 1437, I_FISTTP = 1423, + I_FISUB = 1345, I_FISUBR = 1352, I_FLD = 1073, I_FLD1 = 1140, I_FLDCW = 1097, + I_FLDENV = 1089, I_FLDL2E = 1154, I_FLDL2T = 1146, I_FLDLG2 = 1169, I_FLDLN2 = 1177, + I_FLDPI = 1162, I_FLDZ = 1185, I_FMUL = 1028, I_FMULP = 1555, I_FNCLEX = 7314, + I_FNINIT = 7329, I_FNOP = 1110, I_FNSAVE = 7344, I_FNSTCW = 7299, I_FNSTENV = 7282, + I_FNSTSW = 7359, I_FPATAN = 1212, I_FPREM = 1255, I_FPREM1 = 1229, I_FPTAN = 1205, + I_FRNDINT = 1287, I_FRSTOR = 1518, I_FSAVE = 7352, I_FSCALE = 1296, I_FSETPM = 1495, + I_FSIN = 1304, I_FSINCOS = 1278, I_FSQRT = 1271, I_FST = 1078, I_FSTCW = 7307, + I_FSTENV = 7291, I_FSTP = 1083, I_FSTSW = 7367, I_FSUB = 1047, I_FSUBP = 1578, + I_FSUBR = 1053, I_FSUBRP = 1570, I_FTST = 1128, I_FUCOM = 1533, I_FUCOMI = 1503, + I_FUCOMIP = 1613, I_FUCOMP = 1540, I_FUCOMPP = 1408, I_FXAM = 1134, I_FXCH = 1104, + I_FXRSTOR = 9925, I_FXRSTOR64 = 9934, I_FXSAVE = 9897, I_FXSAVE64 = 9905, + I_FXTRACT = 1220, I_FYL2X = 1198, I_FYL2XP1 = 1262, I_GETSEC = 632, I_HADDPD = 4214, + I_HADDPS = 4222, I_HLT = 481, I_HSUBPD = 4248, I_HSUBPS = 4256, I_IDIV = 1650, + I_IMUL = 117, I_IN = 446, I_INC = 81, I_INS = 123, I_INSERTPS = 9580, I_INSERTQ = 4176, + I_INT = 366, I_INT1 = 475, I_INT3 = 360, I_INTO = 371, I_INVD = 554, I_INVEPT = 8317, + I_INVLPG = 1726, I_INVLPGA = 1880, I_INVPCID = 8334, I_INVVPID = 8325, I_IRET = 377, + I_JA = 166, I_JAE = 147, I_JB = 143, I_JBE = 161, I_JCXZ = 426, I_JECXZ = 432, + I_JG = 202, I_JGE = 192, I_JL = 188, I_JLE = 197, I_JMP = 461, I_JMP_FAR = 466, + I_JNO = 138, I_JNP = 183, I_JNS = 174, I_JNZ = 156, I_JO = 134, I_JP = 179, + I_JRCXZ = 439, I_JS = 170, I_JZ = 152, I_LAHF = 289, I_LAR = 521, I_LDDQU = 7027, + I_LDMXCSR = 9955, I_LDS = 335, I_LEA = 223, I_LEAVE = 347, I_LES = 330, I_LFENCE = 4298, + I_LFS = 916, I_LGDT = 1702, I_LGS = 921, I_LIDT = 1708, I_LLDT = 1667, I_LMSW = 1720, + I_LODS = 313, I_LOOP = 420, I_LOOPNZ = 405, I_LOOPZ = 413, I_LSL = 526, I_LSS = 906, + I_LTR = 1673, I_LZCNT = 4396, I_MASKMOVDQU = 7152, I_MASKMOVQ = 7142, I_MAXPD = 3592, + I_MAXPS = 3585, I_MAXSD = 3606, I_MAXSS = 3599, I_MFENCE = 4324, I_MINPD = 3472, + I_MINPS = 3465, I_MINSD = 3486, I_MINSS = 3479, I_MONITOR = 1770, I_MOV = 218, + I_MOVAPD = 2492, I_MOVAPS = 2484, I_MOVBE = 9284, I_MOVD = 3953, I_MOVDDUP = 2219, + I_MOVDQ2Q = 6555, I_MOVDQA = 3979, I_MOVDQU = 3987, I_MOVHLPS = 2184, I_MOVHPD = 2378, + I_MOVHPS = 2370, I_MOVLHPS = 2361, I_MOVLPD = 2201, I_MOVLPS = 2193, I_MOVMSKPD = 2848, + I_MOVMSKPS = 2838, I_MOVNTDQ = 6882, I_MOVNTDQA = 7928, I_MOVNTI = 951, I_MOVNTPD = 2589, + I_MOVNTPS = 2580, I_MOVNTQ = 6874, I_MOVNTSD = 2607, I_MOVNTSS = 2598, I_MOVQ = 3959, + I_MOVQ2DQ = 6546, I_MOVS = 295, I_MOVSD = 2143, I_MOVSHDUP = 2386, I_MOVSLDUP = 2209, + I_MOVSS = 2136, I_MOVSX = 938, I_MOVSXD = 10038, I_MOVUPD = 2128, I_MOVUPS = 2120, + I_MOVZX = 926, I_MPSADBW = 9661, I_MUL = 1640, I_MULPD = 3203, I_MULPS = 3196, + I_MULSD = 3217, I_MULSS = 3210, I_MWAIT = 1779, I_NEG = 1635, I_NOP = 580, + I_NOT = 1630, I_OR = 27, I_ORPD = 3086, I_ORPS = 3080, I_OUT = 450, I_OUTS = 128, + I_PABSB = 7721, I_PABSD = 7751, I_PABSW = 7736, I_PACKSSDW = 3882, I_PACKSSWB = 3714, + I_PACKUSDW = 7949, I_PACKUSWB = 3792, I_PADDB = 7237, I_PADDD = 7267, I_PADDQ = 6514, + I_PADDSB = 6963, I_PADDSW = 6980, I_PADDUSB = 6653, I_PADDUSW = 6672, I_PADDW = 7252, + I_PALIGNR = 9443, I_PAND = 6640, I_PANDN = 6698, I_PAUSE = 10046, I_PAVGB = 6713, + I_PAVGUSB = 2111, I_PAVGW = 6758, I_PBLENDVB = 7632, I_PBLENDW = 9424, I_PCLMULQDQ = 9680, + I_PCMPEQB = 4076, I_PCMPEQD = 4114, I_PCMPEQQ = 7909, I_PCMPEQW = 4095, I_PCMPESTRI = 9759, + I_PCMPESTRM = 9736, I_PCMPGTB = 3735, I_PCMPGTD = 3773, I_PCMPGTQ = 8120, + I_PCMPGTW = 3754, I_PCMPISTRI = 9805, I_PCMPISTRM = 9782, I_PEXTRB = 9462, + I_PEXTRD = 9479, I_PEXTRQ = 9487, I_PEXTRW = 6344, I_PF2ID = 1947, I_PF2IW = 1940, + I_PFACC = 2061, I_PFADD = 2010, I_PFCMPEQ = 2068, I_PFCMPGE = 1971, I_PFCMPGT = 2017, + I_PFMAX = 2026, I_PFMIN = 1980, I_PFMUL = 2077, I_PFNACC = 1954, I_PFPNACC = 1962, + I_PFRCP = 1987, I_PFRCPIT1 = 2033, I_PFRCPIT2 = 2084, I_PFRSQIT1 = 2043, I_PFRSQRT = 1994, + I_PFSUB = 2003, I_PFSUBR = 2053, I_PHADDD = 7408, I_PHADDSW = 7425, I_PHADDW = 7391, + I_PHMINPOSUW = 8292, I_PHSUBD = 7484, I_PHSUBSW = 7501, I_PHSUBW = 7467, I_PI2FD = 1933, + I_PI2FW = 1926, I_PINSRB = 9563, I_PINSRD = 9601, I_PINSRQ = 9609, I_PINSRW = 6327, + I_PMADDUBSW = 7444, I_PMADDWD = 7106, I_PMAXSB = 8207, I_PMAXSD = 8224, I_PMAXSW = 6997, + I_PMAXUB = 6681, I_PMAXUD = 8258, I_PMAXUW = 8241, I_PMINSB = 8139, I_PMINSD = 8156, + I_PMINSW = 6935, I_PMINUB = 6623, I_PMINUD = 8190, I_PMINUW = 8173, I_PMOVMSKB = 6564, + I_PMOVSXBD = 7787, I_PMOVSXBQ = 7808, I_PMOVSXBW = 7766, I_PMOVSXDQ = 7871, + I_PMOVSXWD = 7829, I_PMOVSXWQ = 7850, I_PMOVZXBD = 8015, I_PMOVZXBQ = 8036, + I_PMOVZXBW = 7994, I_PMOVZXDQ = 8099, I_PMOVZXWD = 8057, I_PMOVZXWQ = 8078, + I_PMULDQ = 7892, I_PMULHRSW = 7571, I_PMULHRW = 2094, I_PMULHUW = 6773, I_PMULHW = 6792, + I_PMULLD = 8275, I_PMULLW = 6529, I_PMULUDQ = 7087, I_POP = 22, I_POPA = 98, + I_POPCNT = 4371, I_POPF = 277, I_POR = 6952, I_PREFETCH = 1905, I_PREFETCHNTA = 2435, + I_PREFETCHT0 = 2448, I_PREFETCHT1 = 2460, I_PREFETCHT2 = 2472, I_PREFETCHW = 1915, + I_PSADBW = 7125, I_PSHUFB = 7374, I_PSHUFD = 4021, I_PSHUFHW = 4029, I_PSHUFLW = 4038, + I_PSHUFW = 4013, I_PSIGNB = 7520, I_PSIGND = 7554, I_PSIGNW = 7537, I_PSLLD = 7057, + I_PSLLDQ = 9880, I_PSLLQ = 7072, I_PSLLW = 7042, I_PSRAD = 6743, I_PSRAW = 6728, + I_PSRLD = 6484, I_PSRLDQ = 9863, I_PSRLQ = 6499, I_PSRLW = 6469, I_PSUBB = 7177, + I_PSUBD = 7207, I_PSUBQ = 7222, I_PSUBSB = 6901, I_PSUBSW = 6918, I_PSUBUSB = 6585, + I_PSUBUSW = 6604, I_PSUBW = 7192, I_PSWAPD = 2103, I_PTEST = 7662, I_PUNPCKHBW = 3813, + I_PUNPCKHDQ = 3859, I_PUNPCKHQDQ = 3928, I_PUNPCKHWD = 3836, I_PUNPCKLBW = 3645, + I_PUNPCKLDQ = 3691, I_PUNPCKLQDQ = 3903, I_PUNPCKLWD = 3668, I_PUSH = 16, + I_PUSHA = 91, I_PUSHF = 270, I_PXOR = 7014, I_RCL = 976, I_RCPPS = 2986, I_RCPSS = 2993, + I_RCR = 981, I_RDFSBASE = 9915, I_RDGSBASE = 9945, I_RDMSR = 599, I_RDPMC = 606, + I_RDRAND = 10059, I_RDTSC = 592, I_RDTSCP = 1897, I_RET = 325, I_RETF = 354, + I_ROL = 966, I_ROR = 971, I_ROUNDPD = 9329, I_ROUNDPS = 9310, I_ROUNDSD = 9367, + I_ROUNDSS = 9348, I_RSM = 881, I_RSQRTPS = 2948, I_RSQRTSS = 2957, I_SAHF = 283, + I_SAL = 996, I_SALC = 393, I_SAR = 1001, I_SBB = 36, I_SCAS = 319, I_SETA = 806, + I_SETAE = 779, I_SETB = 773, I_SETBE = 799, I_SETG = 858, I_SETGE = 844, I_SETL = 838, + I_SETLE = 851, I_SETNO = 766, I_SETNP = 831, I_SETNS = 818, I_SETNZ = 792, + I_SETO = 760, I_SETP = 825, I_SETS = 812, I_SETZ = 786, I_SFENCE = 4354, I_SGDT = 1690, + I_SHL = 986, I_SHLD = 875, I_SHR = 991, I_SHRD = 891, I_SHUFPD = 6369, I_SHUFPS = 6361, + I_SIDT = 1696, I_SKINIT = 1872, I_SLDT = 1656, I_SMSW = 1714, I_SQRTPD = 2888, + I_SQRTPS = 2880, I_SQRTSD = 2904, I_SQRTSS = 2896, I_STAC = 1792, I_STC = 496, + I_STD = 516, I_STGI = 1860, I_STI = 506, I_STMXCSR = 9984, I_STOS = 307, I_STR = 1662, + I_SUB = 51, I_SUBPD = 3412, I_SUBPS = 3405, I_SUBSD = 3426, I_SUBSS = 3419, + I_SWAPGS = 1889, I_SYSCALL = 531, I_SYSENTER = 613, I_SYSEXIT = 623, I_SYSRET = 546, + I_TEST = 206, I_TZCNT = 4384, I_UCOMISD = 2775, I_UCOMISS = 2766, I_UD2 = 568, + I_UNPCKHPD = 2329, I_UNPCKHPS = 2319, I_UNPCKLPD = 2287, I_UNPCKLPS = 2277, + I_VADDPD = 3172, I_VADDPS = 3164, I_VADDSD = 3188, I_VADDSS = 3180, I_VADDSUBPD = 6447, + I_VADDSUBPS = 6458, I_VAESDEC = 9250, I_VAESDECLAST = 9271, I_VAESENC = 9208, + I_VAESENCLAST = 9229, I_VAESIMC = 9191, I_VAESKEYGENASSIST = 9845, I_VANDNPD = 3071, + I_VANDNPS = 3062, I_VANDPD = 3038, I_VANDPS = 3030, I_VBLENDPD = 9414, I_VBLENDPS = 9395, + I_VBLENDVPD = 9714, I_VBLENDVPS = 9703, I_VBROADCASTF128 = 7705, I_VBROADCASTSD = 7691, + I_VBROADCASTSS = 7677, I_VCMPEQPD = 5121, I_VCMPEQPS = 4719, I_VCMPEQSD = 5925, + I_VCMPEQSS = 5523, I_VCMPEQ_OSPD = 5302, I_VCMPEQ_OSPS = 4900, I_VCMPEQ_OSSD = 6106, + I_VCMPEQ_OSSS = 5704, I_VCMPEQ_UQPD = 5208, I_VCMPEQ_UQPS = 4806, I_VCMPEQ_UQSD = 6012, + I_VCMPEQ_UQSS = 5610, I_VCMPEQ_USPD = 5411, I_VCMPEQ_USPS = 5009, I_VCMPEQ_USSD = 6215, + I_VCMPEQ_USSS = 5813, I_VCMPFALSEPD = 5243, I_VCMPFALSEPS = 4841, I_VCMPFALSESD = 6047, + I_VCMPFALSESS = 5645, I_VCMPFALSE_OSPD = 5452, I_VCMPFALSE_OSPS = 5050, I_VCMPFALSE_OSSD = 6256, + I_VCMPFALSE_OSSS = 5854, I_VCMPGEPD = 5270, I_VCMPGEPS = 4868, I_VCMPGESD = 6074, + I_VCMPGESS = 5672, I_VCMPGE_OQPD = 5482, I_VCMPGE_OQPS = 5080, I_VCMPGE_OQSD = 6286, + I_VCMPGE_OQSS = 5884, I_VCMPGTPD = 5280, I_VCMPGTPS = 4878, I_VCMPGTSD = 6084, + I_VCMPGTSS = 5682, I_VCMPGT_OQPD = 5495, I_VCMPGT_OQPS = 5093, I_VCMPGT_OQSD = 6299, + I_VCMPGT_OQSS = 5897, I_VCMPLEPD = 5141, I_VCMPLEPS = 4739, I_VCMPLESD = 5945, + I_VCMPLESS = 5543, I_VCMPLE_OQPD = 5328, I_VCMPLE_OQPS = 4926, I_VCMPLE_OQSD = 6132, + I_VCMPLE_OQSS = 5730, I_VCMPLTPD = 5131, I_VCMPLTPS = 4729, I_VCMPLTSD = 5935, + I_VCMPLTSS = 5533, I_VCMPLT_OQPD = 5315, I_VCMPLT_OQPS = 4913, I_VCMPLT_OQSD = 6119, + I_VCMPLT_OQSS = 5717, I_VCMPNEQPD = 5164, I_VCMPNEQPS = 4762, I_VCMPNEQSD = 5968, + I_VCMPNEQSS = 5566, I_VCMPNEQ_OQPD = 5256, I_VCMPNEQ_OQPS = 4854, I_VCMPNEQ_OQSD = 6060, + I_VCMPNEQ_OQSS = 5658, I_VCMPNEQ_OSPD = 5468, I_VCMPNEQ_OSPS = 5066, I_VCMPNEQ_OSSD = 6272, + I_VCMPNEQ_OSSS = 5870, I_VCMPNEQ_USPD = 5356, I_VCMPNEQ_USPS = 4954, I_VCMPNEQ_USSD = 6160, + I_VCMPNEQ_USSS = 5758, I_VCMPNGEPD = 5221, I_VCMPNGEPS = 4819, I_VCMPNGESD = 6025, + I_VCMPNGESS = 5623, I_VCMPNGE_UQPD = 5424, I_VCMPNGE_UQPS = 5022, I_VCMPNGE_UQSD = 6228, + I_VCMPNGE_UQSS = 5826, I_VCMPNGTPD = 5232, I_VCMPNGTPS = 4830, I_VCMPNGTSD = 6036, + I_VCMPNGTSS = 5634, I_VCMPNGT_UQPD = 5438, I_VCMPNGT_UQPS = 5036, I_VCMPNGT_UQSD = 6242, + I_VCMPNGT_UQSS = 5840, I_VCMPNLEPD = 5186, I_VCMPNLEPS = 4784, I_VCMPNLESD = 5990, + I_VCMPNLESS = 5588, I_VCMPNLE_UQPD = 5384, I_VCMPNLE_UQPS = 4982, I_VCMPNLE_UQSD = 6188, + I_VCMPNLE_UQSS = 5786, I_VCMPNLTPD = 5175, I_VCMPNLTPS = 4773, I_VCMPNLTSD = 5979, + I_VCMPNLTSS = 5577, I_VCMPNLT_UQPD = 5370, I_VCMPNLT_UQPS = 4968, I_VCMPNLT_UQSD = 6174, + I_VCMPNLT_UQSS = 5772, I_VCMPORDPD = 5197, I_VCMPORDPS = 4795, I_VCMPORDSD = 6001, + I_VCMPORDSS = 5599, I_VCMPORD_SPD = 5398, I_VCMPORD_SPS = 4996, I_VCMPORD_SSD = 6202, + I_VCMPORD_SSS = 5800, I_VCMPTRUEPD = 5290, I_VCMPTRUEPS = 4888, I_VCMPTRUESD = 6094, + I_VCMPTRUESS = 5692, I_VCMPTRUE_USPD = 5508, I_VCMPTRUE_USPS = 5106, I_VCMPTRUE_USSD = 6312, + I_VCMPTRUE_USSS = 5910, I_VCMPUNORDPD = 5151, I_VCMPUNORDPS = 4749, I_VCMPUNORDSD = 5955, + I_VCMPUNORDSS = 5553, I_VCMPUNORD_SPD = 5341, I_VCMPUNORD_SPS = 4939, I_VCMPUNORD_SSD = 6145, + I_VCMPUNORD_SSS = 5743, I_VCOMISD = 2829, I_VCOMISS = 2820, I_VCVTDQ2PD = 6852, + I_VCVTDQ2PS = 3371, I_VCVTPD2DQ = 6863, I_VCVTPD2PS = 3307, I_VCVTPS2DQ = 3382, + I_VCVTPS2PD = 3296, I_VCVTSD2SI = 2755, I_VCVTSD2SS = 3329, I_VCVTSI2SD = 2569, + I_VCVTSI2SS = 2558, I_VCVTSS2SD = 3318, I_VCVTSS2SI = 2744, I_VCVTTPD2DQ = 6840, + I_VCVTTPS2DQ = 3393, I_VCVTTSD2SI = 2692, I_VCVTTSS2SI = 2680, I_VDIVPD = 3561, + I_VDIVPS = 3553, I_VDIVSD = 3577, I_VDIVSS = 3569, I_VDPPD = 9654, I_VDPPS = 9641, + I_VERR = 1678, I_VERW = 1684, I_VEXTRACTF128 = 9549, I_VEXTRACTPS = 9524, + I_VFMADD132PD = 8420, I_VFMADD132PS = 8407, I_VFMADD132SD = 8446, I_VFMADD132SS = 8433, + I_VFMADD213PD = 8700, I_VFMADD213PS = 8687, I_VFMADD213SD = 8726, I_VFMADD213SS = 8713, + I_VFMADD231PD = 8980, I_VFMADD231PS = 8967, I_VFMADD231SD = 9006, I_VFMADD231SS = 8993, + I_VFMADDSUB132PD = 8359, I_VFMADDSUB132PS = 8343, I_VFMADDSUB213PD = 8639, + I_VFMADDSUB213PS = 8623, I_VFMADDSUB231PD = 8919, I_VFMADDSUB231PS = 8903, + I_VFMSUB132PD = 8472, I_VFMSUB132PS = 8459, I_VFMSUB132SD = 8498, I_VFMSUB132SS = 8485, + I_VFMSUB213PD = 8752, I_VFMSUB213PS = 8739, I_VFMSUB213SD = 8778, I_VFMSUB213SS = 8765, + I_VFMSUB231PD = 9032, I_VFMSUB231PS = 9019, I_VFMSUB231SD = 9058, I_VFMSUB231SS = 9045, + I_VFMSUBADD132PD = 8391, I_VFMSUBADD132PS = 8375, I_VFMSUBADD213PD = 8671, + I_VFMSUBADD213PS = 8655, I_VFMSUBADD231PD = 8951, I_VFMSUBADD231PS = 8935, + I_VFNMADD132PD = 8525, I_VFNMADD132PS = 8511, I_VFNMADD132SD = 8553, I_VFNMADD132SS = 8539, + I_VFNMADD213PD = 8805, I_VFNMADD213PS = 8791, I_VFNMADD213SD = 8833, I_VFNMADD213SS = 8819, + I_VFNMADD231PD = 9085, I_VFNMADD231PS = 9071, I_VFNMADD231SD = 9113, I_VFNMADD231SS = 9099, + I_VFNMSUB132PD = 8581, I_VFNMSUB132PS = 8567, I_VFNMSUB132SD = 8609, I_VFNMSUB132SS = 8595, + I_VFNMSUB213PD = 8861, I_VFNMSUB213PS = 8847, I_VFNMSUB213SD = 8889, I_VFNMSUB213SS = 8875, + I_VFNMSUB231PD = 9141, I_VFNMSUB231PS = 9127, I_VFNMSUB231SD = 9169, I_VFNMSUB231SS = 9155, + I_VHADDPD = 4230, I_VHADDPS = 4239, I_VHSUBPD = 4264, I_VHSUBPS = 4273, I_VINSERTF128 = 9536, + I_VINSERTPS = 9590, I_VLDDQU = 7034, I_VLDMXCSR = 9974, I_VMASKMOVDQU = 7164, + I_VMASKMOVPD = 7982, I_VMASKMOVPS = 7970, I_VMAXPD = 3621, I_VMAXPS = 3613, + I_VMAXSD = 3637, I_VMAXSS = 3629, I_VMCALL = 1734, I_VMCLEAR = 10022, I_VMFUNC = 1814, + I_VMINPD = 3501, I_VMINPS = 3493, I_VMINSD = 3517, I_VMINSS = 3509, I_VMLAUNCH = 1742, + I_VMLOAD = 1844, I_VMMCALL = 1835, I_VMOVAPD = 2509, I_VMOVAPS = 2500, I_VMOVD = 3965, + I_VMOVDDUP = 2267, I_VMOVDQA = 3995, I_VMOVDQU = 4004, I_VMOVHLPS = 2228, + I_VMOVHPD = 2415, I_VMOVHPS = 2406, I_VMOVLHPS = 2396, I_VMOVLPD = 2247, I_VMOVLPS = 2238, + I_VMOVMSKPD = 2869, I_VMOVMSKPS = 2858, I_VMOVNTDQ = 6891, I_VMOVNTDQA = 7938, + I_VMOVNTPD = 2626, I_VMOVNTPS = 2616, I_VMOVQ = 3972, I_VMOVSD = 2176, I_VMOVSHDUP = 2424, + I_VMOVSLDUP = 2256, I_VMOVSS = 2168, I_VMOVUPD = 2159, I_VMOVUPS = 2150, I_VMPSADBW = 9670, + I_VMPTRLD = 10013, I_VMPTRST = 6418, I_VMREAD = 4161, I_VMRESUME = 1752, I_VMRUN = 1828, + I_VMSAVE = 1852, I_VMULPD = 3232, I_VMULPS = 3224, I_VMULSD = 3248, I_VMULSS = 3240, + I_VMWRITE = 4185, I_VMXOFF = 1762, I_VMXON = 10031, I_VORPD = 3099, I_VORPS = 3092, + I_VPABSB = 7728, I_VPABSD = 7758, I_VPABSW = 7743, I_VPACKSSDW = 3892, I_VPACKSSWB = 3724, + I_VPACKUSDW = 7959, I_VPACKUSWB = 3802, I_VPADDB = 7244, I_VPADDD = 7274, + I_VPADDQ = 6521, I_VPADDSB = 6971, I_VPADDSW = 6988, I_VPADDUSW = 6662, I_VPADDW = 7259, + I_VPALIGNR = 9452, I_VPAND = 6646, I_VPANDN = 6705, I_VPAVGB = 6720, I_VPAVGW = 6765, + I_VPBLENDVB = 9725, I_VPBLENDW = 9433, I_VPCLMULQDQ = 9691, I_VPCMPEQB = 4085, + I_VPCMPEQD = 4123, I_VPCMPEQQ = 7918, I_VPCMPEQW = 4104, I_VPCMPESTRI = 9770, + I_VPCMPESTRM = 9747, I_VPCMPGTB = 3744, I_VPCMPGTD = 3782, I_VPCMPGTQ = 8129, + I_VPCMPGTW = 3763, I_VPCMPISTRI = 9816, I_VPCMPISTRM = 9793, I_VPERM2F128 = 9298, + I_VPERMILPD = 7603, I_VPERMILPS = 7592, I_VPEXTRB = 9470, I_VPEXTRD = 9495, + I_VPEXTRQ = 9504, I_VPEXTRW = 6352, I_VPHADDD = 7416, I_VPHADDSW = 7434, I_VPHADDW = 7399, + I_VPHMINPOSUW = 8304, I_VPHSUBD = 7492, I_VPHSUBSW = 7510, I_VPHSUBW = 7475, + I_VPINSRB = 9571, I_VPINSRD = 9617, I_VPINSRQ = 9626, I_VPINSRW = 6335, I_VPMADDUBSW = 7455, + I_VPMADDWD = 7115, I_VPMAXSB = 8215, I_VPMAXSD = 8232, I_VPMAXSW = 7005, I_VPMAXUB = 6689, + I_VPMAXUD = 8266, I_VPMAXUW = 8249, I_VPMINSB = 8147, I_VPMINSD = 8164, I_VPMINSW = 6943, + I_VPMINUB = 6631, I_VPMINUD = 8198, I_VPMINUW = 8181, I_VPMOVMSKB = 6574, + I_VPMOVSXBD = 7797, I_VPMOVSXBQ = 7818, I_VPMOVSXBW = 7776, I_VPMOVSXDQ = 7881, + I_VPMOVSXWD = 7839, I_VPMOVSXWQ = 7860, I_VPMOVZXBD = 8025, I_VPMOVZXBQ = 8046, + I_VPMOVZXBW = 8004, I_VPMOVZXDQ = 8109, I_VPMOVZXWD = 8067, I_VPMOVZXWQ = 8088, + I_VPMULDQ = 7900, I_VPMULHRSW = 7581, I_VPMULHUW = 6782, I_VPMULHW = 6800, + I_VPMULLD = 8283, I_VPMULLW = 6537, I_VPMULUDQ = 7096, I_VPOR = 6957, I_VPSADBW = 7133, + I_VPSHUFB = 7382, I_VPSHUFD = 4047, I_VPSHUFHW = 4056, I_VPSHUFLW = 4066, + I_VPSIGNB = 7528, I_VPSIGND = 7562, I_VPSIGNW = 7545, I_VPSLLD = 7064, I_VPSLLDQ = 9888, + I_VPSLLQ = 7079, I_VPSLLW = 7049, I_VPSRAD = 6750, I_VPSRAW = 6735, I_VPSRLD = 6491, + I_VPSRLDQ = 9871, I_VPSRLQ = 6506, I_VPSRLW = 6476, I_VPSUBB = 7184, I_VPSUBD = 7214, + I_VPSUBQ = 7229, I_VPSUBSB = 6909, I_VPSUBSW = 6926, I_VPSUBUSB = 6594, I_VPSUBUSW = 6613, + I_VPSUBW = 7199, I_VPTEST = 7669, I_VPUNPCKHBW = 3824, I_VPUNPCKHDQ = 3870, + I_VPUNPCKHQDQ = 3940, I_VPUNPCKHWD = 3847, I_VPUNPCKLBW = 3656, I_VPUNPCKLDQ = 3702, + I_VPUNPCKLQDQ = 3915, I_VPUNPCKLWD = 3679, I_VPXOR = 7020, I_VRCPPS = 3000, + I_VRCPSS = 3008, I_VROUNDPD = 9338, I_VROUNDPS = 9319, I_VROUNDSD = 9376, + I_VROUNDSS = 9357, I_VRSQRTPS = 2966, I_VRSQRTSS = 2976, I_VSHUFPD = 6386, + I_VSHUFPS = 6377, I_VSQRTPD = 2921, I_VSQRTPS = 2912, I_VSQRTSD = 2939, I_VSQRTSS = 2930, + I_VSTMXCSR = 10003, I_VSUBPD = 3441, I_VSUBPS = 3433, I_VSUBSD = 3457, I_VSUBSS = 3449, + I_VTESTPD = 7623, I_VTESTPS = 7614, I_VUCOMISD = 2794, I_VUCOMISS = 2784, + I_VUNPCKHPD = 2350, I_VUNPCKHPS = 2339, I_VUNPCKLPD = 2308, I_VUNPCKLPS = 2297, + I_VXORPD = 3128, I_VXORPS = 3120, I_VZEROALL = 4151, I_VZEROUPPER = 4139, + I_WAIT = 10053, I_WBINVD = 560, I_WRFSBASE = 9964, I_WRGSBASE = 9993, I_WRMSR = 585, + I_XABORT = 1006, I_XADD = 945, I_XBEGIN = 1014, I_XCHG = 212, I_XEND = 1822, + I_XGETBV = 1798, I_XLAT = 399, I_XOR = 61, I_XORPD = 3113, I_XORPS = 3106, + I_XRSTOR = 4306, I_XRSTOR64 = 4314, I_XSAVE = 4282, I_XSAVE64 = 4289, I_XSAVEOPT = 4332, + I_XSAVEOPT64 = 4342, I_XSETBV = 1806, I__3DNOW = 10067 } _InstructionType; typedef enum { diff --git a/NativeCore/Dependencies/distorm/src/config.h b/NativeCore/Dependencies/distorm/src/config.h index 3fdaf44a..6febad67 100644 --- a/NativeCore/Dependencies/distorm/src/config.h +++ b/NativeCore/Dependencies/distorm/src/config.h @@ -4,7 +4,7 @@ config.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -13,7 +13,7 @@ This library is licensed under the BSD license. See the file COPYING. #define CONFIG_H /* diStorm version number. */ -#define __DISTORMV__ 0x030400 +#define __DISTORMV__ 0x030503 #include /* memset, memcpy - can be easily self implemented for libc independency. */ @@ -57,6 +57,7 @@ This library is licensed under the BSD license. See the file COPYING. #define _DLLEXPORT_ #define _FASTCALL_ +/* Keep inline as static (arrrrg) as it would break linux on some flavors otherwise. */ #define _INLINE_ static /* GCC ignores this directive... */ /*#define _FASTCALL_ __attribute__((__fastcall__))*/ @@ -94,7 +95,7 @@ This library is licensed under the BSD license. See the file COPYING. #define _DLLEXPORT_ #define _FASTCALL_ -#define _INLINE_ +#define _INLINE_ static /* End of __TINYC__ */ diff --git a/NativeCore/Dependencies/distorm/src/decoder.c b/NativeCore/Dependencies/distorm/src/decoder.c index 188996df..29adcd43 100644 --- a/NativeCore/Dependencies/distorm/src/decoder.c +++ b/NativeCore/Dependencies/distorm/src/decoder.c @@ -4,7 +4,7 @@ decoder.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -24,30 +24,34 @@ This library is licensed under the BSD license. See the file COPYING. static _DecodeType decode_get_effective_addr_size(_DecodeType dt, _iflags decodedPrefixes) { /* - * This table is to map from the current decoding mode to an effective address size: + * Map from the current decoding mode to an effective address size: * Decode16 -> Decode32 * Decode32 -> Decode16 * Decode64 -> Decode32 */ - static _DecodeType AddrSizeTable[] = {Decode32Bits, Decode16Bits, Decode32Bits}; /* Switch to non default mode if prefix exists, only for ADDRESS SIZE. */ - if (decodedPrefixes & INST_PRE_ADDR_SIZE) dt = AddrSizeTable[dt]; + if (decodedPrefixes & INST_PRE_ADDR_SIZE) { + if (dt == Decode32Bits) return Decode16Bits; + return Decode32Bits; + } return dt; } static _DecodeType decode_get_effective_op_size(_DecodeType dt, _iflags decodedPrefixes, unsigned int rex, _iflags instFlags) { /* - * This table is to map from the current decoding mode to an effective operand size: + * Map from the current decoding mode to an effective operand size: * Decode16 -> Decode32 * Decode32 -> Decode16 * Decode64 -> Decode16 * Not that in 64bits it's a bit more complicated, because of REX and promoted instructions. */ - static _DecodeType OpSizeTable[] = {Decode32Bits, Decode16Bits, Decode16Bits}; - if (decodedPrefixes & INST_PRE_OP_SIZE) return OpSizeTable[dt]; + if (decodedPrefixes & INST_PRE_OP_SIZE) { + if (dt == Decode16Bits) return Decode32Bits; + return Decode16Bits; + } if (dt == Decode64Bits) { /* @@ -60,83 +64,71 @@ static _DecodeType decode_get_effective_op_size(_DecodeType dt, _iflags decodedP /* Automatically promoted instructions have only INST_64BITS SET! */ if (((instFlags & (INST_64BITS | INST_PRE_REX)) == INST_64BITS) || /* Other instructions in 64 bits can be promoted only with a REX prefix. */ - ((decodedPrefixes & INST_PRE_REX) && (rex & PREFIX_EX_W))) dt = Decode64Bits; - else dt = Decode32Bits; /* Default. */ + ((decodedPrefixes & INST_PRE_REX) && (rex & PREFIX_EX_W))) return Decode64Bits; + return Decode32Bits; /* Default. */ } + return dt; } -/* A helper macro to convert from diStorm's CPU flags to EFLAGS. */ +/* + * A helper macro to convert from diStorm's CPU flags to EFLAGS. + * Copy eflags from compact version (8 bits) to eflags compatible (16 bits). + * From D_COMPACT_IF to D_IF, bit index 1 to 9. + * From D_COMPACT_DF to D_DF, bit index 3 to 10. + * From D_COMPACT_OF to D_OF, bit index 5 to 11. + */ #define CONVERT_FLAGS_TO_EFLAGS(dst, src, field) dst->field = ((src->field & D_COMPACT_SAME_FLAGS) | \ - ((src->field & D_COMPACT_IF) ? D_IF : 0) | \ - ((src->field & D_COMPACT_DF) ? D_DF : 0) | \ - ((src->field & D_COMPACT_OF) ? D_OF : 0)); + ((src->field & D_COMPACT_IF) << (9 - 1)) | \ + ((src->field & D_COMPACT_DF) << (10 - 3)) | \ + ((src->field & D_COMPACT_OF) << (11 - 5))); -static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) +/* If DECRES_SUCCESS is returned, CI is in sync, otherwise it loses sync. */ +/* Important note: CI is keeping track only for code and codeLen, in case of a failure caller has to restart on their own. */ +static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, const uint8_t* startCode, _DInst* di) { - /* Remember whether the instruction is privileged. */ - uint16_t privilegedFlag = 0; - - /* The ModR/M byte of the current instruction. */ - unsigned int modrm = 0; - - /* The REX/VEX prefix byte value. */ - unsigned int vrex = ps->vrex; - - /* - * Backup original input, so we can use it later if a problem occurs - * (like not enough data for decoding, invalid opcode, etc). - */ - const uint8_t* startCode = ci->code; - /* Holds the info about the current found instruction. */ - _InstInfo* ii = NULL; - _InstInfo iip; /* Privileged instruction cache. */ - _InstSharedInfo* isi = NULL; - - /* Used only for special CMP instructions which have pseudo opcodes suffix. */ - unsigned char cmpType = 0; - - /* - * Indicates whether it is right to LOCK the instruction by decoding its first operand. - * Only then you know if it's ok to output the LOCK prefix's text... - * Used for first operand only. - */ - int lockable = FALSE; + _InstInfo* ii; + _InstSharedInfo* isi; /* Calculate (and cache) effective-operand-size and effective-address-size only once. */ _DecodeType effOpSz, effAdrSz; _iflags instFlags; - ii = inst_lookup(ci, ps); + /* The ModR/M byte of the current instruction. */ + unsigned int modrm = 0; + int isPrefixed = 0; + + ii = inst_lookup(ci, ps, &isPrefixed); if (ii == NULL) goto _Undecodable; + isi = &InstSharedInfoTable[ii->sharedIndex]; instFlags = FlagsTable[isi->flagsIndex]; - privilegedFlag = ii->opcodeId & OPCODE_ID_PRIVILEGED; - if (privilegedFlag) { + /* Cache the effective operand-size and address-size. */ + if (isPrefixed) { + /* - * Copy the privileged instruction info so we can remove the privileged bit - * from the opcodeId field. This makes sure we're not modifying the tables - * in case we lookup this privileged instruction later. - */ - iip = *ii; - iip.opcodeId &= ~OPCODE_ID_PRIVILEGED; - ii = &iip; - } + * If both REX and OpSize are available we will have to disable the OpSize, because REX has precedence. + * However, only if REX.W is set! + * We had to wait with this test, since the operand size may be a mandatory prefix, + * and we know it only after fetching opcode. + */ + if ((ps->decodedPrefixes & INST_PRE_OP_SIZE) && + (ps->prefixExtType == PET_REX) && + (ps->vrex & PREFIX_EX_W) && + (!ps->isOpSizeMandatory)) { + ps->decodedPrefixes &= ~INST_PRE_OP_SIZE; + prefixes_ignore(ps, PFXIDX_OP_SIZE); + } - /* - * If both REX and OpSize are available we will have to disable the OpSize, because REX has precedence. - * However, only if REX.W is set ! - * We had to wait with this test, since the operand size may be a mandatory prefix, - * and we know it only after prefetching. - */ - if ((ps->prefixExtType == PET_REX) && - (ps->decodedPrefixes & INST_PRE_OP_SIZE) && - (!ps->isOpSizeMandatory) && - (vrex & PREFIX_EX_W)) { - ps->decodedPrefixes &= ~INST_PRE_OP_SIZE; - prefixes_ignore(ps, PFXIDX_OP_SIZE); + effAdrSz = decode_get_effective_addr_size(ci->dt, ps->decodedPrefixes); + effOpSz = decode_get_effective_op_size(ci->dt, ps->decodedPrefixes, ps->vrex, instFlags); + } + else + { + effAdrSz = ci->dt; /* Default is current decoding type since there's no prefix. */ + effOpSz = decode_get_effective_op_size(ci->dt, 0, 0, instFlags); } /* @@ -153,161 +145,188 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) * Though, don't drop an instruction which is also supported in 16 and 32 bits. */ - /* ! ! ! DISABLED UNTIL FURTHER NOTICE ! ! ! Decode16Bits CAN NOW DECODE 32 BITS INSTRUCTIONS ! ! !*/ - /* if (ii && (dt == Decode16Bits) && (instFlags & INST_32BITS) && (~instFlags & INST_16BITS)) ii = NULL; */ + /* ! ! ! DISABLED UNTIL FURTHER NOTICE ! ! ! Decode16Bits CAN NOW DECODE 32 BITS INSTRUCTIONS ! ! !*/ + /* if (ii && (dt == Decode16Bits) && (instFlags & INST_32BITS) && (~instFlags & INST_16BITS)) ii = NULL; */ - /* Drop instructions which are invalid in 64 bits. */ - if ((ci->dt == Decode64Bits) && (instFlags & INST_INVALID_64BITS)) goto _Undecodable; - - /* If it's only a 64 bits instruction drop it in other decoding modes. */ - if ((ci->dt != Decode64Bits) && (instFlags & INST_64BITS_FETCH)) goto _Undecodable; + memset(di, 0, sizeof(_DInst)); if (instFlags & INST_MODRM_REQUIRED) { /* If the ModRM byte is not part of the opcode, skip the last byte code, so code points now to ModRM. */ - if (~instFlags & INST_MODRM_INCLUDED) { + if (!(instFlags & INST_MODRM_INCLUDED)) { ci->code++; if (--ci->codeLen < 0) goto _Undecodable; } modrm = *ci->code; - - /* Some instructions enforce that reg=000, so validate that. (Specifically EXTRQ). */ - if ((instFlags & INST_FORCE_REG0) && (((modrm >> 3) & 7) != 0)) goto _Undecodable; - /* Some instructions enforce that mod=11, so validate that. */ - if ((instFlags & INST_MODRR_REQUIRED) && (modrm < INST_DIVIDED_MODRM)) goto _Undecodable; } ci->code++; /* Skip the last byte we just read (either last opcode's byte code or a ModRM). */ - /* Cache the effective operand-size and address-size. */ - effOpSz = decode_get_effective_op_size(ci->dt, ps->decodedPrefixes, vrex, instFlags); - effAdrSz = decode_get_effective_addr_size(ci->dt, ps->decodedPrefixes); - - memset(di, 0, sizeof(_DInst)); - di->base = R_NONE; + di->addr = ci->codeOffset & ci->addrMask; + di->opcode = ii->opcodeId; + di->flags = isi->meta & META_INST_PRIVILEGED; /* - * Try to extract the next operand only if the latter exists. - * For example, if there is not first operand, no reason to try to extract second operand... - * I decided that a for-break is better for readability in this specific case than goto. - * Note: do-while with a constant 0 makes the compiler warning about it. + * Store the address size inside the flags. + * This is necessary for the caller to know the size of rSP when using PUSHA for example. */ - for (;;) { - if (isi->d != OT_NONE) { - if (!operands_extract(ci, di, ii, instFlags, (_OpType)isi->d, ONT_1, modrm, ps, effOpSz, effAdrSz, &lockable)) goto _Undecodable; - } else break; + di->base = R_NONE; + di->segment = R_NONE; + + FLAG_SET_ADDRSIZE(di, effAdrSz); + + /* Try to extract the next operand only if the latter exists. */ + if (isi->d != OT_NONE) { + unsigned int opsNo = 1; + _Operand* op = &di->ops[0]; + if (instFlags & (INST_MODRR_REQUIRED | INST_FORCE_REG0)) { + /* Some instructions enforce that mod=11, so validate that. */ + if ((modrm < INST_DIVIDED_MODRM) && (instFlags & INST_MODRR_REQUIRED)) goto _Undecodable; + /* Some instructions enforce that reg=000, so validate that. (Specifically EXTRQ). */ + if ((instFlags & INST_FORCE_REG0) && (((modrm >> 3) & 7) != 0)) goto _Undecodable; + } + if (!operands_extract(ci, di, ii, instFlags, (_OpType)isi->d, modrm, ps, effOpSz, effAdrSz, op++)) goto _Undecodable; if (isi->s != OT_NONE) { - if (!operands_extract(ci, di, ii, instFlags, (_OpType)isi->s, ONT_2, modrm, ps, effOpSz, effAdrSz, NULL)) goto _Undecodable; - } else break; - - /* Use third operand, only if the flags says this InstInfo requires it. */ - if (instFlags & INST_USE_OP3) { - if (!operands_extract(ci, di, ii, instFlags, (_OpType)((_InstInfoEx*)ii)->op3, ONT_3, modrm, ps, effOpSz, effAdrSz, NULL)) goto _Undecodable; - } else break; - - /* Support for a fourth operand is added for (i.e:) INSERTQ instruction. */ - if (instFlags & INST_USE_OP4) { - if (!operands_extract(ci, di, ii, instFlags, (_OpType)((_InstInfoEx*)ii)->op4, ONT_4, modrm, ps, effOpSz, effAdrSz, NULL)) goto _Undecodable; + if (!operands_extract(ci, di, ii, instFlags, (_OpType)isi->s, modrm, ps, effOpSz, effAdrSz, op++)) goto _Undecodable; + opsNo++; + /* Use third operand, only if the flags says this InstInfo requires it. */ + if (instFlags & INST_USE_OP3) { + if (!operands_extract(ci, di, ii, instFlags, (_OpType)((_InstInfoEx*)ii)->op3, modrm, ps, effOpSz, effAdrSz, op++)) goto _Undecodable; + opsNo++; + /* Support for a fourth operand is added for (e.g:) INSERTQ instruction. */ + if (instFlags & INST_USE_OP4) { + if (!operands_extract(ci, di, ii, instFlags, (_OpType)((_InstInfoEx*)ii)->op4, modrm, ps, effOpSz, effAdrSz, op++)) goto _Undecodable; + opsNo++; + } + } } - break; - } /* Continue here after all operands were extracted. */ - - /* If it were a 3DNow! instruction, we will have to find the instruction itself now that we got its operands extracted. */ - if (instFlags & INST_3DNOW_FETCH) { - ii = inst_lookup_3dnow(ci); - if (ii == NULL) goto _Undecodable; - isi = &InstSharedInfoTable[ii->sharedIndex]; - instFlags = FlagsTable[isi->flagsIndex]; + + /* Copy DST_WR flag. */ + di->flags |= (instFlags & INST_DST_WR) >> (31 - 6); /* Copy bit from INST_DST_WR (bit 31) to FLAG_DST_WR (bit 6). */ + /* operands_extract may touched it for FPU operands, so add on top. */ + di->opsNo += (uint8_t)opsNo; } - /* Check whether pseudo opcode is needed, only for CMP instructions: */ - if (instFlags & INST_PSEUDO_OPCODE) { - if (--ci->codeLen < 0) goto _Undecodable; - cmpType = *ci->code; - ci->code++; - if (instFlags & INST_PRE_VEX) { - /* AVX Comparison type must be between 0 to 32, otherwise Reserved. */ - if (cmpType >= INST_VCMP_MAX_RANGE) goto _Undecodable; - } else { - /* SSE Comparison type must be between 0 to 8, otherwise Reserved. */ - if (cmpType >= INST_CMP_MAX_RANGE) goto _Undecodable; + if (instFlags & (INST_3DNOW_FETCH | + INST_PSEUDO_OPCODE | + INST_NATIVE | + INST_PRE_REPNZ | + INST_PRE_REP | + INST_PRE_ADDR_SIZE | + INST_INVALID_64BITS | + INST_64BITS_FETCH)) { /* 8 for 1! */ + + /* If it's a native instruction copy OpSize Prefix. */ + if (ps && instFlags & INST_NATIVE) ps->usedPrefixes |= (ps->decodedPrefixes & INST_PRE_OP_SIZE); + + if (ci->dt != Decode64Bits) { + /* If it's only a 64 bits instruction drop it in other decoding modes. */ + if (instFlags & INST_64BITS_FETCH) goto _Undecodable; + } + else { + /* Drop instructions which are invalid in 64 bits. */ + if (instFlags & INST_INVALID_64BITS) goto _Undecodable; } - } - /* - * There's a limit of 15 bytes on instruction length. The only way to violate - * this limit is by putting redundant prefixes before an instruction. - * start points to first prefix if any, otherwise it points to instruction first byte. - */ - if ((ci->code - ps->start) > INST_MAXIMUM_SIZE) goto _Undecodable; /* Drop instruction. */ + /* If it were a 3DNow! instruction, we will have to find the instruction itself now that we got its operands extracted. */ + if (instFlags & INST_3DNOW_FETCH) { + ii = inst_lookup_3dnow(ci); + if (ii == NULL) goto _Undecodable; + isi = &InstSharedInfoTable[ii->sharedIndex]; + instFlags = FlagsTable[isi->flagsIndex]; + di->opcode = ii->opcodeId; + } - /* - * If we reached here the instruction was fully decoded, we located the instruction in the DB and extracted operands. - * Use the correct mnemonic according to the DT. - * If we are in 32 bits decoding mode it doesn't necessarily mean we will choose mnemonic2, alas, - * it means that if there is a mnemonic2, it will be used. - */ + /* Check whether pseudo opcode is needed, only for CMP instructions: */ + if (instFlags & INST_PSEUDO_OPCODE) { + /* Used only for special CMP instructions which have pseudo opcodes suffix. */ + unsigned int cmpType; - /* Start with prefix LOCK. */ - if ((lockable == TRUE) && (instFlags & INST_PRE_LOCK)) { - ps->usedPrefixes |= INST_PRE_LOCK; - di->flags |= FLAG_LOCK; - } else if ((instFlags & INST_PRE_REPNZ) && (ps->decodedPrefixes & INST_PRE_REPNZ)) { - ps->usedPrefixes |= INST_PRE_REPNZ; - di->flags |= FLAG_REPNZ; - } else if ((instFlags & INST_PRE_REP) && (ps->decodedPrefixes & INST_PRE_REP)) { - ps->usedPrefixes |= INST_PRE_REP; - di->flags |= FLAG_REP; - } + if (--ci->codeLen < 0) goto _Undecodable; + cmpType = *ci->code; + ci->code++; - /* If it's JeCXZ the ADDR_SIZE prefix affects them. */ - if ((instFlags & (INST_PRE_ADDR_SIZE | INST_USE_EXMNEMONIC)) == (INST_PRE_ADDR_SIZE | INST_USE_EXMNEMONIC)) { - ps->usedPrefixes |= INST_PRE_ADDR_SIZE; - if (effAdrSz == Decode16Bits) di->opcode = ii->opcodeId; - else if (effAdrSz == Decode32Bits) di->opcode = ((_InstInfoEx*)ii)->opcodeId2; - /* Ignore REX.W in 64bits, JECXZ is promoted. */ - else /* Decode64Bits */ di->opcode = ((_InstInfoEx*)ii)->opcodeId3; - } + /* + * The opcodeId is the offset to the FIRST pseudo compare mnemonic, + * we will have to fix it so it offsets into the corrected mnemonic. + * Therefore, we use another table to fix the offset. + */ + if (instFlags & INST_PRE_VEX) { + /* AVX Comparison type must be between 0 to 32, otherwise Reserved. */ + if (cmpType >= INST_VCMP_MAX_RANGE) goto _Undecodable; + + /* Use the AVX pseudo compare mnemonics table. */ + di->opcode = ii->opcodeId + VCmpMnemonicOffsets[cmpType]; + } + else { + /* SSE Comparison type must be between 0 to 8, otherwise Reserved. */ + if (cmpType >= INST_CMP_MAX_RANGE) goto _Undecodable; + di->opcode = ii->opcodeId + CmpMnemonicOffsets[cmpType]; + } + + goto _SkipOpcoding; + } + + /* Start with prefix REP/N/Z. */ + if (isPrefixed && (instFlags & (INST_PRE_REPNZ | INST_PRE_REP))) { + if ((instFlags & INST_PRE_REPNZ) && (ps->decodedPrefixes & INST_PRE_REPNZ)) { + ps->usedPrefixes |= INST_PRE_REPNZ; + di->flags |= FLAG_REPNZ; + } + else if ((instFlags & INST_PRE_REP) && (ps->decodedPrefixes & INST_PRE_REP)) { + ps->usedPrefixes |= INST_PRE_REP; + di->flags |= FLAG_REP; + } + } + + if (instFlags & INST_PRE_ADDR_SIZE) { + /* If it's JeCXZ the ADDR_SIZE prefix affects them. */ + if (instFlags & INST_USE_EXMNEMONIC) { + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + if (effAdrSz == Decode16Bits) di->opcode = ii->opcodeId; + else if (effAdrSz == Decode32Bits) di->opcode = ((_InstInfoEx*)ii)->opcodeId2; + /* Ignore REX.W in 64bits, JECXZ is promoted. */ + else /* Decode64Bits */ di->opcode = ((_InstInfoEx*)ii)->opcodeId3; + } + + /* LOOPxx instructions are also native instruction, but they are special case ones, ADDR_SIZE prefix affects them. */ + else if (instFlags & INST_NATIVE) { + di->opcode = ii->opcodeId; - /* LOOPxx instructions are also native instruction, but they are special case ones, ADDR_SIZE prefix affects them. */ - else if ((instFlags & (INST_PRE_ADDR_SIZE | INST_NATIVE)) == (INST_PRE_ADDR_SIZE | INST_NATIVE)) { - di->opcode = ii->opcodeId; + /* If LOOPxx gets here from 64bits, it must be Decode32Bits because Address Size prefix is set. */ + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + } - /* If LOOPxx gets here from 64bits, it must be Decode32Bits because Address Size prefix is set. */ - ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + goto _SkipOpcoding; + } } + /* + * If we reached here the instruction was fully decoded, we located the instruction in the DB and extracted operands. + * Use the correct mnemonic according to the DT. + * If we are in 32 bits decoding mode it doesn't necessarily mean we will choose mnemonic2, alas, + * it means that if there is a mnemonic2, it will be used. * Note: * If the instruction is prefixed by operand size we will format it in the non-default decoding mode! * So there might be a situation that an instruction of 32 bit gets formatted in 16 bits decoding mode. * Both ways should end up with a correct and expected formatting of the text. - */ - else if (effOpSz == Decode16Bits) { /* Decode16Bits */ - - /* Set operand size. */ - FLAG_SET_OPSIZE(di, Decode16Bits); - - /* - * If it's a special instruction which has two mnemonics, then use the 16 bits one + update usedPrefixes. - * Note: use 16 bits mnemonic if that instruction supports 32 bit or 64 bit explicitly. - */ - if ((instFlags & INST_USE_EXMNEMONIC) && ((instFlags & (INST_32BITS | INST_64BITS)) == 0)) ps->usedPrefixes |= INST_PRE_OP_SIZE; - di->opcode = ii->opcodeId; - } else if (effOpSz == Decode32Bits) { /* Decode32Bits */ + */ + if (effOpSz == Decode32Bits) { /* Decode32Bits */ /* Set operand size. */ FLAG_SET_OPSIZE(di, Decode32Bits); /* Give a chance for special mnemonic instruction in 32 bits decoding. */ if (instFlags & INST_USE_EXMNEMONIC) { - ps->usedPrefixes |= INST_PRE_OP_SIZE; /* Is it a special instruction which has another mnemonic for mod=11 ? */ if (instFlags & INST_MNEMONIC_MODRM_BASED) { - if (modrm >= INST_DIVIDED_MODRM) di->opcode = ii->opcodeId; - else di->opcode = ((_InstInfoEx*)ii)->opcodeId2; - } else di->opcode = ((_InstInfoEx*)ii)->opcodeId2; - } else di->opcode = ii->opcodeId; - } else { /* Decode64Bits, note that some instructions might be decoded in Decode32Bits above. */ + if (modrm < INST_DIVIDED_MODRM) di->opcode = ((_InstInfoEx*)ii)->opcodeId2; + } + else di->opcode = ((_InstInfoEx*)ii)->opcodeId2; + ps->usedPrefixes |= INST_PRE_OP_SIZE; + } + } + else if (effOpSz == Decode64Bits) { /* Decode64Bits, note that some instructions might be decoded in Decode32Bits above. */ /* Set operand size. */ FLAG_SET_OPSIZE(di, Decode64Bits); @@ -318,85 +337,84 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) * because they must not use REX (otherwise it will get to the wrong instruction which share same opcode). * See XRSTOR and XSAVEOPT. */ - if ((instFlags & INST_MNEMONIC_MODRM_BASED) && (modrm >= INST_DIVIDED_MODRM)) goto _Undecodable; + if ((modrm >= INST_DIVIDED_MODRM) && (instFlags & INST_MNEMONIC_MODRM_BASED)) goto _Undecodable; /* Use third mnemonic, for 64 bits. */ - if ((instFlags & INST_USE_EXMNEMONIC2) && (vrex & PREFIX_EX_W)) { + if ((instFlags & INST_USE_EXMNEMONIC2) && (ps->vrex & PREFIX_EX_W)) { ps->usedPrefixes |= INST_PRE_REX; di->opcode = ((_InstInfoEx*)ii)->opcodeId3; - } else di->opcode = ((_InstInfoEx*)ii)->opcodeId2; /* Use second mnemonic. */ - } else di->opcode = ii->opcodeId; + } + else di->opcode = ((_InstInfoEx*)ii)->opcodeId2; /* Use second mnemonic. */ + } } + else { /* Decode16Bits */ - /* If it's a native instruction use OpSize Prefix. */ - if ((instFlags & INST_NATIVE) && (ps->decodedPrefixes & INST_PRE_OP_SIZE)) ps->usedPrefixes |= INST_PRE_OP_SIZE; - - /* Check VEX mnemonics: */ - if ((instFlags & INST_PRE_VEX) && - (((((_InstInfoEx*)ii)->flagsEx & INST_MNEMONIC_VEXW_BASED) && (vrex & PREFIX_EX_W)) || - ((((_InstInfoEx*)ii)->flagsEx & INST_MNEMONIC_VEXL_BASED) && (vrex & PREFIX_EX_L)))) { - di->opcode = ((_InstInfoEx*)ii)->opcodeId2; - } + /* Set operand size. */ + FLAG_SET_OPSIZE(di, Decode16Bits); - /* Or is it a special CMP instruction which needs a pseudo opcode suffix ? */ - if (instFlags & INST_PSEUDO_OPCODE) { /* - * The opcodeId is the offset to the FIRST pseudo compare mnemonic, - * we will have to fix it so it offsets into the corrected mnemonic. - * Therefore, we use another table to fix the offset. + * If it's a special instruction which has two mnemonics, then use the 16 bits one + update usedPrefixes. + * Note: use 16 bits mnemonic if that instruction supports 32 bit or 64 bit explicitly. */ - if (instFlags & INST_PRE_VEX) { - /* Use the AVX pseudo compare mnemonics table. */ - di->opcode = ii->opcodeId + VCmpMnemonicOffsets[cmpType]; - } else { - /* Use the SSE pseudo compare mnemonics table. */ - di->opcode = ii->opcodeId + CmpMnemonicOffsets[cmpType]; - } + if ((instFlags & (INST_USE_EXMNEMONIC | INST_32BITS | INST_64BITS)) == INST_USE_EXMNEMONIC) ps->usedPrefixes |= INST_PRE_OP_SIZE; } - /* - * Store the address size inside the flags. - * This is necessary for the caller to know the size of rSP when using PUSHA for example. - */ - FLAG_SET_ADDRSIZE(di, effAdrSz); +_SkipOpcoding: - /* Copy DST_WR flag. */ - if (instFlags & INST_DST_WR) di->flags |= FLAG_DST_WR; + /* Check VEX mnemonics: */ + if (isPrefixed && (instFlags & INST_PRE_VEX) && + (((((_InstInfoEx*)ii)->flagsEx & INST_MNEMONIC_VEXW_BASED) && (ps->vrex & PREFIX_EX_W)) || + ((((_InstInfoEx*)ii)->flagsEx & INST_MNEMONIC_VEXL_BASED) && (ps->vrex & PREFIX_EX_L)))) { + di->opcode = ((_InstInfoEx*)ii)->opcodeId2; + } - /* Set the unused prefixes mask. */ - di->unusedPrefixesMask = prefixes_set_unused_mask(ps); + /* Instruction's size should include prefixes too if exist. */ + di->size = (uint8_t)(ci->code - startCode); + /* + * There's a limit of 15 bytes on instruction length. The only way to violate + * this limit is by putting redundant prefixes before an instruction. + * start points to first prefix if any, otherwise it points to instruction first byte. + */ + if (di->size > INST_MAXIMUM_SIZE) goto _Undecodable; - /* Fix privileged. Assumes the privilegedFlag is 0x8000 only. */ - di->flags |= privilegedFlag; + /* Set the unused prefixes mask, if any prefixes (not) used at all. */ + if (isPrefixed) di->unusedPrefixesMask = prefixes_set_unused_mask(ps); /* Copy instruction meta. */ di->meta = isi->meta; - if (di->segment == 0) di->segment = R_NONE; - /* Take into account the O_MEM base register for the mask. */ - if (di->base != R_NONE) di->usedRegistersMask |= _REGISTERTORCLASS[di->base]; - - /* Copy CPU affected flags. */ - CONVERT_FLAGS_TO_EFLAGS(di, isi, modifiedFlagsMask); - CONVERT_FLAGS_TO_EFLAGS(di, isi, testedFlagsMask); - CONVERT_FLAGS_TO_EFLAGS(di, isi, undefinedFlagsMask); + if (ci->features & DF_FILL_EFLAGS) { + /* Copy CPU affected flags. */ + if (isi->testedFlagsMask) CONVERT_FLAGS_TO_EFLAGS(di, isi, testedFlagsMask); + if (isi->modifiedFlagsMask) CONVERT_FLAGS_TO_EFLAGS(di, isi, modifiedFlagsMask); + if (isi->undefinedFlagsMask) CONVERT_FLAGS_TO_EFLAGS(di, isi, undefinedFlagsMask); + } - /* Calculate the size of the instruction we've just decoded. */ - di->size = (uint8_t)((ci->code - startCode) & 0xff); + /* + * Instruction can still be invalid if it's total length is over 15 bytes with prefixes. + * Up to the caller to check that. + */ return DECRES_SUCCESS; -_Undecodable: /* If the instruction couldn't be decoded for some reason, drop the first byte. */ - memset(di, 0, sizeof(_DInst)); - di->base = R_NONE; - - di->size = 1; - /* Clean prefixes just in case... */ - ps->usedPrefixes = 0; - - /* Special case for WAIT instruction: If it's dropped, you have to return a valid instruction! */ +_Undecodable: /* If the instruction couldn't be decoded for some reason, fail. */ + /* Special case for WAIT instruction: If it's dropped as a prefix, we have to return a valid instruction! */ if (*startCode == INST_WAIT_INDEX) { + int delta; + memset(di, 0, sizeof(_DInst)); + di->addr = ci->codeOffset & ci->addrMask; + di->imm.byte = INST_WAIT_INDEX; + di->segment = R_NONE; + di->base = R_NONE; + di->size = 1; di->opcode = I_WAIT; META_SET_ISC(di, ISC_INTEGER); + + /* Fix ci because WAIT could be a prefix that failed, and ci->code is now out of sync. */ + delta = (int)(ci->code - startCode); /* How many bytes we read so far. */ + ci->codeLen += delta - 1; + ci->code = startCode + 1; + /* codeOffset is fixed outside. */ + return DECRES_SUCCESS; } @@ -414,32 +432,36 @@ static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, _DInst* di) */ _DecodeResult decode_internal(_CodeInfo* _ci, int supportOldIntr, _DInst result[], unsigned int maxResultCount, unsigned int* usedInstructionsCount) { + _CodeInfo ci = *_ci; /* A working copy, we don't touch user's _ci except OUT params. */ _PrefixState ps; - unsigned int prefixSize; - _CodeInfo ci; - unsigned int features; - unsigned int mfc; + /* Bookkeep these from ci below, as it makes things way simpler. */ + const uint8_t* code; + int codeLen; + _OffsetType codeOffset; - _OffsetType codeOffset = _ci->codeOffset; - const uint8_t* code = _ci->code; - int codeLen = _ci->codeLen; - - /* - * This is used for printing only, it is the real offset of where the whole instruction begins. - * We need this variable in addition to codeOffset, because prefixes might change the real offset an instruction begins at. - * So we keep track of both. - */ - _OffsetType startInstOffset = 0; - - const uint8_t* p; + _DecodeResult ret = DECRES_SUCCESS; /* Current working decoded instruction in results. */ - unsigned int nextPos = 0; - _DInst *pdi = NULL; + _DInst* pdi = (_DInst*)&result[0]; /* There's always a room for at least one slot, checked earlier. */ + _DInst* maxResultAddr; - _OffsetType addrMask = (_OffsetType)-1; + unsigned int features = ci.features; - _DecodeResult decodeResult; + unsigned int diStructSize; + /* Use next entry. */ +#ifndef DISTORM_LIGHT + if (supportOldIntr) { + diStructSize = sizeof(_DecodedInst); + maxResultAddr = (_DInst*)((size_t)&result[0] + (maxResultCount * sizeof(_DecodedInst))); + } + else +#endif /* DISTORM_LIGHT */ + { + diStructSize = sizeof(_DInst); + maxResultAddr = &result[maxResultCount]; + } + + ci.addrMask = (_OffsetType)-1; #ifdef DISTORM_LIGHT supportOldIntr; /* Unreferenced. */ @@ -449,202 +471,104 @@ _DecodeResult decode_internal(_CodeInfo* _ci, int supportOldIntr, _DInst result[ * Otherwise, we use the textual interface which needs full addresses for formatting bytes output. * So distorm_format will truncate later. */ - if (_ci->features & DF_MAXIMUM_ADDR32) addrMask = 0xffffffff; - else if (_ci->features & DF_MAXIMUM_ADDR16) addrMask = 0xffff; + if (features & DF_MAXIMUM_ADDR32) ci.addrMask = 0xffffffff; + else if (features & DF_MAXIMUM_ADDR16) ci.addrMask = 0xffff; #endif - /* No entries are used yet. */ - *usedInstructionsCount = 0; - ci.dt = _ci->dt; - _ci->nextOffset = codeOffset; + ps.count = 1; /* Force zero'ing ps below. */ /* Decode instructions as long as we have what to decode/enough room in entries. */ - while (codeLen > 0) { - - /* startInstOffset holds the displayed offset of current instruction. */ - startInstOffset = codeOffset; + while (ci.codeLen > 0) { + code = ci.code; + codeLen = ci.codeLen; + codeOffset = ci.codeOffset; - memset(&ps, 0, (size_t)((char*)&ps.pfxIndexer[0] - (char*)&ps)); - memset(ps.pfxIndexer, PFXIDX_NONE, sizeof(int) * PFXIDX_MAX); - ps.start = code; - ps.last = code; - prefixSize = 0; + if (ps.count) memset(&ps, 0, sizeof(ps)); - if (prefixes_is_valid(*code, ci.dt)) { - prefixes_decode(code, codeLen, &ps, ci.dt); - /* Count prefixes, start points to first prefix. */ - prefixSize = (unsigned int)(ps.last - ps.start); - /* - * It might be that we will just notice that we ran out of bytes, or only prefixes - * so we will have to drop everything and halt. - * Also take into consideration of flow control instruction filter. - */ - codeLen -= prefixSize; - if ((codeLen == 0) || (prefixSize == INST_MAXIMUM_SIZE)) { - if (~_ci->features & DF_RETURN_FC_ONLY) { - /* Make sure there is enough room. */ - if (nextPos + (ps.last - code) > maxResultCount) return DECRES_MEMORYERR; - - for (p = code; p < ps.last; p++, startInstOffset++) { - /* Use next entry. */ -#ifndef DISTORM_LIGHT - if (supportOldIntr) { - pdi = (_DInst*)((char*)result + nextPos * sizeof(_DecodedInst)); - } - else -#endif /* DISTORM_LIGHT */ - { - pdi = &result[nextPos]; - } - nextPos++; - memset(pdi, 0, sizeof(_DInst)); - - pdi->flags = FLAG_NOT_DECODABLE; - pdi->imm.byte = *p; - pdi->size = 1; - pdi->addr = startInstOffset & addrMask; - } - *usedInstructionsCount = nextPos; /* Include them all. */ - } - if (codeLen == 0) break; /* Bye bye, out of bytes. */ - } - code += prefixSize; - codeOffset += prefixSize; + /**** INSTRUCTION DECODING NEXT: ****/ - /* If we got only prefixes continue to next instruction. */ - if (prefixSize == INST_MAXIMUM_SIZE) continue; + /* Make sure we didn't run out of output entries. */ + if (pdi >= maxResultAddr) { + ret = DECRES_MEMORYERR; + break; } - /* - * Now we decode the instruction and only then we do further prefixes handling. - * This is because the instruction could not be decoded at all, or an instruction requires - * a mandatory prefix, or some of the prefixes were useless, etc... + ret = decode_inst(&ci, &ps, code, pdi); + /* decode_inst keeps track (only if successful!) for code and codeLen but ignores codeOffset, fix it here. */ + ci.codeOffset += pdi->size; - * Even if there were a mandatory prefix, we already took into account its size as a normal prefix. - * so prefixSize includes that, and the returned size in pdi is simply the size of the real(=without prefixes) instruction. - */ - if (ci.dt == Decode64Bits) { - if (ps.decodedPrefixes & INST_PRE_REX) { - /* REX prefix must precede first byte of instruction. */ - if (ps.rexPos != (code - 1)) { - ps.decodedPrefixes &= ~INST_PRE_REX; - ps.prefixExtType = PET_NONE; - prefixes_ignore(&ps, PFXIDX_REX); - } - /* - * We will disable operand size prefix, - * if it exists only after decoding the instruction, since it might be a mandatory prefix. - * This will be done after calling inst_lookup in decode_inst. - */ - } - /* In 64 bits, segment overrides of CS, DS, ES and SS are ignored. So don't take'em into account. */ - if (ps.decodedPrefixes & INST_PRE_SEGOVRD_MASK32) { - ps.decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK32; - prefixes_ignore(&ps, PFXIDX_SEG); - } - } + if (ret == DECRES_SUCCESS) { - /* Make sure there is at least one more entry to use, for the upcoming instruction. */ - if (nextPos + 1 > maxResultCount) return DECRES_MEMORYERR; -#ifndef DISTORM_LIGHT - if (supportOldIntr) { - pdi = (_DInst*)((char*)result + nextPos * sizeof(_DecodedInst)); - } - else -#endif /* DISTORM_LIGHT */ - { - pdi = &result[nextPos]; - } - nextPos++; + if (features & (DF_SINGLE_BYTE_STEP | DF_RETURN_FC_ONLY | DF_STOP_ON_PRIVILEGED | DF_STOP_ON_FLOW_CONTROL)) { - /* - * The reason we copy these two again is because we have to keep track on the input ourselves. - * There might be a case when an instruction is invalid, and then it will be counted as one byte only. - * But that instruction already read a byte or two from the stream and only then returned the error. - * Thus, we end up unsynchronized on the stream. - * This way, we are totally safe, because we keep track after the call to decode_inst, using the returned size. - */ - ci.code = code; - ci.codeLen = codeLen; - /* Nobody uses codeOffset in the decoder itself, so spare it. */ - - decodeResult = decode_inst(&ci, &ps, pdi); - - /* See if we need to filter this instruction. */ - if ((_ci->features & DF_RETURN_FC_ONLY) && (META_GET_FC(pdi->meta) == FC_NONE)) decodeResult = DECRES_FILTERED; - - /* Set address to the beginning of the instruction. */ - pdi->addr = startInstOffset & addrMask; - /* pdi->disp &= addrMask; */ - - if ((decodeResult == DECRES_INPUTERR) && (ps.decodedPrefixes & INST_PRE_VEX)) { - if (ps.prefixExtType == PET_VEX3BYTES) { - prefixSize -= 2; - codeLen += 2; - } else if (ps.prefixExtType == PET_VEX2BYTES) { - prefixSize -= 1; - codeLen += 1; - } - ps.last = ps.start + prefixSize - 1; - code = ps.last + 1; - codeOffset = startInstOffset + prefixSize; - } else { - /* Advance to next instruction. */ - codeLen -= pdi->size; - codeOffset += pdi->size; - code += pdi->size; - - /* Instruction's size should include prefixes. */ - pdi->size += (uint8_t)prefixSize; - } + /* Sync codeinfo, remember that currently it points to beginning of the instruction and prefixes if any. */ + if (features & DF_SINGLE_BYTE_STEP) { + ci.code = code + 1; + ci.codeLen = codeLen - 1; + ci.codeOffset = codeOffset + 1; + } - /* Drop all prefixes and the instruction itself, because the instruction wasn't successfully decoded. */ - if ((decodeResult == DECRES_INPUTERR) && (~_ci->features & DF_RETURN_FC_ONLY)) { - nextPos--; /* Undo last result. */ - if ((prefixSize + 1) > 0) { /* 1 for the first instruction's byte. */ - if ((nextPos + prefixSize + 1) > maxResultCount) return DECRES_MEMORYERR; + /* See if we need to filter this instruction. */ + if ((features & DF_RETURN_FC_ONLY) && (META_GET_FC(pdi->meta) == FC_NONE)) { + continue; + } - for (p = ps.start; p < ps.last + 1; p++, startInstOffset++) { - /* Use next entry. */ -#ifndef DISTORM_LIGHT - if (supportOldIntr) { - pdi = (_DInst*)((char*)result + nextPos * sizeof(_DecodedInst)); - } - else -#endif /* DISTORM_LIGHT */ - { - pdi = &result[nextPos]; + /* Check whether we need to stop on any feature. */ + if ((features & DF_STOP_ON_PRIVILEGED) && (FLAG_GET_PRIVILEGED(pdi->flags))) { + pdi = (_DInst*)((char*)pdi + diStructSize); + break; /* ret = DECRES_SUCCESS; */ + } + + if (features & DF_STOP_ON_FLOW_CONTROL) { + unsigned int mfc = META_GET_FC(pdi->meta); + if (mfc && (((features & DF_STOP_ON_CALL) && (mfc == FC_CALL)) || + ((features & DF_STOP_ON_RET) && (mfc == FC_RET)) || + ((features & DF_STOP_ON_SYS) && (mfc == FC_SYS)) || + ((features & DF_STOP_ON_UNC_BRANCH) && (mfc == FC_UNC_BRANCH)) || + ((features & DF_STOP_ON_CND_BRANCH) && (mfc == FC_CND_BRANCH)) || + ((features & DF_STOP_ON_INT) && (mfc == FC_INT)) || + ((features & DF_STOP_ON_CMOV) && (mfc == FC_CMOV)) || + ((features & DF_STOP_ON_HLT) && (mfc == FC_HLT)))) { + pdi = (_DInst*)((char*)pdi + diStructSize); + break; /* ret = DECRES_SUCCESS; */ } - nextPos++; + } + } - memset(pdi, 0, sizeof(_DInst)); - pdi->flags = FLAG_NOT_DECODABLE; - pdi->imm.byte = *p; - pdi->size = 1; - pdi->addr = startInstOffset & addrMask; + /* Allocate at least one more entry to use, for the next instruction. */ + pdi = (_DInst*)((char*)pdi + diStructSize); + } + else { /* ret == DECRES_INPUTERR */ + + /* Handle failure of decoding last instruction. */ + if ((!(features & DF_RETURN_FC_ONLY))) { + memset(pdi, 0, sizeof(_DInst)); + pdi->flags = FLAG_NOT_DECODABLE; + pdi->imm.byte = *code; + pdi->size = 1; + pdi->addr = codeOffset & ci.addrMask; + pdi = (_DInst*)((char*)pdi + diStructSize); + + /* If an instruction wasn't decoded then stop on undecodeable if set. */ + if (features & DF_STOP_ON_UNDECODEABLE) { + ret = DECRES_SUCCESS; + break; } } - } else if (decodeResult == DECRES_FILTERED) nextPos--; /* Return it to pool, since it was filtered. */ - - /* Alright, the caller can read, at least, up to this one. */ - *usedInstructionsCount = nextPos; - /* Fix next offset. */ - _ci->nextOffset = codeOffset; - - /* Check whether we need to stop on any flow control instruction. */ - features = _ci->features; - mfc = META_GET_FC(pdi->meta); - if ((decodeResult == DECRES_SUCCESS) && (features & DF_STOP_ON_FLOW_CONTROL)) { - if (((features & DF_STOP_ON_CALL) && (mfc == FC_CALL)) || - ((features & DF_STOP_ON_RET) && (mfc == FC_RET)) || - ((features & DF_STOP_ON_SYS) && (mfc == FC_SYS)) || - ((features & DF_STOP_ON_UNC_BRANCH) && (mfc == FC_UNC_BRANCH)) || - ((features & DF_STOP_ON_CND_BRANCH) && (mfc == FC_CND_BRANCH)) || - ((features & DF_STOP_ON_INT) && (mfc == FC_INT)) || - ((features & DF_STOP_ON_CMOV) && (mfc == FC_CMOV))) - return DECRES_SUCCESS; + + /* Skip a single byte in case of a failure and retry instruction. */ + ci.code = code + 1; + ci.codeLen = codeLen - 1; + ci.codeOffset = codeOffset + 1; + + /* Reset return value. */ + ret = DECRES_SUCCESS; } } - return DECRES_SUCCESS; + /* Set OUT params. */ + *usedInstructionsCount = (unsigned int)(((size_t)pdi - (size_t)result) / (size_t)diStructSize); + _ci->nextOffset = ci.codeOffset; + + return ret; } diff --git a/NativeCore/Dependencies/distorm/src/decoder.h b/NativeCore/Dependencies/distorm/src/decoder.h index 2f9961a5..c40cb646 100644 --- a/NativeCore/Dependencies/distorm/src/decoder.h +++ b/NativeCore/Dependencies/distorm/src/decoder.h @@ -4,20 +4,8 @@ decoder.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2011 Gil Dabah - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. */ @@ -28,6 +16,6 @@ along with this program. If not, see typedef unsigned int _iflags; -_DecodeResult decode_internal(_CodeInfo* ci, int supportOldIntr, _DInst result[], unsigned int maxResultCount, unsigned int* usedInstructionsCount); +_DecodeResult decode_internal(_CodeInfo* _ci, int supportOldIntr, _DInst result[], unsigned int maxResultCount, unsigned int* usedInstructionsCount); #endif /* DECODER_H */ diff --git a/NativeCore/Dependencies/distorm/src/distorm.c b/NativeCore/Dependencies/distorm/src/distorm.c index 12f360fd..e54c28bb 100644 --- a/NativeCore/Dependencies/distorm/src/distorm.c +++ b/NativeCore/Dependencies/distorm/src/distorm.c @@ -5,7 +5,7 @@ diStorm3 C Library Interface diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -29,31 +29,24 @@ This library is licensed under the BSD license. See the file COPYING. return DECRES_SUCCESS; } - /* DECRES_SUCCESS still may indicate we may have something in the result, so zero it first thing. */ - *usedInstructionsCount = 0; - if ((ci == NULL) || (ci->codeLen < 0) || - ((ci->dt != Decode16Bits) && (ci->dt != Decode32Bits) && (ci->dt != Decode64Bits)) || + ((unsigned)ci->dt > (unsigned)Decode64Bits) || (ci->code == NULL) || (result == NULL) || + (maxInstructions == 0) || ((ci->features & (DF_MAXIMUM_ADDR16 | DF_MAXIMUM_ADDR32)) == (DF_MAXIMUM_ADDR16 | DF_MAXIMUM_ADDR32))) { return DECRES_INPUTERR; } - /* Assume length=0 is success. */ - if (ci->codeLen == 0) { - return DECRES_SUCCESS; - } - return decode_internal(ci, FALSE, result, maxInstructions, usedInstructionsCount); } #ifndef DISTORM_LIGHT /* Helper function to concatenate an explicit size when it's unknown from the operands. */ -static void distorm_format_size(_WString* str, const _DInst* di, int opNum) +static void distorm_format_size(unsigned char** str, const _DInst* di, int opNum) { int isSizingRequired = 0; /* @@ -64,7 +57,7 @@ static void distorm_format_size(_WString* str, const _DInst* di, int opNum) * * If given operand number is higher than 2, then output the size anyways. */ - isSizingRequired = ((opNum >= 2) || ((di->ops[0].type != O_REG) && (di->ops[1].type != O_REG))); + isSizingRequired = ((opNum >= 2) || ((opNum == 0) && (di->ops[0].type != O_REG) && (di->ops[1].type != O_REG))); /* Still not sure? Try some special instructions. */ if (!isSizingRequired) { @@ -74,6 +67,7 @@ static void distorm_format_size(_WString* str, const _DInst* di, int opNum) * MOVZX, MOVSX, MOVSXD. * ROL, ROR, RCL, RCR, SHL, SHR, SAL, SAR. * SHLD, SHRD. + * CVTSI2SS is also an exception. */ switch (di->opcode) { @@ -92,6 +86,7 @@ static void distorm_format_size(_WString* str, const _DInst* di, int opNum) case I_SAR: case I_SHLD: case I_SHRD: + case I_CVTSI2SS: isSizingRequired = 1; break; default: /* Instruction doesn't require sizing. */ break; @@ -100,244 +95,262 @@ static void distorm_format_size(_WString* str, const _DInst* di, int opNum) if (isSizingRequired) { - switch (di->ops[opNum].size) + /*case 0: break; OT_MEM's unknown size. */ + switch (di->ops[opNum].size / 8) { - case 0: break; /* OT_MEM's unknown size. */ - case 8: strcat_WSN(str, "byte "); break; - case 16: strcat_WSN(str, "word "); break; - case 32: strcat_WSN(str, "dword "); break; - case 64: strcat_WSN(str, "qword "); break; - case 80: strcat_WSN(str, "tbyte "); break; - case 128: strcat_WSN(str, "dqword "); break; - case 256: strcat_WSN(str, "yword "); break; - default: /* Big oh uh if it gets here. */ break; + case 1: strcat_WS(*str, "BYTE ", 8, 5); break; + case 2: strcat_WS(*str, "WORD ", 8, 5); break; + case 4: strcat_WS(*str, "DWORD ", 8, 6); break; + case 8: strcat_WS(*str, "QWORD ", 8, 6); break; + case 10: strcat_WS(*str, "TBYTE ", 8, 6); break; + case 16: strcat_WS(*str, "DQWORD ", 8, 7); break; + case 32: strcat_WS(*str, "YWORD ", 8, 6); break; } } } -static void distorm_format_signed_disp(_WString* str, const _DInst* di, uint64_t addrMask) +static void distorm_format_signed_disp(unsigned char** str, const _DInst* di, uint64_t addrMask) { int64_t tmpDisp64; if (di->dispSize) { - chrcat_WS(str, ((int64_t)di->disp < 0) ? MINUS_DISP_CHR : PLUS_DISP_CHR); - if ((int64_t)di->disp < 0) tmpDisp64 = -(int64_t)di->disp; - else tmpDisp64 = di->disp; - tmpDisp64 &= addrMask; - str_code_hqw(str, (uint8_t*)&tmpDisp64); + if (((int64_t)di->disp < 0)) { + chrcat_WS(*str, MINUS_DISP_CHR); + tmpDisp64 = -(int64_t)di->disp; + tmpDisp64 &= addrMask; /* Verify only for neg numbers. */ + } + else { + chrcat_WS(*str, PLUS_DISP_CHR); + tmpDisp64 = di->disp; + } + str_int(str, tmpDisp64); } } +static uint8_t prefixTable[6][8] = { "", "LOCK ", "REPNZ ", "REPNZ ", "REP ", "REPZ " }; +static unsigned int prefixSizesTable[6] = { 0, 5, 6, 6, 4, 5 }; +static uint8_t suffixTable[10] = { 0, 'B', 'W', 0, 'D', 0, 0, 0, 'Q' }; + +/* WARNING: This function is written carefully to be able to work with same input and output buffer in-place! */ #ifdef SUPPORT_64BIT_OFFSET _DLLEXPORT_ void distorm_format64(const _CodeInfo* ci, const _DInst* di, _DecodedInst* result) #else _DLLEXPORT_ void distorm_format32(const _CodeInfo* ci, const _DInst* di, _DecodedInst* result) #endif { - _WString* str; - unsigned int i, isDefault; + unsigned char* str; int64_t tmpDisp64; uint64_t addrMask = (uint64_t)-1; - uint8_t segment; const _WMnemonic* mnemonic; + int suffixSize = -1; + unsigned int i; /* Set address mask, when default is for 64bits addresses. */ - if (ci->features & DF_MAXIMUM_ADDR32) addrMask = 0xffffffff; - else if (ci->features & DF_MAXIMUM_ADDR16) addrMask = 0xffff; - - /* Copy other fields. */ - result->size = di->size; - result->offset = di->addr; - - if (di->flags == FLAG_NOT_DECODABLE) { - str = &result->mnemonic; - result->offset &= addrMask; - strclear_WS(&result->operands); - strcpy_WSN(str, "DB "); - str_code_hb(str, di->imm.byte); - strclear_WS(&result->instructionHex); - str_hex_b(&result->instructionHex, di->imm.byte); - return; /* Skip to next instruction. */ + if (ci->features & DF_USE_ADDR_MASK) addrMask = ci->addrMask; + else { + if (ci->features & DF_MAXIMUM_ADDR32) addrMask = 0xffffffff; + else if (ci->features & DF_MAXIMUM_ADDR16) addrMask = 0xffff; } - str = &result->instructionHex; - strclear_WS(str); /* Gotta have full address for (di->addr - ci->codeOffset) to work in all modes. */ - for (i = 0; i < di->size; i++) - str_hex_b(str, ci->code[(unsigned int)(di->addr - ci->codeOffset + i)]); - - /* Truncate address now. */ - result->offset &= addrMask; - - str = &result->mnemonic; - switch (FLAG_GET_PREFIX(di->flags)) - { - case FLAG_LOCK: - strcpy_WSN(str, "lock "); - break; - case FLAG_REP: - /* REP prefix for CMPS and SCAS is really a REPZ. */ - if ((di->opcode == I_CMPS) || (di->opcode == I_SCAS)) strcpy_WSN(str, "repz "); - else strcpy_WSN(str, "rep "); - break; - case FLAG_REPNZ: - strcpy_WSN(str, "repnz "); - break; - default: - /* Init mnemonic string, cause next touch is concatenation. */ - strclear_WS(str); - break; + str_hex(&result->instructionHex, (const uint8_t*)&ci->code[(unsigned int)(di->addr - ci->codeOffset)], di->size); + + if ((int)((int16_t)di->flags) == -1) { + /* In-place considerations: DI is RESULT. Deref fields first. */ + unsigned int size = di->size; + unsigned int byte = di->imm.byte; + _OffsetType offset = di->addr & addrMask; + + result->offset = offset; + result->size = size; + str = (unsigned char*)&result->mnemonic.p; + strcat_WS(str, "DB ", 4, 3); + str_int(&str, byte); + strfinalize_WS(result->mnemonic, str); + *(uint64_t*)&result->operands = 0; /* Clears length and the string at once. */ + return; /* Skip to next instruction. */ } - mnemonic = (const _WMnemonic*)&_MNEMONICS[di->opcode]; - memcpy((int8_t*)&str->p[str->length], mnemonic->p, mnemonic->length + 1); - str->length += mnemonic->length; - - /* Format operands: */ - str = &result->operands; - strclear_WS(str); - - /* Special treatment for String instructions. */ - if ((META_GET_ISC(di->meta) == ISC_INTEGER) && - ((di->opcode == I_MOVS) || - (di->opcode == I_CMPS) || - (di->opcode == I_STOS) || - (di->opcode == I_LODS) || - (di->opcode == I_SCAS))) - { + str = (unsigned char*)&result->operands.p; + + /* Special treatment for String (movs, cmps, stos, lods, scas) instructions. */ + if ((di->opcode >= I_MOVS) && (di->opcode <= I_SCAS)) { /* * No operands are needed if the address size is the default one, * and no segment is overridden, so add the suffix letter, * to indicate size of operation and continue to next instruction. */ - if ((FLAG_GET_ADDRSIZE(di->flags) == ci->dt) && (SEGMENT_IS_DEFAULT(di->segment))) { - str = &result->mnemonic; - switch (di->ops[0].size) - { - case 8: chrcat_WS(str, 'B'); break; - case 16: chrcat_WS(str, 'W'); break; - case 32: chrcat_WS(str, 'D'); break; - case 64: chrcat_WS(str, 'Q'); break; - } - return; + if ((SEGMENT_IS_DEFAULT_OR_NONE(di->segment)) && (FLAG_GET_ADDRSIZE(di->flags) == ci->dt)) { + suffixSize = di->ops[0].size / 8; + goto skipOperands; } + suffixSize = 0; /* Marks it's a string instruction. */ } - for (i = 0; ((i < OPERANDS_NO) && (di->ops[i].type != O_NONE)); i++) { - if (i > 0) strcat_WSN(str, ", "); - switch (di->ops[i].type) - { - case O_REG: - strcat_WS(str, (const _WString*)&_REGISTERS[di->ops[i].index]); - break; - case O_IMM: - /* If the instruction is 'push', show explicit size (except byte imm). */ - if ((di->opcode == I_PUSH) && (di->ops[i].size != 8)) distorm_format_size(str, di, i); - /* Special fix for negative sign extended immediates. */ - if ((di->flags & FLAG_IMM_SIGNED) && (di->ops[i].size == 8)) { - if (di->imm.sbyte < 0) { - chrcat_WS(str, MINUS_DISP_CHR); - str_code_hb(str, -di->imm.sbyte); - break; + for (i = 0; i < di->opsNo; i++) { + unsigned int type = di->ops[i].type; + if (i > 0) strcat_WS(str, ", ", 2, 2); + if (type == O_REG) { + strcat_WSR(&str, &_REGISTERS[di->ops[i].index]); + } + else if (type == O_IMM) { + /* If the instruction is 'push', show explicit size (except byte imm). */ + if ((di->opcode == I_PUSH) && (di->ops[i].size != 8)) distorm_format_size(&str, di, i); + /* Special fix for negative sign extended immediates. */ + if ((di->flags & FLAG_IMM_SIGNED) && (di->ops[i].size == 8) && (di->imm.sbyte < 0)) { + chrcat_WS(str, MINUS_DISP_CHR); + tmpDisp64 = -di->imm.sbyte; + str_int(&str, tmpDisp64); + } + else { + /* Notice signedness and size of the immediate. */ + if (di->ops[i].size == 0x20) str_int(&str, di->imm.dword); + else str_int(&str, di->imm.qword); + } + } + else if (type == O_PC) { +#ifdef SUPPORT_64BIT_OFFSET + str_int(&str, (di->size + di->imm.sqword + di->addr) & addrMask); +#else + tmpDisp64 = ((_OffsetType)di->imm.sdword + di->addr + di->size) & (uint32_t)addrMask; + str_int(&str, tmpDisp64); +#endif + } + else if (type == O_DISP) { + distorm_format_size(&str, di, i); + chrcat_WS(str, OPEN_CHR); + if (!SEGMENT_IS_DEFAULT_OR_NONE(di->segment)) { + strcat_WSR(&str, &_REGISTERS[SEGMENT_GET_UNSAFE(di->segment)]); + chrcat_WS(str, SEG_OFF_CHR); + } + tmpDisp64 = di->disp & addrMask; + str_int(&str, tmpDisp64); + chrcat_WS(str, CLOSE_CHR); + } + else if (type == O_SMEM) { + int isDefault; + int segment; + distorm_format_size(&str, di, i); + chrcat_WS(str, OPEN_CHR); + + segment = SEGMENT_GET(di->segment); + isDefault = SEGMENT_IS_DEFAULT(di->segment); + + /* + * This is where we need to take special care for String instructions. + * If we got here, it means we need to explicitly show their operands. + * The problem with CMPS and MOVS is that they have two(!) memory operands. + * So we have to complement(!) them ourselves, since the isntruction structure supplies only the segment that can be overridden. + * And make the rest of the String operations explicit. + * We ignore default ES/DS in 64 bits. + * ["MOVS"], [OPT.REGI_EDI, OPT.REGI_ESI] -- DS can be overridden. + * ["CMPS"], [OPT.REGI_ESI, OPT.REGI_EDI] -- DS can be overriden. + * + * suffixSize == 0 was set above for string opcode already. + */ + if (suffixSize == 0) { + if (((di->opcode == I_MOVS) && (i == 0)) || ((di->opcode == I_CMPS) && (i == 1))) { + if (ci->dt != Decode64Bits) { + segment = R_ES; + isDefault = FALSE; } + else isDefault = TRUE; } - if (di->ops[i].size == 64) str_code_hqw(str, (uint8_t*)&di->imm.qword); - else str_code_hdw(str, di->imm.dword); - break; - case O_IMM1: - str_code_hdw(str, di->imm.ex.i1); - break; - case O_IMM2: - str_code_hdw(str, di->imm.ex.i2); - break; - case O_DISP: - distorm_format_size(str, di, i); - chrcat_WS(str, OPEN_CHR); - if ((SEGMENT_GET(di->segment) != R_NONE) && !SEGMENT_IS_DEFAULT(di->segment)) { - strcat_WS(str, (const _WString*)&_REGISTERS[SEGMENT_GET(di->segment)]); - chrcat_WS(str, SEG_OFF_CHR); - } - tmpDisp64 = di->disp & addrMask; - str_code_hqw(str, (uint8_t*)&tmpDisp64); - chrcat_WS(str, CLOSE_CHR); - break; - case O_SMEM: - distorm_format_size(str, di, i); - chrcat_WS(str, OPEN_CHR); - - /* - * This is where we need to take special care for String instructions. - * If we got here, it means we need to explicitly show their operands. - * The problem with CMPS and MOVS is that they have two(!) memory operands. - * So we have to complete it ourselves, since the structure supplies only the segment that can be overridden. - * And make the rest of the String operations explicit. - */ - segment = SEGMENT_GET(di->segment); - isDefault = SEGMENT_IS_DEFAULT(di->segment); - switch (di->opcode) - { - case I_MOVS: - isDefault = FALSE; - if (i == 0) segment = R_ES; - break; - case I_CMPS: + else if (isDefault && ((di->opcode == I_MOVS) || (di->opcode == I_CMPS))) { + if (ci->dt != Decode64Bits) { + segment = R_DS; isDefault = FALSE; - if (i == 1) segment = R_ES; - break; - case I_INS: - case I_LODS: - case I_STOS: - case I_SCAS: isDefault = FALSE; break; - } - if (!isDefault && (segment != R_NONE)) { - strcat_WS(str, (const _WString*)&_REGISTERS[segment]); - chrcat_WS(str, SEG_OFF_CHR); + } } + } + if (!isDefault && (segment != R_NONE)) { + strcat_WSR(&str, &_REGISTERS[segment]); + chrcat_WS(str, SEG_OFF_CHR); + } - strcat_WS(str, (const _WString*)&_REGISTERS[di->ops[i].index]); - - distorm_format_signed_disp(str, di, addrMask); - chrcat_WS(str, CLOSE_CHR); - break; - case O_MEM: - distorm_format_size(str, di, i); - chrcat_WS(str, OPEN_CHR); - if ((SEGMENT_GET(di->segment) != R_NONE) && !SEGMENT_IS_DEFAULT(di->segment)) { - strcat_WS(str, (const _WString*)&_REGISTERS[SEGMENT_GET(di->segment)]); - chrcat_WS(str, SEG_OFF_CHR); - } - if (di->base != R_NONE) { - strcat_WS(str, (const _WString*)&_REGISTERS[di->base]); - chrcat_WS(str, PLUS_DISP_CHR); - } - strcat_WS(str, (const _WString*)&_REGISTERS[di->ops[i].index]); - if (di->scale != 0) { - chrcat_WS(str, '*'); - if (di->scale == 2) chrcat_WS(str, '2'); - else if (di->scale == 4) chrcat_WS(str, '4'); - else /* if (di->scale == 8) */ chrcat_WS(str, '8'); - } + strcat_WSR(&str, &_REGISTERS[di->ops[i].index]); - distorm_format_signed_disp(str, di, addrMask); - chrcat_WS(str, CLOSE_CHR); - break; - case O_PC: -#ifdef SUPPORT_64BIT_OFFSET - str_off64(str, (di->imm.sqword + di->addr + di->size) & addrMask); -#else - str_code_hdw(str, ((_OffsetType)di->imm.sdword + di->addr + di->size) & (uint32_t)addrMask); -#endif - break; - case O_PTR: - str_code_hdw(str, di->imm.ptr.seg); + distorm_format_signed_disp(&str, di, addrMask); + chrcat_WS(str, CLOSE_CHR); + } + else if (type == O_MEM) { + distorm_format_size(&str, di, i); + chrcat_WS(str, OPEN_CHR); + if (!SEGMENT_IS_DEFAULT_OR_NONE(di->segment)) { + strcat_WSR(&str, &_REGISTERS[SEGMENT_GET_UNSAFE(di->segment)]); chrcat_WS(str, SEG_OFF_CHR); - str_code_hdw(str, di->imm.ptr.off); - break; + } + if (di->base != R_NONE) { + strcat_WSR(&str, &_REGISTERS[di->base]); + chrcat_WS(str, PLUS_DISP_CHR); + } + strcat_WSR(&str, &_REGISTERS[di->ops[i].index]); + if (di->scale != 0) { + switch (di->scale) + { + case 2: strcat_WS(str, "*2", 2, 2); break; + case 4: strcat_WS(str, "*4", 2, 2); break; + case 8: strcat_WS(str, "*8", 2, 2); break; + } + } + distorm_format_signed_disp(&str, di, addrMask); + chrcat_WS(str, CLOSE_CHR); + } + else if (type == O_PTR) { + str_int(&str, di->imm.ptr.seg); + chrcat_WS(str, SEG_OFF_CHR); + str_int(&str, di->imm.ptr.off); + } + else if (type == O_IMM1) { + str_int(&str, di->imm.ex.i1); + } + else if (type == O_IMM2) { + str_int(&str, di->imm.ex.i2); } } +skipOperands: + + /* Finalize the operands string. */ + strfinalize_WS(result->operands, str); + + /* Not used anymore. if (di->flags & FLAG_HINT_TAKEN) strcat_WSN(str, " ;TAKEN"); else if (di->flags & FLAG_HINT_NOT_TAKEN) strcat_WSN(str, " ;NOT TAKEN"); + */ + { + /* In-place considerations: DI is RESULT. Deref fields first. */ + unsigned int opcode = di->opcode; + unsigned int prefix = FLAG_GET_PREFIX(di->flags); + unsigned int size = di->size; + _OffsetType offset = di->addr & addrMask; + str = (unsigned char*)&result->mnemonic.p; + mnemonic = (const _WMnemonic*)&_MNEMONICS[opcode]; + + if (prefix) { + /* REP prefix for CMPS and SCAS is really a REPZ. */ + prefix += (opcode == I_CMPS); + prefix += (opcode == I_SCAS); + memcpy(str, &prefixTable[prefix][0], 8); + str += prefixSizesTable[prefix]; + } + + /* + * Always copy 16 bytes from the mnemonic, we have a sentinel padding so we can read past. + * This helps the compiler to remove the call to memcpy and therefore makes this copying much faster. + * The longest instruction is exactly 16 chars long, so we null terminate the string below. + */ + memcpy((int8_t*)str, mnemonic->p, 16); + str += mnemonic->length; + + if (suffixSize > 0) { + *str++ = suffixTable[suffixSize]; + } + strfinalize_WS(result->mnemonic, str); + + result->offset = offset; + result->size = size; + } } #ifdef SUPPORT_64BIT_OFFSET @@ -347,9 +360,8 @@ static void distorm_format_signed_disp(_WString* str, const _DInst* di, uint64_t #endif { _DecodeResult res; - _DInst di; _CodeInfo ci; - unsigned int instsCount = 0, i; + unsigned int i, instsCount; *usedInstructionsCount = 0; @@ -358,19 +370,15 @@ static void distorm_format_signed_disp(_WString* str, const _DInst* di, uint64_t return DECRES_INPUTERR; } - if ((dt != Decode16Bits) && (dt != Decode32Bits) && (dt != Decode64Bits)) { + if ((unsigned)dt > (unsigned)Decode64Bits) { return DECRES_INPUTERR; } - if (code == NULL || result == NULL) { + /* Make sure there's at least one instruction in the result buffer. */ + if ((code == NULL) || (result == NULL) || (maxInstructions == 0)) { return DECRES_INPUTERR; } - /* Assume length=0 is success. */ - if (codeLen == 0) { - return DECRES_SUCCESS; - } - /* * We have to format the result into text. But the interal decoder works with the new structure of _DInst. * Therefore, we will pass the result array(!) from the caller and the interal decoder will fill it in with _DInst's. @@ -384,24 +392,22 @@ static void distorm_format_signed_disp(_WString* str, const _DInst* di, uint64_t ci.code = code; ci.codeLen = codeLen; ci.dt = dt; - ci.features = DF_NONE; - if (dt == Decode16Bits) ci.features = DF_MAXIMUM_ADDR16; - else if (dt == Decode32Bits) ci.features = DF_MAXIMUM_ADDR32; + ci.features = DF_USE_ADDR_MASK; + if (dt == Decode16Bits) ci.addrMask = 0xffff; + else if (dt == Decode32Bits) ci.addrMask = 0xffffffff; + else ci.addrMask = (_OffsetType)-1; - res = decode_internal(&ci, TRUE, (_DInst*)result, maxInstructions, &instsCount); + res = decode_internal(&ci, TRUE, (_DInst*)result, maxInstructions, usedInstructionsCount); + instsCount = *usedInstructionsCount; for (i = 0; i < instsCount; i++) { - if ((*usedInstructionsCount + i) >= maxInstructions) return DECRES_MEMORYERR; - - /* Copy the current decomposed result to a temp structure, so we can override the result with text. */ - memcpy(&di, (char*)result + (i * sizeof(_DecodedInst)), sizeof(_DInst)); + /* distorm_format is optimized and can work with same input/output buffer in-place. */ #ifdef SUPPORT_64BIT_OFFSET - distorm_format64(&ci, &di, &result[i]); + distorm_format64(&ci, (_DInst*)&result[i], &result[i]); #else - distorm_format32(&ci, &di, &result[i]); + distorm_format32(&ci, (_DInst*)&result[i], &result[i]); #endif } - *usedInstructionsCount = instsCount; return res; } diff --git a/NativeCore/Dependencies/distorm/src/instructions.c b/NativeCore/Dependencies/distorm/src/instructions.c index 9107b6b0..ff1c43cd 100644 --- a/NativeCore/Dependencies/distorm/src/instructions.c +++ b/NativeCore/Dependencies/distorm/src/instructions.c @@ -4,7 +4,7 @@ instructions.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -168,14 +168,15 @@ static _InstInfo* inst_lookup_prefixed(_InstNode in, _PrefixState* ps) * try to get the instruction and only then check for the operand size prefix. */ - /* If both REPNZ and REP are together, it's illegal for sure. */ + /* If both REPNZ and REP are together, it's illegal for sure. */ if ((ps->decodedPrefixes & INST_PRE_REPS) == INST_PRE_REPS) return NULL; /* Now we know it's either REPNZ+OPSIZE or REP+OPSIZE, so examine the instruction. */ if (ps->decodedPrefixes & INST_PRE_REPNZ) { index = 3; ps->decodedPrefixes &= ~INST_PRE_REPNZ; - } else if (ps->decodedPrefixes & INST_PRE_REP) { + } + else if (ps->decodedPrefixes & INST_PRE_REP) { index = 2; ps->decodedPrefixes &= ~INST_PRE_REP; } @@ -238,7 +239,8 @@ static _InstInfo* inst_vex_lookup(_CodeInfo* ci, _PrefixState* ps) pp = vex & 3; /* Implied leading 0x0f byte by default for 2 bytes VEX prefix. */ start = 1; - } else { /* PET_VEX3BYTES */ + } + else { /* PET_VEX3BYTES */ start = vex & 0x1f; vex2 = *(ps->vexPos + 1); ps->vexV = v = (~vex2 >> 3) & 0xf; @@ -297,7 +299,8 @@ static _InstInfo* inst_vex_lookup(_CodeInfo* ci, _PrefixState* ps) if (instType == INT_LIST_GROUP) { in = InstructionsTree[instIndex + ((*ci->code >> 3) & 7)]; /* Continue below to check prefixed table. */ - } else if (instType == INT_LIST_FULL) { + } + else if (instType == INT_LIST_FULL) { in = InstructionsTree[instIndex + *ci->code]; /* Continue below to check prefixed table. */ } @@ -316,30 +319,40 @@ static _InstInfo* inst_vex_lookup(_CodeInfo* ci, _PrefixState* ps) return NULL; } -_InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) +_InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps, int* isPrefixed) { - unsigned int tmpIndex0 = 0, tmpIndex1 = 0, tmpIndex2 = 0, rex = ps->vrex; - int instType = 0; - _InstNode in = 0; + unsigned int tmpIndex0, tmpIndex1, tmpIndex2; + int instType; + _InstNode in; _InstInfo* ii = NULL; int isWaitIncluded = FALSE; - /* See whether we have to handle a VEX prefixed instruction. */ - if (ps->decodedPrefixes & INST_PRE_VEX) { - ii = inst_vex_lookup(ci, ps); - if (ii != NULL) { - /* Make sure that VEX.L exists when forced. */ - if ((((_InstInfoEx*)ii)->flagsEx & INST_FORCE_VEXL) && (~ps->vrex & PREFIX_EX_L)) return NULL; - /* If the instruction doesn't use VEX.vvvv it must be zero. */ - if ((((_InstInfoEx*)ii)->flagsEx & INST_VEX_V_UNUSED) && ps->vexV) return NULL; + /* Always safe to read first byte codeLen > 0. */ + tmpIndex0 = *ci->code; + + if (prefixes_is_valid((unsigned char)tmpIndex0, ci->dt)) { + *isPrefixed = TRUE; + prefixes_decode(ci, ps); + if (ci->codeLen < 1) return NULL; /* No more bytes for opcode, halt. */ + tmpIndex0 = *ci->code; /* Reload. */ + + /* If there are too many prefixes, it will be checked later in decode_inst. */ + + /* See whether we have to handle a VEX prefixed instruction. */ + if (ps->decodedPrefixes & INST_PRE_VEX) { + ii = inst_vex_lookup(ci, ps); + if (ii != NULL) { + /* Make sure that VEX.L exists when forced. */ + if ((((_InstInfoEx*)ii)->flagsEx & INST_FORCE_VEXL) && (~ps->vrex & PREFIX_EX_L)) return NULL; + /* If the instruction doesn't use VEX.vvvv it must be zero. */ + if ((((_InstInfoEx*)ii)->flagsEx & INST_VEX_V_UNUSED) && ps->vexV) return NULL; + } + return ii; } - return ii; } - /* Read first byte. */ + /* Account first byte, we know it's safe to read. */ ci->codeLen -= 1; - if (ci->codeLen < 0) return NULL; - tmpIndex0 = *ci->code; /* Check for special 0x9b, WAIT instruction, which can be part of some instructions(x87). */ if (tmpIndex0 == INST_WAIT_INDEX) { @@ -359,27 +372,14 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) /* Walk first byte in InstructionsTree root. */ in = InstructionsTree[tmpIndex0]; - if (in == INT_NOTEXISTS) return NULL; + if ((uint32_t)in == INT_NOTEXISTS) return NULL; instType = INST_NODE_TYPE(in); /* Single byte instruction (OCST_1BYTE). */ if ((instType < INT_INFOS) && (!isWaitIncluded)) { /* Some single byte instructions need extra treatment. */ - switch (tmpIndex0) - { - case INST_ARPL_INDEX: - /* - * ARPL/MOVSXD share the same opcode, and both have different operands and mnemonics, of course. - * Practically, I couldn't come up with a comfortable way to merge the operands' types of ARPL/MOVSXD. - * And since the DB can't be patched dynamically, because the DB has to be multi-threaded compliant, - * I have no choice but to check for ARPL/MOVSXD right here - "right about now, the funk soul brother, check it out now, the funk soul brother...", fatboy slim - */ - if (ci->dt == Decode64Bits) { - return &II_MOVSXD; - } /* else ARPL will be returned because its defined in the DB already. */ - break; - - case INST_NOP_INDEX: /* Nopnopnop */ + if (instType == INT_INFO_TREAT) { + if (tmpIndex0 == INST_NOP_INDEX) { /* Nopnopnop */ /* Check for Pause, since it's prefixed with 0xf3, which is not a real mandatory prefix. */ if (ps->decodedPrefixes & INST_PRE_REP) { /* Flag this prefix as used. */ @@ -395,20 +395,33 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) * 90 XCHG EAX, EAX is a true NOP (and not high dword of RAX = 0 although it should be a 32 bits operation). * Note that if the REX.B is used, then the register is not RAX anymore but R8, which means it's not a NOP. */ - if (rex & PREFIX_EX_W) ps->usedPrefixes |= INST_PRE_REX; - if ((ci->dt != Decode64Bits) || (~rex & PREFIX_EX_B)) return &II_NOP; - break; - - case INST_LEA_INDEX: + if (ps->vrex & PREFIX_EX_W) ps->usedPrefixes |= INST_PRE_REX; + if ((ci->dt != Decode64Bits) || (~ps->vrex & PREFIX_EX_B)) return &II_NOP; + } + else if (tmpIndex0 == INST_LEA_INDEX) { /* Ignore segment override prefixes for LEA instruction. */ ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; /* Update unused mask for ignoring segment prefix. */ prefixes_ignore(ps, PFXIDX_SEG); - break; + } + else if (tmpIndex0 == INST_ARPL_INDEX) { + /* + * ARPL/MOVSXD share the same opcode, and both have different operands and mnemonics, of course. + * Practically, I couldn't come up with a comfortable way to merge the operands' types of ARPL/MOVSXD. + * And since the DB can't be patched dynamically, because the DB has to be multi-threaded compliant, + * I have no choice but to check for ARPL/MOVSXD right here - "right about now, the funk soul brother, check it out now, the funk soul brother...", fatboy slim + */ + if (ci->dt == Decode64Bits) { + return &II_MOVSXD; + } /* else ARPL will be returned because its defined in the DB already. */ + } } - - /* Return the 1 byte instruction we found. */ - return instType == INT_INFO ? &InstInfos[INST_NODE_INDEX(in)] : (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in)]; + /* + * Return the 1 byte instruction we found. + * We can have three node types here: infoex, info_treat and info. + * The latter two are really the same basic structure. + */ + return instType == INT_INFOEX ? (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in)] : &InstInfos[INST_NODE_INDEX(in)]; } /* Read second byte, still doesn't mean all of its bits are used (I.E: ModRM). */ @@ -416,7 +429,7 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) ci->codeLen -= 1; if (ci->codeLen < 0) return NULL; tmpIndex1 = *ci->code; - + /* Try single byte instruction + reg bits (OCST_13BYTES). */ if ((instType == INT_LIST_GROUP) && (!isWaitIncluded)) return inst_get_info(in, (tmpIndex1 >> 3) & 7); @@ -442,13 +455,14 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) if (tmpIndex1 < INST_DIVIDED_MODRM) { /* An instruction which requires a ModR/M byte. Thus it's 1.3 bytes long instruction. */ tmpIndex1 = (tmpIndex1 >> 3) & 7; /* Isolate the 3 REG/OPCODE bits. */ - } else { /* Normal 2 bytes instruction. */ - /* - * Divided instructions can't be in the range of 0x8-0xc0. - * That's because 0-8 are used for 3 bits group. - * And 0xc0-0xff are used for not-divided instruction. - * So the in between range is omitted, thus saving some more place in the tables. - */ + } + else { /* Normal 2 bytes instruction. */ + /* + * Divided instructions can't be in the range of 0x8-0xc0. + * That's because 0-8 are used for 3 bits group. + * And 0xc0-0xff are used for not-divided instruction. + * So the in between range is omitted, thus saving some more place in the tables. + */ tmpIndex1 -= INST_DIVIDED_MODRM - 8; } @@ -525,7 +539,7 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) * hence we don't override 'in', cause we might still need it. */ instType = INST_NODE_TYPE(in2); - + if (instType == INT_INFO) ii = &InstInfos[INST_NODE_INDEX(in2)]; else if (instType == INT_INFOEX) ii = (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in2)]; @@ -535,7 +549,7 @@ _InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps) * or it was an official 2.3 (because its index was less than 0xc0) - * Then it means the instruction should be using the REG bits, otherwise give a chance to range 0xc0-0xff. */ - /* If we found an instruction only by its REG bits, AND it is not divided, then return it. */ + /* If we found an instruction only by its REG bits, AND it is not divided, then return it. */ if ((ii != NULL) && (INST_INFO_FLAGS(ii) & INST_NOT_DIVIDED)) return ii; /* Otherwise, if the range is above 0xc0, try the special divided range (range 0x8-0xc0 is omitted). */ if (tmpIndex2 >= INST_DIVIDED_MODRM) return inst_get_info(in, tmpIndex2 - INST_DIVIDED_MODRM + 8); diff --git a/NativeCore/Dependencies/distorm/src/instructions.h b/NativeCore/Dependencies/distorm/src/instructions.h index f6c2c53b..4902c99a 100644 --- a/NativeCore/Dependencies/distorm/src/instructions.h +++ b/NativeCore/Dependencies/distorm/src/instructions.h @@ -4,7 +4,7 @@ instructions.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -22,6 +22,7 @@ This library is licensed under the BSD license. See the file COPYING. * actually, it depends on the decoding mode, unless there's an operand/address size prefix. * For example, the code: 33 c0 could be decoded/executed as XOR AX, AX or XOR EAX, EAX. */ + typedef enum OpType { /* No operand is set */ OT_NONE = 0, @@ -38,18 +39,6 @@ typedef enum OpType { /* Read a signed extended byte(8 bits) immediate */ OT_SEIMM8, - /* - * Special immediates for instructions which have more than one immediate, - * which is an exception from standard instruction format. - * As to version v1.0: ENTER, INSERTQ, EXTRQ are the only problematic ones. - */ - /* 16 bits immediate using the first imm-slot */ - OT_IMM16_1, - /* 8 bits immediate using the first imm-slot */ - OT_IMM8_1, - /* 8 bits immediate using the second imm-slot */ - OT_IMM8_2, - /* Use a 8bit register */ OT_REG8, /* Use a 16bit register */ @@ -63,71 +52,7 @@ typedef enum OpType { * VMX instructions are promoted automatically without a REX prefix. */ OT_REG32_64, - /* Used only by MOV CR/DR(n). Promoted with REX onlly. */ - OT_FREG32_64_RM, - - /* Use or read (indirection) a 8bit register or immediate byte */ - OT_RM8, - /* Some instructions force 16 bits (mov sreg, rm16) */ - OT_RM16, - /* Use or read a 16/32/64bit register or immediate word/dword/qword */ - OT_RM_FULL, - /* - * 32 or 64 bits (with REX) operand size indirection memory operand. - * Some instructions are promoted automatically without a REX prefix. - */ - OT_RM32_64, - /* 16 or 32 bits RM. This is used only with MOVZXD instruction in 64bits. */ - OT_RM16_32, - /* Same as OT_RMXX but POINTS to 16 bits [cannot use GENERAL-PURPOSE REG!] */ - OT_FPUM16, - /* Same as OT_RMXX but POINTS to 32 bits (single precision) [cannot use GENERAL-PURPOSE REG!] */ - OT_FPUM32, - /* Same as OT_RMXX but POINTS to 64 bits (double precision) [cannot use GENERAL-PURPOSE REG!] */ - OT_FPUM64, - /* Same as OT_RMXX but POINTS to 80 bits (extended precision) [cannot use GENERAL-PURPOSE REG!] */ - OT_FPUM80, - /* - * Special operand type for SSE4 where the ModR/M might - * be a 32 bits register or 8 bits memory indirection operand. - */ - OT_R32_M8, - /* - * Special ModR/M for PINSRW, which need a 16 bits memory operand or 32 bits register. - * In 16 bits decoding mode R32 becomes R16, operand size cannot affect this. - */ - OT_R32_M16, - /* - * Special type for SSE4, ModR/M might be a 32 bits or 64 bits (with REX) register or - * a 8 bits memory indirection operand. - */ - OT_R32_64_M8, - /* - * Special type for SSE4, ModR/M might be a 32 bits or 64 bits (with REX) register or - * a 16 bits memory indirection operand. - */ - OT_R32_64_M16, - /* - * Special operand type for MOV reg16/32/64/mem16, segReg 8C /r. and SMSW. - * It supports all decoding modes, but if used as a memory indirection it's a 16 bit ModR/M indirection. - */ - OT_RFULL_M16, - - /* Use a control register */ - OT_CREG, - /* Use a debug register */ - OT_DREG, - /* Use a segment register */ - OT_SREG, - /* - * SEG is encoded in the flags of the opcode itself! - * This is used for specific "push SS" where SS is a segment where - * each "push SS" has an absolutely different opcode byte. - * We need this to detect whether an operand size prefix is used. - */ - OT_SEG, - /* Use AL */ OT_ACC8, /* Use AX (FSTSW) */ @@ -137,41 +62,11 @@ typedef enum OpType { /* Use AX/EAX, no REX is possible for RAX, used only with IN/OUT which don't support 64 bit registers */ OT_ACC_FULL_NOT64, - /* - * Read one word (seg), and a word/dword/qword (depends on operand size) from memory. - * JMP FAR [EBX] means EBX point to 16:32 ptr. - */ - OT_MEM16_FULL, - /* Read one word (seg) and a word/dword/qword (depends on operand size), usually SEG:OFF, JMP 1234:1234 */ - OT_PTR16_FULL, - /* Read one word (limit) and a dword/qword (limit) (depends on operand size), used by SGDT, SIDT, LGDT, LIDT. */ - OT_MEM16_3264, - /* Read a byte(8 bits) immediate and calculate it relatively to the current offset of the instruction being decoded */ OT_RELCB, /* Read a word/dword immediate and calculate it relatively to the current offset of the instruction being decoded */ OT_RELC_FULL, - /* Use general memory indirection, with varying sizes: */ - OT_MEM, - /* Used when a memory indirection is required, but if the mod field is 11, this operand will be ignored. */ - OT_MEM_OPT, - OT_MEM32, - /* Memory dereference for MOVNTI, either 32 or 64 bits (with REX). */ - OT_MEM32_64, - OT_MEM64, - OT_MEM128, - /* Used for cmpxchg8b/16b. */ - OT_MEM64_128, - - /* Read an immediate as an absolute address, size is known by instruction, used by MOV (memory offset) only */ - OT_MOFFS8, - OT_MOFFS_FULL, - /* Use an immediate of 1, as for SHR R/M, 1 */ - OT_CONST1, - /* Use CL, as for SHR R/M, CL */ - OT_REGCL, - /* * Instruction-Block for one byte long instructions, used by INC/DEC/PUSH/POP/XCHG, * REG is extracted from the value of opcode @@ -181,6 +76,9 @@ typedef enum OpType { /* Use a 16/32/64bit register */ OT_IB_R_FULL, + /* Read an immediate as an absolute address, size is known by instruction, used by MOV (memory offset) only */ + OT_MOFFS8, + OT_MOFFS_FULL, /* Use [(r)SI] as INDIRECTION, for repeatable instructions */ OT_REGI_ESI, /* Use [(r)DI] as INDIRECTION, for repeatable instructions */ @@ -199,19 +97,164 @@ typedef enum OpType { OT_FPU_SSI, /* ST(0), ST(i) */ OT_FPU_SIS, /* ST(i), ST(0) */ + /* SSE registers: */ + OT_XMM, + /* Extract the SSE register from the RM bits this time (used when the REG bits are used for opcode extension) */ + OT_XMM_RM, + /* Implied XMM0 register as operand, used in SSE4. */ + OT_REGXMM0, + /* Reg32/Reg 64 depends on prefix width only. */ + OT_WREG32_64, + + /* XMM is encoded in VEX.VVVV. */ + OT_VXMM, + /* XMM is encoded in the high nibble of an immediate byte. */ + OT_XMM_IMM, + /* YMM/XMM is dependent on VEX.L. */ + OT_YXMM, + /* YMM/XMM (depends on prefix length) is encoded in the high nibble of an immediate byte. */ + OT_YXMM_IMM, + /* YMM is encoded in reg. */ + OT_YMM, + /* YMM is encoded in VEX.VVVV. */ + OT_VYMM, + /* YMM/XMM is dependent on VEX.L, and encoded in VEX.VVVV. */ + OT_VYXMM, + + /* Use an immediate of 1, as for SHR R/M, 1 */ + OT_CONST1, + /* Use CL, as for SHR R/M, CL */ + OT_REGCL, + + /* Use a control register */ + OT_CREG, + /* Use a debug register */ + OT_DREG, + /* Use a segment register */ + OT_SREG, + /* + * SEG is encoded in the flags of the opcode itself! + * This is used for specific "push SS" where SS is a segment where + * each "push SS" has an absolutely different opcode byte. + * We need this to detect whether an operand size prefix is used. + */ + OT_SEG, + + /* + * Special immediates for instructions which have more than one immediate, + * which is an exception from standard instruction format. + * As to version v1.0: ENTER, INSERTQ, EXTRQ are the only problematic ones. + */ + /* 16 bits immediate using the first imm-slot */ + OT_IMM16_1, + /* 8 bits immediate using the first imm-slot */ + OT_IMM8_1, + /* 8 bits immediate using the second imm-slot */ + OT_IMM8_2, + + /* Read one word (seg) and a word/dword/qword (depends on operand size), usually SEG:OFF, JMP 1234:1234 */ + OT_PTR16_FULL, + + /* Used only by MOV CR/DR(n). Promoted with REX onlly. */ + OT_FREG32_64_RM, + /* MMX registers: */ OT_MM, /* Extract the MMX register from the RM bits this time (used when the REG bits are used for opcode extension) */ OT_MM_RM, + + + /**** MEMORY only operands: ****/ + + /* Use general memory indirection, with varying sizes: */ + OT_MEM, + OT_MEM32, + /* Memory dereference for MOVNTI, either 32 or 64 bits (with REX). */ + OT_MEM32_64, + OT_MEM64, + /* Used for cmpxchg8b/16b. */ + OT_MEM64_128, + OT_MEM128, + /* + * Read one word (seg), and a word/dword/qword (depends on operand size) from memory. + * JMP FAR [EBX] means EBX point to 16:32 ptr. + */ + OT_MEM16_FULL, + /* Read one word (limit) and a dword/qword (limit) (depends on operand size), used by SGDT, SIDT, LGDT, LIDT. */ + OT_MEM16_3264, + /* Used when a memory indirection is required, but if the mod field is 11, this operand will be ignored. */ + OT_MEM_OPT, + + /* Same as OT_RMXX but POINTS to 16 bits [cannot use GENERAL-PURPOSE REG!] */ + OT_FPUM16, + /* Same as OT_RMXX but POINTS to 32 bits (single precision) [cannot use GENERAL-PURPOSE REG!] */ + OT_FPUM32, + /* Same as OT_RMXX but POINTS to 64 bits (double precision) [cannot use GENERAL-PURPOSE REG!] */ + OT_FPUM64, + /* Same as OT_RMXX but POINTS to 80 bits (extended precision) [cannot use GENERAL-PURPOSE REG!] */ + OT_FPUM80, + + /* Mem128/Mem256 is dependent on VEX.L. */ + OT_LMEM128_256, + + + /**** MEMORY & REGISTER only operands: ****/ + + /* Use or read (indirection) a 8bit register or immediate byte */ + OT_RM8, + /* Some instructions force 16 bits (mov sreg, rm16) */ + OT_RM16, + /* ModR/M for 32 bits. */ + OT_RM32, + /* + * Special operand type for MOV reg16/32/64/mem16, segReg 8C /r. and SMSW. + * It supports all decoding modes, but if used as a memory indirection it's a 16 bit ModR/M indirection. + */ + OT_RFULL_M16, + /* Use or read a 16/32/64bit register or immediate word/dword/qword */ + OT_RM_FULL, + + /* RM32/RM64 depends on prefix width only. */ + OT_WRM32_64, + /* + * Special type for SSE4, ModR/M might be a 32 bits or 64 bits (with REX) register or + * a 8 bits memory indirection operand. + */ + OT_R32_64_M8, + /* + * Special type for SSE4, ModR/M might be a 32 bits or 64 bits (with REX) register or + * a 16 bits memory indirection operand. + */ + OT_R32_64_M16, + + /* + * 32 or 64 bits (with REX) operand size indirection memory operand. + * Some instructions are promoted automatically without a REX prefix. + */ + OT_RM32_64, + /* 16 or 32 bits RM. This is used only with MOVZXD instruction in 64bits. */ + OT_RM16_32, + + /* + * Special operand type for SSE4 where the ModR/M might + * be a 32 bits register or 8 bits memory indirection operand. + */ + OT_R32_M8, + /* + * Special ModR/M for PINSRW, which need a 16 bits memory operand or 32 bits register. + * In 16 bits decoding mode R32 becomes R16, operand size cannot affect this. + */ + OT_R32_M16, + /* Reg32/Reg64 (prefix width) or Mem8. */ + OT_REG32_64_M8, + /* Reg32/Reg64 (prefix width) or Mem16. */ + OT_REG32_64_M16, + /* ModR/M points to 32 bits MMX variable */ OT_MM32, /* ModR/M points to 32 bits MMX variable */ OT_MM64, - /* SSE registers: */ - OT_XMM, - /* Extract the SSE register from the RM bits this time (used when the REG bits are used for opcode extension) */ - OT_XMM_RM, /* ModR/M points to 16 bits SSE variable */ OT_XMM16, /* ModR/M points to 32 bits SSE variable */ @@ -220,47 +263,18 @@ typedef enum OpType { OT_XMM64, /* ModR/M points to 128 bits SSE variable */ OT_XMM128, - /* Implied XMM0 register as operand, used in SSE4. */ - OT_REGXMM0, /* AVX operands: */ - - /* ModR/M for 32 bits. */ - OT_RM32, - /* Reg32/Reg64 (prefix width) or Mem8. */ - OT_REG32_64_M8, - /* Reg32/Reg64 (prefix width) or Mem16. */ - OT_REG32_64_M16, - /* Reg32/Reg 64 depends on prefix width only. */ - OT_WREG32_64, - /* RM32/RM64 depends on prefix width only. */ - OT_WRM32_64, /* XMM or Mem32/Mem64 depends on perfix width only. */ OT_WXMM32_64, - /* XMM is encoded in VEX.VVVV. */ - OT_VXMM, - /* XMM is encoded in the high nibble of an immediate byte. */ - OT_XMM_IMM, - /* YMM/XMM is dependent on VEX.L. */ - OT_YXMM, - /* YMM/XMM (depends on prefix length) is encoded in the high nibble of an immediate byte. */ - OT_YXMM_IMM, - /* YMM is encoded in reg. */ - OT_YMM, /* YMM or Mem256. */ OT_YMM256, - /* YMM is encoded in VEX.VVVV. */ - OT_VYMM, - /* YMM/XMM is dependent on VEX.L, and encoded in VEX.VVVV. */ - OT_VYXMM, /* YMM/XMM or Mem64/Mem256 is dependent on VEX.L. */ OT_YXMM64_256, /* YMM/XMM or Mem128/Mem256 is dependent on VEX.L. */ OT_YXMM128_256, /* XMM or Mem64/Mem256 is dependent on VEX.L. */ - OT_LXMM64_128, - /* Mem128/Mem256 is dependent on VEX.L. */ - OT_LMEM128_256 + OT_LXMM64_128 } _OpType; /* Flags for instruction: */ @@ -365,7 +379,7 @@ typedef enum OpType { #define INST_VEX_V_UNUSED (1 << 6) /* Indication that the instruction is privileged (Ring 0), this should be checked on the opcodeId field. */ -#define OPCODE_ID_PRIVILEGED ((uint16_t)0x8000) +#define META_INST_PRIVILEGED ((uint16_t)0x8000) /* * Indicates which operand is being decoded. @@ -399,7 +413,6 @@ typedef enum {ONT_NONE = -1, ONT_1 = 0, ONT_2 = 1, ONT_3 = 2, ONT_4 = 3} _Operan typedef struct { uint8_t flagsIndex; /* An index into FlagsTables */ uint8_t s, d; /* OpType. */ - uint8_t meta; /* Hi 5 bits = Instruction set class | Lo 3 bits = flow control flags. */ /* * The following are CPU flag masks that the instruction changes. * The flags are compacted so 8 bits representation is enough. @@ -408,6 +421,7 @@ typedef struct { uint8_t modifiedFlagsMask; uint8_t testedFlagsMask; uint8_t undefinedFlagsMask; + uint16_t meta; /* High byte = Instruction set class | Low byte = flow control flags. */ } _InstSharedInfo; /* @@ -445,6 +459,7 @@ typedef enum { INT_NOTEXISTS = 0, /* Not exists. */ INT_INFO = 1, /* It's an instruction info. */ INT_INFOEX, + INT_INFO_TREAT, /* Extra intervention is required by inst_lookup. */ INT_LIST_GROUP, INT_LIST_FULL, INT_LIST_DIVIDED, @@ -457,7 +472,8 @@ typedef enum { /* Instruction node is treated as { int index:13; int type:3; } */ typedef uint16_t _InstNode; -_InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps); +_InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps, int* isPrefixed); _InstInfo* inst_lookup_3dnow(_CodeInfo* ci); #endif /* INSTRUCTIONS_H */ + diff --git a/NativeCore/Dependencies/distorm/src/insts.c b/NativeCore/Dependencies/distorm/src/insts.c index f7d283e5..688558c1 100644 --- a/NativeCore/Dependencies/distorm/src/insts.c +++ b/NativeCore/Dependencies/distorm/src/insts.c @@ -4,7 +4,7 @@ insts.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -15,15 +15,15 @@ This library is licensed under the BSD license. See the file COPYING. /* - * GENERATED BY disOps at Sat Nov 10 19:20:27 2018 + * GENERATED BY disOps at Fri Dec 17 10:22:38 2021 */ -_InstInfo II_MOVSXD = /*II*/ {0x1d4, 10027}; -_InstInfo II_NOP = /*II*/ {0x53, 581}; -_InstInfo II_PAUSE = /*II*/ {0x88, 10035}; -_InstInfo II_WAIT = /*II*/ {0x53, 10042}; -_InstInfo II_RDRAND = /*II*/ {0x1d5, 10048}; -_InstInfo II_3DNOW = /*II*/ {0x1d6, 10056}; +_InstInfo II_MOVSXD = /*II*/ {0x1d7, 10038}; +_InstInfo II_NOP = /*II*/ {0x53, 580}; +_InstInfo II_PAUSE = /*II*/ {0x91, 10046}; +_InstInfo II_WAIT = /*II*/ {0x53, 10053}; +_InstInfo II_RDRAND = /*II*/ {0x1d8, 10059}; +_InstInfo II_3DNOW = /*II*/ {0x1d9, 10067}; _iflags FlagsTable[101] = { 0x80000011, @@ -60,7 +60,6 @@ _iflags FlagsTable[101] = { 0x4014000, 0x8, 0x81000009, -0x9, 0x80000009, 0x1000808, 0x81000808, @@ -94,6 +93,7 @@ _iflags FlagsTable[101] = { 0x80090009, 0x200b0009, 0x20020009, +0x9, 0x80100009, 0x21100009, 0x87000009, @@ -134,7 +134,7 @@ _InstNode Table_0F_0F = 1440; _InstNode Table_0F_38 = 1896; _InstNode Table_0F_3A = 2152; -_InstInfo InstInfos[1246] = { +_InstInfo InstInfos[1248] = { /*II_00*/ {0x0, 11}, /*II_01*/ {0x1, 11}, /*II_02*/ {0x2, 11}, @@ -232,10 +232,10 @@ _InstInfo InstInfos[1246] = { /*II_63*/ {0x32, 111}, /*II_68*/ {0x33, 16}, /*II_6A*/ {0x35, 16}, - /*II_6C*/ {0x36, 32891}, - /*II_6D*/ {0x37, 32891}, - /*II_6E*/ {0x38, 32896}, - /*II_6F*/ {0x39, 32896}, + /*II_6C*/ {0x36, 123}, + /*II_6D*/ {0x37, 123}, + /*II_6E*/ {0x38, 128}, + /*II_6F*/ {0x39, 128}, /*II_70*/ {0x3a, 134}, /*II_71*/ {0x3a, 138}, /*II_72*/ {0x3b, 143}, @@ -316,1071 +316,1073 @@ _InstInfo InstInfos[1246] = { /*II_C9*/ {0x6a, 347}, /*II_CA*/ {0x6b, 354}, /*II_CB*/ {0x6c, 354}, - /*II_CC*/ {0x6d, 360}, - /*II_CD*/ {0x6e, 367}, - /*II_CE*/ {0x6f, 372}, - /*II_CF*/ {0x70, 33146}, - /*II_D4*/ {0x71, 384}, - /*II_D5*/ {0x71, 389}, - /*II_D6*/ {0x72, 394}, - /*II_D7*/ {0x73, 400}, - /*II_E0*/ {0x74, 406}, - /*II_E1*/ {0x74, 414}, - /*II_E2*/ {0x75, 421}, - /*II_E4*/ {0x77, 33215}, - /*II_E5*/ {0x78, 33215}, - /*II_E6*/ {0x79, 33219}, - /*II_E7*/ {0x7a, 33219}, - /*II_E8*/ {0x7b, 456}, - /*II_E9*/ {0x7c, 462}, - /*II_EA*/ {0x7d, 467}, - /*II_EB*/ {0x7e, 462}, - /*II_EC*/ {0x7f, 33215}, - /*II_ED*/ {0x80, 33215}, - /*II_EE*/ {0x81, 33219}, - /*II_EF*/ {0x82, 33219}, - /*II_F1*/ {0x6d, 476}, - /*II_F4*/ {0x53, 33250}, - /*II_F5*/ {0x83, 487}, - /*II_F8*/ {0x83, 492}, - /*II_F9*/ {0x83, 497}, - /*II_FA*/ {0x84, 33270}, - /*II_FB*/ {0x84, 33275}, - /*II_FC*/ {0x85, 512}, - /*II_FD*/ {0x85, 517}, - /*II_0F_02*/ {0x86, 522}, - /*II_0F_03*/ {0x86, 527}, - /*II_0F_05*/ {0x87, 532}, - /*II_0F_06*/ {0x88, 33309}, - /*II_0F_07*/ {0x87, 547}, - /*II_0F_08*/ {0x88, 33323}, - /*II_0F_09*/ {0x88, 33329}, - /*II_0F_0B*/ {0x89, 569}, - /*II_0F_0E*/ {0x8a, 574}, - /*II_0F_1F*/ {0x8b, 581}, - /*II_0F_20*/ {0x8c, 32986}, - /*II_0F_21*/ {0x8d, 32986}, - /*II_0F_22*/ {0x8e, 32986}, - /*II_0F_23*/ {0x8f, 32986}, - /*II_0F_30*/ {0x88, 33354}, - /*II_0F_31*/ {0x88, 33361}, - /*II_0F_32*/ {0x88, 33368}, - /*II_0F_33*/ {0x88, 33375}, - /*II_0F_34*/ {0x87, 614}, - /*II_0F_35*/ {0x87, 624}, - /*II_0F_37*/ {0x90, 633}, - /*II_0F_40*/ {0x91, 641}, - /*II_0F_41*/ {0x91, 648}, - /*II_0F_42*/ {0x92, 656}, - /*II_0F_43*/ {0x92, 663}, - /*II_0F_44*/ {0x93, 671}, - /*II_0F_45*/ {0x93, 678}, - /*II_0F_46*/ {0x94, 686}, - /*II_0F_47*/ {0x94, 694}, - /*II_0F_48*/ {0x95, 701}, - /*II_0F_49*/ {0x95, 708}, - /*II_0F_4A*/ {0x96, 716}, - /*II_0F_4B*/ {0x96, 723}, - /*II_0F_4C*/ {0x97, 731}, - /*II_0F_4D*/ {0x97, 738}, - /*II_0F_4E*/ {0x98, 746}, - /*II_0F_4F*/ {0x98, 754}, - /*II_0F_80*/ {0x99, 134}, - /*II_0F_81*/ {0x99, 138}, - /*II_0F_82*/ {0x9a, 143}, - /*II_0F_83*/ {0x9a, 147}, - /*II_0F_84*/ {0x9b, 152}, - /*II_0F_85*/ {0x9b, 156}, - /*II_0F_86*/ {0x9c, 161}, - /*II_0F_87*/ {0x9c, 166}, - /*II_0F_88*/ {0x9d, 170}, - /*II_0F_89*/ {0x9d, 174}, - /*II_0F_8A*/ {0x9e, 179}, - /*II_0F_8B*/ {0x9e, 183}, - /*II_0F_8C*/ {0x9f, 188}, - /*II_0F_8D*/ {0x9f, 192}, - /*II_0F_8E*/ {0xa0, 197}, - /*II_0F_8F*/ {0xa0, 202}, - /*II_0F_90*/ {0xa1, 761}, - /*II_0F_91*/ {0xa1, 767}, - /*II_0F_92*/ {0xa2, 774}, - /*II_0F_93*/ {0xa2, 780}, - /*II_0F_94*/ {0xa3, 787}, - /*II_0F_95*/ {0xa3, 793}, - /*II_0F_96*/ {0xa4, 800}, - /*II_0F_97*/ {0xa4, 807}, - /*II_0F_98*/ {0xa5, 813}, - /*II_0F_99*/ {0xa5, 819}, - /*II_0F_9A*/ {0xa6, 826}, - /*II_0F_9B*/ {0xa6, 832}, - /*II_0F_9C*/ {0xa7, 839}, - /*II_0F_9D*/ {0xa7, 845}, - /*II_0F_9E*/ {0xa8, 852}, - /*II_0F_9F*/ {0xa8, 859}, - /*II_0F_A0*/ {0xa9, 16}, - /*II_0F_A1*/ {0xaa, 22}, - /*II_0F_A2*/ {0x88, 865}, - /*II_0F_A3*/ {0xab, 872}, - /*II_0F_A8*/ {0xad, 16}, - /*II_0F_A9*/ {0xae, 22}, - /*II_0F_AA*/ {0xaf, 882}, - /*II_0F_AB*/ {0xb0, 887}, - /*II_0F_AF*/ {0xb1, 117}, - /*II_0F_B0*/ {0xb2, 898}, - /*II_0F_B1*/ {0xb3, 898}, - /*II_0F_B2*/ {0xb4, 907}, - /*II_0F_B3*/ {0xb0, 912}, - /*II_0F_B4*/ {0xb4, 917}, - /*II_0F_B5*/ {0xb4, 922}, - /*II_0F_B6*/ {0xb5, 927}, - /*II_0F_B7*/ {0xb6, 927}, - /*II_0F_B9*/ {0x89, 569}, - /*II_0F_BB*/ {0xb0, 934}, - /*II_0F_BE*/ {0xb5, 939}, - /*II_0F_BF*/ {0xb6, 939}, - /*II_0F_C0*/ {0xb2, 946}, - /*II_0F_C1*/ {0xb3, 946}, - /*II_0F_C3*/ {0xb7, 952}, - /*II_0F_C8*/ {0xb8, 960}, - /*II_0F_C8*/ {0xb8, 960}, - /*II_0F_C8*/ {0xb8, 960}, - /*II_0F_C8*/ {0xb8, 960}, - /*II_0F_C8*/ {0xb8, 960}, - /*II_0F_C8*/ {0xb8, 960}, - /*II_0F_C8*/ {0xb8, 960}, - /*II_0F_C8*/ {0xb8, 960}, - /*II_80_00*/ {0xb9, 11}, - /*II_80_01*/ {0xba, 27}, - /*II_80_02*/ {0xbb, 31}, - /*II_80_03*/ {0xbb, 36}, - /*II_80_04*/ {0xbc, 41}, - /*II_80_05*/ {0xb9, 51}, - /*II_80_06*/ {0xbd, 61}, - /*II_80_07*/ {0xbe, 71}, - /*II_81_00*/ {0xbf, 11}, - /*II_81_01*/ {0xc0, 27}, - /*II_81_02*/ {0xc1, 31}, - /*II_81_03*/ {0xc1, 36}, - /*II_81_04*/ {0xc2, 41}, - /*II_81_05*/ {0xbf, 51}, - /*II_81_06*/ {0xc3, 61}, - /*II_81_07*/ {0xc4, 71}, - /*II_82_00*/ {0xc5, 11}, - /*II_82_01*/ {0xc6, 27}, - /*II_82_02*/ {0xc7, 31}, - /*II_82_03*/ {0xc7, 36}, - /*II_82_04*/ {0xc8, 41}, - /*II_82_05*/ {0xc5, 51}, - /*II_82_06*/ {0xc9, 61}, - /*II_82_07*/ {0xca, 71}, - /*II_83_00*/ {0xcb, 11}, - /*II_83_01*/ {0xcc, 27}, - /*II_83_02*/ {0xcd, 31}, - /*II_83_03*/ {0xcd, 36}, - /*II_83_04*/ {0xce, 41}, - /*II_83_05*/ {0xcb, 51}, - /*II_83_06*/ {0xcf, 61}, - /*II_83_07*/ {0xd0, 71}, - /*II_8F_00*/ {0xd1, 22}, - /*II_C0_00*/ {0xd2, 967}, - /*II_C0_01*/ {0xd2, 972}, - /*II_C0_02*/ {0xd3, 977}, - /*II_C0_03*/ {0xd3, 982}, - /*II_C0_04*/ {0xd4, 987}, - /*II_C0_05*/ {0xd4, 992}, - /*II_C0_06*/ {0xd4, 997}, - /*II_C0_07*/ {0xd4, 1002}, - /*II_C1_00*/ {0xd5, 967}, - /*II_C1_01*/ {0xd5, 972}, - /*II_C1_02*/ {0xd6, 977}, - /*II_C1_03*/ {0xd6, 982}, - /*II_C1_04*/ {0xd7, 987}, - /*II_C1_05*/ {0xd7, 992}, - /*II_C1_06*/ {0xd7, 997}, - /*II_C1_07*/ {0xd7, 1002}, - /*II_C6_00*/ {0xd8, 218}, - /*II_C6_F8*/ {0xd9, 1007}, - /*II_C7_00*/ {0xda, 218}, - /*II_C7_F8*/ {0xdb, 1015}, - /*II_D0_00*/ {0xdc, 967}, - /*II_D0_01*/ {0xdc, 972}, - /*II_D0_02*/ {0xdd, 977}, - /*II_D0_03*/ {0xdd, 982}, - /*II_D0_04*/ {0xde, 987}, - /*II_D0_05*/ {0xde, 992}, - /*II_D0_06*/ {0xde, 997}, - /*II_D0_07*/ {0xde, 1002}, - /*II_D1_00*/ {0xdf, 967}, - /*II_D1_01*/ {0xdf, 972}, - /*II_D1_02*/ {0xe0, 977}, - /*II_D1_03*/ {0xe0, 982}, - /*II_D1_04*/ {0xe1, 987}, - /*II_D1_05*/ {0xe1, 992}, - /*II_D1_06*/ {0xe1, 997}, - /*II_D1_07*/ {0xe1, 1002}, - /*II_D2_00*/ {0xe2, 967}, - /*II_D2_01*/ {0xe2, 972}, - /*II_D2_02*/ {0xe3, 977}, - /*II_D2_03*/ {0xe3, 982}, - /*II_D2_04*/ {0xe4, 987}, - /*II_D2_05*/ {0xe4, 992}, - /*II_D2_06*/ {0xe4, 997}, - /*II_D2_07*/ {0xe4, 1002}, - /*II_D3_00*/ {0xe5, 967}, - /*II_D3_01*/ {0xe5, 972}, - /*II_D3_02*/ {0xe6, 977}, - /*II_D3_03*/ {0xe6, 982}, - /*II_D3_04*/ {0xe7, 987}, - /*II_D3_05*/ {0xe7, 992}, - /*II_D3_06*/ {0xe7, 997}, - /*II_D3_07*/ {0xe7, 1002}, - /*II_D8_00*/ {0xe8, 1023}, - /*II_D8_01*/ {0xe8, 1029}, - /*II_D8_02*/ {0xe8, 1035}, - /*II_D8_03*/ {0xe8, 1041}, - /*II_D8_04*/ {0xe8, 1048}, - /*II_D8_05*/ {0xe8, 1054}, - /*II_D8_06*/ {0xe8, 1061}, - /*II_D8_07*/ {0xe8, 1067}, - /*II_D8_C0*/ {0xe9, 1023}, - /*II_D8_C0*/ {0xe9, 1023}, - /*II_D8_C0*/ {0xe9, 1023}, - /*II_D8_C0*/ {0xe9, 1023}, - /*II_D8_C0*/ {0xe9, 1023}, - /*II_D8_C0*/ {0xe9, 1023}, - /*II_D8_C0*/ {0xe9, 1023}, - /*II_D8_C0*/ {0xe9, 1023}, - /*II_D8_C8*/ {0xe9, 1029}, - /*II_D8_C8*/ {0xe9, 1029}, - /*II_D8_C8*/ {0xe9, 1029}, - /*II_D8_C8*/ {0xe9, 1029}, - /*II_D8_C8*/ {0xe9, 1029}, - /*II_D8_C8*/ {0xe9, 1029}, - /*II_D8_C8*/ {0xe9, 1029}, - /*II_D8_C8*/ {0xe9, 1029}, - /*II_D8_D0*/ {0xea, 1035}, - /*II_D8_D0*/ {0xea, 1035}, - /*II_D8_D0*/ {0xea, 1035}, - /*II_D8_D0*/ {0xea, 1035}, - /*II_D8_D0*/ {0xea, 1035}, - /*II_D8_D0*/ {0xea, 1035}, - /*II_D8_D0*/ {0xea, 1035}, - /*II_D8_D0*/ {0xea, 1035}, - /*II_D8_D8*/ {0xea, 1041}, - /*II_D8_D9*/ {0xeb, 1041}, - /*II_D8_D8*/ {0xea, 1041}, - /*II_D8_D8*/ {0xea, 1041}, - /*II_D8_D8*/ {0xea, 1041}, - /*II_D8_D8*/ {0xea, 1041}, - /*II_D8_D8*/ {0xea, 1041}, - /*II_D8_D8*/ {0xea, 1041}, - /*II_D8_E0*/ {0xe9, 1048}, - /*II_D8_E0*/ {0xe9, 1048}, - /*II_D8_E0*/ {0xe9, 1048}, - /*II_D8_E0*/ {0xe9, 1048}, - /*II_D8_E0*/ {0xe9, 1048}, - /*II_D8_E0*/ {0xe9, 1048}, - /*II_D8_E0*/ {0xe9, 1048}, - /*II_D8_E0*/ {0xe9, 1048}, - /*II_D8_E8*/ {0xe9, 1054}, - /*II_D8_E8*/ {0xe9, 1054}, - /*II_D8_E8*/ {0xe9, 1054}, - /*II_D8_E8*/ {0xe9, 1054}, - /*II_D8_E8*/ {0xe9, 1054}, - /*II_D8_E8*/ {0xe9, 1054}, - /*II_D8_E8*/ {0xe9, 1054}, - /*II_D8_E8*/ {0xe9, 1054}, - /*II_D8_F0*/ {0xe9, 1061}, - /*II_D8_F0*/ {0xe9, 1061}, - /*II_D8_F0*/ {0xe9, 1061}, - /*II_D8_F0*/ {0xe9, 1061}, - /*II_D8_F0*/ {0xe9, 1061}, - /*II_D8_F0*/ {0xe9, 1061}, - /*II_D8_F0*/ {0xe9, 1061}, - /*II_D8_F0*/ {0xe9, 1061}, - /*II_D8_F8*/ {0xe9, 1067}, - /*II_D8_F8*/ {0xe9, 1067}, - /*II_D8_F8*/ {0xe9, 1067}, - /*II_D8_F8*/ {0xe9, 1067}, - /*II_D8_F8*/ {0xe9, 1067}, - /*II_D8_F8*/ {0xe9, 1067}, - /*II_D8_F8*/ {0xe9, 1067}, - /*II_D8_F8*/ {0xe9, 1067}, - /*II_D9_00*/ {0xe8, 1074}, - /*II_D9_02*/ {0xec, 1079}, - /*II_D9_03*/ {0xec, 1084}, - /*II_D9_04*/ {0xed, 1090}, - /*II_D9_05*/ {0xee, 1098}, - /*II_D9_C0*/ {0xea, 1074}, - /*II_D9_C0*/ {0xea, 1074}, - /*II_D9_C0*/ {0xea, 1074}, - /*II_D9_C0*/ {0xea, 1074}, - /*II_D9_C0*/ {0xea, 1074}, - /*II_D9_C0*/ {0xea, 1074}, - /*II_D9_C0*/ {0xea, 1074}, - /*II_D9_C0*/ {0xea, 1074}, - /*II_D9_C8*/ {0xea, 1105}, - /*II_D9_C9*/ {0xeb, 1105}, - /*II_D9_C8*/ {0xea, 1105}, - /*II_D9_C8*/ {0xea, 1105}, - /*II_D9_C8*/ {0xea, 1105}, - /*II_D9_C8*/ {0xea, 1105}, - /*II_D9_C8*/ {0xea, 1105}, - /*II_D9_C8*/ {0xea, 1105}, - /*II_D9_D0*/ {0xeb, 1111}, - /*II_D9_E0*/ {0xeb, 1117}, - /*II_D9_E1*/ {0xeb, 1123}, - /*II_D9_E4*/ {0xeb, 1129}, - /*II_D9_E5*/ {0xeb, 1135}, - /*II_D9_E8*/ {0xeb, 1141}, - /*II_D9_E9*/ {0xeb, 1147}, - /*II_D9_EA*/ {0xeb, 1155}, - /*II_D9_EB*/ {0xeb, 1163}, - /*II_D9_EC*/ {0xeb, 1170}, - /*II_D9_ED*/ {0xeb, 1178}, - /*II_D9_EE*/ {0xeb, 1186}, - /*II_D9_F0*/ {0xeb, 1192}, - /*II_D9_F1*/ {0xeb, 1199}, - /*II_D9_F2*/ {0xeb, 1206}, - /*II_D9_F3*/ {0xeb, 1213}, - /*II_D9_F4*/ {0xeb, 1221}, - /*II_D9_F5*/ {0xeb, 1230}, - /*II_D9_F6*/ {0xeb, 1238}, - /*II_D9_F7*/ {0xeb, 1247}, - /*II_D9_F8*/ {0xeb, 1256}, - /*II_D9_F9*/ {0xeb, 1263}, - /*II_D9_FA*/ {0xeb, 1272}, - /*II_D9_FB*/ {0xeb, 1279}, - /*II_D9_FC*/ {0xeb, 1288}, - /*II_D9_FD*/ {0xeb, 1297}, - /*II_D9_FE*/ {0xeb, 1305}, - /*II_D9_FF*/ {0xeb, 1311}, - /*II_DA_00*/ {0xe8, 1317}, - /*II_DA_01*/ {0xe8, 1324}, - /*II_DA_02*/ {0xe8, 1331}, - /*II_DA_03*/ {0xe8, 1338}, - /*II_DA_04*/ {0xe8, 1346}, - /*II_DA_05*/ {0xe8, 1353}, - /*II_DA_06*/ {0xe8, 1361}, - /*II_DA_07*/ {0xe8, 1368}, - /*II_DA_C0*/ {0xef, 1376}, - /*II_DA_C0*/ {0xef, 1376}, - /*II_DA_C0*/ {0xef, 1376}, - /*II_DA_C0*/ {0xef, 1376}, - /*II_DA_C0*/ {0xef, 1376}, - /*II_DA_C0*/ {0xef, 1376}, - /*II_DA_C0*/ {0xef, 1376}, - /*II_DA_C0*/ {0xef, 1376}, - /*II_DA_C8*/ {0xf0, 1384}, - /*II_DA_C8*/ {0xf0, 1384}, - /*II_DA_C8*/ {0xf0, 1384}, - /*II_DA_C8*/ {0xf0, 1384}, - /*II_DA_C8*/ {0xf0, 1384}, - /*II_DA_C8*/ {0xf0, 1384}, - /*II_DA_C8*/ {0xf0, 1384}, - /*II_DA_C8*/ {0xf0, 1384}, - /*II_DA_D0*/ {0xf1, 1392}, - /*II_DA_D0*/ {0xf1, 1392}, - /*II_DA_D0*/ {0xf1, 1392}, - /*II_DA_D0*/ {0xf1, 1392}, - /*II_DA_D0*/ {0xf1, 1392}, - /*II_DA_D0*/ {0xf1, 1392}, - /*II_DA_D0*/ {0xf1, 1392}, - /*II_DA_D0*/ {0xf1, 1392}, - /*II_DA_D8*/ {0xf2, 1401}, - /*II_DA_D8*/ {0xf2, 1401}, - /*II_DA_D8*/ {0xf2, 1401}, - /*II_DA_D8*/ {0xf2, 1401}, - /*II_DA_D8*/ {0xf2, 1401}, - /*II_DA_D8*/ {0xf2, 1401}, - /*II_DA_D8*/ {0xf2, 1401}, - /*II_DA_D8*/ {0xf2, 1401}, - /*II_DA_E9*/ {0xeb, 1409}, - /*II_DB_00*/ {0xe8, 1418}, - /*II_DB_01*/ {0xf3, 1424}, - /*II_DB_02*/ {0xec, 1432}, - /*II_DB_03*/ {0xec, 1438}, - /*II_DB_05*/ {0xf4, 1074}, - /*II_DB_07*/ {0xf5, 1084}, - /*II_DB_C0*/ {0xef, 1445}, - /*II_DB_C0*/ {0xef, 1445}, - /*II_DB_C0*/ {0xef, 1445}, - /*II_DB_C0*/ {0xef, 1445}, - /*II_DB_C0*/ {0xef, 1445}, - /*II_DB_C0*/ {0xef, 1445}, - /*II_DB_C0*/ {0xef, 1445}, - /*II_DB_C0*/ {0xef, 1445}, - /*II_DB_C8*/ {0xf0, 1454}, - /*II_DB_C8*/ {0xf0, 1454}, - /*II_DB_C8*/ {0xf0, 1454}, - /*II_DB_C8*/ {0xf0, 1454}, - /*II_DB_C8*/ {0xf0, 1454}, - /*II_DB_C8*/ {0xf0, 1454}, - /*II_DB_C8*/ {0xf0, 1454}, - /*II_DB_C8*/ {0xf0, 1454}, - /*II_DB_D0*/ {0xf1, 1463}, - /*II_DB_D0*/ {0xf1, 1463}, - /*II_DB_D0*/ {0xf1, 1463}, - /*II_DB_D0*/ {0xf1, 1463}, - /*II_DB_D0*/ {0xf1, 1463}, - /*II_DB_D0*/ {0xf1, 1463}, - /*II_DB_D0*/ {0xf1, 1463}, - /*II_DB_D0*/ {0xf1, 1463}, - /*II_DB_D8*/ {0xf2, 1473}, - /*II_DB_D8*/ {0xf2, 1473}, - /*II_DB_D8*/ {0xf2, 1473}, - /*II_DB_D8*/ {0xf2, 1473}, - /*II_DB_D8*/ {0xf2, 1473}, - /*II_DB_D8*/ {0xf2, 1473}, - /*II_DB_D8*/ {0xf2, 1473}, - /*II_DB_D8*/ {0xf2, 1473}, - /*II_DB_E0*/ {0xeb, 1482}, - /*II_DB_E1*/ {0xeb, 1488}, - /*II_DB_E4*/ {0xeb, 1496}, - /*II_DB_E8*/ {0xf6, 1504}, - /*II_DB_E8*/ {0xf6, 1504}, - /*II_DB_E8*/ {0xf6, 1504}, - /*II_DB_E8*/ {0xf6, 1504}, - /*II_DB_E8*/ {0xf6, 1504}, - /*II_DB_E8*/ {0xf6, 1504}, - /*II_DB_E8*/ {0xf6, 1504}, - /*II_DB_E8*/ {0xf6, 1504}, - /*II_DB_F0*/ {0xf7, 1512}, - /*II_DB_F0*/ {0xf7, 1512}, - /*II_DB_F0*/ {0xf7, 1512}, - /*II_DB_F0*/ {0xf7, 1512}, - /*II_DB_F0*/ {0xf7, 1512}, - /*II_DB_F0*/ {0xf7, 1512}, - /*II_DB_F0*/ {0xf7, 1512}, - /*II_DB_F0*/ {0xf7, 1512}, - /*II_DC_00*/ {0xf8, 1023}, - /*II_DC_01*/ {0xf8, 1029}, - /*II_DC_02*/ {0xf8, 1035}, - /*II_DC_03*/ {0xf8, 1041}, - /*II_DC_04*/ {0xf8, 1048}, - /*II_DC_05*/ {0xf8, 1054}, - /*II_DC_06*/ {0xf8, 1061}, - /*II_DC_07*/ {0xf8, 1067}, - /*II_DC_C0*/ {0xf9, 1023}, - /*II_DC_C0*/ {0xf9, 1023}, - /*II_DC_C0*/ {0xf9, 1023}, - /*II_DC_C0*/ {0xf9, 1023}, - /*II_DC_C0*/ {0xf9, 1023}, - /*II_DC_C0*/ {0xf9, 1023}, - /*II_DC_C0*/ {0xf9, 1023}, - /*II_DC_C0*/ {0xf9, 1023}, - /*II_DC_C8*/ {0xf9, 1029}, - /*II_DC_C8*/ {0xf9, 1029}, - /*II_DC_C8*/ {0xf9, 1029}, - /*II_DC_C8*/ {0xf9, 1029}, - /*II_DC_C8*/ {0xf9, 1029}, - /*II_DC_C8*/ {0xf9, 1029}, - /*II_DC_C8*/ {0xf9, 1029}, - /*II_DC_C8*/ {0xf9, 1029}, - /*II_DC_E0*/ {0xf9, 1054}, - /*II_DC_E0*/ {0xf9, 1054}, - /*II_DC_E0*/ {0xf9, 1054}, - /*II_DC_E0*/ {0xf9, 1054}, - /*II_DC_E0*/ {0xf9, 1054}, - /*II_DC_E0*/ {0xf9, 1054}, - /*II_DC_E0*/ {0xf9, 1054}, - /*II_DC_E0*/ {0xf9, 1054}, - /*II_DC_E8*/ {0xf9, 1048}, - /*II_DC_E8*/ {0xf9, 1048}, - /*II_DC_E8*/ {0xf9, 1048}, - /*II_DC_E8*/ {0xf9, 1048}, - /*II_DC_E8*/ {0xf9, 1048}, - /*II_DC_E8*/ {0xf9, 1048}, - /*II_DC_E8*/ {0xf9, 1048}, - /*II_DC_E8*/ {0xf9, 1048}, - /*II_DC_F0*/ {0xf9, 1067}, - /*II_DC_F0*/ {0xf9, 1067}, - /*II_DC_F0*/ {0xf9, 1067}, - /*II_DC_F0*/ {0xf9, 1067}, - /*II_DC_F0*/ {0xf9, 1067}, - /*II_DC_F0*/ {0xf9, 1067}, - /*II_DC_F0*/ {0xf9, 1067}, - /*II_DC_F0*/ {0xf9, 1067}, - /*II_DC_F8*/ {0xf9, 1061}, - /*II_DC_F8*/ {0xf9, 1061}, - /*II_DC_F8*/ {0xf9, 1061}, - /*II_DC_F8*/ {0xf9, 1061}, - /*II_DC_F8*/ {0xf9, 1061}, - /*II_DC_F8*/ {0xf9, 1061}, - /*II_DC_F8*/ {0xf9, 1061}, - /*II_DC_F8*/ {0xf9, 1061}, - /*II_DD_00*/ {0xf8, 1074}, - /*II_DD_01*/ {0xfa, 1424}, - /*II_DD_02*/ {0xfb, 1079}, - /*II_DD_03*/ {0xfb, 1084}, - /*II_DD_04*/ {0xed, 1519}, - /*II_DD_C0*/ {0xea, 1527}, - /*II_DD_C0*/ {0xea, 1527}, - /*II_DD_C0*/ {0xea, 1527}, - /*II_DD_C0*/ {0xea, 1527}, - /*II_DD_C0*/ {0xea, 1527}, - /*II_DD_C0*/ {0xea, 1527}, - /*II_DD_C0*/ {0xea, 1527}, - /*II_DD_C0*/ {0xea, 1527}, - /*II_DD_D0*/ {0xea, 1079}, - /*II_DD_D0*/ {0xea, 1079}, - /*II_DD_D0*/ {0xea, 1079}, - /*II_DD_D0*/ {0xea, 1079}, - /*II_DD_D0*/ {0xea, 1079}, - /*II_DD_D0*/ {0xea, 1079}, - /*II_DD_D0*/ {0xea, 1079}, - /*II_DD_D0*/ {0xea, 1079}, - /*II_DD_D8*/ {0xea, 1084}, - /*II_DD_D8*/ {0xea, 1084}, - /*II_DD_D8*/ {0xea, 1084}, - /*II_DD_D8*/ {0xea, 1084}, - /*II_DD_D8*/ {0xea, 1084}, - /*II_DD_D8*/ {0xea, 1084}, - /*II_DD_D8*/ {0xea, 1084}, - /*II_DD_D8*/ {0xea, 1084}, - /*II_DD_E0*/ {0xf9, 1534}, - /*II_DD_E1*/ {0xeb, 1534}, - /*II_DD_E0*/ {0xf9, 1534}, - /*II_DD_E0*/ {0xf9, 1534}, - /*II_DD_E0*/ {0xf9, 1534}, - /*II_DD_E0*/ {0xf9, 1534}, - /*II_DD_E0*/ {0xf9, 1534}, - /*II_DD_E0*/ {0xf9, 1534}, - /*II_DD_E8*/ {0xea, 1541}, - /*II_DD_E9*/ {0xeb, 1541}, - /*II_DD_E8*/ {0xea, 1541}, - /*II_DD_E8*/ {0xea, 1541}, - /*II_DD_E8*/ {0xea, 1541}, - /*II_DD_E8*/ {0xea, 1541}, - /*II_DD_E8*/ {0xea, 1541}, - /*II_DD_E8*/ {0xea, 1541}, - /*II_DE_00*/ {0xee, 1317}, - /*II_DE_01*/ {0xee, 1324}, - /*II_DE_02*/ {0xee, 1331}, - /*II_DE_03*/ {0xee, 1338}, - /*II_DE_04*/ {0xee, 1346}, - /*II_DE_05*/ {0xee, 1353}, - /*II_DE_06*/ {0xee, 1361}, - /*II_DE_07*/ {0xee, 1368}, - /*II_DE_C0*/ {0xf9, 1549}, - /*II_DE_C1*/ {0xeb, 1549}, - /*II_DE_C0*/ {0xf9, 1549}, - /*II_DE_C0*/ {0xf9, 1549}, - /*II_DE_C0*/ {0xf9, 1549}, - /*II_DE_C0*/ {0xf9, 1549}, - /*II_DE_C0*/ {0xf9, 1549}, - /*II_DE_C0*/ {0xf9, 1549}, - /*II_DE_C8*/ {0xf9, 1556}, - /*II_DE_C9*/ {0xeb, 1556}, - /*II_DE_C8*/ {0xf9, 1556}, - /*II_DE_C8*/ {0xf9, 1556}, - /*II_DE_C8*/ {0xf9, 1556}, - /*II_DE_C8*/ {0xf9, 1556}, - /*II_DE_C8*/ {0xf9, 1556}, - /*II_DE_C8*/ {0xf9, 1556}, - /*II_DE_D9*/ {0xeb, 1563}, - /*II_DE_E0*/ {0xf9, 1571}, - /*II_DE_E1*/ {0xeb, 1571}, - /*II_DE_E0*/ {0xf9, 1571}, - /*II_DE_E0*/ {0xf9, 1571}, - /*II_DE_E0*/ {0xf9, 1571}, - /*II_DE_E0*/ {0xf9, 1571}, - /*II_DE_E0*/ {0xf9, 1571}, - /*II_DE_E0*/ {0xf9, 1571}, - /*II_DE_E8*/ {0xf9, 1579}, - /*II_DE_E9*/ {0xeb, 1579}, - /*II_DE_E8*/ {0xf9, 1579}, - /*II_DE_E8*/ {0xf9, 1579}, - /*II_DE_E8*/ {0xf9, 1579}, - /*II_DE_E8*/ {0xf9, 1579}, - /*II_DE_E8*/ {0xf9, 1579}, - /*II_DE_E8*/ {0xf9, 1579}, - /*II_DE_F0*/ {0xf9, 1586}, - /*II_DE_F1*/ {0xeb, 1586}, - /*II_DE_F0*/ {0xf9, 1586}, - /*II_DE_F0*/ {0xf9, 1586}, - /*II_DE_F0*/ {0xf9, 1586}, - /*II_DE_F0*/ {0xf9, 1586}, - /*II_DE_F0*/ {0xf9, 1586}, - /*II_DE_F0*/ {0xf9, 1586}, - /*II_DE_F8*/ {0xf9, 1594}, - /*II_DE_F9*/ {0xeb, 1594}, - /*II_DE_F8*/ {0xf9, 1594}, - /*II_DE_F8*/ {0xf9, 1594}, - /*II_DE_F8*/ {0xf9, 1594}, - /*II_DE_F8*/ {0xf9, 1594}, - /*II_DE_F8*/ {0xf9, 1594}, - /*II_DE_F8*/ {0xf9, 1594}, - /*II_DF_00*/ {0xee, 1418}, - /*II_DF_01*/ {0xfc, 1424}, - /*II_DF_02*/ {0xfd, 1432}, - /*II_DF_03*/ {0xfd, 1438}, - /*II_DF_04*/ {0xf4, 1601}, - /*II_DF_05*/ {0xf8, 1418}, - /*II_DF_06*/ {0xf5, 1607}, - /*II_DF_07*/ {0xfb, 1438}, - /*II_DF_E8*/ {0xf6, 1614}, - /*II_DF_E8*/ {0xf6, 1614}, - /*II_DF_E8*/ {0xf6, 1614}, - /*II_DF_E8*/ {0xf6, 1614}, - /*II_DF_E8*/ {0xf6, 1614}, - /*II_DF_E8*/ {0xf6, 1614}, - /*II_DF_E8*/ {0xf6, 1614}, - /*II_DF_E8*/ {0xf6, 1614}, - /*II_DF_F0*/ {0xf6, 1623}, - /*II_DF_F0*/ {0xf6, 1623}, - /*II_DF_F0*/ {0xf6, 1623}, - /*II_DF_F0*/ {0xf6, 1623}, - /*II_DF_F0*/ {0xf6, 1623}, - /*II_DF_F0*/ {0xf6, 1623}, - /*II_DF_F0*/ {0xf6, 1623}, - /*II_DF_F0*/ {0xf6, 1623}, - /*II_F6_00*/ {0xfe, 206}, - /*II_F6_02*/ {0xff, 1631}, - /*II_F6_03*/ {0x100, 1636}, - /*II_F6_04*/ {0x101, 1641}, - /*II_F6_05*/ {0x101, 117}, - /*II_F6_06*/ {0x102, 1646}, - /*II_F6_07*/ {0x102, 1651}, - /*II_F7_00*/ {0x103, 206}, - /*II_F7_02*/ {0x104, 1631}, - /*II_F7_03*/ {0x105, 1636}, - /*II_F7_04*/ {0x106, 1641}, - /*II_F7_05*/ {0x106, 117}, - /*II_F7_06*/ {0x107, 1646}, - /*II_F7_07*/ {0x107, 1651}, - /*II_FE_00*/ {0x108, 81}, - /*II_FE_01*/ {0x108, 86}, - /*II_FF_00*/ {0x109, 81}, - /*II_FF_01*/ {0x109, 86}, - /*II_FF_02*/ {0x10a, 456}, - /*II_FF_03*/ {0x10b, 260}, - /*II_FF_04*/ {0x10c, 462}, - /*II_FF_05*/ {0x10d, 467}, - /*II_FF_06*/ {0x10e, 16}, - /*II_0F_00_00*/ {0x10f, 1657}, - /*II_0F_00_01*/ {0x110, 1663}, - /*II_0F_00_02*/ {0x110, 34436}, - /*II_0F_00_03*/ {0x111, 34442}, - /*II_0F_00_04*/ {0x112, 1679}, - /*II_0F_00_05*/ {0x112, 1685}, - /*II_0F_01_00*/ {0x113, 1691}, - /*II_0F_01_01*/ {0x113, 1697}, - /*II_0F_01_02*/ {0x113, 34471}, - /*II_0F_01_03*/ {0x113, 34477}, - /*II_0F_01_04*/ {0x114, 1715}, - /*II_0F_01_06*/ {0x115, 34489}, - /*II_0F_01_07*/ {0x116, 34495}, - /*II_0F_01_C1*/ {0x117, 1735}, - /*II_0F_01_C2*/ {0x117, 1743}, - /*II_0F_01_C3*/ {0x117, 1753}, - /*II_0F_01_C4*/ {0x117, 1763}, - /*II_0F_01_C8*/ {0x118, 1771}, - /*II_0F_01_C9*/ {0x118, 1780}, - /*II_0F_01_D0*/ {0x88, 1787}, - /*II_0F_01_D1*/ {0x88, 1795}, - /*II_0F_01_D4*/ {0x117, 1803}, - /*II_0F_01_D5*/ {0x119, 1811}, - /*II_0F_01_D8*/ {0x11a, 1817}, - /*II_0F_01_D9*/ {0x11b, 1824}, - /*II_0F_01_DA*/ {0x11c, 1833}, - /*II_0F_01_DB*/ {0x11c, 1841}, - /*II_0F_01_DC*/ {0x11b, 1849}, - /*II_0F_01_DD*/ {0x11b, 1855}, - /*II_0F_01_DE*/ {0x11c, 1861}, - /*II_0F_01_DF*/ {0x11d, 1869}, - /*II_0F_01_F8*/ {0x11e, 1878}, - /*II_0F_01_F9*/ {0x11e, 1886}, - /*II_0F_0D_00*/ {0x11f, 1894}, - /*II_0F_0D_01*/ {0x11f, 1904}, - /*II_0F_0F_0C*/ {0x120, 1915}, - /*II_0F_0F_0D*/ {0x121, 1922}, - /*II_0F_0F_1C*/ {0x120, 1929}, - /*II_0F_0F_1D*/ {0x121, 1936}, - /*II_0F_0F_8A*/ {0x120, 1943}, - /*II_0F_0F_8E*/ {0x120, 1951}, - /*II_0F_0F_90*/ {0x121, 1960}, - /*II_0F_0F_94*/ {0x121, 1969}, - /*II_0F_0F_96*/ {0x121, 1976}, - /*II_0F_0F_97*/ {0x121, 1983}, - /*II_0F_0F_9A*/ {0x121, 1992}, - /*II_0F_0F_9E*/ {0x121, 1999}, - /*II_0F_0F_A0*/ {0x121, 2006}, - /*II_0F_0F_A4*/ {0x121, 2015}, - /*II_0F_0F_A6*/ {0x121, 2022}, - /*II_0F_0F_A7*/ {0x121, 2032}, - /*II_0F_0F_AA*/ {0x121, 2042}, - /*II_0F_0F_AE*/ {0x121, 2050}, - /*II_0F_0F_B0*/ {0x121, 2057}, - /*II_0F_0F_B4*/ {0x121, 2066}, - /*II_0F_0F_B6*/ {0x121, 2073}, - /*II_0F_0F_B7*/ {0x121, 2083}, - /*II_0F_0F_BB*/ {0x120, 2092}, - /*II_0F_0F_BF*/ {0x121, 2100}, - /*II_0F_10*/ {0x122, 2109}, - /*II_66_0F_10*/ {0x123, 2117}, - /*II_F3_0F_10*/ {0x124, 2125}, - /*II_F2_0F_10*/ {0x125, 2132}, - /*II_0F_11*/ {0x12a, 2109}, - /*II_66_0F_11*/ {0x12b, 2117}, - /*II_F3_0F_11*/ {0x12c, 2125}, - /*II_F2_0F_11*/ {0x12d, 2132}, - /*II_66_0F_12*/ {0x132, 2190}, - /*II_F3_0F_12*/ {0x133, 2198}, - /*II_F2_0F_12*/ {0x133, 2208}, - /*II_0F_13*/ {0x137, 2182}, - /*II_66_0F_13*/ {0x138, 2190}, - /*II_0F_14*/ {0x13a, 2266}, - /*II_66_0F_14*/ {0x13b, 2276}, - /*II_0F_15*/ {0x13a, 2308}, - /*II_66_0F_15*/ {0x13b, 2318}, - /*II_66_0F_16*/ {0x132, 2367}, - /*II_F3_0F_16*/ {0x13d, 2375}, - /*II_0F_17*/ {0x137, 2359}, - /*II_66_0F_17*/ {0x138, 2367}, - /*II_0F_18_00*/ {0x13e, 2424}, - /*II_0F_18_01*/ {0x13e, 2437}, - /*II_0F_18_02*/ {0x13e, 2449}, - /*II_0F_18_03*/ {0x13e, 2461}, - /*II_0F_28*/ {0x122, 2473}, - /*II_66_0F_28*/ {0x123, 2481}, - /*II_0F_29*/ {0x12a, 2473}, - /*II_66_0F_29*/ {0x12b, 2481}, - /*II_0F_2A*/ {0x13f, 2507}, - /*II_66_0F_2A*/ {0x140, 2517}, - /*II_F3_0F_2A*/ {0x141, 2527}, - /*II_F2_0F_2A*/ {0x142, 2537}, - /*II_0F_2B*/ {0x143, 2569}, - /*II_66_0F_2B*/ {0x144, 2578}, - /*II_F3_0F_2B*/ {0x145, 2587}, - /*II_F2_0F_2B*/ {0x146, 2596}, - /*II_0F_2C*/ {0x148, 2625}, - /*II_66_0F_2C*/ {0x149, 2636}, - /*II_F3_0F_2C*/ {0x14a, 2647}, - /*II_F2_0F_2C*/ {0x14b, 2658}, - /*II_0F_2D*/ {0x148, 2693}, - /*II_66_0F_2D*/ {0x13b, 2703}, - /*II_F3_0F_2D*/ {0x14a, 2713}, - /*II_F2_0F_2D*/ {0x14b, 2723}, - /*II_0F_2E*/ {0x14d, 2755}, - /*II_66_0F_2E*/ {0x14e, 2764}, - /*II_0F_2F*/ {0x14d, 2793}, - /*II_66_0F_2F*/ {0x14e, 2801}, - /*II_0F_50*/ {0x151, 2827}, - /*II_66_0F_50*/ {0x152, 2837}, - /*II_0F_51*/ {0x13a, 2869}, - /*II_66_0F_51*/ {0x13b, 2877}, - /*II_F3_0F_51*/ {0x154, 2885}, - /*II_F2_0F_51*/ {0x14e, 2893}, - /*II_0F_52*/ {0x13a, 2937}, - /*II_F3_0F_52*/ {0x154, 2946}, - /*II_0F_53*/ {0x13a, 2975}, - /*II_F3_0F_53*/ {0x154, 2982}, - /*II_0F_54*/ {0x13a, 3005}, - /*II_66_0F_54*/ {0x13b, 3012}, - /*II_0F_55*/ {0x13a, 3035}, - /*II_66_0F_55*/ {0x13b, 3043}, - /*II_0F_56*/ {0x13a, 3069}, - /*II_66_0F_56*/ {0x13b, 3075}, - /*II_0F_57*/ {0x13a, 3095}, - /*II_66_0F_57*/ {0x13b, 3102}, - /*II_0F_58*/ {0x13a, 3125}, - /*II_66_0F_58*/ {0x13b, 3132}, - /*II_F3_0F_58*/ {0x154, 3139}, - /*II_F2_0F_58*/ {0x14e, 3146}, - /*II_0F_59*/ {0x13a, 3185}, - /*II_66_0F_59*/ {0x13b, 3192}, - /*II_F3_0F_59*/ {0x154, 3199}, - /*II_F2_0F_59*/ {0x14e, 3206}, - /*II_0F_5A*/ {0x14e, 3245}, - /*II_66_0F_5A*/ {0x13b, 3255}, - /*II_F3_0F_5A*/ {0x155, 3265}, - /*II_F2_0F_5A*/ {0x14e, 3275}, - /*II_0F_5B*/ {0x13b, 3329}, - /*II_66_0F_5B*/ {0x13b, 3339}, - /*II_F3_0F_5B*/ {0x13b, 3349}, - /*II_0F_5C*/ {0x13a, 3394}, - /*II_66_0F_5C*/ {0x13b, 3401}, - /*II_F3_0F_5C*/ {0x154, 3408}, - /*II_F2_0F_5C*/ {0x14e, 3415}, - /*II_0F_5D*/ {0x13a, 3454}, - /*II_66_0F_5D*/ {0x13b, 3461}, - /*II_F3_0F_5D*/ {0x154, 3468}, - /*II_F2_0F_5D*/ {0x14e, 3475}, - /*II_0F_5E*/ {0x13a, 3514}, - /*II_66_0F_5E*/ {0x13b, 3521}, - /*II_F3_0F_5E*/ {0x154, 3528}, - /*II_F2_0F_5E*/ {0x14e, 3535}, - /*II_0F_5F*/ {0x13a, 3574}, - /*II_66_0F_5F*/ {0x13b, 3581}, - /*II_F3_0F_5F*/ {0x154, 3588}, - /*II_F2_0F_5F*/ {0x14e, 3595}, - /*II_0F_60*/ {0x158, 3634}, - /*II_66_0F_60*/ {0x13b, 3634}, - /*II_0F_61*/ {0x158, 3657}, - /*II_66_0F_61*/ {0x13b, 3657}, - /*II_0F_62*/ {0x158, 3680}, - /*II_66_0F_62*/ {0x13b, 3680}, - /*II_0F_63*/ {0x159, 3703}, - /*II_66_0F_63*/ {0x13b, 3703}, - /*II_0F_64*/ {0x159, 3724}, - /*II_66_0F_64*/ {0x13b, 3724}, - /*II_0F_65*/ {0x159, 3743}, - /*II_66_0F_65*/ {0x13b, 3743}, - /*II_0F_66*/ {0x159, 3762}, - /*II_66_0F_66*/ {0x13b, 3762}, - /*II_0F_67*/ {0x159, 3781}, - /*II_66_0F_67*/ {0x13b, 3781}, - /*II_0F_68*/ {0x159, 3802}, - /*II_66_0F_68*/ {0x13b, 3802}, - /*II_0F_69*/ {0x159, 3825}, - /*II_66_0F_69*/ {0x13b, 3825}, - /*II_0F_6A*/ {0x159, 3848}, - /*II_66_0F_6A*/ {0x13b, 3848}, - /*II_0F_6B*/ {0x159, 3871}, - /*II_66_0F_6B*/ {0x13b, 3871}, - /*II_66_0F_6C*/ {0x13b, 3892}, - /*II_66_0F_6D*/ {0x13b, 3917}, - /*II_0F_6F*/ {0x15d, 3948}, - /*II_66_0F_6F*/ {0x123, 3968}, - /*II_F3_0F_6F*/ {0x123, 3976}, - /*II_0F_74*/ {0x159, 4065}, - /*II_66_0F_74*/ {0x13b, 4065}, - /*II_0F_75*/ {0x159, 4084}, - /*II_66_0F_75*/ {0x13b, 4084}, - /*II_0F_76*/ {0x159, 4103}, - /*II_66_0F_76*/ {0x13b, 4103}, - /*II_0F_77*/ {0x161, 4122}, - /*II_0F_78*/ {0x163, 4150}, - /*II_0F_79*/ {0x166, 4174}, - /*II_66_0F_79*/ {0x167, 4158}, - /*II_F2_0F_79*/ {0x168, 4165}, - /*II_0F_7A_30*/ {0x169, 4183}, - /*II_0F_7A_31*/ {0x16a, 4193}, - /*II_66_0F_7C*/ {0x16b, 4203}, - /*II_F2_0F_7C*/ {0x16b, 4211}, - /*II_66_0F_7D*/ {0x16b, 4237}, - /*II_F2_0F_7D*/ {0x16b, 4245}, - /*II_F3_0F_7E*/ {0x125, 3948}, - /*II_0F_7F*/ {0x16f, 3948}, - /*II_66_0F_7F*/ {0x12b, 3968}, - /*II_F3_0F_7F*/ {0x12b, 3976}, - /*II_F3_0F_B8*/ {0x173, 4360}, - /*II_0F_BA_04*/ {0x174, 872}, - /*II_0F_BA_05*/ {0x175, 887}, - /*II_0F_BA_06*/ {0x175, 912}, - /*II_0F_BA_07*/ {0x175, 934}, - /*II_0F_BC*/ {0x176, 4368}, - /*II_F3_0F_BC*/ {0x177, 4373}, - /*II_0F_BD*/ {0x176, 4380}, - /*II_F3_0F_BD*/ {0x178, 4385}, - /*II_0F_C7_07*/ {0x188, 6407}, - /*II_66_0F_D0*/ {0x16b, 6416}, - /*II_F2_0F_D0*/ {0x16b, 6426}, - /*II_0F_D1*/ {0x159, 6458}, - /*II_66_0F_D1*/ {0x13b, 6458}, - /*II_0F_D2*/ {0x159, 6473}, - /*II_66_0F_D2*/ {0x13b, 6473}, - /*II_0F_D3*/ {0x159, 6488}, - /*II_66_0F_D3*/ {0x13b, 6488}, - /*II_0F_D4*/ {0x14e, 6503}, - /*II_66_0F_D4*/ {0x13b, 6503}, - /*II_0F_D5*/ {0x159, 6518}, - /*II_66_0F_D5*/ {0x13b, 6518}, - /*II_66_0F_D6*/ {0x12d, 3948}, - /*II_F3_0F_D6*/ {0x189, 6535}, - /*II_F2_0F_D6*/ {0x18a, 6544}, - /*II_0F_D7*/ {0x18c, 6553}, - /*II_66_0F_D7*/ {0x18d, 6553}, - /*II_0F_D8*/ {0x159, 6574}, - /*II_66_0F_D8*/ {0x13b, 6574}, - /*II_0F_D9*/ {0x159, 6593}, - /*II_66_0F_D9*/ {0x13b, 6593}, - /*II_0F_DA*/ {0x18f, 6612}, - /*II_66_0F_DA*/ {0x13b, 6612}, - /*II_0F_DB*/ {0x159, 6629}, - /*II_66_0F_DB*/ {0x13b, 6629}, - /*II_0F_DC*/ {0x159, 6642}, - /*II_66_0F_DC*/ {0x13b, 6642}, - /*II_0F_DD*/ {0x159, 6661}, - /*II_66_0F_DD*/ {0x13b, 6661}, - /*II_0F_DE*/ {0x18f, 6670}, - /*II_66_0F_DE*/ {0x13b, 6670}, - /*II_0F_DF*/ {0x159, 6687}, - /*II_66_0F_DF*/ {0x13b, 6687}, - /*II_0F_E0*/ {0x18f, 6702}, - /*II_66_0F_E0*/ {0x13b, 6702}, - /*II_0F_E1*/ {0x159, 6717}, - /*II_66_0F_E1*/ {0x13b, 6717}, - /*II_0F_E2*/ {0x159, 6732}, - /*II_66_0F_E2*/ {0x13b, 6732}, - /*II_0F_E3*/ {0x18f, 6747}, - /*II_66_0F_E3*/ {0x13b, 6747}, - /*II_0F_E4*/ {0x18f, 6762}, - /*II_66_0F_E4*/ {0x13b, 6762}, - /*II_0F_E5*/ {0x159, 6781}, - /*II_66_0F_E5*/ {0x13b, 6781}, - /*II_66_0F_E6*/ {0x13b, 6798}, - /*II_F3_0F_E6*/ {0x14e, 6809}, - /*II_F2_0F_E6*/ {0x13b, 6819}, - /*II_0F_E7*/ {0x190, 6863}, - /*II_66_0F_E7*/ {0x144, 6871}, - /*II_0F_E8*/ {0x159, 6890}, - /*II_66_0F_E8*/ {0x13b, 6890}, - /*II_0F_E9*/ {0x159, 6907}, - /*II_66_0F_E9*/ {0x13b, 6907}, - /*II_0F_EA*/ {0x18f, 6924}, - /*II_66_0F_EA*/ {0x13b, 6924}, - /*II_0F_EB*/ {0x159, 6941}, - /*II_66_0F_EB*/ {0x13b, 6941}, - /*II_0F_EC*/ {0x159, 6952}, - /*II_66_0F_EC*/ {0x13b, 6952}, - /*II_0F_ED*/ {0x159, 6969}, - /*II_66_0F_ED*/ {0x13b, 6969}, - /*II_0F_EE*/ {0x18f, 6986}, - /*II_66_0F_EE*/ {0x13b, 6986}, - /*II_0F_EF*/ {0x159, 7003}, - /*II_66_0F_EF*/ {0x13b, 7003}, - /*II_F2_0F_F0*/ {0x191, 7016}, - /*II_0F_F1*/ {0x159, 7031}, - /*II_66_0F_F1*/ {0x13b, 7031}, - /*II_0F_F2*/ {0x159, 7046}, - /*II_66_0F_F2*/ {0x13b, 7046}, - /*II_0F_F3*/ {0x159, 7061}, - /*II_66_0F_F3*/ {0x13b, 7061}, - /*II_0F_F4*/ {0x193, 7076}, - /*II_66_0F_F4*/ {0x13b, 7076}, - /*II_0F_F5*/ {0x159, 7095}, - /*II_66_0F_F5*/ {0x13b, 7095}, - /*II_0F_F6*/ {0x18f, 7114}, - /*II_66_0F_F6*/ {0x13b, 7114}, - /*II_0F_F7*/ {0x194, 7131}, - /*II_66_0F_F7*/ {0x195, 7141}, - /*II_0F_F8*/ {0x159, 7166}, - /*II_66_0F_F8*/ {0x13b, 7166}, - /*II_0F_F9*/ {0x159, 7181}, - /*II_66_0F_F9*/ {0x13b, 7181}, - /*II_0F_FA*/ {0x159, 7196}, - /*II_66_0F_FA*/ {0x13b, 7196}, - /*II_0F_FB*/ {0x193, 7211}, - /*II_66_0F_FB*/ {0x13b, 7211}, - /*II_0F_FC*/ {0x159, 7226}, - /*II_66_0F_FC*/ {0x13b, 7226}, - /*II_0F_FD*/ {0x159, 7241}, - /*II_66_0F_FD*/ {0x13b, 7241}, - /*II_0F_FE*/ {0x159, 7256}, - /*II_66_0F_FE*/ {0x13b, 7256}, - /*II_D9_06*/ {0x197, 7271}, - /*II_9B_D9_06*/ {0x198, 7280}, - /*II_D9_07*/ {0xfd, 7288}, - /*II_9B_D9_07*/ {0x199, 7296}, - /*II_DB_E2*/ {0xeb, 7303}, - /*II_9B_DB_E2*/ {0x19a, 7311}, - /*II_DB_E3*/ {0xeb, 7318}, - /*II_9B_DB_E3*/ {0x19a, 7326}, - /*II_DD_06*/ {0x197, 7333}, - /*II_9B_DD_06*/ {0x198, 7341}, - /*II_DD_07*/ {0xfd, 7348}, - /*II_9B_DD_07*/ {0x199, 7356}, - /*II_DF_E0*/ {0x19b, 7348}, - /*II_9B_DF_E0*/ {0x19c, 7356}, - /*II_0F_38_00*/ {0x19d, 7363}, - /*II_66_0F_38_00*/ {0x19e, 7363}, - /*II_0F_38_01*/ {0x19d, 7380}, - /*II_66_0F_38_01*/ {0x19e, 7380}, - /*II_0F_38_02*/ {0x19d, 7397}, - /*II_66_0F_38_02*/ {0x19e, 7397}, - /*II_0F_38_03*/ {0x19d, 7414}, - /*II_66_0F_38_03*/ {0x19e, 7414}, - /*II_0F_38_04*/ {0x19d, 7433}, - /*II_66_0F_38_04*/ {0x19e, 7433}, - /*II_0F_38_05*/ {0x19d, 7456}, - /*II_66_0F_38_05*/ {0x19e, 7456}, - /*II_0F_38_06*/ {0x19d, 7473}, - /*II_66_0F_38_06*/ {0x19e, 7473}, - /*II_0F_38_07*/ {0x19d, 7490}, - /*II_66_0F_38_07*/ {0x19e, 7490}, - /*II_0F_38_08*/ {0x19d, 7509}, - /*II_66_0F_38_08*/ {0x19e, 7509}, - /*II_0F_38_09*/ {0x19d, 7526}, - /*II_66_0F_38_09*/ {0x19e, 7526}, - /*II_0F_38_0A*/ {0x19d, 7543}, - /*II_66_0F_38_0A*/ {0x19e, 7543}, - /*II_0F_38_0B*/ {0x19d, 7560}, - /*II_66_0F_38_0B*/ {0x19e, 7560}, - /*II_66_0F_38_17*/ {0x1a0, 7651}, - /*II_0F_38_1C*/ {0x19d, 7710}, - /*II_66_0F_38_1C*/ {0x19e, 7710}, - /*II_0F_38_1D*/ {0x19d, 7725}, - /*II_66_0F_38_1D*/ {0x19e, 7725}, - /*II_0F_38_1E*/ {0x19d, 7740}, - /*II_66_0F_38_1E*/ {0x19e, 7740}, - /*II_66_0F_38_20*/ {0x1a5, 7755}, - /*II_66_0F_38_21*/ {0x1a6, 7776}, - /*II_66_0F_38_22*/ {0x1a7, 7797}, - /*II_66_0F_38_23*/ {0x1a5, 7818}, - /*II_66_0F_38_24*/ {0x1a6, 7839}, - /*II_66_0F_38_25*/ {0x1a5, 7860}, - /*II_66_0F_38_28*/ {0x1a9, 7881}, - /*II_66_0F_38_29*/ {0x1a9, 7898}, - /*II_66_0F_38_2A*/ {0x1aa, 7917}, - /*II_66_0F_38_2B*/ {0x1a9, 7938}, - /*II_66_0F_38_30*/ {0x1a5, 7983}, - /*II_66_0F_38_31*/ {0x1a6, 8004}, - /*II_66_0F_38_32*/ {0x1a7, 8025}, - /*II_66_0F_38_33*/ {0x1a5, 8046}, - /*II_66_0F_38_34*/ {0x1a6, 8067}, - /*II_66_0F_38_35*/ {0x1a5, 8088}, - /*II_66_0F_38_37*/ {0x1a0, 8109}, - /*II_66_0F_38_38*/ {0x1a9, 8128}, - /*II_66_0F_38_39*/ {0x1a9, 8145}, - /*II_66_0F_38_3A*/ {0x1a9, 8162}, - /*II_66_0F_38_3B*/ {0x1a9, 8179}, - /*II_66_0F_38_3C*/ {0x1a9, 8196}, - /*II_66_0F_38_3D*/ {0x1a9, 8213}, - /*II_66_0F_38_3E*/ {0x1a9, 8230}, - /*II_66_0F_38_3F*/ {0x1a9, 8247}, - /*II_66_0F_38_40*/ {0x1a9, 8264}, - /*II_66_0F_38_41*/ {0x1a9, 8281}, - /*II_66_0F_38_80*/ {0x1ad, 8306}, - /*II_66_0F_38_81*/ {0x1ad, 8314}, - /*II_66_0F_38_82*/ {0x1ad, 8323}, - /*II_66_0F_38_DB*/ {0x1b0, 9172}, - /*II_66_0F_38_DC*/ {0x1b0, 9189}, - /*II_66_0F_38_DD*/ {0x1b0, 9206}, - /*II_66_0F_38_DE*/ {0x1b0, 9231}, - /*II_66_0F_38_DF*/ {0x1b0, 9248}, - /*II_0F_38_F0*/ {0x1b3, 9273}, - /*II_F2_0F_38_F0*/ {0x1b4, 9280}, - /*II_0F_38_F1*/ {0x1b5, 9273}, - /*II_F2_0F_38_F1*/ {0x1b6, 9280}, - /*II_0F_71_02*/ {0x1cd, 6458}, - /*II_66_0F_71_02*/ {0x1ce, 6458}, - /*II_0F_71_04*/ {0x1cd, 6717}, - /*II_66_0F_71_04*/ {0x1ce, 6717}, - /*II_0F_71_06*/ {0x1cd, 7031}, - /*II_66_0F_71_06*/ {0x1ce, 7031}, - /*II_0F_72_02*/ {0x1cd, 6473}, - /*II_66_0F_72_02*/ {0x1ce, 6473}, - /*II_0F_72_04*/ {0x1cd, 6732}, - /*II_66_0F_72_04*/ {0x1ce, 6732}, - /*II_0F_72_06*/ {0x1cd, 7046}, - /*II_66_0F_72_06*/ {0x1ce, 7046}, - /*II_0F_73_02*/ {0x1cd, 6488}, - /*II_66_0F_73_02*/ {0x1ce, 6488}, - /*II_66_0F_73_03*/ {0x1ce, 9852}, - /*II_0F_73_06*/ {0x1cd, 7061}, - /*II_66_0F_73_06*/ {0x1ce, 7061}, - /*II_66_0F_73_07*/ {0x1ce, 9869}, - /*II_F3_0F_AE_00*/ {0x1d0, 9904}, - /*II_F3_0F_AE_01*/ {0x1d0, 9934}, - /*II_0F_AE_02*/ {0x1d1, 9944}, - /*II_F3_0F_AE_02*/ {0x1d0, 9953}, - /*II_0F_AE_03*/ {0x1d1, 9973}, - /*II_F3_0F_AE_03*/ {0x1d0, 9982}, - /*II_0F_C7_06*/ {0x1d3, 10002}, - /*II_66_0F_C7_06*/ {0x188, 10011}, - /*II_F3_0F_C7_06*/ {0x188, 10020} + /*II_CC*/ {0x53, 360}, + /*II_CD*/ {0x6d, 366}, + /*II_CE*/ {0x6e, 371}, + /*II_CF*/ {0x6f, 377}, + /*II_D4*/ {0x70, 383}, + /*II_D5*/ {0x70, 388}, + /*II_D6*/ {0x71, 393}, + /*II_D7*/ {0x72, 399}, + /*II_E0*/ {0x73, 405}, + /*II_E1*/ {0x73, 413}, + /*II_E2*/ {0x74, 420}, + /*II_E4*/ {0x76, 446}, + /*II_E5*/ {0x77, 446}, + /*II_E6*/ {0x78, 450}, + /*II_E7*/ {0x79, 450}, + /*II_E8*/ {0x7a, 455}, + /*II_E9*/ {0x7b, 461}, + /*II_EA*/ {0x7c, 466}, + /*II_EB*/ {0x7d, 461}, + /*II_EC*/ {0x7e, 446}, + /*II_ED*/ {0x7f, 446}, + /*II_EE*/ {0x80, 450}, + /*II_EF*/ {0x81, 450}, + /*II_F1*/ {0x82, 475}, + /*II_F4*/ {0x83, 481}, + /*II_F5*/ {0x84, 486}, + /*II_F8*/ {0x84, 491}, + /*II_F9*/ {0x84, 496}, + /*II_FA*/ {0x85, 501}, + /*II_FB*/ {0x85, 506}, + /*II_FC*/ {0x86, 511}, + /*II_FD*/ {0x86, 516}, + /*II_0F_02*/ {0x87, 521}, + /*II_0F_03*/ {0x87, 526}, + /*II_0F_05*/ {0x88, 531}, + /*II_0F_06*/ {0x89, 540}, + /*II_0F_07*/ {0x88, 546}, + /*II_0F_08*/ {0x89, 554}, + /*II_0F_09*/ {0x89, 560}, + /*II_0F_0B*/ {0x8a, 568}, + /*II_0F_0E*/ {0x8b, 573}, + /*II_0F_1F*/ {0x8c, 580}, + /*II_0F_20*/ {0x8d, 218}, + /*II_0F_21*/ {0x8e, 218}, + /*II_0F_22*/ {0x8f, 218}, + /*II_0F_23*/ {0x90, 218}, + /*II_0F_30*/ {0x89, 585}, + /*II_0F_31*/ {0x89, 592}, + /*II_0F_32*/ {0x89, 599}, + /*II_0F_33*/ {0x89, 606}, + /*II_0F_34*/ {0x88, 613}, + /*II_0F_35*/ {0x88, 623}, + /*II_0F_37*/ {0x91, 632}, + /*II_0F_40*/ {0x92, 640}, + /*II_0F_41*/ {0x92, 647}, + /*II_0F_42*/ {0x93, 655}, + /*II_0F_43*/ {0x93, 662}, + /*II_0F_44*/ {0x94, 670}, + /*II_0F_45*/ {0x94, 677}, + /*II_0F_46*/ {0x95, 685}, + /*II_0F_47*/ {0x95, 693}, + /*II_0F_48*/ {0x96, 700}, + /*II_0F_49*/ {0x96, 707}, + /*II_0F_4A*/ {0x97, 715}, + /*II_0F_4B*/ {0x97, 722}, + /*II_0F_4C*/ {0x98, 730}, + /*II_0F_4D*/ {0x98, 737}, + /*II_0F_4E*/ {0x99, 745}, + /*II_0F_4F*/ {0x99, 753}, + /*II_0F_80*/ {0x9a, 134}, + /*II_0F_81*/ {0x9a, 138}, + /*II_0F_82*/ {0x9b, 143}, + /*II_0F_83*/ {0x9b, 147}, + /*II_0F_84*/ {0x9c, 152}, + /*II_0F_85*/ {0x9c, 156}, + /*II_0F_86*/ {0x9d, 161}, + /*II_0F_87*/ {0x9d, 166}, + /*II_0F_88*/ {0x9e, 170}, + /*II_0F_89*/ {0x9e, 174}, + /*II_0F_8A*/ {0x9f, 179}, + /*II_0F_8B*/ {0x9f, 183}, + /*II_0F_8C*/ {0xa0, 188}, + /*II_0F_8D*/ {0xa0, 192}, + /*II_0F_8E*/ {0xa1, 197}, + /*II_0F_8F*/ {0xa1, 202}, + /*II_0F_90*/ {0xa2, 760}, + /*II_0F_91*/ {0xa2, 766}, + /*II_0F_92*/ {0xa3, 773}, + /*II_0F_93*/ {0xa3, 779}, + /*II_0F_94*/ {0xa4, 786}, + /*II_0F_95*/ {0xa4, 792}, + /*II_0F_96*/ {0xa5, 799}, + /*II_0F_97*/ {0xa5, 806}, + /*II_0F_98*/ {0xa6, 812}, + /*II_0F_99*/ {0xa6, 818}, + /*II_0F_9A*/ {0xa7, 825}, + /*II_0F_9B*/ {0xa7, 831}, + /*II_0F_9C*/ {0xa8, 838}, + /*II_0F_9D*/ {0xa8, 844}, + /*II_0F_9E*/ {0xa9, 851}, + /*II_0F_9F*/ {0xa9, 858}, + /*II_0F_A0*/ {0xaa, 16}, + /*II_0F_A1*/ {0xab, 22}, + /*II_0F_A2*/ {0x91, 864}, + /*II_0F_A3*/ {0xac, 871}, + /*II_0F_A8*/ {0xae, 16}, + /*II_0F_A9*/ {0xaf, 22}, + /*II_0F_AA*/ {0xb0, 881}, + /*II_0F_AB*/ {0xb1, 886}, + /*II_0F_AF*/ {0xb2, 117}, + /*II_0F_B0*/ {0xb3, 897}, + /*II_0F_B1*/ {0xb4, 897}, + /*II_0F_B2*/ {0xb5, 906}, + /*II_0F_B3*/ {0xb1, 911}, + /*II_0F_B4*/ {0xb5, 916}, + /*II_0F_B5*/ {0xb5, 921}, + /*II_0F_B6*/ {0xb6, 926}, + /*II_0F_B7*/ {0xb7, 926}, + /*II_0F_B9*/ {0x8a, 568}, + /*II_0F_BB*/ {0xb1, 933}, + /*II_0F_BE*/ {0xb6, 938}, + /*II_0F_BF*/ {0xb7, 938}, + /*II_0F_C0*/ {0xb3, 945}, + /*II_0F_C1*/ {0xb4, 945}, + /*II_0F_C3*/ {0xb8, 951}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_80_00*/ {0xba, 11}, + /*II_80_01*/ {0xbb, 27}, + /*II_80_02*/ {0xbc, 31}, + /*II_80_03*/ {0xbc, 36}, + /*II_80_04*/ {0xbd, 41}, + /*II_80_05*/ {0xba, 51}, + /*II_80_06*/ {0xbe, 61}, + /*II_80_07*/ {0xbf, 71}, + /*II_81_00*/ {0xc0, 11}, + /*II_81_01*/ {0xc1, 27}, + /*II_81_02*/ {0xc2, 31}, + /*II_81_03*/ {0xc2, 36}, + /*II_81_04*/ {0xc3, 41}, + /*II_81_05*/ {0xc0, 51}, + /*II_81_06*/ {0xc4, 61}, + /*II_81_07*/ {0xc5, 71}, + /*II_82_00*/ {0xc6, 11}, + /*II_82_01*/ {0xc7, 27}, + /*II_82_02*/ {0xc8, 31}, + /*II_82_03*/ {0xc8, 36}, + /*II_82_04*/ {0xc9, 41}, + /*II_82_05*/ {0xc6, 51}, + /*II_82_06*/ {0xca, 61}, + /*II_82_07*/ {0xcb, 71}, + /*II_83_00*/ {0xcc, 11}, + /*II_83_01*/ {0xcd, 27}, + /*II_83_02*/ {0xce, 31}, + /*II_83_03*/ {0xce, 36}, + /*II_83_04*/ {0xcf, 41}, + /*II_83_05*/ {0xcc, 51}, + /*II_83_06*/ {0xd0, 61}, + /*II_83_07*/ {0xd1, 71}, + /*II_8F_00*/ {0xd2, 22}, + /*II_C0_00*/ {0xd3, 966}, + /*II_C0_01*/ {0xd3, 971}, + /*II_C0_02*/ {0xd4, 976}, + /*II_C0_03*/ {0xd4, 981}, + /*II_C0_04*/ {0xd5, 986}, + /*II_C0_05*/ {0xd5, 991}, + /*II_C0_06*/ {0xd5, 996}, + /*II_C0_07*/ {0xd5, 1001}, + /*II_C1_00*/ {0xd6, 966}, + /*II_C1_01*/ {0xd6, 971}, + /*II_C1_02*/ {0xd7, 976}, + /*II_C1_03*/ {0xd7, 981}, + /*II_C1_04*/ {0xd8, 986}, + /*II_C1_05*/ {0xd8, 991}, + /*II_C1_06*/ {0xd8, 996}, + /*II_C1_07*/ {0xd8, 1001}, + /*II_C6_00*/ {0xd9, 218}, + /*II_C6_F8*/ {0xda, 1006}, + /*II_C7_00*/ {0xdb, 218}, + /*II_C7_F8*/ {0xdc, 1014}, + /*II_D0_00*/ {0xdd, 966}, + /*II_D0_01*/ {0xdd, 971}, + /*II_D0_02*/ {0xde, 976}, + /*II_D0_03*/ {0xde, 981}, + /*II_D0_04*/ {0xdf, 986}, + /*II_D0_05*/ {0xdf, 991}, + /*II_D0_06*/ {0xdf, 996}, + /*II_D0_07*/ {0xdf, 1001}, + /*II_D1_00*/ {0xe0, 966}, + /*II_D1_01*/ {0xe0, 971}, + /*II_D1_02*/ {0xe1, 976}, + /*II_D1_03*/ {0xe1, 981}, + /*II_D1_04*/ {0xe2, 986}, + /*II_D1_05*/ {0xe2, 991}, + /*II_D1_06*/ {0xe2, 996}, + /*II_D1_07*/ {0xe2, 1001}, + /*II_D2_00*/ {0xe3, 966}, + /*II_D2_01*/ {0xe3, 971}, + /*II_D2_02*/ {0xe4, 976}, + /*II_D2_03*/ {0xe4, 981}, + /*II_D2_04*/ {0xe5, 986}, + /*II_D2_05*/ {0xe5, 991}, + /*II_D2_06*/ {0xe5, 996}, + /*II_D2_07*/ {0xe5, 1001}, + /*II_D3_00*/ {0xe6, 966}, + /*II_D3_01*/ {0xe6, 971}, + /*II_D3_02*/ {0xe7, 976}, + /*II_D3_03*/ {0xe7, 981}, + /*II_D3_04*/ {0xe8, 986}, + /*II_D3_05*/ {0xe8, 991}, + /*II_D3_06*/ {0xe8, 996}, + /*II_D3_07*/ {0xe8, 1001}, + /*II_D8_00*/ {0xe9, 1022}, + /*II_D8_01*/ {0xe9, 1028}, + /*II_D8_02*/ {0xe9, 1034}, + /*II_D8_03*/ {0xe9, 1040}, + /*II_D8_04*/ {0xe9, 1047}, + /*II_D8_05*/ {0xe9, 1053}, + /*II_D8_06*/ {0xe9, 1060}, + /*II_D8_07*/ {0xe9, 1066}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D9*/ {0xec, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D9_00*/ {0xe9, 1073}, + /*II_D9_02*/ {0xed, 1078}, + /*II_D9_03*/ {0xed, 1083}, + /*II_D9_04*/ {0xee, 1089}, + /*II_D9_05*/ {0xef, 1097}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C9*/ {0xec, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_D0*/ {0xec, 1110}, + /*II_D9_E0*/ {0xec, 1116}, + /*II_D9_E1*/ {0xec, 1122}, + /*II_D9_E4*/ {0xec, 1128}, + /*II_D9_E5*/ {0xec, 1134}, + /*II_D9_E8*/ {0xec, 1140}, + /*II_D9_E9*/ {0xec, 1146}, + /*II_D9_EA*/ {0xec, 1154}, + /*II_D9_EB*/ {0xec, 1162}, + /*II_D9_EC*/ {0xec, 1169}, + /*II_D9_ED*/ {0xec, 1177}, + /*II_D9_EE*/ {0xec, 1185}, + /*II_D9_F0*/ {0xec, 1191}, + /*II_D9_F1*/ {0xec, 1198}, + /*II_D9_F2*/ {0xec, 1205}, + /*II_D9_F3*/ {0xec, 1212}, + /*II_D9_F4*/ {0xec, 1220}, + /*II_D9_F5*/ {0xec, 1229}, + /*II_D9_F6*/ {0xec, 1237}, + /*II_D9_F7*/ {0xec, 1246}, + /*II_D9_F8*/ {0xec, 1255}, + /*II_D9_F9*/ {0xec, 1262}, + /*II_D9_FA*/ {0xec, 1271}, + /*II_D9_FB*/ {0xec, 1278}, + /*II_D9_FC*/ {0xec, 1287}, + /*II_D9_FD*/ {0xec, 1296}, + /*II_D9_FE*/ {0xec, 1304}, + /*II_D9_FF*/ {0xec, 1310}, + /*II_DA_00*/ {0xe9, 1316}, + /*II_DA_01*/ {0xe9, 1323}, + /*II_DA_02*/ {0xe9, 1330}, + /*II_DA_03*/ {0xe9, 1337}, + /*II_DA_04*/ {0xe9, 1345}, + /*II_DA_05*/ {0xe9, 1352}, + /*II_DA_06*/ {0xe9, 1360}, + /*II_DA_07*/ {0xe9, 1367}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_E9*/ {0xec, 1408}, + /*II_DB_00*/ {0xe9, 1417}, + /*II_DB_01*/ {0xf4, 1423}, + /*II_DB_02*/ {0xed, 1431}, + /*II_DB_03*/ {0xed, 1437}, + /*II_DB_05*/ {0xf5, 1073}, + /*II_DB_07*/ {0xf6, 1083}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_E0*/ {0xec, 1481}, + /*II_DB_E1*/ {0xec, 1487}, + /*II_DB_E4*/ {0xec, 1495}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DC_00*/ {0xf9, 1022}, + /*II_DC_01*/ {0xf9, 1028}, + /*II_DC_02*/ {0xf9, 1034}, + /*II_DC_03*/ {0xf9, 1040}, + /*II_DC_04*/ {0xf9, 1047}, + /*II_DC_05*/ {0xf9, 1053}, + /*II_DC_06*/ {0xf9, 1060}, + /*II_DC_07*/ {0xf9, 1066}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DD_00*/ {0xf9, 1073}, + /*II_DD_01*/ {0xfb, 1423}, + /*II_DD_02*/ {0xfc, 1078}, + /*II_DD_03*/ {0xfc, 1083}, + /*II_DD_04*/ {0xee, 1518}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E1*/ {0xec, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E9*/ {0xec, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DE_00*/ {0xef, 1316}, + /*II_DE_01*/ {0xef, 1323}, + /*II_DE_02*/ {0xef, 1330}, + /*II_DE_03*/ {0xef, 1337}, + /*II_DE_04*/ {0xef, 1345}, + /*II_DE_05*/ {0xef, 1352}, + /*II_DE_06*/ {0xef, 1360}, + /*II_DE_07*/ {0xef, 1367}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C1*/ {0xec, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C9*/ {0xec, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_D9*/ {0xec, 1562}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E1*/ {0xec, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E9*/ {0xec, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F1*/ {0xec, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F9*/ {0xec, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DF_00*/ {0xef, 1417}, + /*II_DF_01*/ {0xfd, 1423}, + /*II_DF_02*/ {0xfe, 1431}, + /*II_DF_03*/ {0xfe, 1437}, + /*II_DF_04*/ {0xf5, 1600}, + /*II_DF_05*/ {0xf9, 1417}, + /*II_DF_06*/ {0xf6, 1606}, + /*II_DF_07*/ {0xfc, 1437}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_F6_00*/ {0xff, 206}, + /*II_F6_02*/ {0x100, 1630}, + /*II_F6_03*/ {0x101, 1635}, + /*II_F6_04*/ {0x102, 1640}, + /*II_F6_05*/ {0x102, 117}, + /*II_F6_06*/ {0x103, 1645}, + /*II_F6_07*/ {0x103, 1650}, + /*II_F7_00*/ {0x104, 206}, + /*II_F7_02*/ {0x105, 1630}, + /*II_F7_03*/ {0x106, 1635}, + /*II_F7_04*/ {0x107, 1640}, + /*II_F7_05*/ {0x107, 117}, + /*II_F7_06*/ {0x108, 1645}, + /*II_F7_07*/ {0x108, 1650}, + /*II_FE_00*/ {0x109, 81}, + /*II_FE_01*/ {0x109, 86}, + /*II_FF_00*/ {0x10a, 81}, + /*II_FF_01*/ {0x10a, 86}, + /*II_FF_02*/ {0x10b, 455}, + /*II_FF_03*/ {0x10c, 260}, + /*II_FF_04*/ {0x10d, 461}, + /*II_FF_05*/ {0x10e, 466}, + /*II_FF_06*/ {0x10f, 16}, + /*II_0F_00_00*/ {0x110, 1656}, + /*II_0F_00_01*/ {0x111, 1662}, + /*II_0F_00_02*/ {0x112, 1667}, + /*II_0F_00_03*/ {0x113, 1673}, + /*II_0F_00_04*/ {0x114, 1678}, + /*II_0F_00_05*/ {0x114, 1684}, + /*II_0F_01_00*/ {0x115, 1690}, + /*II_0F_01_01*/ {0x115, 1696}, + /*II_0F_01_02*/ {0x116, 1702}, + /*II_0F_01_03*/ {0x116, 1708}, + /*II_0F_01_04*/ {0x117, 1714}, + /*II_0F_01_06*/ {0x118, 1720}, + /*II_0F_01_07*/ {0x119, 1726}, + /*II_0F_01_C1*/ {0x11a, 1734}, + /*II_0F_01_C2*/ {0x11a, 1742}, + /*II_0F_01_C3*/ {0x11a, 1752}, + /*II_0F_01_C4*/ {0x11a, 1762}, + /*II_0F_01_C8*/ {0x11b, 1770}, + /*II_0F_01_C9*/ {0x11b, 1779}, + /*II_0F_01_CA*/ {0x11b, 1786}, + /*II_0F_01_CB*/ {0x11b, 1792}, + /*II_0F_01_D0*/ {0x91, 1798}, + /*II_0F_01_D1*/ {0x91, 1806}, + /*II_0F_01_D4*/ {0x11a, 1814}, + /*II_0F_01_D5*/ {0x11c, 1822}, + /*II_0F_01_D8*/ {0x11d, 1828}, + /*II_0F_01_D9*/ {0x11e, 1835}, + /*II_0F_01_DA*/ {0x11f, 1844}, + /*II_0F_01_DB*/ {0x11f, 1852}, + /*II_0F_01_DC*/ {0x11e, 1860}, + /*II_0F_01_DD*/ {0x11e, 1866}, + /*II_0F_01_DE*/ {0x11f, 1872}, + /*II_0F_01_DF*/ {0x120, 1880}, + /*II_0F_01_F8*/ {0x121, 1889}, + /*II_0F_01_F9*/ {0x121, 1897}, + /*II_0F_0D_00*/ {0x122, 1905}, + /*II_0F_0D_01*/ {0x122, 1915}, + /*II_0F_0F_0C*/ {0x123, 1926}, + /*II_0F_0F_0D*/ {0x124, 1933}, + /*II_0F_0F_1C*/ {0x123, 1940}, + /*II_0F_0F_1D*/ {0x124, 1947}, + /*II_0F_0F_8A*/ {0x123, 1954}, + /*II_0F_0F_8E*/ {0x123, 1962}, + /*II_0F_0F_90*/ {0x124, 1971}, + /*II_0F_0F_94*/ {0x124, 1980}, + /*II_0F_0F_96*/ {0x124, 1987}, + /*II_0F_0F_97*/ {0x124, 1994}, + /*II_0F_0F_9A*/ {0x124, 2003}, + /*II_0F_0F_9E*/ {0x124, 2010}, + /*II_0F_0F_A0*/ {0x124, 2017}, + /*II_0F_0F_A4*/ {0x124, 2026}, + /*II_0F_0F_A6*/ {0x124, 2033}, + /*II_0F_0F_A7*/ {0x124, 2043}, + /*II_0F_0F_AA*/ {0x124, 2053}, + /*II_0F_0F_AE*/ {0x124, 2061}, + /*II_0F_0F_B0*/ {0x124, 2068}, + /*II_0F_0F_B4*/ {0x124, 2077}, + /*II_0F_0F_B6*/ {0x124, 2084}, + /*II_0F_0F_B7*/ {0x124, 2094}, + /*II_0F_0F_BB*/ {0x123, 2103}, + /*II_0F_0F_BF*/ {0x124, 2111}, + /*II_0F_10*/ {0x125, 2120}, + /*II_66_0F_10*/ {0x126, 2128}, + /*II_F3_0F_10*/ {0x127, 2136}, + /*II_F2_0F_10*/ {0x128, 2143}, + /*II_0F_11*/ {0x12d, 2120}, + /*II_66_0F_11*/ {0x12e, 2128}, + /*II_F3_0F_11*/ {0x12f, 2136}, + /*II_F2_0F_11*/ {0x130, 2143}, + /*II_66_0F_12*/ {0x135, 2201}, + /*II_F3_0F_12*/ {0x136, 2209}, + /*II_F2_0F_12*/ {0x136, 2219}, + /*II_0F_13*/ {0x13a, 2193}, + /*II_66_0F_13*/ {0x13b, 2201}, + /*II_0F_14*/ {0x13d, 2277}, + /*II_66_0F_14*/ {0x13e, 2287}, + /*II_0F_15*/ {0x13d, 2319}, + /*II_66_0F_15*/ {0x13e, 2329}, + /*II_66_0F_16*/ {0x135, 2378}, + /*II_F3_0F_16*/ {0x140, 2386}, + /*II_0F_17*/ {0x13a, 2370}, + /*II_66_0F_17*/ {0x13b, 2378}, + /*II_0F_18_00*/ {0x141, 2435}, + /*II_0F_18_01*/ {0x141, 2448}, + /*II_0F_18_02*/ {0x141, 2460}, + /*II_0F_18_03*/ {0x141, 2472}, + /*II_0F_28*/ {0x125, 2484}, + /*II_66_0F_28*/ {0x126, 2492}, + /*II_0F_29*/ {0x12d, 2484}, + /*II_66_0F_29*/ {0x12e, 2492}, + /*II_0F_2A*/ {0x142, 2518}, + /*II_66_0F_2A*/ {0x143, 2528}, + /*II_F3_0F_2A*/ {0x144, 2538}, + /*II_F2_0F_2A*/ {0x145, 2548}, + /*II_0F_2B*/ {0x146, 2580}, + /*II_66_0F_2B*/ {0x147, 2589}, + /*II_F3_0F_2B*/ {0x148, 2598}, + /*II_F2_0F_2B*/ {0x149, 2607}, + /*II_0F_2C*/ {0x14b, 2636}, + /*II_66_0F_2C*/ {0x14c, 2647}, + /*II_F3_0F_2C*/ {0x14d, 2658}, + /*II_F2_0F_2C*/ {0x14e, 2669}, + /*II_0F_2D*/ {0x14b, 2704}, + /*II_66_0F_2D*/ {0x13e, 2714}, + /*II_F3_0F_2D*/ {0x14d, 2724}, + /*II_F2_0F_2D*/ {0x14e, 2734}, + /*II_0F_2E*/ {0x150, 2766}, + /*II_66_0F_2E*/ {0x151, 2775}, + /*II_0F_2F*/ {0x150, 2804}, + /*II_66_0F_2F*/ {0x151, 2812}, + /*II_0F_50*/ {0x154, 2838}, + /*II_66_0F_50*/ {0x155, 2848}, + /*II_0F_51*/ {0x13d, 2880}, + /*II_66_0F_51*/ {0x13e, 2888}, + /*II_F3_0F_51*/ {0x157, 2896}, + /*II_F2_0F_51*/ {0x151, 2904}, + /*II_0F_52*/ {0x13d, 2948}, + /*II_F3_0F_52*/ {0x157, 2957}, + /*II_0F_53*/ {0x13d, 2986}, + /*II_F3_0F_53*/ {0x157, 2993}, + /*II_0F_54*/ {0x13d, 3016}, + /*II_66_0F_54*/ {0x13e, 3023}, + /*II_0F_55*/ {0x13d, 3046}, + /*II_66_0F_55*/ {0x13e, 3054}, + /*II_0F_56*/ {0x13d, 3080}, + /*II_66_0F_56*/ {0x13e, 3086}, + /*II_0F_57*/ {0x13d, 3106}, + /*II_66_0F_57*/ {0x13e, 3113}, + /*II_0F_58*/ {0x13d, 3136}, + /*II_66_0F_58*/ {0x13e, 3143}, + /*II_F3_0F_58*/ {0x157, 3150}, + /*II_F2_0F_58*/ {0x151, 3157}, + /*II_0F_59*/ {0x13d, 3196}, + /*II_66_0F_59*/ {0x13e, 3203}, + /*II_F3_0F_59*/ {0x157, 3210}, + /*II_F2_0F_59*/ {0x151, 3217}, + /*II_0F_5A*/ {0x151, 3256}, + /*II_66_0F_5A*/ {0x13e, 3266}, + /*II_F3_0F_5A*/ {0x158, 3276}, + /*II_F2_0F_5A*/ {0x151, 3286}, + /*II_0F_5B*/ {0x13e, 3340}, + /*II_66_0F_5B*/ {0x13e, 3350}, + /*II_F3_0F_5B*/ {0x13e, 3360}, + /*II_0F_5C*/ {0x13d, 3405}, + /*II_66_0F_5C*/ {0x13e, 3412}, + /*II_F3_0F_5C*/ {0x157, 3419}, + /*II_F2_0F_5C*/ {0x151, 3426}, + /*II_0F_5D*/ {0x13d, 3465}, + /*II_66_0F_5D*/ {0x13e, 3472}, + /*II_F3_0F_5D*/ {0x157, 3479}, + /*II_F2_0F_5D*/ {0x151, 3486}, + /*II_0F_5E*/ {0x13d, 3525}, + /*II_66_0F_5E*/ {0x13e, 3532}, + /*II_F3_0F_5E*/ {0x157, 3539}, + /*II_F2_0F_5E*/ {0x151, 3546}, + /*II_0F_5F*/ {0x13d, 3585}, + /*II_66_0F_5F*/ {0x13e, 3592}, + /*II_F3_0F_5F*/ {0x157, 3599}, + /*II_F2_0F_5F*/ {0x151, 3606}, + /*II_0F_60*/ {0x15b, 3645}, + /*II_66_0F_60*/ {0x13e, 3645}, + /*II_0F_61*/ {0x15b, 3668}, + /*II_66_0F_61*/ {0x13e, 3668}, + /*II_0F_62*/ {0x15b, 3691}, + /*II_66_0F_62*/ {0x13e, 3691}, + /*II_0F_63*/ {0x15c, 3714}, + /*II_66_0F_63*/ {0x13e, 3714}, + /*II_0F_64*/ {0x15c, 3735}, + /*II_66_0F_64*/ {0x13e, 3735}, + /*II_0F_65*/ {0x15c, 3754}, + /*II_66_0F_65*/ {0x13e, 3754}, + /*II_0F_66*/ {0x15c, 3773}, + /*II_66_0F_66*/ {0x13e, 3773}, + /*II_0F_67*/ {0x15c, 3792}, + /*II_66_0F_67*/ {0x13e, 3792}, + /*II_0F_68*/ {0x15c, 3813}, + /*II_66_0F_68*/ {0x13e, 3813}, + /*II_0F_69*/ {0x15c, 3836}, + /*II_66_0F_69*/ {0x13e, 3836}, + /*II_0F_6A*/ {0x15c, 3859}, + /*II_66_0F_6A*/ {0x13e, 3859}, + /*II_0F_6B*/ {0x15c, 3882}, + /*II_66_0F_6B*/ {0x13e, 3882}, + /*II_66_0F_6C*/ {0x13e, 3903}, + /*II_66_0F_6D*/ {0x13e, 3928}, + /*II_0F_6F*/ {0x160, 3959}, + /*II_66_0F_6F*/ {0x126, 3979}, + /*II_F3_0F_6F*/ {0x126, 3987}, + /*II_0F_74*/ {0x15c, 4076}, + /*II_66_0F_74*/ {0x13e, 4076}, + /*II_0F_75*/ {0x15c, 4095}, + /*II_66_0F_75*/ {0x13e, 4095}, + /*II_0F_76*/ {0x15c, 4114}, + /*II_66_0F_76*/ {0x13e, 4114}, + /*II_0F_77*/ {0x164, 4133}, + /*II_0F_78*/ {0x166, 4161}, + /*II_0F_79*/ {0x169, 4185}, + /*II_66_0F_79*/ {0x16a, 4169}, + /*II_F2_0F_79*/ {0x16b, 4176}, + /*II_0F_7A_30*/ {0x16c, 4194}, + /*II_0F_7A_31*/ {0x16d, 4204}, + /*II_66_0F_7C*/ {0x16e, 4214}, + /*II_F2_0F_7C*/ {0x16e, 4222}, + /*II_66_0F_7D*/ {0x16e, 4248}, + /*II_F2_0F_7D*/ {0x16e, 4256}, + /*II_F3_0F_7E*/ {0x128, 3959}, + /*II_0F_7F*/ {0x172, 3959}, + /*II_66_0F_7F*/ {0x12e, 3979}, + /*II_F3_0F_7F*/ {0x12e, 3987}, + /*II_F3_0F_B8*/ {0x176, 4371}, + /*II_0F_BA_04*/ {0x177, 871}, + /*II_0F_BA_05*/ {0x178, 886}, + /*II_0F_BA_06*/ {0x178, 911}, + /*II_0F_BA_07*/ {0x178, 933}, + /*II_0F_BC*/ {0x179, 4379}, + /*II_F3_0F_BC*/ {0x17a, 4384}, + /*II_0F_BD*/ {0x179, 4391}, + /*II_F3_0F_BD*/ {0x17b, 4396}, + /*II_0F_C7_07*/ {0x18b, 6418}, + /*II_66_0F_D0*/ {0x16e, 6427}, + /*II_F2_0F_D0*/ {0x16e, 6437}, + /*II_0F_D1*/ {0x15c, 6469}, + /*II_66_0F_D1*/ {0x13e, 6469}, + /*II_0F_D2*/ {0x15c, 6484}, + /*II_66_0F_D2*/ {0x13e, 6484}, + /*II_0F_D3*/ {0x15c, 6499}, + /*II_66_0F_D3*/ {0x13e, 6499}, + /*II_0F_D4*/ {0x151, 6514}, + /*II_66_0F_D4*/ {0x13e, 6514}, + /*II_0F_D5*/ {0x15c, 6529}, + /*II_66_0F_D5*/ {0x13e, 6529}, + /*II_66_0F_D6*/ {0x130, 3959}, + /*II_F3_0F_D6*/ {0x18c, 6546}, + /*II_F2_0F_D6*/ {0x18d, 6555}, + /*II_0F_D7*/ {0x18f, 6564}, + /*II_66_0F_D7*/ {0x190, 6564}, + /*II_0F_D8*/ {0x15c, 6585}, + /*II_66_0F_D8*/ {0x13e, 6585}, + /*II_0F_D9*/ {0x15c, 6604}, + /*II_66_0F_D9*/ {0x13e, 6604}, + /*II_0F_DA*/ {0x192, 6623}, + /*II_66_0F_DA*/ {0x13e, 6623}, + /*II_0F_DB*/ {0x15c, 6640}, + /*II_66_0F_DB*/ {0x13e, 6640}, + /*II_0F_DC*/ {0x15c, 6653}, + /*II_66_0F_DC*/ {0x13e, 6653}, + /*II_0F_DD*/ {0x15c, 6672}, + /*II_66_0F_DD*/ {0x13e, 6672}, + /*II_0F_DE*/ {0x192, 6681}, + /*II_66_0F_DE*/ {0x13e, 6681}, + /*II_0F_DF*/ {0x15c, 6698}, + /*II_66_0F_DF*/ {0x13e, 6698}, + /*II_0F_E0*/ {0x192, 6713}, + /*II_66_0F_E0*/ {0x13e, 6713}, + /*II_0F_E1*/ {0x15c, 6728}, + /*II_66_0F_E1*/ {0x13e, 6728}, + /*II_0F_E2*/ {0x15c, 6743}, + /*II_66_0F_E2*/ {0x13e, 6743}, + /*II_0F_E3*/ {0x192, 6758}, + /*II_66_0F_E3*/ {0x13e, 6758}, + /*II_0F_E4*/ {0x192, 6773}, + /*II_66_0F_E4*/ {0x13e, 6773}, + /*II_0F_E5*/ {0x15c, 6792}, + /*II_66_0F_E5*/ {0x13e, 6792}, + /*II_66_0F_E6*/ {0x13e, 6809}, + /*II_F3_0F_E6*/ {0x151, 6820}, + /*II_F2_0F_E6*/ {0x13e, 6830}, + /*II_0F_E7*/ {0x193, 6874}, + /*II_66_0F_E7*/ {0x147, 6882}, + /*II_0F_E8*/ {0x15c, 6901}, + /*II_66_0F_E8*/ {0x13e, 6901}, + /*II_0F_E9*/ {0x15c, 6918}, + /*II_66_0F_E9*/ {0x13e, 6918}, + /*II_0F_EA*/ {0x192, 6935}, + /*II_66_0F_EA*/ {0x13e, 6935}, + /*II_0F_EB*/ {0x15c, 6952}, + /*II_66_0F_EB*/ {0x13e, 6952}, + /*II_0F_EC*/ {0x15c, 6963}, + /*II_66_0F_EC*/ {0x13e, 6963}, + /*II_0F_ED*/ {0x15c, 6980}, + /*II_66_0F_ED*/ {0x13e, 6980}, + /*II_0F_EE*/ {0x192, 6997}, + /*II_66_0F_EE*/ {0x13e, 6997}, + /*II_0F_EF*/ {0x15c, 7014}, + /*II_66_0F_EF*/ {0x13e, 7014}, + /*II_F2_0F_F0*/ {0x194, 7027}, + /*II_0F_F1*/ {0x15c, 7042}, + /*II_66_0F_F1*/ {0x13e, 7042}, + /*II_0F_F2*/ {0x15c, 7057}, + /*II_66_0F_F2*/ {0x13e, 7057}, + /*II_0F_F3*/ {0x15c, 7072}, + /*II_66_0F_F3*/ {0x13e, 7072}, + /*II_0F_F4*/ {0x196, 7087}, + /*II_66_0F_F4*/ {0x13e, 7087}, + /*II_0F_F5*/ {0x15c, 7106}, + /*II_66_0F_F5*/ {0x13e, 7106}, + /*II_0F_F6*/ {0x192, 7125}, + /*II_66_0F_F6*/ {0x13e, 7125}, + /*II_0F_F7*/ {0x197, 7142}, + /*II_66_0F_F7*/ {0x198, 7152}, + /*II_0F_F8*/ {0x15c, 7177}, + /*II_66_0F_F8*/ {0x13e, 7177}, + /*II_0F_F9*/ {0x15c, 7192}, + /*II_66_0F_F9*/ {0x13e, 7192}, + /*II_0F_FA*/ {0x15c, 7207}, + /*II_66_0F_FA*/ {0x13e, 7207}, + /*II_0F_FB*/ {0x196, 7222}, + /*II_66_0F_FB*/ {0x13e, 7222}, + /*II_0F_FC*/ {0x15c, 7237}, + /*II_66_0F_FC*/ {0x13e, 7237}, + /*II_0F_FD*/ {0x15c, 7252}, + /*II_66_0F_FD*/ {0x13e, 7252}, + /*II_0F_FE*/ {0x15c, 7267}, + /*II_66_0F_FE*/ {0x13e, 7267}, + /*II_D9_06*/ {0x19a, 7282}, + /*II_9B_D9_06*/ {0x19b, 7291}, + /*II_D9_07*/ {0xfe, 7299}, + /*II_9B_D9_07*/ {0x19c, 7307}, + /*II_DB_E2*/ {0xec, 7314}, + /*II_9B_DB_E2*/ {0x19d, 7322}, + /*II_DB_E3*/ {0xec, 7329}, + /*II_9B_DB_E3*/ {0x19d, 7337}, + /*II_DD_06*/ {0x19a, 7344}, + /*II_9B_DD_06*/ {0x19b, 7352}, + /*II_DD_07*/ {0xfe, 7359}, + /*II_9B_DD_07*/ {0x19c, 7367}, + /*II_DF_E0*/ {0x19e, 7359}, + /*II_9B_DF_E0*/ {0x19f, 7367}, + /*II_0F_38_00*/ {0x1a0, 7374}, + /*II_66_0F_38_00*/ {0x1a1, 7374}, + /*II_0F_38_01*/ {0x1a0, 7391}, + /*II_66_0F_38_01*/ {0x1a1, 7391}, + /*II_0F_38_02*/ {0x1a0, 7408}, + /*II_66_0F_38_02*/ {0x1a1, 7408}, + /*II_0F_38_03*/ {0x1a0, 7425}, + /*II_66_0F_38_03*/ {0x1a1, 7425}, + /*II_0F_38_04*/ {0x1a0, 7444}, + /*II_66_0F_38_04*/ {0x1a1, 7444}, + /*II_0F_38_05*/ {0x1a0, 7467}, + /*II_66_0F_38_05*/ {0x1a1, 7467}, + /*II_0F_38_06*/ {0x1a0, 7484}, + /*II_66_0F_38_06*/ {0x1a1, 7484}, + /*II_0F_38_07*/ {0x1a0, 7501}, + /*II_66_0F_38_07*/ {0x1a1, 7501}, + /*II_0F_38_08*/ {0x1a0, 7520}, + /*II_66_0F_38_08*/ {0x1a1, 7520}, + /*II_0F_38_09*/ {0x1a0, 7537}, + /*II_66_0F_38_09*/ {0x1a1, 7537}, + /*II_0F_38_0A*/ {0x1a0, 7554}, + /*II_66_0F_38_0A*/ {0x1a1, 7554}, + /*II_0F_38_0B*/ {0x1a0, 7571}, + /*II_66_0F_38_0B*/ {0x1a1, 7571}, + /*II_66_0F_38_17*/ {0x1a3, 7662}, + /*II_0F_38_1C*/ {0x1a0, 7721}, + /*II_66_0F_38_1C*/ {0x1a1, 7721}, + /*II_0F_38_1D*/ {0x1a0, 7736}, + /*II_66_0F_38_1D*/ {0x1a1, 7736}, + /*II_0F_38_1E*/ {0x1a0, 7751}, + /*II_66_0F_38_1E*/ {0x1a1, 7751}, + /*II_66_0F_38_20*/ {0x1a8, 7766}, + /*II_66_0F_38_21*/ {0x1a9, 7787}, + /*II_66_0F_38_22*/ {0x1aa, 7808}, + /*II_66_0F_38_23*/ {0x1a8, 7829}, + /*II_66_0F_38_24*/ {0x1a9, 7850}, + /*II_66_0F_38_25*/ {0x1a8, 7871}, + /*II_66_0F_38_28*/ {0x1ac, 7892}, + /*II_66_0F_38_29*/ {0x1ac, 7909}, + /*II_66_0F_38_2A*/ {0x1ad, 7928}, + /*II_66_0F_38_2B*/ {0x1ac, 7949}, + /*II_66_0F_38_30*/ {0x1a8, 7994}, + /*II_66_0F_38_31*/ {0x1a9, 8015}, + /*II_66_0F_38_32*/ {0x1aa, 8036}, + /*II_66_0F_38_33*/ {0x1a8, 8057}, + /*II_66_0F_38_34*/ {0x1a9, 8078}, + /*II_66_0F_38_35*/ {0x1a8, 8099}, + /*II_66_0F_38_37*/ {0x1a3, 8120}, + /*II_66_0F_38_38*/ {0x1ac, 8139}, + /*II_66_0F_38_39*/ {0x1ac, 8156}, + /*II_66_0F_38_3A*/ {0x1ac, 8173}, + /*II_66_0F_38_3B*/ {0x1ac, 8190}, + /*II_66_0F_38_3C*/ {0x1ac, 8207}, + /*II_66_0F_38_3D*/ {0x1ac, 8224}, + /*II_66_0F_38_3E*/ {0x1ac, 8241}, + /*II_66_0F_38_3F*/ {0x1ac, 8258}, + /*II_66_0F_38_40*/ {0x1ac, 8275}, + /*II_66_0F_38_41*/ {0x1ac, 8292}, + /*II_66_0F_38_80*/ {0x1b0, 8317}, + /*II_66_0F_38_81*/ {0x1b0, 8325}, + /*II_66_0F_38_82*/ {0x1b0, 8334}, + /*II_66_0F_38_DB*/ {0x1b3, 9183}, + /*II_66_0F_38_DC*/ {0x1b3, 9200}, + /*II_66_0F_38_DD*/ {0x1b3, 9217}, + /*II_66_0F_38_DE*/ {0x1b3, 9242}, + /*II_66_0F_38_DF*/ {0x1b3, 9259}, + /*II_0F_38_F0*/ {0x1b6, 9284}, + /*II_F2_0F_38_F0*/ {0x1b7, 9291}, + /*II_0F_38_F1*/ {0x1b8, 9284}, + /*II_F2_0F_38_F1*/ {0x1b9, 9291}, + /*II_0F_71_02*/ {0x1d0, 6469}, + /*II_66_0F_71_02*/ {0x1d1, 6469}, + /*II_0F_71_04*/ {0x1d0, 6728}, + /*II_66_0F_71_04*/ {0x1d1, 6728}, + /*II_0F_71_06*/ {0x1d0, 7042}, + /*II_66_0F_71_06*/ {0x1d1, 7042}, + /*II_0F_72_02*/ {0x1d0, 6484}, + /*II_66_0F_72_02*/ {0x1d1, 6484}, + /*II_0F_72_04*/ {0x1d0, 6743}, + /*II_66_0F_72_04*/ {0x1d1, 6743}, + /*II_0F_72_06*/ {0x1d0, 7057}, + /*II_66_0F_72_06*/ {0x1d1, 7057}, + /*II_0F_73_02*/ {0x1d0, 6499}, + /*II_66_0F_73_02*/ {0x1d1, 6499}, + /*II_66_0F_73_03*/ {0x1d1, 9863}, + /*II_0F_73_06*/ {0x1d0, 7072}, + /*II_66_0F_73_06*/ {0x1d1, 7072}, + /*II_66_0F_73_07*/ {0x1d1, 9880}, + /*II_F3_0F_AE_00*/ {0x1d3, 9915}, + /*II_F3_0F_AE_01*/ {0x1d3, 9945}, + /*II_0F_AE_02*/ {0x1d4, 9955}, + /*II_F3_0F_AE_02*/ {0x1d3, 9964}, + /*II_0F_AE_03*/ {0x1d4, 9984}, + /*II_F3_0F_AE_03*/ {0x1d3, 9993}, + /*II_0F_C7_06*/ {0x1d6, 10013}, + /*II_66_0F_C7_06*/ {0x18b, 10022}, + /*II_F3_0F_C7_06*/ {0x18b, 10031} }; _InstInfoEx InstInfosEx[381] = { @@ -1388,383 +1390,383 @@ _InstInfoEx InstInfosEx[381] = { /*II_6B*/ {{0x34, 117}, 0x0, 5, 0, 0, 0}, /*II_98*/ {{0x4e, 228}, 0x0, 0, 0, 233, 239}, /*II_99*/ {{0x4e, 245}, 0x0, 0, 0, 250, 255}, - /*II_E3*/ {{0x76, 427}, 0x0, 0, 0, 433, 440}, - /*II_0F_A4*/ {{0xac, 876}, 0x0, 1, 0, 0, 0}, - /*II_0F_A5*/ {{0xac, 876}, 0x0, 52, 0, 0, 0}, - /*II_0F_AC*/ {{0xac, 892}, 0x0, 1, 0, 0, 0}, - /*II_0F_AD*/ {{0xac, 892}, 0x0, 52, 0, 0, 0}, - /*II_V_0F_10*/ {{0x126, 2139}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_10*/ {{0x126, 2148}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_10*/ {{0x127, 2157}, 0x20, 69, 0, 0, 0}, - /*II_V_F2_0F_10*/ {{0x127, 2165}, 0x20, 69, 0, 0, 0}, - /*II_VRR_F3_0F_10*/ {{0x128, 2157}, 0x60, 0, 0, 0, 0}, - /*II_VRR_F2_0F_10*/ {{0x129, 2165}, 0x60, 0, 0, 0, 0}, - /*II_V_0F_11*/ {{0x12e, 2139}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_11*/ {{0x12e, 2148}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_11*/ {{0x127, 2157}, 0x20, 69, 0, 0, 0}, - /*II_V_F2_0F_11*/ {{0x127, 2165}, 0x20, 69, 0, 0, 0}, - /*II_VRR_F3_0F_11*/ {{0x12f, 2157}, 0x60, 0, 0, 0, 0}, - /*II_VRR_F2_0F_11*/ {{0x130, 2165}, 0x60, 0, 0, 0, 0}, - /*II_0F_12*/ {{0x131, 2173}, 0x0, 0, 0, 2182, 0}, - /*II_V_0F_12*/ {{0x134, 2217}, 0x0, 72, 0, 2227, 0}, - /*II_V_66_0F_12*/ {{0x135, 2236}, 0x0, 46, 0, 0, 0}, - /*II_V_F3_0F_12*/ {{0x126, 2245}, 0x41, 0, 0, 0, 0}, - /*II_V_F2_0F_12*/ {{0x136, 2256}, 0x41, 0, 0, 0, 0}, - /*II_V_0F_13*/ {{0x139, 2227}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_13*/ {{0x139, 2236}, 0x40, 0, 0, 0, 0}, - /*II_V_0F_14*/ {{0x13c, 2286}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_14*/ {{0x13c, 2297}, 0x1, 90, 0, 0, 0}, - /*II_V_0F_15*/ {{0x13c, 2328}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_15*/ {{0x13c, 2339}, 0x1, 90, 0, 0, 0}, - /*II_0F_16*/ {{0x131, 2350}, 0x0, 0, 0, 2359, 0}, - /*II_V_0F_16*/ {{0x134, 2385}, 0x0, 72, 0, 2395, 0}, - /*II_V_66_0F_16*/ {{0x135, 2404}, 0x0, 46, 0, 0, 0}, - /*II_V_F3_0F_16*/ {{0x126, 2413}, 0x41, 0, 0, 0, 0}, - /*II_V_0F_17*/ {{0x139, 2395}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_17*/ {{0x139, 2404}, 0x40, 0, 0, 0, 0}, - /*II_V_0F_28*/ {{0x126, 2489}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_28*/ {{0x126, 2498}, 0x41, 0, 0, 0, 0}, - /*II_V_0F_29*/ {{0x12e, 2489}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_29*/ {{0x12e, 2498}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_2A*/ {{0x135, 2547}, 0x2, 79, 0, 0, 0}, - /*II_V_F2_0F_2A*/ {{0x135, 2558}, 0x2, 79, 0, 0, 0}, - /*II_V_0F_2B*/ {{0x147, 2605}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_2B*/ {{0x147, 2615}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_2C*/ {{0x14c, 2669}, 0x42, 0, 0, 0, 0}, - /*II_V_F2_0F_2C*/ {{0x14c, 2681}, 0x42, 0, 0, 0, 0}, - /*II_V_F3_0F_2D*/ {{0x14c, 2733}, 0x42, 0, 0, 0, 0}, - /*II_V_F2_0F_2D*/ {{0x14c, 2744}, 0x42, 0, 0, 0, 0}, - /*II_V_0F_2E*/ {{0x14f, 2773}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_2E*/ {{0x150, 2783}, 0x40, 0, 0, 0, 0}, - /*II_V_0F_2F*/ {{0x14f, 2809}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_2F*/ {{0x150, 2818}, 0x40, 0, 0, 0, 0}, - /*II_V_0F_50*/ {{0x153, 2847}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_50*/ {{0x153, 2858}, 0x41, 0, 0, 0, 0}, - /*II_V_0F_51*/ {{0x126, 2901}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_51*/ {{0x126, 2910}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_51*/ {{0x135, 2919}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_51*/ {{0x135, 2928}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_52*/ {{0x126, 2955}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_52*/ {{0x135, 2965}, 0x0, 71, 0, 0, 0}, - /*II_V_0F_53*/ {{0x126, 2989}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_53*/ {{0x135, 2997}, 0x0, 71, 0, 0, 0}, - /*II_V_0F_54*/ {{0x13c, 3019}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_54*/ {{0x13c, 3027}, 0x1, 90, 0, 0, 0}, - /*II_V_0F_55*/ {{0x13c, 3051}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_55*/ {{0x13c, 3060}, 0x1, 90, 0, 0, 0}, - /*II_V_0F_56*/ {{0x13c, 3081}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_56*/ {{0x13c, 3088}, 0x1, 90, 0, 0, 0}, - /*II_V_0F_57*/ {{0x13c, 3109}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_57*/ {{0x13c, 3117}, 0x1, 90, 0, 0, 0}, - /*II_V_0F_58*/ {{0x13c, 3153}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_58*/ {{0x13c, 3161}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_58*/ {{0x135, 3169}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_58*/ {{0x135, 3177}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_59*/ {{0x13c, 3213}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_59*/ {{0x13c, 3221}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_59*/ {{0x135, 3229}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_59*/ {{0x135, 3237}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_5A*/ {{0x156, 3285}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_5A*/ {{0x157, 3296}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_5A*/ {{0x135, 3307}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_5A*/ {{0x135, 3318}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_5B*/ {{0x126, 3360}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_5B*/ {{0x126, 3371}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_5B*/ {{0x126, 3382}, 0x41, 0, 0, 0, 0}, - /*II_V_0F_5C*/ {{0x13c, 3422}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_5C*/ {{0x13c, 3430}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_5C*/ {{0x135, 3438}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_5C*/ {{0x135, 3446}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_5D*/ {{0x13c, 3482}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_5D*/ {{0x13c, 3490}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_5D*/ {{0x135, 3498}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_5D*/ {{0x135, 3506}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_5E*/ {{0x13c, 3542}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_5E*/ {{0x13c, 3550}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_5E*/ {{0x135, 3558}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_5E*/ {{0x135, 3566}, 0x0, 72, 0, 0, 0}, - /*II_V_0F_5F*/ {{0x13c, 3602}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_5F*/ {{0x13c, 3610}, 0x1, 90, 0, 0, 0}, - /*II_V_F3_0F_5F*/ {{0x135, 3618}, 0x0, 71, 0, 0, 0}, - /*II_V_F2_0F_5F*/ {{0x135, 3626}, 0x0, 72, 0, 0, 0}, - /*II_V_66_0F_60*/ {{0x135, 3645}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_61*/ {{0x135, 3668}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_62*/ {{0x135, 3691}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_63*/ {{0x135, 3713}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_64*/ {{0x135, 3733}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_65*/ {{0x135, 3752}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_66*/ {{0x135, 3771}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_67*/ {{0x135, 3791}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_68*/ {{0x135, 3813}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_69*/ {{0x135, 3836}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_6A*/ {{0x135, 3859}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_6B*/ {{0x135, 3881}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_6C*/ {{0x135, 3904}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_6D*/ {{0x135, 3929}, 0x0, 73, 0, 0, 0}, - /*II_0F_6E*/ {{0x15a, 3942}, 0x0, 0, 0, 0, 3948}, - /*II_66_0F_6E*/ {{0x15b, 3942}, 0x0, 0, 0, 0, 3948}, - /*II_V_66_0F_6E*/ {{0x15c, 3954}, 0x46, 0, 0, 3961, 0}, - /*II_V_66_0F_6F*/ {{0x126, 3984}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_6F*/ {{0x126, 3993}, 0x41, 0, 0, 0, 0}, - /*II_0F_70*/ {{0x15e, 4002}, 0x0, 1, 0, 0, 0}, - /*II_66_0F_70*/ {{0x15f, 4010}, 0x0, 1, 0, 0, 0}, - /*II_F3_0F_70*/ {{0x15f, 4018}, 0x0, 1, 0, 0, 0}, - /*II_F2_0F_70*/ {{0x15f, 4027}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_70*/ {{0x160, 4036}, 0x40, 1, 0, 0, 0}, - /*II_V_F3_0F_70*/ {{0x160, 4045}, 0x40, 1, 0, 0, 0}, - /*II_V_F2_0F_70*/ {{0x160, 4055}, 0x40, 1, 0, 0, 0}, - /*II_V_66_0F_74*/ {{0x135, 4074}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_75*/ {{0x135, 4093}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_76*/ {{0x135, 4112}, 0x0, 73, 0, 0, 0}, - /*II_V_0F_77*/ {{0x162, 4128}, 0x49, 0, 0, 4140, 0}, - /*II_66_0F_78*/ {{0x164, 4158}, 0x0, 8, 0, 0, 0}, - /*II_F2_0F_78*/ {{0x165, 4165}, 0x0, 7, 8, 0, 0}, - /*II_V_66_0F_7C*/ {{0x13c, 4219}, 0x1, 90, 0, 0, 0}, - /*II_V_F2_0F_7C*/ {{0x13c, 4228}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_7D*/ {{0x13c, 4253}, 0x1, 90, 0, 0, 0}, - /*II_V_F2_0F_7D*/ {{0x13c, 4262}, 0x1, 90, 0, 0, 0}, - /*II_0F_7E*/ {{0x16c, 3942}, 0x0, 0, 0, 0, 3948}, - /*II_66_0F_7E*/ {{0x16d, 3942}, 0x0, 0, 0, 0, 3948}, - /*II_V_66_0F_7E*/ {{0x16e, 3954}, 0x46, 0, 0, 3961, 0}, - /*II_V_F3_0F_7E*/ {{0x150, 3961}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_7F*/ {{0x12e, 3984}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_7F*/ {{0x12e, 3993}, 0x41, 0, 0, 0, 0}, - /*II_0F_AE_04*/ {{0x170, 4271}, 0x0, 0, 0, 0, 4278}, - /*II_0F_AE_05*/ {{0x171, 4287}, 0x0, 0, 0, 4295, 4303}, - /*II_0F_AE_06*/ {{0x171, 4313}, 0x0, 0, 0, 4321, 4331}, - /*II_0F_AE_07*/ {{0x172, 4343}, 0x0, 0, 0, 4351, 0}, - /*II_0F_C2*/ {{0x179, 4392}, 0x0, 0, 0, 4401, 4410}, - /*II_66_0F_C2*/ {{0x17a, 4471}, 0x0, 0, 0, 4480, 4489}, - /*II_F3_0F_C2*/ {{0x17b, 4550}, 0x0, 0, 0, 4559, 4568}, - /*II_F2_0F_C2*/ {{0x17c, 4629}, 0x0, 0, 0, 4638, 4647}, - /*II_V_0F_C2*/ {{0x17d, 4708}, 0x1, 90, 0, 4718, 4728}, - /*II_V_66_0F_C2*/ {{0x17d, 5110}, 0x1, 90, 0, 5120, 5130}, - /*II_V_F3_0F_C2*/ {{0x17e, 5512}, 0x0, 71, 0, 5522, 5532}, - /*II_V_F2_0F_C2*/ {{0x17e, 5914}, 0x0, 72, 0, 5924, 5934}, - /*II_0F_C4*/ {{0x17f, 6316}, 0x0, 1, 0, 0, 0}, - /*II_66_0F_C4*/ {{0x180, 6316}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_C4*/ {{0x181, 6324}, 0x0, 25, 1, 0, 0}, - /*II_0F_C5*/ {{0x182, 6333}, 0x0, 1, 0, 0, 0}, - /*II_66_0F_C5*/ {{0x183, 6333}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_C5*/ {{0x184, 6341}, 0x40, 1, 0, 0, 0}, - /*II_0F_C6*/ {{0x185, 6350}, 0x0, 1, 0, 0, 0}, - /*II_66_0F_C6*/ {{0x15f, 6358}, 0x0, 1, 0, 0, 0}, - /*II_V_0F_C6*/ {{0x186, 6366}, 0x1, 90, 1, 0, 0}, - /*II_V_66_0F_C6*/ {{0x186, 6375}, 0x1, 90, 1, 0, 0}, - /*II_0F_C7_01*/ {{0x187, 6384}, 0x0, 0, 0, 0, 6395}, - /*II_V_66_0F_D0*/ {{0x13c, 6436}, 0x1, 90, 0, 0, 0}, - /*II_V_F2_0F_D0*/ {{0x13c, 6447}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_D1*/ {{0x135, 6465}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D2*/ {{0x135, 6480}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D3*/ {{0x135, 6495}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D4*/ {{0x135, 6510}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D5*/ {{0x135, 6526}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D6*/ {{0x18b, 3961}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_D7*/ {{0x18e, 6563}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_D8*/ {{0x135, 6583}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_D9*/ {{0x135, 6602}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DA*/ {{0x135, 6620}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DB*/ {{0x135, 6635}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DC*/ {{0x135, 6651}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DD*/ {{0x135, 6651}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DE*/ {{0x135, 6678}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_DF*/ {{0x135, 6694}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E0*/ {{0x135, 6709}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E1*/ {{0x135, 6724}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E2*/ {{0x135, 6739}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E3*/ {{0x135, 6754}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E4*/ {{0x135, 6771}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E5*/ {{0x135, 6789}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E6*/ {{0x157, 6829}, 0x41, 0, 0, 0, 0}, - /*II_V_F3_0F_E6*/ {{0x156, 6841}, 0x41, 0, 0, 0, 0}, - /*II_V_F2_0F_E6*/ {{0x157, 6852}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_E7*/ {{0x147, 6880}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_E8*/ {{0x135, 6898}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_E9*/ {{0x135, 6915}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_EA*/ {{0x135, 6932}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_EB*/ {{0x135, 6946}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_EC*/ {{0x135, 6960}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_ED*/ {{0x135, 6977}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_EE*/ {{0x135, 6994}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_EF*/ {{0x135, 7009}, 0x0, 73, 0, 0, 0}, - /*II_V_F2_0F_F0*/ {{0x192, 7023}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_F1*/ {{0x135, 7038}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F2*/ {{0x135, 7053}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F3*/ {{0x135, 7068}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F4*/ {{0x135, 7085}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F5*/ {{0x135, 7104}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F6*/ {{0x135, 7122}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F7*/ {{0x196, 7153}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_F8*/ {{0x135, 7173}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_F9*/ {{0x135, 7188}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_FA*/ {{0x135, 7203}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_FB*/ {{0x135, 7218}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_FC*/ {{0x135, 7233}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_FD*/ {{0x135, 7248}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_FE*/ {{0x135, 7263}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_00*/ {{0x135, 7371}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_01*/ {{0x135, 7388}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_02*/ {{0x135, 7405}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_03*/ {{0x135, 7423}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_04*/ {{0x135, 7444}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_05*/ {{0x135, 7464}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_06*/ {{0x135, 7481}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_07*/ {{0x135, 7499}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_08*/ {{0x135, 7517}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_09*/ {{0x135, 7534}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_0A*/ {{0x135, 7551}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_0B*/ {{0x135, 7570}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_0C*/ {{0x13c, 7581}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_38_0D*/ {{0x13c, 7592}, 0x1, 90, 0, 0, 0}, - /*II_V_66_0F_38_0E*/ {{0x126, 7603}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_38_0F*/ {{0x126, 7612}, 0x41, 0, 0, 0, 0}, - /*II_66_0F_38_10*/ {{0x19f, 7621}, 0x0, 74, 0, 0, 0}, - /*II_66_0F_38_14*/ {{0x19f, 7631}, 0x0, 74, 0, 0, 0}, - /*II_66_0F_38_15*/ {{0x19f, 7641}, 0x0, 74, 0, 0, 0}, - /*II_V_66_0F_38_17*/ {{0x126, 7658}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_38_18*/ {{0x1a1, 7666}, 0x41, 0, 0, 0, 0}, - /*II_V_66_0F_38_19*/ {{0x1a2, 7680}, 0x50, 0, 0, 0, 0}, - /*II_V_66_0F_38_1A*/ {{0x1a3, 7694}, 0x50, 0, 0, 0, 0}, - /*II_V_66_0F_38_1C*/ {{0x1a4, 7717}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_1D*/ {{0x1a4, 7732}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_1E*/ {{0x1a4, 7747}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_20*/ {{0x150, 7765}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_21*/ {{0x14f, 7786}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_22*/ {{0x1a8, 7807}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_23*/ {{0x150, 7828}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_24*/ {{0x14f, 7849}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_25*/ {{0x150, 7870}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_28*/ {{0x135, 7889}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_29*/ {{0x135, 7907}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_2A*/ {{0x1ab, 7927}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_2B*/ {{0x135, 7948}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_2C*/ {{0x13c, 7959}, 0x1, 92, 0, 0, 0}, - /*II_V_66_0F_38_2D*/ {{0x13c, 7971}, 0x1, 92, 0, 0, 0}, - /*II_V_66_0F_38_2E*/ {{0x1ac, 7959}, 0x1, 83, 0, 0, 0}, - /*II_V_66_0F_38_2F*/ {{0x1ac, 7971}, 0x1, 83, 0, 0, 0}, - /*II_V_66_0F_38_30*/ {{0x150, 7993}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_31*/ {{0x14f, 8014}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_32*/ {{0x1a8, 8035}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_33*/ {{0x150, 8056}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_34*/ {{0x14f, 8077}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_35*/ {{0x150, 8098}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_37*/ {{0x135, 8118}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_38*/ {{0x135, 8136}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_39*/ {{0x135, 8153}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3A*/ {{0x135, 8170}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3B*/ {{0x135, 8187}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3C*/ {{0x135, 8204}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3D*/ {{0x135, 8221}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3E*/ {{0x135, 8238}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_3F*/ {{0x135, 8255}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_40*/ {{0x135, 8272}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_41*/ {{0x1a4, 8293}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_96*/ {{0x1ae, 8332}, 0x7, 90, 0, 8348, 0}, - /*II_V_66_0F_38_97*/ {{0x1ae, 8364}, 0x7, 90, 0, 8380, 0}, - /*II_V_66_0F_38_98*/ {{0x1ae, 8396}, 0x7, 90, 0, 8409, 0}, - /*II_V_66_0F_38_99*/ {{0x1af, 8422}, 0x6, 80, 0, 8435, 0}, - /*II_V_66_0F_38_9A*/ {{0x1ae, 8448}, 0x7, 90, 0, 8461, 0}, - /*II_V_66_0F_38_9B*/ {{0x1af, 8474}, 0x6, 80, 0, 8487, 0}, - /*II_V_66_0F_38_9C*/ {{0x1ae, 8500}, 0x7, 90, 0, 8514, 0}, - /*II_V_66_0F_38_9D*/ {{0x1af, 8528}, 0x6, 80, 0, 8542, 0}, - /*II_V_66_0F_38_9E*/ {{0x1ae, 8556}, 0x7, 90, 0, 8570, 0}, - /*II_V_66_0F_38_9F*/ {{0x1af, 8584}, 0x6, 80, 0, 8598, 0}, - /*II_V_66_0F_38_A6*/ {{0x1ae, 8612}, 0x7, 90, 0, 8628, 0}, - /*II_V_66_0F_38_A7*/ {{0x1ae, 8644}, 0x7, 90, 0, 8660, 0}, - /*II_V_66_0F_38_A8*/ {{0x1ae, 8676}, 0x7, 90, 0, 8689, 0}, - /*II_V_66_0F_38_A9*/ {{0x1af, 8702}, 0x6, 80, 0, 8715, 0}, - /*II_V_66_0F_38_AA*/ {{0x1ae, 8728}, 0x7, 90, 0, 8741, 0}, - /*II_V_66_0F_38_AB*/ {{0x1af, 8754}, 0x6, 80, 0, 8767, 0}, - /*II_V_66_0F_38_AC*/ {{0x1ae, 8780}, 0x7, 90, 0, 8794, 0}, - /*II_V_66_0F_38_AD*/ {{0x1af, 8808}, 0x6, 80, 0, 8822, 0}, - /*II_V_66_0F_38_AE*/ {{0x1ae, 8836}, 0x7, 90, 0, 8850, 0}, - /*II_V_66_0F_38_AF*/ {{0x1af, 8864}, 0x6, 80, 0, 8878, 0}, - /*II_V_66_0F_38_B6*/ {{0x1ae, 8892}, 0x7, 90, 0, 8908, 0}, - /*II_V_66_0F_38_B7*/ {{0x1ae, 8924}, 0x7, 90, 0, 8940, 0}, - /*II_V_66_0F_38_B8*/ {{0x1ae, 8956}, 0x7, 90, 0, 8969, 0}, - /*II_V_66_0F_38_B9*/ {{0x1af, 8982}, 0x6, 80, 0, 8995, 0}, - /*II_V_66_0F_38_BA*/ {{0x1ae, 9008}, 0x7, 90, 0, 9021, 0}, - /*II_V_66_0F_38_BB*/ {{0x1af, 9034}, 0x6, 80, 0, 9047, 0}, - /*II_V_66_0F_38_BC*/ {{0x1ae, 9060}, 0x7, 90, 0, 9074, 0}, - /*II_V_66_0F_38_BD*/ {{0x1af, 9088}, 0x6, 80, 0, 9102, 0}, - /*II_V_66_0F_38_BE*/ {{0x1ae, 9116}, 0x7, 90, 0, 9130, 0}, - /*II_V_66_0F_38_BF*/ {{0x1af, 9144}, 0x6, 80, 0, 9158, 0}, - /*II_V_66_0F_38_DB*/ {{0x1b1, 9180}, 0x40, 0, 0, 0, 0}, - /*II_V_66_0F_38_DC*/ {{0x1b2, 9197}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_DD*/ {{0x1b2, 9218}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_DE*/ {{0x1b2, 9239}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_38_DF*/ {{0x1b2, 9260}, 0x0, 73, 0, 0, 0}, - /*II_V_66_0F_3A_04*/ {{0x1b7, 7581}, 0x41, 1, 0, 0, 0}, - /*II_V_66_0F_3A_05*/ {{0x1b7, 7592}, 0x41, 1, 0, 0, 0}, - /*II_V_66_0F_3A_06*/ {{0x1b8, 9287}, 0x10, 86, 1, 0, 0}, - /*II_66_0F_3A_08*/ {{0x19f, 9299}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_08*/ {{0x1b7, 9308}, 0x41, 1, 0, 0, 0}, - /*II_66_0F_3A_09*/ {{0x19f, 9318}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_09*/ {{0x1b7, 9327}, 0x41, 1, 0, 0, 0}, - /*II_66_0F_3A_0A*/ {{0x1b9, 9337}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0A*/ {{0x181, 9346}, 0x0, 71, 1, 0, 0}, - /*II_66_0F_3A_0B*/ {{0x1ba, 9356}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0B*/ {{0x181, 9365}, 0x0, 72, 1, 0, 0}, - /*II_66_0F_3A_0C*/ {{0x19f, 9375}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0C*/ {{0x186, 9384}, 0x1, 90, 1, 0, 0}, - /*II_66_0F_3A_0D*/ {{0x19f, 9394}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0D*/ {{0x186, 9403}, 0x1, 90, 1, 0, 0}, - /*II_66_0F_3A_0E*/ {{0x19f, 9413}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0E*/ {{0x181, 9422}, 0x0, 73, 1, 0, 0}, - /*II_0F_3A_0F*/ {{0x1bb, 9432}, 0x0, 1, 0, 0, 0}, - /*II_66_0F_3A_0F*/ {{0x1bc, 9432}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_0F*/ {{0x181, 9441}, 0x0, 73, 1, 0, 0}, - /*II_66_0F_3A_14*/ {{0x1bd, 9451}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_14*/ {{0x1be, 9459}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_15*/ {{0x1bf, 6333}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_15*/ {{0x1c0, 6341}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_16*/ {{0x1c1, 9468}, 0x0, 1, 0, 0, 9476}, - /*II_V_66_0F_3A_16*/ {{0x1c2, 9484}, 0x46, 1, 0, 9493, 0}, - /*II_66_0F_3A_17*/ {{0x1c3, 9502}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_17*/ {{0x1c4, 9513}, 0x40, 1, 0, 0, 0}, - /*II_V_66_0F_3A_18*/ {{0x1b8, 9525}, 0x10, 73, 1, 0, 0}, - /*II_V_66_0F_3A_19*/ {{0x1c5, 9538}, 0x50, 1, 0, 0, 0}, - /*II_66_0F_3A_20*/ {{0x1c6, 9552}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_20*/ {{0x181, 9560}, 0x0, 76, 1, 0, 0}, - /*II_66_0F_3A_21*/ {{0x1b9, 9569}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_21*/ {{0x181, 9579}, 0x0, 71, 1, 0, 0}, - /*II_66_0F_3A_22*/ {{0x1c7, 9590}, 0x0, 1, 0, 0, 9598}, - /*II_V_66_0F_3A_22*/ {{0x181, 9606}, 0x6, 79, 1, 9615, 0}, - /*II_66_0F_3A_40*/ {{0x19f, 9624}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_40*/ {{0x186, 9630}, 0x1, 90, 1, 0, 0}, - /*II_66_0F_3A_41*/ {{0x19f, 9637}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_41*/ {{0x181, 9643}, 0x0, 73, 1, 0, 0}, - /*II_66_0F_3A_42*/ {{0x19f, 9650}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_42*/ {{0x181, 9659}, 0x0, 73, 1, 0, 0}, - /*II_66_0F_3A_44*/ {{0x1c8, 9669}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_44*/ {{0x1c9, 9680}, 0x0, 73, 1, 0, 0}, - /*II_V_66_0F_3A_4A*/ {{0x186, 9692}, 0x1, 90, 84, 0, 0}, - /*II_V_66_0F_3A_4B*/ {{0x186, 9703}, 0x1, 90, 84, 0, 0}, - /*II_V_66_0F_3A_4C*/ {{0x181, 9714}, 0x0, 73, 82, 0, 0}, - /*II_66_0F_3A_60*/ {{0x1ca, 9725}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_60*/ {{0x160, 9736}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_61*/ {{0x1ca, 9748}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_61*/ {{0x160, 9759}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_62*/ {{0x1ca, 9771}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_62*/ {{0x160, 9782}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_63*/ {{0x1ca, 9794}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_63*/ {{0x160, 9805}, 0x40, 1, 0, 0, 0}, - /*II_66_0F_3A_DF*/ {{0x1cb, 9817}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_3A_DF*/ {{0x1cc, 9834}, 0x40, 1, 0, 0, 0}, - /*II_V_66_0F_71_02*/ {{0x1cf, 6465}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_71_04*/ {{0x1cf, 6724}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_71_06*/ {{0x1cf, 7038}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_72_02*/ {{0x1cf, 6480}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_72_04*/ {{0x1cf, 6739}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_72_06*/ {{0x1cf, 7053}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_73_02*/ {{0x1cf, 6495}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_73_03*/ {{0x1cf, 9860}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_73_06*/ {{0x1cf, 7068}, 0x0, 1, 0, 0, 0}, - /*II_V_66_0F_73_07*/ {{0x1cf, 9877}, 0x0, 1, 0, 0, 0}, - /*II_0F_AE_00*/ {{0x170, 9886}, 0x0, 0, 0, 0, 9894}, - /*II_0F_AE_01*/ {{0x170, 9914}, 0x0, 0, 0, 0, 9923}, - /*II_V_0F_AE_02*/ {{0x1d2, 9963}, 0x40, 0, 0, 0, 0}, - /*II_V_0F_AE_03*/ {{0x1d2, 9992}, 0x40, 0, 0, 0, 0} + /*II_E3*/ {{0x75, 426}, 0x0, 0, 0, 432, 439}, + /*II_0F_A4*/ {{0xad, 875}, 0x0, 1, 0, 0, 0}, + /*II_0F_A5*/ {{0xad, 875}, 0x0, 42, 0, 0, 0}, + /*II_0F_AC*/ {{0xad, 891}, 0x0, 1, 0, 0, 0}, + /*II_0F_AD*/ {{0xad, 891}, 0x0, 42, 0, 0, 0}, + /*II_V_0F_10*/ {{0x129, 2150}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_10*/ {{0x129, 2159}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_10*/ {{0x12a, 2168}, 0x20, 31, 0, 0, 0}, + /*II_V_F2_0F_10*/ {{0x12a, 2176}, 0x20, 31, 0, 0, 0}, + /*II_VRR_F3_0F_10*/ {{0x12b, 2168}, 0x60, 0, 0, 0, 0}, + /*II_VRR_F2_0F_10*/ {{0x12c, 2176}, 0x60, 0, 0, 0, 0}, + /*II_V_0F_11*/ {{0x131, 2150}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_11*/ {{0x131, 2159}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_11*/ {{0x12a, 2168}, 0x20, 31, 0, 0, 0}, + /*II_V_F2_0F_11*/ {{0x12a, 2176}, 0x20, 31, 0, 0, 0}, + /*II_VRR_F3_0F_11*/ {{0x132, 2168}, 0x60, 0, 0, 0, 0}, + /*II_VRR_F2_0F_11*/ {{0x133, 2176}, 0x60, 0, 0, 0, 0}, + /*II_0F_12*/ {{0x134, 2184}, 0x0, 0, 0, 2193, 0}, + /*II_V_0F_12*/ {{0x137, 2228}, 0x0, 86, 0, 2238, 0}, + /*II_V_66_0F_12*/ {{0x138, 2247}, 0x0, 57, 0, 0, 0}, + /*II_V_F3_0F_12*/ {{0x129, 2256}, 0x41, 0, 0, 0, 0}, + /*II_V_F2_0F_12*/ {{0x139, 2267}, 0x41, 0, 0, 0, 0}, + /*II_V_0F_13*/ {{0x13c, 2238}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_13*/ {{0x13c, 2247}, 0x40, 0, 0, 0, 0}, + /*II_V_0F_14*/ {{0x13f, 2297}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_14*/ {{0x13f, 2308}, 0x1, 91, 0, 0, 0}, + /*II_V_0F_15*/ {{0x13f, 2339}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_15*/ {{0x13f, 2350}, 0x1, 91, 0, 0, 0}, + /*II_0F_16*/ {{0x134, 2361}, 0x0, 0, 0, 2370, 0}, + /*II_V_0F_16*/ {{0x137, 2396}, 0x0, 86, 0, 2406, 0}, + /*II_V_66_0F_16*/ {{0x138, 2415}, 0x0, 57, 0, 0, 0}, + /*II_V_F3_0F_16*/ {{0x129, 2424}, 0x41, 0, 0, 0, 0}, + /*II_V_0F_17*/ {{0x13c, 2406}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_17*/ {{0x13c, 2415}, 0x40, 0, 0, 0, 0}, + /*II_V_0F_28*/ {{0x129, 2500}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_28*/ {{0x129, 2509}, 0x41, 0, 0, 0, 0}, + /*II_V_0F_29*/ {{0x131, 2500}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_29*/ {{0x131, 2509}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_2A*/ {{0x138, 2558}, 0x2, 73, 0, 0, 0}, + /*II_V_F2_0F_2A*/ {{0x138, 2569}, 0x2, 73, 0, 0, 0}, + /*II_V_0F_2B*/ {{0x14a, 2616}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_2B*/ {{0x14a, 2626}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_2C*/ {{0x14f, 2680}, 0x42, 0, 0, 0, 0}, + /*II_V_F2_0F_2C*/ {{0x14f, 2692}, 0x42, 0, 0, 0, 0}, + /*II_V_F3_0F_2D*/ {{0x14f, 2744}, 0x42, 0, 0, 0, 0}, + /*II_V_F2_0F_2D*/ {{0x14f, 2755}, 0x42, 0, 0, 0, 0}, + /*II_V_0F_2E*/ {{0x152, 2784}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_2E*/ {{0x153, 2794}, 0x40, 0, 0, 0, 0}, + /*II_V_0F_2F*/ {{0x152, 2820}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_2F*/ {{0x153, 2829}, 0x40, 0, 0, 0, 0}, + /*II_V_0F_50*/ {{0x156, 2858}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_50*/ {{0x156, 2869}, 0x41, 0, 0, 0, 0}, + /*II_V_0F_51*/ {{0x129, 2912}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_51*/ {{0x129, 2921}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_51*/ {{0x138, 2930}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_51*/ {{0x138, 2939}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_52*/ {{0x129, 2966}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_52*/ {{0x138, 2976}, 0x0, 85, 0, 0, 0}, + /*II_V_0F_53*/ {{0x129, 3000}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_53*/ {{0x138, 3008}, 0x0, 85, 0, 0, 0}, + /*II_V_0F_54*/ {{0x13f, 3030}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_54*/ {{0x13f, 3038}, 0x1, 91, 0, 0, 0}, + /*II_V_0F_55*/ {{0x13f, 3062}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_55*/ {{0x13f, 3071}, 0x1, 91, 0, 0, 0}, + /*II_V_0F_56*/ {{0x13f, 3092}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_56*/ {{0x13f, 3099}, 0x1, 91, 0, 0, 0}, + /*II_V_0F_57*/ {{0x13f, 3120}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_57*/ {{0x13f, 3128}, 0x1, 91, 0, 0, 0}, + /*II_V_0F_58*/ {{0x13f, 3164}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_58*/ {{0x13f, 3172}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_58*/ {{0x138, 3180}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_58*/ {{0x138, 3188}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_59*/ {{0x13f, 3224}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_59*/ {{0x13f, 3232}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_59*/ {{0x138, 3240}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_59*/ {{0x138, 3248}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_5A*/ {{0x159, 3296}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_5A*/ {{0x15a, 3307}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_5A*/ {{0x138, 3318}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_5A*/ {{0x138, 3329}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_5B*/ {{0x129, 3371}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_5B*/ {{0x129, 3382}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_5B*/ {{0x129, 3393}, 0x41, 0, 0, 0, 0}, + /*II_V_0F_5C*/ {{0x13f, 3433}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_5C*/ {{0x13f, 3441}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_5C*/ {{0x138, 3449}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_5C*/ {{0x138, 3457}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_5D*/ {{0x13f, 3493}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_5D*/ {{0x13f, 3501}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_5D*/ {{0x138, 3509}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_5D*/ {{0x138, 3517}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_5E*/ {{0x13f, 3553}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_5E*/ {{0x13f, 3561}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_5E*/ {{0x138, 3569}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_5E*/ {{0x138, 3577}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_5F*/ {{0x13f, 3613}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_5F*/ {{0x13f, 3621}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_5F*/ {{0x138, 3629}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_5F*/ {{0x138, 3637}, 0x0, 86, 0, 0, 0}, + /*II_V_66_0F_60*/ {{0x138, 3656}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_61*/ {{0x138, 3679}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_62*/ {{0x138, 3702}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_63*/ {{0x138, 3724}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_64*/ {{0x138, 3744}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_65*/ {{0x138, 3763}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_66*/ {{0x138, 3782}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_67*/ {{0x138, 3802}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_68*/ {{0x138, 3824}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_69*/ {{0x138, 3847}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_6A*/ {{0x138, 3870}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_6B*/ {{0x138, 3892}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_6C*/ {{0x138, 3915}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_6D*/ {{0x138, 3940}, 0x0, 87, 0, 0, 0}, + /*II_0F_6E*/ {{0x15d, 3953}, 0x0, 0, 0, 0, 3959}, + /*II_66_0F_6E*/ {{0x15e, 3953}, 0x0, 0, 0, 0, 3959}, + /*II_V_66_0F_6E*/ {{0x15f, 3965}, 0x46, 0, 0, 3972, 0}, + /*II_V_66_0F_6F*/ {{0x129, 3995}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_6F*/ {{0x129, 4004}, 0x41, 0, 0, 0, 0}, + /*II_0F_70*/ {{0x161, 4013}, 0x0, 1, 0, 0, 0}, + /*II_66_0F_70*/ {{0x162, 4021}, 0x0, 1, 0, 0, 0}, + /*II_F3_0F_70*/ {{0x162, 4029}, 0x0, 1, 0, 0, 0}, + /*II_F2_0F_70*/ {{0x162, 4038}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_70*/ {{0x163, 4047}, 0x40, 1, 0, 0, 0}, + /*II_V_F3_0F_70*/ {{0x163, 4056}, 0x40, 1, 0, 0, 0}, + /*II_V_F2_0F_70*/ {{0x163, 4066}, 0x40, 1, 0, 0, 0}, + /*II_V_66_0F_74*/ {{0x138, 4085}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_75*/ {{0x138, 4104}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_76*/ {{0x138, 4123}, 0x0, 87, 0, 0, 0}, + /*II_V_0F_77*/ {{0x165, 4139}, 0x49, 0, 0, 4151, 0}, + /*II_66_0F_78*/ {{0x167, 4169}, 0x0, 49, 0, 0, 0}, + /*II_F2_0F_78*/ {{0x168, 4176}, 0x0, 48, 49, 0, 0}, + /*II_V_66_0F_7C*/ {{0x13f, 4230}, 0x1, 91, 0, 0, 0}, + /*II_V_F2_0F_7C*/ {{0x13f, 4239}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_7D*/ {{0x13f, 4264}, 0x1, 91, 0, 0, 0}, + /*II_V_F2_0F_7D*/ {{0x13f, 4273}, 0x1, 91, 0, 0, 0}, + /*II_0F_7E*/ {{0x16f, 3953}, 0x0, 0, 0, 0, 3959}, + /*II_66_0F_7E*/ {{0x170, 3953}, 0x0, 0, 0, 0, 3959}, + /*II_V_66_0F_7E*/ {{0x171, 3965}, 0x46, 0, 0, 3972, 0}, + /*II_V_F3_0F_7E*/ {{0x153, 3972}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_7F*/ {{0x131, 3995}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_7F*/ {{0x131, 4004}, 0x41, 0, 0, 0, 0}, + /*II_0F_AE_04*/ {{0x173, 4282}, 0x0, 0, 0, 0, 4289}, + /*II_0F_AE_05*/ {{0x174, 4298}, 0x0, 0, 0, 4306, 4314}, + /*II_0F_AE_06*/ {{0x174, 4324}, 0x0, 0, 0, 4332, 4342}, + /*II_0F_AE_07*/ {{0x175, 4354}, 0x0, 0, 0, 4362, 0}, + /*II_0F_C2*/ {{0x17c, 4403}, 0x0, 0, 0, 4412, 4421}, + /*II_66_0F_C2*/ {{0x17d, 4482}, 0x0, 0, 0, 4491, 4500}, + /*II_F3_0F_C2*/ {{0x17e, 4561}, 0x0, 0, 0, 4570, 4579}, + /*II_F2_0F_C2*/ {{0x17f, 4640}, 0x0, 0, 0, 4649, 4658}, + /*II_V_0F_C2*/ {{0x180, 4719}, 0x1, 91, 0, 4729, 4739}, + /*II_V_66_0F_C2*/ {{0x180, 5121}, 0x1, 91, 0, 5131, 5141}, + /*II_V_F3_0F_C2*/ {{0x181, 5523}, 0x0, 85, 0, 5533, 5543}, + /*II_V_F2_0F_C2*/ {{0x181, 5925}, 0x0, 86, 0, 5935, 5945}, + /*II_0F_C4*/ {{0x182, 6327}, 0x0, 1, 0, 0, 0}, + /*II_66_0F_C4*/ {{0x183, 6327}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_C4*/ {{0x184, 6335}, 0x0, 79, 1, 0, 0}, + /*II_0F_C5*/ {{0x185, 6344}, 0x0, 1, 0, 0, 0}, + /*II_66_0F_C5*/ {{0x186, 6344}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_C5*/ {{0x187, 6352}, 0x40, 1, 0, 0, 0}, + /*II_0F_C6*/ {{0x188, 6361}, 0x0, 1, 0, 0, 0}, + /*II_66_0F_C6*/ {{0x162, 6369}, 0x0, 1, 0, 0, 0}, + /*II_V_0F_C6*/ {{0x189, 6377}, 0x1, 91, 1, 0, 0}, + /*II_V_66_0F_C6*/ {{0x189, 6386}, 0x1, 91, 1, 0, 0}, + /*II_0F_C7_01*/ {{0x18a, 6395}, 0x0, 0, 0, 0, 6406}, + /*II_V_66_0F_D0*/ {{0x13f, 6447}, 0x1, 91, 0, 0, 0}, + /*II_V_F2_0F_D0*/ {{0x13f, 6458}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_D1*/ {{0x138, 6476}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D2*/ {{0x138, 6491}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D3*/ {{0x138, 6506}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D4*/ {{0x138, 6521}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D5*/ {{0x138, 6537}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D6*/ {{0x18e, 3972}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_D7*/ {{0x191, 6574}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_D8*/ {{0x138, 6594}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D9*/ {{0x138, 6613}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DA*/ {{0x138, 6631}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DB*/ {{0x138, 6646}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DC*/ {{0x138, 6662}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DD*/ {{0x138, 6662}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DE*/ {{0x138, 6689}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DF*/ {{0x138, 6705}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E0*/ {{0x138, 6720}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E1*/ {{0x138, 6735}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E2*/ {{0x138, 6750}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E3*/ {{0x138, 6765}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E4*/ {{0x138, 6782}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E5*/ {{0x138, 6800}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E6*/ {{0x15a, 6840}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_E6*/ {{0x159, 6852}, 0x41, 0, 0, 0, 0}, + /*II_V_F2_0F_E6*/ {{0x15a, 6863}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_E7*/ {{0x14a, 6891}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_E8*/ {{0x138, 6909}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E9*/ {{0x138, 6926}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_EA*/ {{0x138, 6943}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_EB*/ {{0x138, 6957}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_EC*/ {{0x138, 6971}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_ED*/ {{0x138, 6988}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_EE*/ {{0x138, 7005}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_EF*/ {{0x138, 7020}, 0x0, 87, 0, 0, 0}, + /*II_V_F2_0F_F0*/ {{0x195, 7034}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_F1*/ {{0x138, 7049}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F2*/ {{0x138, 7064}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F3*/ {{0x138, 7079}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F4*/ {{0x138, 7096}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F5*/ {{0x138, 7115}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F6*/ {{0x138, 7133}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F7*/ {{0x199, 7164}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_F8*/ {{0x138, 7184}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F9*/ {{0x138, 7199}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_FA*/ {{0x138, 7214}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_FB*/ {{0x138, 7229}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_FC*/ {{0x138, 7244}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_FD*/ {{0x138, 7259}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_FE*/ {{0x138, 7274}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_00*/ {{0x138, 7382}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_01*/ {{0x138, 7399}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_02*/ {{0x138, 7416}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_03*/ {{0x138, 7434}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_04*/ {{0x138, 7455}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_05*/ {{0x138, 7475}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_06*/ {{0x138, 7492}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_07*/ {{0x138, 7510}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_08*/ {{0x138, 7528}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_09*/ {{0x138, 7545}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_0A*/ {{0x138, 7562}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_0B*/ {{0x138, 7581}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_0C*/ {{0x13f, 7592}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_38_0D*/ {{0x13f, 7603}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_38_0E*/ {{0x129, 7614}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_38_0F*/ {{0x129, 7623}, 0x41, 0, 0, 0, 0}, + /*II_66_0F_38_10*/ {{0x1a2, 7632}, 0x0, 32, 0, 0, 0}, + /*II_66_0F_38_14*/ {{0x1a2, 7642}, 0x0, 32, 0, 0, 0}, + /*II_66_0F_38_15*/ {{0x1a2, 7652}, 0x0, 32, 0, 0, 0}, + /*II_V_66_0F_38_17*/ {{0x129, 7669}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_38_18*/ {{0x1a4, 7677}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_38_19*/ {{0x1a5, 7691}, 0x50, 0, 0, 0, 0}, + /*II_V_66_0F_38_1A*/ {{0x1a6, 7705}, 0x50, 0, 0, 0, 0}, + /*II_V_66_0F_38_1C*/ {{0x1a7, 7728}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_1D*/ {{0x1a7, 7743}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_1E*/ {{0x1a7, 7758}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_20*/ {{0x153, 7776}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_21*/ {{0x152, 7797}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_22*/ {{0x1ab, 7818}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_23*/ {{0x153, 7839}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_24*/ {{0x152, 7860}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_25*/ {{0x153, 7881}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_28*/ {{0x138, 7900}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_29*/ {{0x138, 7918}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_2A*/ {{0x1ae, 7938}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_2B*/ {{0x138, 7959}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_2C*/ {{0x13f, 7970}, 0x1, 67, 0, 0, 0}, + /*II_V_66_0F_38_2D*/ {{0x13f, 7982}, 0x1, 67, 0, 0, 0}, + /*II_V_66_0F_38_2E*/ {{0x1af, 7970}, 0x1, 36, 0, 0, 0}, + /*II_V_66_0F_38_2F*/ {{0x1af, 7982}, 0x1, 36, 0, 0, 0}, + /*II_V_66_0F_38_30*/ {{0x153, 8004}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_31*/ {{0x152, 8025}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_32*/ {{0x1ab, 8046}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_33*/ {{0x153, 8067}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_34*/ {{0x152, 8088}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_35*/ {{0x153, 8109}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_37*/ {{0x138, 8129}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_38*/ {{0x138, 8147}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_39*/ {{0x138, 8164}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3A*/ {{0x138, 8181}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3B*/ {{0x138, 8198}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3C*/ {{0x138, 8215}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3D*/ {{0x138, 8232}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3E*/ {{0x138, 8249}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3F*/ {{0x138, 8266}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_40*/ {{0x138, 8283}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_41*/ {{0x1a7, 8304}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_96*/ {{0x1b1, 8343}, 0x7, 91, 0, 8359, 0}, + /*II_V_66_0F_38_97*/ {{0x1b1, 8375}, 0x7, 91, 0, 8391, 0}, + /*II_V_66_0F_38_98*/ {{0x1b1, 8407}, 0x7, 91, 0, 8420, 0}, + /*II_V_66_0F_38_99*/ {{0x1b2, 8433}, 0x6, 88, 0, 8446, 0}, + /*II_V_66_0F_38_9A*/ {{0x1b1, 8459}, 0x7, 91, 0, 8472, 0}, + /*II_V_66_0F_38_9B*/ {{0x1b2, 8485}, 0x6, 88, 0, 8498, 0}, + /*II_V_66_0F_38_9C*/ {{0x1b1, 8511}, 0x7, 91, 0, 8525, 0}, + /*II_V_66_0F_38_9D*/ {{0x1b2, 8539}, 0x6, 88, 0, 8553, 0}, + /*II_V_66_0F_38_9E*/ {{0x1b1, 8567}, 0x7, 91, 0, 8581, 0}, + /*II_V_66_0F_38_9F*/ {{0x1b2, 8595}, 0x6, 88, 0, 8609, 0}, + /*II_V_66_0F_38_A6*/ {{0x1b1, 8623}, 0x7, 91, 0, 8639, 0}, + /*II_V_66_0F_38_A7*/ {{0x1b1, 8655}, 0x7, 91, 0, 8671, 0}, + /*II_V_66_0F_38_A8*/ {{0x1b1, 8687}, 0x7, 91, 0, 8700, 0}, + /*II_V_66_0F_38_A9*/ {{0x1b2, 8713}, 0x6, 88, 0, 8726, 0}, + /*II_V_66_0F_38_AA*/ {{0x1b1, 8739}, 0x7, 91, 0, 8752, 0}, + /*II_V_66_0F_38_AB*/ {{0x1b2, 8765}, 0x6, 88, 0, 8778, 0}, + /*II_V_66_0F_38_AC*/ {{0x1b1, 8791}, 0x7, 91, 0, 8805, 0}, + /*II_V_66_0F_38_AD*/ {{0x1b2, 8819}, 0x6, 88, 0, 8833, 0}, + /*II_V_66_0F_38_AE*/ {{0x1b1, 8847}, 0x7, 91, 0, 8861, 0}, + /*II_V_66_0F_38_AF*/ {{0x1b2, 8875}, 0x6, 88, 0, 8889, 0}, + /*II_V_66_0F_38_B6*/ {{0x1b1, 8903}, 0x7, 91, 0, 8919, 0}, + /*II_V_66_0F_38_B7*/ {{0x1b1, 8935}, 0x7, 91, 0, 8951, 0}, + /*II_V_66_0F_38_B8*/ {{0x1b1, 8967}, 0x7, 91, 0, 8980, 0}, + /*II_V_66_0F_38_B9*/ {{0x1b2, 8993}, 0x6, 88, 0, 9006, 0}, + /*II_V_66_0F_38_BA*/ {{0x1b1, 9019}, 0x7, 91, 0, 9032, 0}, + /*II_V_66_0F_38_BB*/ {{0x1b2, 9045}, 0x6, 88, 0, 9058, 0}, + /*II_V_66_0F_38_BC*/ {{0x1b1, 9071}, 0x7, 91, 0, 9085, 0}, + /*II_V_66_0F_38_BD*/ {{0x1b2, 9099}, 0x6, 88, 0, 9113, 0}, + /*II_V_66_0F_38_BE*/ {{0x1b1, 9127}, 0x7, 91, 0, 9141, 0}, + /*II_V_66_0F_38_BF*/ {{0x1b2, 9155}, 0x6, 88, 0, 9169, 0}, + /*II_V_66_0F_38_DB*/ {{0x1b4, 9191}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_DC*/ {{0x1b5, 9208}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_DD*/ {{0x1b5, 9229}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_DE*/ {{0x1b5, 9250}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_DF*/ {{0x1b5, 9271}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_3A_04*/ {{0x1ba, 7592}, 0x41, 1, 0, 0, 0}, + /*II_V_66_0F_3A_05*/ {{0x1ba, 7603}, 0x41, 1, 0, 0, 0}, + /*II_V_66_0F_3A_06*/ {{0x1bb, 9298}, 0x10, 89, 1, 0, 0}, + /*II_66_0F_3A_08*/ {{0x1a2, 9310}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_08*/ {{0x1ba, 9319}, 0x41, 1, 0, 0, 0}, + /*II_66_0F_3A_09*/ {{0x1a2, 9329}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_09*/ {{0x1ba, 9338}, 0x41, 1, 0, 0, 0}, + /*II_66_0F_3A_0A*/ {{0x1bc, 9348}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0A*/ {{0x184, 9357}, 0x0, 85, 1, 0, 0}, + /*II_66_0F_3A_0B*/ {{0x1bd, 9367}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0B*/ {{0x184, 9376}, 0x0, 86, 1, 0, 0}, + /*II_66_0F_3A_0C*/ {{0x1a2, 9386}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0C*/ {{0x189, 9395}, 0x1, 91, 1, 0, 0}, + /*II_66_0F_3A_0D*/ {{0x1a2, 9405}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0D*/ {{0x189, 9414}, 0x1, 91, 1, 0, 0}, + /*II_66_0F_3A_0E*/ {{0x1a2, 9424}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0E*/ {{0x184, 9433}, 0x0, 87, 1, 0, 0}, + /*II_0F_3A_0F*/ {{0x1be, 9443}, 0x0, 1, 0, 0, 0}, + /*II_66_0F_3A_0F*/ {{0x1bf, 9443}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0F*/ {{0x184, 9452}, 0x0, 87, 1, 0, 0}, + /*II_66_0F_3A_14*/ {{0x1c0, 9462}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_14*/ {{0x1c1, 9470}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_15*/ {{0x1c2, 6344}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_15*/ {{0x1c3, 6352}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_16*/ {{0x1c4, 9479}, 0x0, 1, 0, 0, 9487}, + /*II_V_66_0F_3A_16*/ {{0x1c5, 9495}, 0x46, 1, 0, 9504, 0}, + /*II_66_0F_3A_17*/ {{0x1c6, 9513}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_17*/ {{0x1c7, 9524}, 0x40, 1, 0, 0, 0}, + /*II_V_66_0F_3A_18*/ {{0x1bb, 9536}, 0x10, 87, 1, 0, 0}, + /*II_V_66_0F_3A_19*/ {{0x1c8, 9549}, 0x50, 1, 0, 0, 0}, + /*II_66_0F_3A_20*/ {{0x1c9, 9563}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_20*/ {{0x184, 9571}, 0x0, 80, 1, 0, 0}, + /*II_66_0F_3A_21*/ {{0x1bc, 9580}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_21*/ {{0x184, 9590}, 0x0, 85, 1, 0, 0}, + /*II_66_0F_3A_22*/ {{0x1ca, 9601}, 0x0, 1, 0, 0, 9609}, + /*II_V_66_0F_3A_22*/ {{0x184, 9617}, 0x6, 73, 1, 9626, 0}, + /*II_66_0F_3A_40*/ {{0x1a2, 9635}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_40*/ {{0x189, 9641}, 0x1, 91, 1, 0, 0}, + /*II_66_0F_3A_41*/ {{0x1a2, 9648}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_41*/ {{0x184, 9654}, 0x0, 87, 1, 0, 0}, + /*II_66_0F_3A_42*/ {{0x1a2, 9661}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_42*/ {{0x184, 9670}, 0x0, 87, 1, 0, 0}, + /*II_66_0F_3A_44*/ {{0x1cb, 9680}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_44*/ {{0x1cc, 9691}, 0x0, 87, 1, 0, 0}, + /*II_V_66_0F_3A_4A*/ {{0x189, 9703}, 0x1, 91, 37, 0, 0}, + /*II_V_66_0F_3A_4B*/ {{0x189, 9714}, 0x1, 91, 37, 0, 0}, + /*II_V_66_0F_3A_4C*/ {{0x184, 9725}, 0x0, 87, 35, 0, 0}, + /*II_66_0F_3A_60*/ {{0x1cd, 9736}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_60*/ {{0x163, 9747}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_61*/ {{0x1cd, 9759}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_61*/ {{0x163, 9770}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_62*/ {{0x1cd, 9782}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_62*/ {{0x163, 9793}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_63*/ {{0x1cd, 9805}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_63*/ {{0x163, 9816}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_DF*/ {{0x1ce, 9828}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_DF*/ {{0x1cf, 9845}, 0x40, 1, 0, 0, 0}, + /*II_V_66_0F_71_02*/ {{0x1d2, 6476}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_71_04*/ {{0x1d2, 6735}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_71_06*/ {{0x1d2, 7049}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_72_02*/ {{0x1d2, 6491}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_72_04*/ {{0x1d2, 6750}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_72_06*/ {{0x1d2, 7064}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_73_02*/ {{0x1d2, 6506}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_73_03*/ {{0x1d2, 9871}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_73_06*/ {{0x1d2, 7079}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_73_07*/ {{0x1d2, 9888}, 0x0, 1, 0, 0, 0}, + /*II_0F_AE_00*/ {{0x173, 9897}, 0x0, 0, 0, 0, 9905}, + /*II_0F_AE_01*/ {{0x173, 9925}, 0x0, 0, 0, 0, 9934}, + /*II_V_0F_AE_02*/ {{0x1d5, 9974}, 0x40, 0, 0, 0, 0}, + /*II_V_0F_AE_03*/ {{0x1d5, 10003}, 0x40, 0, 0, 0, 0} }; _InstNode InstructionsTree[5688] = { @@ -1783,7 +1785,7 @@ _InstNode InstructionsTree[5688] = { /* c - _0C */ 0x200c, /* d - _0D */ 0x200d, /* e - _0E */ 0x200e, -/* f - _0F */ 0x8100, +/* f - _0F */ 0xa100, /* 10 - _10 */ 0x200f, /* 11 - _11 */ 0x2010, /* 12 - _12 */ 0x2011, @@ -1867,7 +1869,7 @@ _InstNode InstructionsTree[5688] = { /* 60 - _60 */ 0x205b, /* 61 - _61 */ 0x205c, /* 62 - _62 */ 0x205d, -/* 63 - _63 */ 0x205e, +/* 63 - _63 */ 0x605e, /* 64 - */ 0, /* 65 - */ 0, /* 66 - */ 0, @@ -1896,10 +1898,10 @@ _InstNode InstructionsTree[5688] = { /* 7d - _7D */ 0x2072, /* 7e - _7E */ 0x2073, /* 7f - _7F */ 0x2074, -/* 80 - _80 */ 0x6200, -/* 81 - _81 */ 0x6208, -/* 82 - _82 */ 0x6210, -/* 83 - _83 */ 0x6218, +/* 80 - _80 */ 0x8200, +/* 81 - _81 */ 0x8208, +/* 82 - _82 */ 0x8210, +/* 83 - _83 */ 0x8218, /* 84 - _84 */ 0x2075, /* 85 - _85 */ 0x2076, /* 86 - _86 */ 0x2077, @@ -1909,10 +1911,10 @@ _InstNode InstructionsTree[5688] = { /* 8a - _8A */ 0x207b, /* 8b - _8B */ 0x207c, /* 8c - _8C */ 0x207d, -/* 8d - _8D */ 0x207e, +/* 8d - _8D */ 0x607e, /* 8e - _8E */ 0x207f, -/* 8f - _8F */ 0x6220, -/* 90 - _90 */ 0x2080, +/* 8f - _8F */ 0x8220, +/* 90 - _90 */ 0x6080, /* 91 - _91 */ 0x2081, /* 92 - _92 */ 0x2082, /* 93 - _93 */ 0x2083, @@ -1960,14 +1962,14 @@ _InstNode InstructionsTree[5688] = { /* bd - _B8 */ 0x20aa, /* be - _B8 */ 0x20ab, /* bf - _B8 */ 0x20ac, -/* c0 - _C0 */ 0x6228, -/* c1 - _C1 */ 0x6230, +/* c0 - _C0 */ 0x8228, +/* c1 - _C1 */ 0x8230, /* c2 - _C2 */ 0x20ad, /* c3 - _C3 */ 0x20ae, /* c4 - _C4 */ 0x20af, /* c5 - _C5 */ 0x20b0, -/* c6 - _C6 */ 0xa238, -/* c7 - _C7 */ 0xa280, +/* c6 - _C6 */ 0xc238, +/* c7 - _C7 */ 0xc280, /* c8 - _C8 */ 0x20b1, /* c9 - _C9 */ 0x20b2, /* ca - _CA */ 0x20b3, @@ -1976,22 +1978,22 @@ _InstNode InstructionsTree[5688] = { /* cd - _CD */ 0x20b6, /* ce - _CE */ 0x20b7, /* cf - _CF */ 0x20b8, -/* d0 - _D0 */ 0x62c8, -/* d1 - _D1 */ 0x62d0, -/* d2 - _D2 */ 0x62d8, -/* d3 - _D3 */ 0x62e0, +/* d0 - _D0 */ 0x82c8, +/* d1 - _D1 */ 0x82d0, +/* d2 - _D2 */ 0x82d8, +/* d3 - _D3 */ 0x82e0, /* d4 - _D4 */ 0x20b9, /* d5 - _D5 */ 0x20ba, /* d6 - _D6 */ 0x20bb, /* d7 - _D7 */ 0x20bc, -/* d8 - _D8 */ 0xa2e8, -/* d9 - _D9 */ 0xa330, -/* da - _DA */ 0xa378, -/* db - _DB */ 0xa3c0, -/* dc - _DC */ 0xa408, -/* dd - _DD */ 0xa450, -/* de - _DE */ 0xa498, -/* df - _DF */ 0xa4e0, +/* d8 - _D8 */ 0xc2e8, +/* d9 - _D9 */ 0xc330, +/* da - _DA */ 0xc378, +/* db - _DB */ 0xc3c0, +/* dc - _DC */ 0xc408, +/* dd - _DD */ 0xc450, +/* de - _DE */ 0xc498, +/* df - _DF */ 0xc4e0, /* e0 - _E0 */ 0x20bd, /* e1 - _E1 */ 0x20be, /* e2 - _E2 */ 0x20bf, @@ -2014,18 +2016,18 @@ _InstNode InstructionsTree[5688] = { /* f3 - */ 0, /* f4 - _F4 */ 0x20cd, /* f5 - _F5 */ 0x20ce, -/* f6 - _F6 */ 0x6528, -/* f7 - _F7 */ 0x6530, +/* f6 - _F6 */ 0x8528, +/* f7 - _F7 */ 0x8530, /* f8 - _F8 */ 0x20cf, /* f9 - _F9 */ 0x20d0, /* fa - _FA */ 0x20d1, /* fb - _FB */ 0x20d2, /* fc - _FC */ 0x20d3, /* fd - _FD */ 0x20d4, -/* fe - _FE */ 0x6538, -/* ff - _FF */ 0x6540, -/* 100 - _0F_00 */ 0x6548, -/* 101 - _0F_01 */ 0xa550, +/* fe - _FE */ 0x8538, +/* ff - _FF */ 0x8540, +/* 100 - _0F_00 */ 0x8548, +/* 101 - _0F_01 */ 0xc550, /* 102 - _0F_02 */ 0x20d5, /* 103 - _0F_03 */ 0x20d6, /* 104 - */ 0, @@ -2037,18 +2039,18 @@ _InstNode InstructionsTree[5688] = { /* 10a - */ 0, /* 10b - _0F_0B */ 0x20dc, /* 10c - */ 0, -/* 10d - _0F_0D */ 0x6598, +/* 10d - _0F_0D */ 0x8598, /* 10e - _0F_0E */ 0x20dd, -/* 10f - _0F_0F */ 0x85a0, -/* 110 - _0F_10 */ 0xc6a0, -/* 111 - _0F_11 */ 0xc6ac, -/* 112 - _0F_12 */ 0xc6b8, -/* 113 - _0F_13 */ 0xc6c4, -/* 114 - _0F_14 */ 0xc6d0, -/* 115 - _0F_15 */ 0xc6dc, -/* 116 - _0F_16 */ 0xc6e8, -/* 117 - _0F_17 */ 0xc6f4, -/* 118 - _0F_18 */ 0x6700, +/* 10f - _0F_0F */ 0xa5a0, +/* 110 - _0F_10 */ 0xe6a0, +/* 111 - _0F_11 */ 0xe6ac, +/* 112 - _0F_12 */ 0xe6b8, +/* 113 - _0F_13 */ 0xe6c4, +/* 114 - _0F_14 */ 0xe6d0, +/* 115 - _0F_15 */ 0xe6dc, +/* 116 - _0F_16 */ 0xe6e8, +/* 117 - _0F_17 */ 0xe6f4, +/* 118 - _0F_18 */ 0x8700, /* 119 - */ 0, /* 11a - */ 0, /* 11b - */ 0, @@ -2064,14 +2066,14 @@ _InstNode InstructionsTree[5688] = { /* 125 - */ 0, /* 126 - */ 0, /* 127 - */ 0, -/* 128 - _0F_28 */ 0xc708, -/* 129 - _0F_29 */ 0xc714, -/* 12a - _0F_2A */ 0xc720, -/* 12b - _0F_2B */ 0xc72c, -/* 12c - _0F_2C */ 0xc738, -/* 12d - _0F_2D */ 0xc744, -/* 12e - _0F_2E */ 0xc750, -/* 12f - _0F_2F */ 0xc75c, +/* 128 - _0F_28 */ 0xe708, +/* 129 - _0F_29 */ 0xe714, +/* 12a - _0F_2A */ 0xe720, +/* 12b - _0F_2B */ 0xe72c, +/* 12c - _0F_2C */ 0xe738, +/* 12d - _0F_2D */ 0xe744, +/* 12e - _0F_2E */ 0xe750, +/* 12f - _0F_2F */ 0xe75c, /* 130 - _0F_30 */ 0x20e3, /* 131 - _0F_31 */ 0x20e4, /* 132 - _0F_32 */ 0x20e5, @@ -2080,9 +2082,9 @@ _InstNode InstructionsTree[5688] = { /* 135 - _0F_35 */ 0x20e8, /* 136 - */ 0, /* 137 - _0F_37 */ 0x20e9, -/* 138 - _0F_38 */ 0x8768, +/* 138 - _0F_38 */ 0xa768, /* 139 - */ 0, -/* 13a - _0F_3A */ 0x8868, +/* 13a - _0F_3A */ 0xa868, /* 13b - */ 0, /* 13c - */ 0, /* 13d - */ 0, @@ -2104,54 +2106,54 @@ _InstNode InstructionsTree[5688] = { /* 14d - _0F_4D */ 0x20f7, /* 14e - _0F_4E */ 0x20f8, /* 14f - _0F_4F */ 0x20f9, -/* 150 - _0F_50 */ 0xc968, -/* 151 - _0F_51 */ 0xc974, -/* 152 - _0F_52 */ 0xc980, -/* 153 - _0F_53 */ 0xc98c, -/* 154 - _0F_54 */ 0xc998, -/* 155 - _0F_55 */ 0xc9a4, -/* 156 - _0F_56 */ 0xc9b0, -/* 157 - _0F_57 */ 0xc9bc, -/* 158 - _0F_58 */ 0xc9c8, -/* 159 - _0F_59 */ 0xc9d4, -/* 15a - _0F_5A */ 0xc9e0, -/* 15b - _0F_5B */ 0xc9ec, -/* 15c - _0F_5C */ 0xc9f8, -/* 15d - _0F_5D */ 0xca04, -/* 15e - _0F_5E */ 0xca10, -/* 15f - _0F_5F */ 0xca1c, -/* 160 - _0F_60 */ 0xca28, -/* 161 - _0F_61 */ 0xca34, -/* 162 - _0F_62 */ 0xca40, -/* 163 - _0F_63 */ 0xca4c, -/* 164 - _0F_64 */ 0xca58, -/* 165 - _0F_65 */ 0xca64, -/* 166 - _0F_66 */ 0xca70, -/* 167 - _0F_67 */ 0xca7c, -/* 168 - _0F_68 */ 0xca88, -/* 169 - _0F_69 */ 0xca94, -/* 16a - _0F_6A */ 0xcaa0, -/* 16b - _0F_6B */ 0xcaac, -/* 16c - _0F_6C */ 0xcab8, -/* 16d - _0F_6D */ 0xcac4, -/* 16e - _0F_6E */ 0xcad0, -/* 16f - _0F_6F */ 0xcadc, -/* 170 - _0F_70 */ 0xcae8, -/* 171 - _0F_71 */ 0x6af4, -/* 172 - _0F_72 */ 0x6afc, -/* 173 - _0F_73 */ 0x6b04, -/* 174 - _0F_74 */ 0xcb0c, -/* 175 - _0F_75 */ 0xcb18, -/* 176 - _0F_76 */ 0xcb24, -/* 177 - _0F_77 */ 0xcb30, -/* 178 - _0F_78 */ 0xcb3c, -/* 179 - _0F_79 */ 0xcb48, -/* 17a - _0F_7A */ 0x8b54, +/* 150 - _0F_50 */ 0xe968, +/* 151 - _0F_51 */ 0xe974, +/* 152 - _0F_52 */ 0xe980, +/* 153 - _0F_53 */ 0xe98c, +/* 154 - _0F_54 */ 0xe998, +/* 155 - _0F_55 */ 0xe9a4, +/* 156 - _0F_56 */ 0xe9b0, +/* 157 - _0F_57 */ 0xe9bc, +/* 158 - _0F_58 */ 0xe9c8, +/* 159 - _0F_59 */ 0xe9d4, +/* 15a - _0F_5A */ 0xe9e0, +/* 15b - _0F_5B */ 0xe9ec, +/* 15c - _0F_5C */ 0xe9f8, +/* 15d - _0F_5D */ 0xea04, +/* 15e - _0F_5E */ 0xea10, +/* 15f - _0F_5F */ 0xea1c, +/* 160 - _0F_60 */ 0xea28, +/* 161 - _0F_61 */ 0xea34, +/* 162 - _0F_62 */ 0xea40, +/* 163 - _0F_63 */ 0xea4c, +/* 164 - _0F_64 */ 0xea58, +/* 165 - _0F_65 */ 0xea64, +/* 166 - _0F_66 */ 0xea70, +/* 167 - _0F_67 */ 0xea7c, +/* 168 - _0F_68 */ 0xea88, +/* 169 - _0F_69 */ 0xea94, +/* 16a - _0F_6A */ 0xeaa0, +/* 16b - _0F_6B */ 0xeaac, +/* 16c - _0F_6C */ 0xeab8, +/* 16d - _0F_6D */ 0xeac4, +/* 16e - _0F_6E */ 0xead0, +/* 16f - _0F_6F */ 0xeadc, +/* 170 - _0F_70 */ 0xeae8, +/* 171 - _0F_71 */ 0x8af4, +/* 172 - _0F_72 */ 0x8afc, +/* 173 - _0F_73 */ 0x8b04, +/* 174 - _0F_74 */ 0xeb0c, +/* 175 - _0F_75 */ 0xeb18, +/* 176 - _0F_76 */ 0xeb24, +/* 177 - _0F_77 */ 0xeb30, +/* 178 - _0F_78 */ 0xeb3c, +/* 179 - _0F_79 */ 0xeb48, +/* 17a - _0F_7A */ 0xab54, /* 17b - */ 0, -/* 17c - _0F_7C */ 0xcc54, -/* 17d - _0F_7D */ 0xcc60, -/* 17e - _0F_7E */ 0xcc6c, -/* 17f - _0F_7F */ 0xcc78, +/* 17c - _0F_7C */ 0xec54, +/* 17d - _0F_7D */ 0xec60, +/* 17e - _0F_7E */ 0xec6c, +/* 17f - _0F_7F */ 0xec78, /* 180 - _0F_80 */ 0x20fa, /* 181 - _0F_81 */ 0x20fb, /* 182 - _0F_82 */ 0x20fc, @@ -2198,7 +2200,7 @@ _InstNode InstructionsTree[5688] = { /* 1ab - _0F_AB */ 0x2121, /* 1ac - _0F_AC */ 0x4007, /* 1ad - _0F_AD */ 0x4008, -/* 1ae - _0F_AE */ 0x6c84, +/* 1ae - _0F_AE */ 0x8c84, /* 1af - _0F_AF */ 0x2122, /* 1b0 - _0F_B0 */ 0x2123, /* 1b1 - _0F_B1 */ 0x2124, @@ -2208,22 +2210,22 @@ _InstNode InstructionsTree[5688] = { /* 1b5 - _0F_B5 */ 0x2128, /* 1b6 - _0F_B6 */ 0x2129, /* 1b7 - _0F_B7 */ 0x212a, -/* 1b8 - _0F_B8 */ 0xcc8c, +/* 1b8 - _0F_B8 */ 0xec8c, /* 1b9 - _0F_B9 */ 0x212b, -/* 1ba - _0F_BA */ 0x6c98, +/* 1ba - _0F_BA */ 0x8c98, /* 1bb - _0F_BB */ 0x212c, -/* 1bc - _0F_BC */ 0xcca0, -/* 1bd - _0F_BD */ 0xccac, +/* 1bc - _0F_BC */ 0xeca0, +/* 1bd - _0F_BD */ 0xecac, /* 1be - _0F_BE */ 0x212d, /* 1bf - _0F_BF */ 0x212e, /* 1c0 - _0F_C0 */ 0x212f, /* 1c1 - _0F_C1 */ 0x2130, -/* 1c2 - _0F_C2 */ 0xccb8, +/* 1c2 - _0F_C2 */ 0xecb8, /* 1c3 - _0F_C3 */ 0x2131, -/* 1c4 - _0F_C4 */ 0xccc4, -/* 1c5 - _0F_C5 */ 0xccd0, -/* 1c6 - _0F_C6 */ 0xccdc, -/* 1c7 - _0F_C7 */ 0x6ce8, +/* 1c4 - _0F_C4 */ 0xecc4, +/* 1c5 - _0F_C5 */ 0xecd0, +/* 1c6 - _0F_C6 */ 0xecdc, +/* 1c7 - _0F_C7 */ 0x8ce8, /* 1c8 - _0F_C8 */ 0x2132, /* 1c9 - _0F_C8 */ 0x2133, /* 1ca - _0F_C8 */ 0x2134, @@ -2232,53 +2234,53 @@ _InstNode InstructionsTree[5688] = { /* 1cd - _0F_C8 */ 0x2137, /* 1ce - _0F_C8 */ 0x2138, /* 1cf - _0F_C8 */ 0x2139, -/* 1d0 - _0F_D0 */ 0xccf0, -/* 1d1 - _0F_D1 */ 0xccfc, -/* 1d2 - _0F_D2 */ 0xcd08, -/* 1d3 - _0F_D3 */ 0xcd14, -/* 1d4 - _0F_D4 */ 0xcd20, -/* 1d5 - _0F_D5 */ 0xcd2c, -/* 1d6 - _0F_D6 */ 0xcd38, -/* 1d7 - _0F_D7 */ 0xcd44, -/* 1d8 - _0F_D8 */ 0xcd50, -/* 1d9 - _0F_D9 */ 0xcd5c, -/* 1da - _0F_DA */ 0xcd68, -/* 1db - _0F_DB */ 0xcd74, -/* 1dc - _0F_DC */ 0xcd80, -/* 1dd - _0F_DD */ 0xcd8c, -/* 1de - _0F_DE */ 0xcd98, -/* 1df - _0F_DF */ 0xcda4, -/* 1e0 - _0F_E0 */ 0xcdb0, -/* 1e1 - _0F_E1 */ 0xcdbc, -/* 1e2 - _0F_E2 */ 0xcdc8, -/* 1e3 - _0F_E3 */ 0xcdd4, -/* 1e4 - _0F_E4 */ 0xcde0, -/* 1e5 - _0F_E5 */ 0xcdec, -/* 1e6 - _0F_E6 */ 0xcdf8, -/* 1e7 - _0F_E7 */ 0xce04, -/* 1e8 - _0F_E8 */ 0xce10, -/* 1e9 - _0F_E9 */ 0xce1c, -/* 1ea - _0F_EA */ 0xce28, -/* 1eb - _0F_EB */ 0xce34, -/* 1ec - _0F_EC */ 0xce40, -/* 1ed - _0F_ED */ 0xce4c, -/* 1ee - _0F_EE */ 0xce58, -/* 1ef - _0F_EF */ 0xce64, -/* 1f0 - _0F_F0 */ 0xce70, -/* 1f1 - _0F_F1 */ 0xce7c, -/* 1f2 - _0F_F2 */ 0xce88, -/* 1f3 - _0F_F3 */ 0xce94, -/* 1f4 - _0F_F4 */ 0xcea0, -/* 1f5 - _0F_F5 */ 0xceac, -/* 1f6 - _0F_F6 */ 0xceb8, -/* 1f7 - _0F_F7 */ 0xcec4, -/* 1f8 - _0F_F8 */ 0xced0, -/* 1f9 - _0F_F9 */ 0xcedc, -/* 1fa - _0F_FA */ 0xcee8, -/* 1fb - _0F_FB */ 0xcef4, -/* 1fc - _0F_FC */ 0xcf00, -/* 1fd - _0F_FD */ 0xcf0c, -/* 1fe - _0F_FE */ 0xcf18, +/* 1d0 - _0F_D0 */ 0xecf0, +/* 1d1 - _0F_D1 */ 0xecfc, +/* 1d2 - _0F_D2 */ 0xed08, +/* 1d3 - _0F_D3 */ 0xed14, +/* 1d4 - _0F_D4 */ 0xed20, +/* 1d5 - _0F_D5 */ 0xed2c, +/* 1d6 - _0F_D6 */ 0xed38, +/* 1d7 - _0F_D7 */ 0xed44, +/* 1d8 - _0F_D8 */ 0xed50, +/* 1d9 - _0F_D9 */ 0xed5c, +/* 1da - _0F_DA */ 0xed68, +/* 1db - _0F_DB */ 0xed74, +/* 1dc - _0F_DC */ 0xed80, +/* 1dd - _0F_DD */ 0xed8c, +/* 1de - _0F_DE */ 0xed98, +/* 1df - _0F_DF */ 0xeda4, +/* 1e0 - _0F_E0 */ 0xedb0, +/* 1e1 - _0F_E1 */ 0xedbc, +/* 1e2 - _0F_E2 */ 0xedc8, +/* 1e3 - _0F_E3 */ 0xedd4, +/* 1e4 - _0F_E4 */ 0xede0, +/* 1e5 - _0F_E5 */ 0xedec, +/* 1e6 - _0F_E6 */ 0xedf8, +/* 1e7 - _0F_E7 */ 0xee04, +/* 1e8 - _0F_E8 */ 0xee10, +/* 1e9 - _0F_E9 */ 0xee1c, +/* 1ea - _0F_EA */ 0xee28, +/* 1eb - _0F_EB */ 0xee34, +/* 1ec - _0F_EC */ 0xee40, +/* 1ed - _0F_ED */ 0xee4c, +/* 1ee - _0F_EE */ 0xee58, +/* 1ef - _0F_EF */ 0xee64, +/* 1f0 - _0F_F0 */ 0xee70, +/* 1f1 - _0F_F1 */ 0xee7c, +/* 1f2 - _0F_F2 */ 0xee88, +/* 1f3 - _0F_F3 */ 0xee94, +/* 1f4 - _0F_F4 */ 0xeea0, +/* 1f5 - _0F_F5 */ 0xeeac, +/* 1f6 - _0F_F6 */ 0xeeb8, +/* 1f7 - _0F_F7 */ 0xeec4, +/* 1f8 - _0F_F8 */ 0xeed0, +/* 1f9 - _0F_F9 */ 0xeedc, +/* 1fa - _0F_FA */ 0xeee8, +/* 1fb - _0F_FB */ 0xeef4, +/* 1fc - _0F_FC */ 0xef00, +/* 1fd - _0F_FD */ 0xef0c, +/* 1fe - _0F_FE */ 0xef18, /* 1ff - */ 0, /* 200 - _80_00 */ 0x213a, /* 201 - _80_01 */ 0x213b, @@ -2590,8 +2592,8 @@ _InstNode InstructionsTree[5688] = { /* 333 - _D9_03 */ 0x21d9, /* 334 - _D9_04 */ 0x21da, /* 335 - _D9_05 */ 0x21db, -/* 336 - _D9_06 */ 0xcf24, -/* 337 - _D9_07 */ 0xcf30, +/* 336 - _D9_06 */ 0xef24, +/* 337 - _D9_07 */ 0xef30, /* 338 - _D9_C0 */ 0x21dc, /* 339 - _D9_C0 */ 0x21dd, /* 33a - _D9_C0 */ 0x21de, @@ -2770,8 +2772,8 @@ _InstNode InstructionsTree[5688] = { /* 3e7 - _DB_D8 */ 0x2256, /* 3e8 - _DB_E0 */ 0x2257, /* 3e9 - _DB_E1 */ 0x2258, -/* 3ea - _DB_E2 */ 0xcf3c, -/* 3eb - _DB_E3 */ 0xcf48, +/* 3ea - _DB_E2 */ 0xef3c, +/* 3eb - _DB_E3 */ 0xef48, /* 3ec - _DB_E4 */ 0x2259, /* 3ed - */ 0, /* 3ee - */ 0, @@ -2878,8 +2880,8 @@ _InstNode InstructionsTree[5688] = { /* 453 - _DD_03 */ 0x22a5, /* 454 - _DD_04 */ 0x22a6, /* 455 - */ 0, -/* 456 - _DD_06 */ 0xcf54, -/* 457 - _DD_07 */ 0xcf60, +/* 456 - _DD_06 */ 0xef54, +/* 457 - _DD_07 */ 0xef60, /* 458 - _DD_C0 */ 0x22a7, /* 459 - _DD_C0 */ 0x22a8, /* 45a - _DD_C0 */ 0x22a9, @@ -3056,7 +3058,7 @@ _InstNode InstructionsTree[5688] = { /* 505 - */ 0, /* 506 - */ 0, /* 507 - */ 0, -/* 508 - _DF_E0 */ 0xcf6c, +/* 508 - _DF_E0 */ 0xef6c, /* 509 - */ 0, /* 50a - */ 0, /* 50b - */ 0, @@ -3146,28 +3148,28 @@ _InstNode InstructionsTree[5688] = { /* 55f - */ 0, /* 560 - _0F_01_C8 */ 0x2348, /* 561 - _0F_01_C9 */ 0x2349, -/* 562 - */ 0, -/* 563 - */ 0, +/* 562 - _0F_01_CA */ 0x234a, +/* 563 - _0F_01_CB */ 0x234b, /* 564 - */ 0, /* 565 - */ 0, /* 566 - */ 0, /* 567 - */ 0, -/* 568 - _0F_01_D0 */ 0x234a, -/* 569 - _0F_01_D1 */ 0x234b, +/* 568 - _0F_01_D0 */ 0x234c, +/* 569 - _0F_01_D1 */ 0x234d, /* 56a - */ 0, /* 56b - */ 0, -/* 56c - _0F_01_D4 */ 0x234c, -/* 56d - _0F_01_D5 */ 0x234d, +/* 56c - _0F_01_D4 */ 0x234e, +/* 56d - _0F_01_D5 */ 0x234f, /* 56e - */ 0, /* 56f - */ 0, -/* 570 - _0F_01_D8 */ 0x234e, -/* 571 - _0F_01_D9 */ 0x234f, -/* 572 - _0F_01_DA */ 0x2350, -/* 573 - _0F_01_DB */ 0x2351, -/* 574 - _0F_01_DC */ 0x2352, -/* 575 - _0F_01_DD */ 0x2353, -/* 576 - _0F_01_DE */ 0x2354, -/* 577 - _0F_01_DF */ 0x2355, +/* 570 - _0F_01_D8 */ 0x2350, +/* 571 - _0F_01_D9 */ 0x2351, +/* 572 - _0F_01_DA */ 0x2352, +/* 573 - _0F_01_DB */ 0x2353, +/* 574 - _0F_01_DC */ 0x2354, +/* 575 - _0F_01_DD */ 0x2355, +/* 576 - _0F_01_DE */ 0x2356, +/* 577 - _0F_01_DF */ 0x2357, /* 578 - */ 0, /* 579 - */ 0, /* 57a - */ 0, @@ -3192,16 +3194,16 @@ _InstNode InstructionsTree[5688] = { /* 58d - */ 0, /* 58e - */ 0, /* 58f - */ 0, -/* 590 - _0F_01_F8 */ 0x2356, -/* 591 - _0F_01_F9 */ 0x2357, +/* 590 - _0F_01_F8 */ 0x2358, +/* 591 - _0F_01_F9 */ 0x2359, /* 592 - */ 0, /* 593 - */ 0, /* 594 - */ 0, /* 595 - */ 0, /* 596 - */ 0, /* 597 - */ 0, -/* 598 - _0F_0D_00 */ 0x2358, -/* 599 - _0F_0D_01 */ 0x2359, +/* 598 - _0F_0D_00 */ 0x235a, +/* 599 - _0F_0D_01 */ 0x235b, /* 59a - */ 0, /* 59b - */ 0, /* 59c - */ 0, @@ -3220,8 +3222,8 @@ _InstNode InstructionsTree[5688] = { /* 5a9 - */ 0, /* 5aa - */ 0, /* 5ab - */ 0, -/* 5ac - _0F_0F_0C */ 0x235a, -/* 5ad - _0F_0F_0D */ 0x235b, +/* 5ac - _0F_0F_0C */ 0x235c, +/* 5ad - _0F_0F_0D */ 0x235d, /* 5ae - */ 0, /* 5af - */ 0, /* 5b0 - */ 0, @@ -3236,8 +3238,8 @@ _InstNode InstructionsTree[5688] = { /* 5b9 - */ 0, /* 5ba - */ 0, /* 5bb - */ 0, -/* 5bc - _0F_0F_1C */ 0x235c, -/* 5bd - _0F_0F_1D */ 0x235d, +/* 5bc - _0F_0F_1C */ 0x235e, +/* 5bd - _0F_0F_1D */ 0x235f, /* 5be - */ 0, /* 5bf - */ 0, /* 5c0 - */ 0, @@ -3346,60 +3348,60 @@ _InstNode InstructionsTree[5688] = { /* 627 - */ 0, /* 628 - */ 0, /* 629 - */ 0, -/* 62a - _0F_0F_8A */ 0x235e, +/* 62a - _0F_0F_8A */ 0x2360, /* 62b - */ 0, /* 62c - */ 0, /* 62d - */ 0, -/* 62e - _0F_0F_8E */ 0x235f, +/* 62e - _0F_0F_8E */ 0x2361, /* 62f - */ 0, -/* 630 - _0F_0F_90 */ 0x2360, +/* 630 - _0F_0F_90 */ 0x2362, /* 631 - */ 0, /* 632 - */ 0, /* 633 - */ 0, -/* 634 - _0F_0F_94 */ 0x2361, +/* 634 - _0F_0F_94 */ 0x2363, /* 635 - */ 0, -/* 636 - _0F_0F_96 */ 0x2362, -/* 637 - _0F_0F_97 */ 0x2363, +/* 636 - _0F_0F_96 */ 0x2364, +/* 637 - _0F_0F_97 */ 0x2365, /* 638 - */ 0, /* 639 - */ 0, -/* 63a - _0F_0F_9A */ 0x2364, +/* 63a - _0F_0F_9A */ 0x2366, /* 63b - */ 0, /* 63c - */ 0, /* 63d - */ 0, -/* 63e - _0F_0F_9E */ 0x2365, +/* 63e - _0F_0F_9E */ 0x2367, /* 63f - */ 0, -/* 640 - _0F_0F_A0 */ 0x2366, +/* 640 - _0F_0F_A0 */ 0x2368, /* 641 - */ 0, /* 642 - */ 0, /* 643 - */ 0, -/* 644 - _0F_0F_A4 */ 0x2367, +/* 644 - _0F_0F_A4 */ 0x2369, /* 645 - */ 0, -/* 646 - _0F_0F_A6 */ 0x2368, -/* 647 - _0F_0F_A7 */ 0x2369, +/* 646 - _0F_0F_A6 */ 0x236a, +/* 647 - _0F_0F_A7 */ 0x236b, /* 648 - */ 0, /* 649 - */ 0, -/* 64a - _0F_0F_AA */ 0x236a, +/* 64a - _0F_0F_AA */ 0x236c, /* 64b - */ 0, /* 64c - */ 0, /* 64d - */ 0, -/* 64e - _0F_0F_AE */ 0x236b, +/* 64e - _0F_0F_AE */ 0x236d, /* 64f - */ 0, -/* 650 - _0F_0F_B0 */ 0x236c, +/* 650 - _0F_0F_B0 */ 0x236e, /* 651 - */ 0, /* 652 - */ 0, /* 653 - */ 0, -/* 654 - _0F_0F_B4 */ 0x236d, +/* 654 - _0F_0F_B4 */ 0x236f, /* 655 - */ 0, -/* 656 - _0F_0F_B6 */ 0x236e, -/* 657 - _0F_0F_B7 */ 0x236f, +/* 656 - _0F_0F_B6 */ 0x2370, +/* 657 - _0F_0F_B7 */ 0x2371, /* 658 - */ 0, /* 659 - */ 0, /* 65a - */ 0, -/* 65b - _0F_0F_BB */ 0x2370, +/* 65b - _0F_0F_BB */ 0x2372, /* 65c - */ 0, /* 65d - */ 0, /* 65e - */ 0, -/* 65f - _0F_0F_BF */ 0x2371, +/* 65f - _0F_0F_BF */ 0x2373, /* 660 - */ 0, /* 661 - */ 0, /* 662 - */ 0, @@ -3464,10 +3466,10 @@ _InstNode InstructionsTree[5688] = { /* 69d - */ 0, /* 69e - */ 0, /* 69f - */ 0, -/* 6a0 - _0F_10 */ 0x2372, -/* 6a1 - _66_0F_10 */ 0x2373, -/* 6a2 - _F3_0F_10 */ 0x2374, -/* 6a3 - _F2_0F_10 */ 0x2375, +/* 6a0 - _0F_10 */ 0x2374, +/* 6a1 - _66_0F_10 */ 0x2375, +/* 6a2 - _F3_0F_10 */ 0x2376, +/* 6a3 - _F2_0F_10 */ 0x2377, /* 6a4 - _V_0F_10 */ 0x4009, /* 6a5 - _V_66_0F_10 */ 0x400a, /* 6a6 - _V_F3_0F_10 */ 0x400b, @@ -3476,10 +3478,10 @@ _InstNode InstructionsTree[5688] = { /* 6a9 - */ 0, /* 6aa - _VRR_F3_0F_10 */ 0x400d, /* 6ab - _VRR_F2_0F_10 */ 0x400e, -/* 6ac - _0F_11 */ 0x2376, -/* 6ad - _66_0F_11 */ 0x2377, -/* 6ae - _F3_0F_11 */ 0x2378, -/* 6af - _F2_0F_11 */ 0x2379, +/* 6ac - _0F_11 */ 0x2378, +/* 6ad - _66_0F_11 */ 0x2379, +/* 6ae - _F3_0F_11 */ 0x237a, +/* 6af - _F2_0F_11 */ 0x237b, /* 6b0 - _V_0F_11 */ 0x400f, /* 6b1 - _V_66_0F_11 */ 0x4010, /* 6b2 - _V_F3_0F_11 */ 0x4011, @@ -3489,9 +3491,9 @@ _InstNode InstructionsTree[5688] = { /* 6b6 - _VRR_F3_0F_11 */ 0x4013, /* 6b7 - _VRR_F2_0F_11 */ 0x4014, /* 6b8 - _0F_12 */ 0x4015, -/* 6b9 - _66_0F_12 */ 0x237a, -/* 6ba - _F3_0F_12 */ 0x237b, -/* 6bb - _F2_0F_12 */ 0x237c, +/* 6b9 - _66_0F_12 */ 0x237c, +/* 6ba - _F3_0F_12 */ 0x237d, +/* 6bb - _F2_0F_12 */ 0x237e, /* 6bc - _V_0F_12 */ 0x4016, /* 6bd - _V_66_0F_12 */ 0x4017, /* 6be - _V_F3_0F_12 */ 0x4018, @@ -3500,8 +3502,8 @@ _InstNode InstructionsTree[5688] = { /* 6c1 - */ 0, /* 6c2 - */ 0, /* 6c3 - */ 0, -/* 6c4 - _0F_13 */ 0x237d, -/* 6c5 - _66_0F_13 */ 0x237e, +/* 6c4 - _0F_13 */ 0x237f, +/* 6c5 - _66_0F_13 */ 0x2380, /* 6c6 - */ 0, /* 6c7 - */ 0, /* 6c8 - _V_0F_13 */ 0x401a, @@ -3512,8 +3514,8 @@ _InstNode InstructionsTree[5688] = { /* 6cd - */ 0, /* 6ce - */ 0, /* 6cf - */ 0, -/* 6d0 - _0F_14 */ 0x237f, -/* 6d1 - _66_0F_14 */ 0x2380, +/* 6d0 - _0F_14 */ 0x2381, +/* 6d1 - _66_0F_14 */ 0x2382, /* 6d2 - */ 0, /* 6d3 - */ 0, /* 6d4 - _V_0F_14 */ 0x401c, @@ -3524,8 +3526,8 @@ _InstNode InstructionsTree[5688] = { /* 6d9 - */ 0, /* 6da - */ 0, /* 6db - */ 0, -/* 6dc - _0F_15 */ 0x2381, -/* 6dd - _66_0F_15 */ 0x2382, +/* 6dc - _0F_15 */ 0x2383, +/* 6dd - _66_0F_15 */ 0x2384, /* 6de - */ 0, /* 6df - */ 0, /* 6e0 - _V_0F_15 */ 0x401e, @@ -3537,8 +3539,8 @@ _InstNode InstructionsTree[5688] = { /* 6e6 - */ 0, /* 6e7 - */ 0, /* 6e8 - _0F_16 */ 0x4020, -/* 6e9 - _66_0F_16 */ 0x2383, -/* 6ea - _F3_0F_16 */ 0x2384, +/* 6e9 - _66_0F_16 */ 0x2385, +/* 6ea - _F3_0F_16 */ 0x2386, /* 6eb - */ 0, /* 6ec - _V_0F_16 */ 0x4021, /* 6ed - _V_66_0F_16 */ 0x4022, @@ -3548,8 +3550,8 @@ _InstNode InstructionsTree[5688] = { /* 6f1 - */ 0, /* 6f2 - */ 0, /* 6f3 - */ 0, -/* 6f4 - _0F_17 */ 0x2385, -/* 6f5 - _66_0F_17 */ 0x2386, +/* 6f4 - _0F_17 */ 0x2387, +/* 6f5 - _66_0F_17 */ 0x2388, /* 6f6 - */ 0, /* 6f7 - */ 0, /* 6f8 - _V_0F_17 */ 0x4024, @@ -3560,16 +3562,16 @@ _InstNode InstructionsTree[5688] = { /* 6fd - */ 0, /* 6fe - */ 0, /* 6ff - */ 0, -/* 700 - _0F_18_00 */ 0x2387, -/* 701 - _0F_18_01 */ 0x2388, -/* 702 - _0F_18_02 */ 0x2389, -/* 703 - _0F_18_03 */ 0x238a, +/* 700 - _0F_18_00 */ 0x2389, +/* 701 - _0F_18_01 */ 0x238a, +/* 702 - _0F_18_02 */ 0x238b, +/* 703 - _0F_18_03 */ 0x238c, /* 704 - */ 0, /* 705 - */ 0, /* 706 - */ 0, /* 707 - */ 0, -/* 708 - _0F_28 */ 0x238b, -/* 709 - _66_0F_28 */ 0x238c, +/* 708 - _0F_28 */ 0x238d, +/* 709 - _66_0F_28 */ 0x238e, /* 70a - */ 0, /* 70b - */ 0, /* 70c - _V_0F_28 */ 0x4026, @@ -3580,8 +3582,8 @@ _InstNode InstructionsTree[5688] = { /* 711 - */ 0, /* 712 - */ 0, /* 713 - */ 0, -/* 714 - _0F_29 */ 0x238d, -/* 715 - _66_0F_29 */ 0x238e, +/* 714 - _0F_29 */ 0x238f, +/* 715 - _66_0F_29 */ 0x2390, /* 716 - */ 0, /* 717 - */ 0, /* 718 - _V_0F_29 */ 0x4028, @@ -3592,10 +3594,10 @@ _InstNode InstructionsTree[5688] = { /* 71d - */ 0, /* 71e - */ 0, /* 71f - */ 0, -/* 720 - _0F_2A */ 0x238f, -/* 721 - _66_0F_2A */ 0x2390, -/* 722 - _F3_0F_2A */ 0x2391, -/* 723 - _F2_0F_2A */ 0x2392, +/* 720 - _0F_2A */ 0x2391, +/* 721 - _66_0F_2A */ 0x2392, +/* 722 - _F3_0F_2A */ 0x2393, +/* 723 - _F2_0F_2A */ 0x2394, /* 724 - */ 0, /* 725 - */ 0, /* 726 - _V_F3_0F_2A */ 0x402a, @@ -3604,10 +3606,10 @@ _InstNode InstructionsTree[5688] = { /* 729 - */ 0, /* 72a - */ 0, /* 72b - */ 0, -/* 72c - _0F_2B */ 0x2393, -/* 72d - _66_0F_2B */ 0x2394, -/* 72e - _F3_0F_2B */ 0x2395, -/* 72f - _F2_0F_2B */ 0x2396, +/* 72c - _0F_2B */ 0x2395, +/* 72d - _66_0F_2B */ 0x2396, +/* 72e - _F3_0F_2B */ 0x2397, +/* 72f - _F2_0F_2B */ 0x2398, /* 730 - _V_0F_2B */ 0x402c, /* 731 - _V_66_0F_2B */ 0x402d, /* 732 - */ 0, @@ -3616,10 +3618,10 @@ _InstNode InstructionsTree[5688] = { /* 735 - */ 0, /* 736 - */ 0, /* 737 - */ 0, -/* 738 - _0F_2C */ 0x2397, -/* 739 - _66_0F_2C */ 0x2398, -/* 73a - _F3_0F_2C */ 0x2399, -/* 73b - _F2_0F_2C */ 0x239a, +/* 738 - _0F_2C */ 0x2399, +/* 739 - _66_0F_2C */ 0x239a, +/* 73a - _F3_0F_2C */ 0x239b, +/* 73b - _F2_0F_2C */ 0x239c, /* 73c - */ 0, /* 73d - */ 0, /* 73e - _V_F3_0F_2C */ 0x402e, @@ -3628,10 +3630,10 @@ _InstNode InstructionsTree[5688] = { /* 741 - */ 0, /* 742 - */ 0, /* 743 - */ 0, -/* 744 - _0F_2D */ 0x239b, -/* 745 - _66_0F_2D */ 0x239c, -/* 746 - _F3_0F_2D */ 0x239d, -/* 747 - _F2_0F_2D */ 0x239e, +/* 744 - _0F_2D */ 0x239d, +/* 745 - _66_0F_2D */ 0x239e, +/* 746 - _F3_0F_2D */ 0x239f, +/* 747 - _F2_0F_2D */ 0x23a0, /* 748 - */ 0, /* 749 - */ 0, /* 74a - _V_F3_0F_2D */ 0x4030, @@ -3640,8 +3642,8 @@ _InstNode InstructionsTree[5688] = { /* 74d - */ 0, /* 74e - */ 0, /* 74f - */ 0, -/* 750 - _0F_2E */ 0x239f, -/* 751 - _66_0F_2E */ 0x23a0, +/* 750 - _0F_2E */ 0x23a1, +/* 751 - _66_0F_2E */ 0x23a2, /* 752 - */ 0, /* 753 - */ 0, /* 754 - _V_0F_2E */ 0x4032, @@ -3652,8 +3654,8 @@ _InstNode InstructionsTree[5688] = { /* 759 - */ 0, /* 75a - */ 0, /* 75b - */ 0, -/* 75c - _0F_2F */ 0x23a1, -/* 75d - _66_0F_2F */ 0x23a2, +/* 75c - _0F_2F */ 0x23a3, +/* 75d - _66_0F_2F */ 0x23a4, /* 75e - */ 0, /* 75f - */ 0, /* 760 - _V_0F_2F */ 0x4034, @@ -3664,72 +3666,72 @@ _InstNode InstructionsTree[5688] = { /* 765 - */ 0, /* 766 - */ 0, /* 767 - */ 0, -/* 768 - _0F_38_00 */ 0xcf78, -/* 769 - _0F_38_01 */ 0xcf84, -/* 76a - _0F_38_02 */ 0xcf90, -/* 76b - _0F_38_03 */ 0xcf9c, -/* 76c - _0F_38_04 */ 0xcfa8, -/* 76d - _0F_38_05 */ 0xcfb4, -/* 76e - _0F_38_06 */ 0xcfc0, -/* 76f - _0F_38_07 */ 0xcfcc, -/* 770 - _0F_38_08 */ 0xcfd8, -/* 771 - _0F_38_09 */ 0xcfe4, -/* 772 - _0F_38_0A */ 0xcff0, -/* 773 - _0F_38_0B */ 0xcffc, -/* 774 - _0F_38_0C */ 0xd008, -/* 775 - _0F_38_0D */ 0xd014, -/* 776 - _0F_38_0E */ 0xd020, -/* 777 - _0F_38_0F */ 0xd02c, -/* 778 - _0F_38_10 */ 0xd038, +/* 768 - _0F_38_00 */ 0xef78, +/* 769 - _0F_38_01 */ 0xef84, +/* 76a - _0F_38_02 */ 0xef90, +/* 76b - _0F_38_03 */ 0xef9c, +/* 76c - _0F_38_04 */ 0xefa8, +/* 76d - _0F_38_05 */ 0xefb4, +/* 76e - _0F_38_06 */ 0xefc0, +/* 76f - _0F_38_07 */ 0xefcc, +/* 770 - _0F_38_08 */ 0xefd8, +/* 771 - _0F_38_09 */ 0xefe4, +/* 772 - _0F_38_0A */ 0xeff0, +/* 773 - _0F_38_0B */ 0xeffc, +/* 774 - _0F_38_0C */ 0xf008, +/* 775 - _0F_38_0D */ 0xf014, +/* 776 - _0F_38_0E */ 0xf020, +/* 777 - _0F_38_0F */ 0xf02c, +/* 778 - _0F_38_10 */ 0xf038, /* 779 - */ 0, /* 77a - */ 0, /* 77b - */ 0, -/* 77c - _0F_38_14 */ 0xd044, -/* 77d - _0F_38_15 */ 0xd050, +/* 77c - _0F_38_14 */ 0xf044, +/* 77d - _0F_38_15 */ 0xf050, /* 77e - */ 0, -/* 77f - _0F_38_17 */ 0xd05c, -/* 780 - _0F_38_18 */ 0xd068, -/* 781 - _0F_38_19 */ 0xd074, -/* 782 - _0F_38_1A */ 0xd080, +/* 77f - _0F_38_17 */ 0xf05c, +/* 780 - _0F_38_18 */ 0xf068, +/* 781 - _0F_38_19 */ 0xf074, +/* 782 - _0F_38_1A */ 0xf080, /* 783 - */ 0, -/* 784 - _0F_38_1C */ 0xd08c, -/* 785 - _0F_38_1D */ 0xd098, -/* 786 - _0F_38_1E */ 0xd0a4, +/* 784 - _0F_38_1C */ 0xf08c, +/* 785 - _0F_38_1D */ 0xf098, +/* 786 - _0F_38_1E */ 0xf0a4, /* 787 - */ 0, -/* 788 - _0F_38_20 */ 0xd0b0, -/* 789 - _0F_38_21 */ 0xd0bc, -/* 78a - _0F_38_22 */ 0xd0c8, -/* 78b - _0F_38_23 */ 0xd0d4, -/* 78c - _0F_38_24 */ 0xd0e0, -/* 78d - _0F_38_25 */ 0xd0ec, +/* 788 - _0F_38_20 */ 0xf0b0, +/* 789 - _0F_38_21 */ 0xf0bc, +/* 78a - _0F_38_22 */ 0xf0c8, +/* 78b - _0F_38_23 */ 0xf0d4, +/* 78c - _0F_38_24 */ 0xf0e0, +/* 78d - _0F_38_25 */ 0xf0ec, /* 78e - */ 0, /* 78f - */ 0, -/* 790 - _0F_38_28 */ 0xd0f8, -/* 791 - _0F_38_29 */ 0xd104, -/* 792 - _0F_38_2A */ 0xd110, -/* 793 - _0F_38_2B */ 0xd11c, -/* 794 - _0F_38_2C */ 0xd128, -/* 795 - _0F_38_2D */ 0xd134, -/* 796 - _0F_38_2E */ 0xd140, -/* 797 - _0F_38_2F */ 0xd14c, -/* 798 - _0F_38_30 */ 0xd158, -/* 799 - _0F_38_31 */ 0xd164, -/* 79a - _0F_38_32 */ 0xd170, -/* 79b - _0F_38_33 */ 0xd17c, -/* 79c - _0F_38_34 */ 0xd188, -/* 79d - _0F_38_35 */ 0xd194, +/* 790 - _0F_38_28 */ 0xf0f8, +/* 791 - _0F_38_29 */ 0xf104, +/* 792 - _0F_38_2A */ 0xf110, +/* 793 - _0F_38_2B */ 0xf11c, +/* 794 - _0F_38_2C */ 0xf128, +/* 795 - _0F_38_2D */ 0xf134, +/* 796 - _0F_38_2E */ 0xf140, +/* 797 - _0F_38_2F */ 0xf14c, +/* 798 - _0F_38_30 */ 0xf158, +/* 799 - _0F_38_31 */ 0xf164, +/* 79a - _0F_38_32 */ 0xf170, +/* 79b - _0F_38_33 */ 0xf17c, +/* 79c - _0F_38_34 */ 0xf188, +/* 79d - _0F_38_35 */ 0xf194, /* 79e - */ 0, -/* 79f - _0F_38_37 */ 0xd1a0, -/* 7a0 - _0F_38_38 */ 0xd1ac, -/* 7a1 - _0F_38_39 */ 0xd1b8, -/* 7a2 - _0F_38_3A */ 0xd1c4, -/* 7a3 - _0F_38_3B */ 0xd1d0, -/* 7a4 - _0F_38_3C */ 0xd1dc, -/* 7a5 - _0F_38_3D */ 0xd1e8, -/* 7a6 - _0F_38_3E */ 0xd1f4, -/* 7a7 - _0F_38_3F */ 0xd200, -/* 7a8 - _0F_38_40 */ 0xd20c, -/* 7a9 - _0F_38_41 */ 0xd218, +/* 79f - _0F_38_37 */ 0xf1a0, +/* 7a0 - _0F_38_38 */ 0xf1ac, +/* 7a1 - _0F_38_39 */ 0xf1b8, +/* 7a2 - _0F_38_3A */ 0xf1c4, +/* 7a3 - _0F_38_3B */ 0xf1d0, +/* 7a4 - _0F_38_3C */ 0xf1dc, +/* 7a5 - _0F_38_3D */ 0xf1e8, +/* 7a6 - _0F_38_3E */ 0xf1f4, +/* 7a7 - _0F_38_3F */ 0xf200, +/* 7a8 - _0F_38_40 */ 0xf20c, +/* 7a9 - _0F_38_41 */ 0xf218, /* 7aa - */ 0, /* 7ab - */ 0, /* 7ac - */ 0, @@ -3792,9 +3794,9 @@ _InstNode InstructionsTree[5688] = { /* 7e5 - */ 0, /* 7e6 - */ 0, /* 7e7 - */ 0, -/* 7e8 - _0F_38_80 */ 0xd224, -/* 7e9 - _0F_38_81 */ 0xd230, -/* 7ea - _0F_38_82 */ 0xd23c, +/* 7e8 - _0F_38_80 */ 0xf224, +/* 7e9 - _0F_38_81 */ 0xf230, +/* 7ea - _0F_38_82 */ 0xf23c, /* 7eb - */ 0, /* 7ec - */ 0, /* 7ed - */ 0, @@ -3814,48 +3816,48 @@ _InstNode InstructionsTree[5688] = { /* 7fb - */ 0, /* 7fc - */ 0, /* 7fd - */ 0, -/* 7fe - _0F_38_96 */ 0xd248, -/* 7ff - _0F_38_97 */ 0xd254, -/* 800 - _0F_38_98 */ 0xd260, -/* 801 - _0F_38_99 */ 0xd26c, -/* 802 - _0F_38_9A */ 0xd278, -/* 803 - _0F_38_9B */ 0xd284, -/* 804 - _0F_38_9C */ 0xd290, -/* 805 - _0F_38_9D */ 0xd29c, -/* 806 - _0F_38_9E */ 0xd2a8, -/* 807 - _0F_38_9F */ 0xd2b4, +/* 7fe - _0F_38_96 */ 0xf248, +/* 7ff - _0F_38_97 */ 0xf254, +/* 800 - _0F_38_98 */ 0xf260, +/* 801 - _0F_38_99 */ 0xf26c, +/* 802 - _0F_38_9A */ 0xf278, +/* 803 - _0F_38_9B */ 0xf284, +/* 804 - _0F_38_9C */ 0xf290, +/* 805 - _0F_38_9D */ 0xf29c, +/* 806 - _0F_38_9E */ 0xf2a8, +/* 807 - _0F_38_9F */ 0xf2b4, /* 808 - */ 0, /* 809 - */ 0, /* 80a - */ 0, /* 80b - */ 0, /* 80c - */ 0, /* 80d - */ 0, -/* 80e - _0F_38_A6 */ 0xd2c0, -/* 80f - _0F_38_A7 */ 0xd2cc, -/* 810 - _0F_38_A8 */ 0xd2d8, -/* 811 - _0F_38_A9 */ 0xd2e4, -/* 812 - _0F_38_AA */ 0xd2f0, -/* 813 - _0F_38_AB */ 0xd2fc, -/* 814 - _0F_38_AC */ 0xd308, -/* 815 - _0F_38_AD */ 0xd314, -/* 816 - _0F_38_AE */ 0xd320, -/* 817 - _0F_38_AF */ 0xd32c, +/* 80e - _0F_38_A6 */ 0xf2c0, +/* 80f - _0F_38_A7 */ 0xf2cc, +/* 810 - _0F_38_A8 */ 0xf2d8, +/* 811 - _0F_38_A9 */ 0xf2e4, +/* 812 - _0F_38_AA */ 0xf2f0, +/* 813 - _0F_38_AB */ 0xf2fc, +/* 814 - _0F_38_AC */ 0xf308, +/* 815 - _0F_38_AD */ 0xf314, +/* 816 - _0F_38_AE */ 0xf320, +/* 817 - _0F_38_AF */ 0xf32c, /* 818 - */ 0, /* 819 - */ 0, /* 81a - */ 0, /* 81b - */ 0, /* 81c - */ 0, /* 81d - */ 0, -/* 81e - _0F_38_B6 */ 0xd338, -/* 81f - _0F_38_B7 */ 0xd344, -/* 820 - _0F_38_B8 */ 0xd350, -/* 821 - _0F_38_B9 */ 0xd35c, -/* 822 - _0F_38_BA */ 0xd368, -/* 823 - _0F_38_BB */ 0xd374, -/* 824 - _0F_38_BC */ 0xd380, -/* 825 - _0F_38_BD */ 0xd38c, -/* 826 - _0F_38_BE */ 0xd398, -/* 827 - _0F_38_BF */ 0xd3a4, +/* 81e - _0F_38_B6 */ 0xf338, +/* 81f - _0F_38_B7 */ 0xf344, +/* 820 - _0F_38_B8 */ 0xf350, +/* 821 - _0F_38_B9 */ 0xf35c, +/* 822 - _0F_38_BA */ 0xf368, +/* 823 - _0F_38_BB */ 0xf374, +/* 824 - _0F_38_BC */ 0xf380, +/* 825 - _0F_38_BD */ 0xf38c, +/* 826 - _0F_38_BE */ 0xf398, +/* 827 - _0F_38_BF */ 0xf3a4, /* 828 - */ 0, /* 829 - */ 0, /* 82a - */ 0, @@ -3883,11 +3885,11 @@ _InstNode InstructionsTree[5688] = { /* 840 - */ 0, /* 841 - */ 0, /* 842 - */ 0, -/* 843 - _0F_38_DB */ 0xd3b0, -/* 844 - _0F_38_DC */ 0xd3bc, -/* 845 - _0F_38_DD */ 0xd3c8, -/* 846 - _0F_38_DE */ 0xd3d4, -/* 847 - _0F_38_DF */ 0xd3e0, +/* 843 - _0F_38_DB */ 0xf3b0, +/* 844 - _0F_38_DC */ 0xf3bc, +/* 845 - _0F_38_DD */ 0xf3c8, +/* 846 - _0F_38_DE */ 0xf3d4, +/* 847 - _0F_38_DF */ 0xf3e0, /* 848 - */ 0, /* 849 - */ 0, /* 84a - */ 0, @@ -3904,8 +3906,8 @@ _InstNode InstructionsTree[5688] = { /* 855 - */ 0, /* 856 - */ 0, /* 857 - */ 0, -/* 858 - _0F_38_F0 */ 0xd3ec, -/* 859 - _0F_38_F1 */ 0xd3f8, +/* 858 - _0F_38_F0 */ 0xf3ec, +/* 859 - _0F_38_F1 */ 0xf3f8, /* 85a - */ 0, /* 85b - */ 0, /* 85c - */ 0, @@ -3924,37 +3926,37 @@ _InstNode InstructionsTree[5688] = { /* 869 - */ 0, /* 86a - */ 0, /* 86b - */ 0, -/* 86c - _0F_3A_04 */ 0xd404, -/* 86d - _0F_3A_05 */ 0xd410, -/* 86e - _0F_3A_06 */ 0xd41c, +/* 86c - _0F_3A_04 */ 0xf404, +/* 86d - _0F_3A_05 */ 0xf410, +/* 86e - _0F_3A_06 */ 0xf41c, /* 86f - */ 0, -/* 870 - _0F_3A_08 */ 0xd428, -/* 871 - _0F_3A_09 */ 0xd434, -/* 872 - _0F_3A_0A */ 0xd440, -/* 873 - _0F_3A_0B */ 0xd44c, -/* 874 - _0F_3A_0C */ 0xd458, -/* 875 - _0F_3A_0D */ 0xd464, -/* 876 - _0F_3A_0E */ 0xd470, -/* 877 - _0F_3A_0F */ 0xd47c, +/* 870 - _0F_3A_08 */ 0xf428, +/* 871 - _0F_3A_09 */ 0xf434, +/* 872 - _0F_3A_0A */ 0xf440, +/* 873 - _0F_3A_0B */ 0xf44c, +/* 874 - _0F_3A_0C */ 0xf458, +/* 875 - _0F_3A_0D */ 0xf464, +/* 876 - _0F_3A_0E */ 0xf470, +/* 877 - _0F_3A_0F */ 0xf47c, /* 878 - */ 0, /* 879 - */ 0, /* 87a - */ 0, /* 87b - */ 0, -/* 87c - _0F_3A_14 */ 0xd488, -/* 87d - _0F_3A_15 */ 0xd494, -/* 87e - _0F_3A_16 */ 0xd4a0, -/* 87f - _0F_3A_17 */ 0xd4ac, -/* 880 - _0F_3A_18 */ 0xd4b8, -/* 881 - _0F_3A_19 */ 0xd4c4, +/* 87c - _0F_3A_14 */ 0xf488, +/* 87d - _0F_3A_15 */ 0xf494, +/* 87e - _0F_3A_16 */ 0xf4a0, +/* 87f - _0F_3A_17 */ 0xf4ac, +/* 880 - _0F_3A_18 */ 0xf4b8, +/* 881 - _0F_3A_19 */ 0xf4c4, /* 882 - */ 0, /* 883 - */ 0, /* 884 - */ 0, /* 885 - */ 0, /* 886 - */ 0, /* 887 - */ 0, -/* 888 - _0F_3A_20 */ 0xd4d0, -/* 889 - _0F_3A_21 */ 0xd4dc, -/* 88a - _0F_3A_22 */ 0xd4e8, +/* 888 - _0F_3A_20 */ 0xf4d0, +/* 889 - _0F_3A_21 */ 0xf4dc, +/* 88a - _0F_3A_22 */ 0xf4e8, /* 88b - */ 0, /* 88c - */ 0, /* 88d - */ 0, @@ -3984,19 +3986,19 @@ _InstNode InstructionsTree[5688] = { /* 8a5 - */ 0, /* 8a6 - */ 0, /* 8a7 - */ 0, -/* 8a8 - _0F_3A_40 */ 0xd4f4, -/* 8a9 - _0F_3A_41 */ 0xd500, -/* 8aa - _0F_3A_42 */ 0xd50c, +/* 8a8 - _0F_3A_40 */ 0xf4f4, +/* 8a9 - _0F_3A_41 */ 0xf500, +/* 8aa - _0F_3A_42 */ 0xf50c, /* 8ab - */ 0, -/* 8ac - _0F_3A_44 */ 0xd518, +/* 8ac - _0F_3A_44 */ 0xf518, /* 8ad - */ 0, /* 8ae - */ 0, /* 8af - */ 0, /* 8b0 - */ 0, /* 8b1 - */ 0, -/* 8b2 - _0F_3A_4A */ 0xd524, -/* 8b3 - _0F_3A_4B */ 0xd530, -/* 8b4 - _0F_3A_4C */ 0xd53c, +/* 8b2 - _0F_3A_4A */ 0xf524, +/* 8b3 - _0F_3A_4B */ 0xf530, +/* 8b4 - _0F_3A_4C */ 0xf53c, /* 8b5 - */ 0, /* 8b6 - */ 0, /* 8b7 - */ 0, @@ -4016,10 +4018,10 @@ _InstNode InstructionsTree[5688] = { /* 8c5 - */ 0, /* 8c6 - */ 0, /* 8c7 - */ 0, -/* 8c8 - _0F_3A_60 */ 0xd548, -/* 8c9 - _0F_3A_61 */ 0xd554, -/* 8ca - _0F_3A_62 */ 0xd560, -/* 8cb - _0F_3A_63 */ 0xd56c, +/* 8c8 - _0F_3A_60 */ 0xf548, +/* 8c9 - _0F_3A_61 */ 0xf554, +/* 8ca - _0F_3A_62 */ 0xf560, +/* 8cb - _0F_3A_63 */ 0xf56c, /* 8cc - */ 0, /* 8cd - */ 0, /* 8ce - */ 0, @@ -4143,7 +4145,7 @@ _InstNode InstructionsTree[5688] = { /* 944 - */ 0, /* 945 - */ 0, /* 946 - */ 0, -/* 947 - _0F_3A_DF */ 0xd578, +/* 947 - _0F_3A_DF */ 0xf578, /* 948 - */ 0, /* 949 - */ 0, /* 94a - */ 0, @@ -4176,8 +4178,8 @@ _InstNode InstructionsTree[5688] = { /* 965 - */ 0, /* 966 - */ 0, /* 967 - */ 0, -/* 968 - _0F_50 */ 0x23a3, -/* 969 - _66_0F_50 */ 0x23a4, +/* 968 - _0F_50 */ 0x23a5, +/* 969 - _66_0F_50 */ 0x23a6, /* 96a - */ 0, /* 96b - */ 0, /* 96c - _V_0F_50 */ 0x4036, @@ -4188,10 +4190,10 @@ _InstNode InstructionsTree[5688] = { /* 971 - */ 0, /* 972 - */ 0, /* 973 - */ 0, -/* 974 - _0F_51 */ 0x23a5, -/* 975 - _66_0F_51 */ 0x23a6, -/* 976 - _F3_0F_51 */ 0x23a7, -/* 977 - _F2_0F_51 */ 0x23a8, +/* 974 - _0F_51 */ 0x23a7, +/* 975 - _66_0F_51 */ 0x23a8, +/* 976 - _F3_0F_51 */ 0x23a9, +/* 977 - _F2_0F_51 */ 0x23aa, /* 978 - _V_0F_51 */ 0x4038, /* 979 - _V_66_0F_51 */ 0x4039, /* 97a - _V_F3_0F_51 */ 0x403a, @@ -4200,9 +4202,9 @@ _InstNode InstructionsTree[5688] = { /* 97d - */ 0, /* 97e - */ 0, /* 97f - */ 0, -/* 980 - _0F_52 */ 0x23a9, +/* 980 - _0F_52 */ 0x23ab, /* 981 - */ 0, -/* 982 - _F3_0F_52 */ 0x23aa, +/* 982 - _F3_0F_52 */ 0x23ac, /* 983 - */ 0, /* 984 - _V_0F_52 */ 0x403c, /* 985 - */ 0, @@ -4212,9 +4214,9 @@ _InstNode InstructionsTree[5688] = { /* 989 - */ 0, /* 98a - */ 0, /* 98b - */ 0, -/* 98c - _0F_53 */ 0x23ab, +/* 98c - _0F_53 */ 0x23ad, /* 98d - */ 0, -/* 98e - _F3_0F_53 */ 0x23ac, +/* 98e - _F3_0F_53 */ 0x23ae, /* 98f - */ 0, /* 990 - _V_0F_53 */ 0x403e, /* 991 - */ 0, @@ -4224,8 +4226,8 @@ _InstNode InstructionsTree[5688] = { /* 995 - */ 0, /* 996 - */ 0, /* 997 - */ 0, -/* 998 - _0F_54 */ 0x23ad, -/* 999 - _66_0F_54 */ 0x23ae, +/* 998 - _0F_54 */ 0x23af, +/* 999 - _66_0F_54 */ 0x23b0, /* 99a - */ 0, /* 99b - */ 0, /* 99c - _V_0F_54 */ 0x4040, @@ -4236,8 +4238,8 @@ _InstNode InstructionsTree[5688] = { /* 9a1 - */ 0, /* 9a2 - */ 0, /* 9a3 - */ 0, -/* 9a4 - _0F_55 */ 0x23af, -/* 9a5 - _66_0F_55 */ 0x23b0, +/* 9a4 - _0F_55 */ 0x23b1, +/* 9a5 - _66_0F_55 */ 0x23b2, /* 9a6 - */ 0, /* 9a7 - */ 0, /* 9a8 - _V_0F_55 */ 0x4042, @@ -4248,8 +4250,8 @@ _InstNode InstructionsTree[5688] = { /* 9ad - */ 0, /* 9ae - */ 0, /* 9af - */ 0, -/* 9b0 - _0F_56 */ 0x23b1, -/* 9b1 - _66_0F_56 */ 0x23b2, +/* 9b0 - _0F_56 */ 0x23b3, +/* 9b1 - _66_0F_56 */ 0x23b4, /* 9b2 - */ 0, /* 9b3 - */ 0, /* 9b4 - _V_0F_56 */ 0x4044, @@ -4260,8 +4262,8 @@ _InstNode InstructionsTree[5688] = { /* 9b9 - */ 0, /* 9ba - */ 0, /* 9bb - */ 0, -/* 9bc - _0F_57 */ 0x23b3, -/* 9bd - _66_0F_57 */ 0x23b4, +/* 9bc - _0F_57 */ 0x23b5, +/* 9bd - _66_0F_57 */ 0x23b6, /* 9be - */ 0, /* 9bf - */ 0, /* 9c0 - _V_0F_57 */ 0x4046, @@ -4272,10 +4274,10 @@ _InstNode InstructionsTree[5688] = { /* 9c5 - */ 0, /* 9c6 - */ 0, /* 9c7 - */ 0, -/* 9c8 - _0F_58 */ 0x23b5, -/* 9c9 - _66_0F_58 */ 0x23b6, -/* 9ca - _F3_0F_58 */ 0x23b7, -/* 9cb - _F2_0F_58 */ 0x23b8, +/* 9c8 - _0F_58 */ 0x23b7, +/* 9c9 - _66_0F_58 */ 0x23b8, +/* 9ca - _F3_0F_58 */ 0x23b9, +/* 9cb - _F2_0F_58 */ 0x23ba, /* 9cc - _V_0F_58 */ 0x4048, /* 9cd - _V_66_0F_58 */ 0x4049, /* 9ce - _V_F3_0F_58 */ 0x404a, @@ -4284,10 +4286,10 @@ _InstNode InstructionsTree[5688] = { /* 9d1 - */ 0, /* 9d2 - */ 0, /* 9d3 - */ 0, -/* 9d4 - _0F_59 */ 0x23b9, -/* 9d5 - _66_0F_59 */ 0x23ba, -/* 9d6 - _F3_0F_59 */ 0x23bb, -/* 9d7 - _F2_0F_59 */ 0x23bc, +/* 9d4 - _0F_59 */ 0x23bb, +/* 9d5 - _66_0F_59 */ 0x23bc, +/* 9d6 - _F3_0F_59 */ 0x23bd, +/* 9d7 - _F2_0F_59 */ 0x23be, /* 9d8 - _V_0F_59 */ 0x404c, /* 9d9 - _V_66_0F_59 */ 0x404d, /* 9da - _V_F3_0F_59 */ 0x404e, @@ -4296,10 +4298,10 @@ _InstNode InstructionsTree[5688] = { /* 9dd - */ 0, /* 9de - */ 0, /* 9df - */ 0, -/* 9e0 - _0F_5A */ 0x23bd, -/* 9e1 - _66_0F_5A */ 0x23be, -/* 9e2 - _F3_0F_5A */ 0x23bf, -/* 9e3 - _F2_0F_5A */ 0x23c0, +/* 9e0 - _0F_5A */ 0x23bf, +/* 9e1 - _66_0F_5A */ 0x23c0, +/* 9e2 - _F3_0F_5A */ 0x23c1, +/* 9e3 - _F2_0F_5A */ 0x23c2, /* 9e4 - _V_0F_5A */ 0x4050, /* 9e5 - _V_66_0F_5A */ 0x4051, /* 9e6 - _V_F3_0F_5A */ 0x4052, @@ -4308,9 +4310,9 @@ _InstNode InstructionsTree[5688] = { /* 9e9 - */ 0, /* 9ea - */ 0, /* 9eb - */ 0, -/* 9ec - _0F_5B */ 0x23c1, -/* 9ed - _66_0F_5B */ 0x23c2, -/* 9ee - _F3_0F_5B */ 0x23c3, +/* 9ec - _0F_5B */ 0x23c3, +/* 9ed - _66_0F_5B */ 0x23c4, +/* 9ee - _F3_0F_5B */ 0x23c5, /* 9ef - */ 0, /* 9f0 - _V_0F_5B */ 0x4054, /* 9f1 - _V_66_0F_5B */ 0x4055, @@ -4320,10 +4322,10 @@ _InstNode InstructionsTree[5688] = { /* 9f5 - */ 0, /* 9f6 - */ 0, /* 9f7 - */ 0, -/* 9f8 - _0F_5C */ 0x23c4, -/* 9f9 - _66_0F_5C */ 0x23c5, -/* 9fa - _F3_0F_5C */ 0x23c6, -/* 9fb - _F2_0F_5C */ 0x23c7, +/* 9f8 - _0F_5C */ 0x23c6, +/* 9f9 - _66_0F_5C */ 0x23c7, +/* 9fa - _F3_0F_5C */ 0x23c8, +/* 9fb - _F2_0F_5C */ 0x23c9, /* 9fc - _V_0F_5C */ 0x4057, /* 9fd - _V_66_0F_5C */ 0x4058, /* 9fe - _V_F3_0F_5C */ 0x4059, @@ -4332,10 +4334,10 @@ _InstNode InstructionsTree[5688] = { /* a01 - */ 0, /* a02 - */ 0, /* a03 - */ 0, -/* a04 - _0F_5D */ 0x23c8, -/* a05 - _66_0F_5D */ 0x23c9, -/* a06 - _F3_0F_5D */ 0x23ca, -/* a07 - _F2_0F_5D */ 0x23cb, +/* a04 - _0F_5D */ 0x23ca, +/* a05 - _66_0F_5D */ 0x23cb, +/* a06 - _F3_0F_5D */ 0x23cc, +/* a07 - _F2_0F_5D */ 0x23cd, /* a08 - _V_0F_5D */ 0x405b, /* a09 - _V_66_0F_5D */ 0x405c, /* a0a - _V_F3_0F_5D */ 0x405d, @@ -4344,10 +4346,10 @@ _InstNode InstructionsTree[5688] = { /* a0d - */ 0, /* a0e - */ 0, /* a0f - */ 0, -/* a10 - _0F_5E */ 0x23cc, -/* a11 - _66_0F_5E */ 0x23cd, -/* a12 - _F3_0F_5E */ 0x23ce, -/* a13 - _F2_0F_5E */ 0x23cf, +/* a10 - _0F_5E */ 0x23ce, +/* a11 - _66_0F_5E */ 0x23cf, +/* a12 - _F3_0F_5E */ 0x23d0, +/* a13 - _F2_0F_5E */ 0x23d1, /* a14 - _V_0F_5E */ 0x405f, /* a15 - _V_66_0F_5E */ 0x4060, /* a16 - _V_F3_0F_5E */ 0x4061, @@ -4356,10 +4358,10 @@ _InstNode InstructionsTree[5688] = { /* a19 - */ 0, /* a1a - */ 0, /* a1b - */ 0, -/* a1c - _0F_5F */ 0x23d0, -/* a1d - _66_0F_5F */ 0x23d1, -/* a1e - _F3_0F_5F */ 0x23d2, -/* a1f - _F2_0F_5F */ 0x23d3, +/* a1c - _0F_5F */ 0x23d2, +/* a1d - _66_0F_5F */ 0x23d3, +/* a1e - _F3_0F_5F */ 0x23d4, +/* a1f - _F2_0F_5F */ 0x23d5, /* a20 - _V_0F_5F */ 0x4063, /* a21 - _V_66_0F_5F */ 0x4064, /* a22 - _V_F3_0F_5F */ 0x4065, @@ -4368,8 +4370,8 @@ _InstNode InstructionsTree[5688] = { /* a25 - */ 0, /* a26 - */ 0, /* a27 - */ 0, -/* a28 - _0F_60 */ 0x23d4, -/* a29 - _66_0F_60 */ 0x23d5, +/* a28 - _0F_60 */ 0x23d6, +/* a29 - _66_0F_60 */ 0x23d7, /* a2a - */ 0, /* a2b - */ 0, /* a2c - */ 0, @@ -4380,8 +4382,8 @@ _InstNode InstructionsTree[5688] = { /* a31 - */ 0, /* a32 - */ 0, /* a33 - */ 0, -/* a34 - _0F_61 */ 0x23d6, -/* a35 - _66_0F_61 */ 0x23d7, +/* a34 - _0F_61 */ 0x23d8, +/* a35 - _66_0F_61 */ 0x23d9, /* a36 - */ 0, /* a37 - */ 0, /* a38 - */ 0, @@ -4392,8 +4394,8 @@ _InstNode InstructionsTree[5688] = { /* a3d - */ 0, /* a3e - */ 0, /* a3f - */ 0, -/* a40 - _0F_62 */ 0x23d8, -/* a41 - _66_0F_62 */ 0x23d9, +/* a40 - _0F_62 */ 0x23da, +/* a41 - _66_0F_62 */ 0x23db, /* a42 - */ 0, /* a43 - */ 0, /* a44 - */ 0, @@ -4404,8 +4406,8 @@ _InstNode InstructionsTree[5688] = { /* a49 - */ 0, /* a4a - */ 0, /* a4b - */ 0, -/* a4c - _0F_63 */ 0x23da, -/* a4d - _66_0F_63 */ 0x23db, +/* a4c - _0F_63 */ 0x23dc, +/* a4d - _66_0F_63 */ 0x23dd, /* a4e - */ 0, /* a4f - */ 0, /* a50 - */ 0, @@ -4416,8 +4418,8 @@ _InstNode InstructionsTree[5688] = { /* a55 - */ 0, /* a56 - */ 0, /* a57 - */ 0, -/* a58 - _0F_64 */ 0x23dc, -/* a59 - _66_0F_64 */ 0x23dd, +/* a58 - _0F_64 */ 0x23de, +/* a59 - _66_0F_64 */ 0x23df, /* a5a - */ 0, /* a5b - */ 0, /* a5c - */ 0, @@ -4428,8 +4430,8 @@ _InstNode InstructionsTree[5688] = { /* a61 - */ 0, /* a62 - */ 0, /* a63 - */ 0, -/* a64 - _0F_65 */ 0x23de, -/* a65 - _66_0F_65 */ 0x23df, +/* a64 - _0F_65 */ 0x23e0, +/* a65 - _66_0F_65 */ 0x23e1, /* a66 - */ 0, /* a67 - */ 0, /* a68 - */ 0, @@ -4440,8 +4442,8 @@ _InstNode InstructionsTree[5688] = { /* a6d - */ 0, /* a6e - */ 0, /* a6f - */ 0, -/* a70 - _0F_66 */ 0x23e0, -/* a71 - _66_0F_66 */ 0x23e1, +/* a70 - _0F_66 */ 0x23e2, +/* a71 - _66_0F_66 */ 0x23e3, /* a72 - */ 0, /* a73 - */ 0, /* a74 - */ 0, @@ -4452,8 +4454,8 @@ _InstNode InstructionsTree[5688] = { /* a79 - */ 0, /* a7a - */ 0, /* a7b - */ 0, -/* a7c - _0F_67 */ 0x23e2, -/* a7d - _66_0F_67 */ 0x23e3, +/* a7c - _0F_67 */ 0x23e4, +/* a7d - _66_0F_67 */ 0x23e5, /* a7e - */ 0, /* a7f - */ 0, /* a80 - */ 0, @@ -4464,8 +4466,8 @@ _InstNode InstructionsTree[5688] = { /* a85 - */ 0, /* a86 - */ 0, /* a87 - */ 0, -/* a88 - _0F_68 */ 0x23e4, -/* a89 - _66_0F_68 */ 0x23e5, +/* a88 - _0F_68 */ 0x23e6, +/* a89 - _66_0F_68 */ 0x23e7, /* a8a - */ 0, /* a8b - */ 0, /* a8c - */ 0, @@ -4476,8 +4478,8 @@ _InstNode InstructionsTree[5688] = { /* a91 - */ 0, /* a92 - */ 0, /* a93 - */ 0, -/* a94 - _0F_69 */ 0x23e6, -/* a95 - _66_0F_69 */ 0x23e7, +/* a94 - _0F_69 */ 0x23e8, +/* a95 - _66_0F_69 */ 0x23e9, /* a96 - */ 0, /* a97 - */ 0, /* a98 - */ 0, @@ -4488,8 +4490,8 @@ _InstNode InstructionsTree[5688] = { /* a9d - */ 0, /* a9e - */ 0, /* a9f - */ 0, -/* aa0 - _0F_6A */ 0x23e8, -/* aa1 - _66_0F_6A */ 0x23e9, +/* aa0 - _0F_6A */ 0x23ea, +/* aa1 - _66_0F_6A */ 0x23eb, /* aa2 - */ 0, /* aa3 - */ 0, /* aa4 - */ 0, @@ -4500,8 +4502,8 @@ _InstNode InstructionsTree[5688] = { /* aa9 - */ 0, /* aaa - */ 0, /* aab - */ 0, -/* aac - _0F_6B */ 0x23ea, -/* aad - _66_0F_6B */ 0x23eb, +/* aac - _0F_6B */ 0x23ec, +/* aad - _66_0F_6B */ 0x23ed, /* aae - */ 0, /* aaf - */ 0, /* ab0 - */ 0, @@ -4513,7 +4515,7 @@ _InstNode InstructionsTree[5688] = { /* ab6 - */ 0, /* ab7 - */ 0, /* ab8 - */ 0, -/* ab9 - _66_0F_6C */ 0x23ec, +/* ab9 - _66_0F_6C */ 0x23ee, /* aba - */ 0, /* abb - */ 0, /* abc - */ 0, @@ -4525,7 +4527,7 @@ _InstNode InstructionsTree[5688] = { /* ac2 - */ 0, /* ac3 - */ 0, /* ac4 - */ 0, -/* ac5 - _66_0F_6D */ 0x23ed, +/* ac5 - _66_0F_6D */ 0x23ef, /* ac6 - */ 0, /* ac7 - */ 0, /* ac8 - */ 0, @@ -4548,9 +4550,9 @@ _InstNode InstructionsTree[5688] = { /* ad9 - */ 0, /* ada - */ 0, /* adb - */ 0, -/* adc - _0F_6F */ 0x23ee, -/* add - _66_0F_6F */ 0x23ef, -/* ade - _F3_0F_6F */ 0x23f0, +/* adc - _0F_6F */ 0x23f0, +/* add - _66_0F_6F */ 0x23f1, +/* ade - _F3_0F_6F */ 0x23f2, /* adf - */ 0, /* ae0 - */ 0, /* ae1 - _V_66_0F_6F */ 0x4078, @@ -4574,30 +4576,30 @@ _InstNode InstructionsTree[5688] = { /* af3 - */ 0, /* af4 - */ 0, /* af5 - */ 0, -/* af6 - _0F_71_02 */ 0xd584, +/* af6 - _0F_71_02 */ 0xf584, /* af7 - */ 0, -/* af8 - _0F_71_04 */ 0xd590, +/* af8 - _0F_71_04 */ 0xf590, /* af9 - */ 0, -/* afa - _0F_71_06 */ 0xd59c, +/* afa - _0F_71_06 */ 0xf59c, /* afb - */ 0, /* afc - */ 0, /* afd - */ 0, -/* afe - _0F_72_02 */ 0xd5a8, +/* afe - _0F_72_02 */ 0xf5a8, /* aff - */ 0, -/* b00 - _0F_72_04 */ 0xd5b4, +/* b00 - _0F_72_04 */ 0xf5b4, /* b01 - */ 0, -/* b02 - _0F_72_06 */ 0xd5c0, +/* b02 - _0F_72_06 */ 0xf5c0, /* b03 - */ 0, /* b04 - */ 0, /* b05 - */ 0, -/* b06 - _0F_73_02 */ 0xd5cc, -/* b07 - _0F_73_03 */ 0xd5d8, +/* b06 - _0F_73_02 */ 0xf5cc, +/* b07 - _0F_73_03 */ 0xf5d8, /* b08 - */ 0, /* b09 - */ 0, -/* b0a - _0F_73_06 */ 0xd5e4, -/* b0b - _0F_73_07 */ 0xd5f0, -/* b0c - _0F_74 */ 0x23f1, -/* b0d - _66_0F_74 */ 0x23f2, +/* b0a - _0F_73_06 */ 0xf5e4, +/* b0b - _0F_73_07 */ 0xf5f0, +/* b0c - _0F_74 */ 0x23f3, +/* b0d - _66_0F_74 */ 0x23f4, /* b0e - */ 0, /* b0f - */ 0, /* b10 - */ 0, @@ -4608,8 +4610,8 @@ _InstNode InstructionsTree[5688] = { /* b15 - */ 0, /* b16 - */ 0, /* b17 - */ 0, -/* b18 - _0F_75 */ 0x23f3, -/* b19 - _66_0F_75 */ 0x23f4, +/* b18 - _0F_75 */ 0x23f5, +/* b19 - _66_0F_75 */ 0x23f6, /* b1a - */ 0, /* b1b - */ 0, /* b1c - */ 0, @@ -4620,8 +4622,8 @@ _InstNode InstructionsTree[5688] = { /* b21 - */ 0, /* b22 - */ 0, /* b23 - */ 0, -/* b24 - _0F_76 */ 0x23f5, -/* b25 - _66_0F_76 */ 0x23f6, +/* b24 - _0F_76 */ 0x23f7, +/* b25 - _66_0F_76 */ 0x23f8, /* b26 - */ 0, /* b27 - */ 0, /* b28 - */ 0, @@ -4632,7 +4634,7 @@ _InstNode InstructionsTree[5688] = { /* b2d - */ 0, /* b2e - */ 0, /* b2f - */ 0, -/* b30 - _0F_77 */ 0x23f7, +/* b30 - _0F_77 */ 0x23f9, /* b31 - */ 0, /* b32 - */ 0, /* b33 - */ 0, @@ -4644,7 +4646,7 @@ _InstNode InstructionsTree[5688] = { /* b39 - */ 0, /* b3a - */ 0, /* b3b - */ 0, -/* b3c - _0F_78 */ 0x23f8, +/* b3c - _0F_78 */ 0x23fa, /* b3d - _66_0F_78 */ 0x4085, /* b3e - */ 0, /* b3f - _F2_0F_78 */ 0x4086, @@ -4656,10 +4658,10 @@ _InstNode InstructionsTree[5688] = { /* b45 - */ 0, /* b46 - */ 0, /* b47 - */ 0, -/* b48 - _0F_79 */ 0x23f9, -/* b49 - _66_0F_79 */ 0x23fa, +/* b48 - _0F_79 */ 0x23fb, +/* b49 - _66_0F_79 */ 0x23fc, /* b4a - */ 0, -/* b4b - _F2_0F_79 */ 0x23fb, +/* b4b - _F2_0F_79 */ 0x23fd, /* b4c - */ 0, /* b4d - */ 0, /* b4e - */ 0, @@ -4716,8 +4718,8 @@ _InstNode InstructionsTree[5688] = { /* b81 - */ 0, /* b82 - */ 0, /* b83 - */ 0, -/* b84 - _0F_7A_30 */ 0x23fc, -/* b85 - _0F_7A_31 */ 0x23fd, +/* b84 - _0F_7A_30 */ 0x23fe, +/* b85 - _0F_7A_31 */ 0x23ff, /* b86 - */ 0, /* b87 - */ 0, /* b88 - */ 0, @@ -4925,9 +4927,9 @@ _InstNode InstructionsTree[5688] = { /* c52 - */ 0, /* c53 - */ 0, /* c54 - */ 0, -/* c55 - _66_0F_7C */ 0x23fe, +/* c55 - _66_0F_7C */ 0x2400, /* c56 - */ 0, -/* c57 - _F2_0F_7C */ 0x23ff, +/* c57 - _F2_0F_7C */ 0x2401, /* c58 - */ 0, /* c59 - _V_66_0F_7C */ 0x4087, /* c5a - */ 0, @@ -4937,9 +4939,9 @@ _InstNode InstructionsTree[5688] = { /* c5e - */ 0, /* c5f - */ 0, /* c60 - */ 0, -/* c61 - _66_0F_7D */ 0x2400, +/* c61 - _66_0F_7D */ 0x2402, /* c62 - */ 0, -/* c63 - _F2_0F_7D */ 0x2401, +/* c63 - _F2_0F_7D */ 0x2403, /* c64 - */ 0, /* c65 - _V_66_0F_7D */ 0x4089, /* c66 - */ 0, @@ -4950,7 +4952,7 @@ _InstNode InstructionsTree[5688] = { /* c6b - */ 0, /* c6c - _0F_7E */ 0x408b, /* c6d - _66_0F_7E */ 0x408c, -/* c6e - _F3_0F_7E */ 0x2402, +/* c6e - _F3_0F_7E */ 0x2404, /* c6f - */ 0, /* c70 - */ 0, /* c71 - _V_66_0F_7E */ 0x408d, @@ -4960,9 +4962,9 @@ _InstNode InstructionsTree[5688] = { /* c75 - */ 0, /* c76 - */ 0, /* c77 - */ 0, -/* c78 - _0F_7F */ 0x2403, -/* c79 - _66_0F_7F */ 0x2404, -/* c7a - _F3_0F_7F */ 0x2405, +/* c78 - _0F_7F */ 0x2405, +/* c79 - _66_0F_7F */ 0x2406, +/* c7a - _F3_0F_7F */ 0x2407, /* c7b - */ 0, /* c7c - */ 0, /* c7d - _V_66_0F_7F */ 0x408f, @@ -4972,17 +4974,17 @@ _InstNode InstructionsTree[5688] = { /* c81 - */ 0, /* c82 - */ 0, /* c83 - */ 0, -/* c84 - _0F_AE_00 */ 0xd5fc, -/* c85 - _0F_AE_01 */ 0xd608, -/* c86 - _0F_AE_02 */ 0xd614, -/* c87 - _0F_AE_03 */ 0xd620, +/* c84 - _0F_AE_00 */ 0xf5fc, +/* c85 - _0F_AE_01 */ 0xf608, +/* c86 - _0F_AE_02 */ 0xf614, +/* c87 - _0F_AE_03 */ 0xf620, /* c88 - _0F_AE_04 */ 0x4091, /* c89 - _0F_AE_05 */ 0x4092, /* c8a - _0F_AE_06 */ 0x4093, /* c8b - _0F_AE_07 */ 0x4094, /* c8c - */ 0, /* c8d - */ 0, -/* c8e - _F3_0F_B8 */ 0x2406, +/* c8e - _F3_0F_B8 */ 0x2408, /* c8f - */ 0, /* c90 - */ 0, /* c91 - */ 0, @@ -4996,13 +4998,13 @@ _InstNode InstructionsTree[5688] = { /* c99 - */ 0, /* c9a - */ 0, /* c9b - */ 0, -/* c9c - _0F_BA_04 */ 0x2407, -/* c9d - _0F_BA_05 */ 0x2408, -/* c9e - _0F_BA_06 */ 0x2409, -/* c9f - _0F_BA_07 */ 0x240a, -/* ca0 - _0F_BC */ 0x240b, +/* c9c - _0F_BA_04 */ 0x2409, +/* c9d - _0F_BA_05 */ 0x240a, +/* c9e - _0F_BA_06 */ 0x240b, +/* c9f - _0F_BA_07 */ 0x240c, +/* ca0 - _0F_BC */ 0x240d, /* ca1 - */ 0, -/* ca2 - _F3_0F_BC */ 0x240c, +/* ca2 - _F3_0F_BC */ 0x240e, /* ca3 - */ 0, /* ca4 - */ 0, /* ca5 - */ 0, @@ -5012,9 +5014,9 @@ _InstNode InstructionsTree[5688] = { /* ca9 - */ 0, /* caa - */ 0, /* cab - */ 0, -/* cac - _0F_BD */ 0x240d, +/* cac - _0F_BD */ 0x240f, /* cad - */ 0, -/* cae - _F3_0F_BD */ 0x240e, +/* cae - _F3_0F_BD */ 0x2410, /* caf - */ 0, /* cb0 - */ 0, /* cb1 - */ 0, @@ -5078,12 +5080,12 @@ _InstNode InstructionsTree[5688] = { /* ceb - */ 0, /* cec - */ 0, /* ced - */ 0, -/* cee - _0F_C7_06 */ 0xd62c, -/* cef - _0F_C7_07 */ 0x240f, +/* cee - _0F_C7_06 */ 0xf62c, +/* cef - _0F_C7_07 */ 0x2411, /* cf0 - */ 0, -/* cf1 - _66_0F_D0 */ 0x2410, +/* cf1 - _66_0F_D0 */ 0x2412, /* cf2 - */ 0, -/* cf3 - _F2_0F_D0 */ 0x2411, +/* cf3 - _F2_0F_D0 */ 0x2413, /* cf4 - */ 0, /* cf5 - _V_66_0F_D0 */ 0x40a8, /* cf6 - */ 0, @@ -5092,8 +5094,8 @@ _InstNode InstructionsTree[5688] = { /* cf9 - */ 0, /* cfa - */ 0, /* cfb - */ 0, -/* cfc - _0F_D1 */ 0x2412, -/* cfd - _66_0F_D1 */ 0x2413, +/* cfc - _0F_D1 */ 0x2414, +/* cfd - _66_0F_D1 */ 0x2415, /* cfe - */ 0, /* cff - */ 0, /* d00 - */ 0, @@ -5104,8 +5106,8 @@ _InstNode InstructionsTree[5688] = { /* d05 - */ 0, /* d06 - */ 0, /* d07 - */ 0, -/* d08 - _0F_D2 */ 0x2414, -/* d09 - _66_0F_D2 */ 0x2415, +/* d08 - _0F_D2 */ 0x2416, +/* d09 - _66_0F_D2 */ 0x2417, /* d0a - */ 0, /* d0b - */ 0, /* d0c - */ 0, @@ -5116,8 +5118,8 @@ _InstNode InstructionsTree[5688] = { /* d11 - */ 0, /* d12 - */ 0, /* d13 - */ 0, -/* d14 - _0F_D3 */ 0x2416, -/* d15 - _66_0F_D3 */ 0x2417, +/* d14 - _0F_D3 */ 0x2418, +/* d15 - _66_0F_D3 */ 0x2419, /* d16 - */ 0, /* d17 - */ 0, /* d18 - */ 0, @@ -5128,8 +5130,8 @@ _InstNode InstructionsTree[5688] = { /* d1d - */ 0, /* d1e - */ 0, /* d1f - */ 0, -/* d20 - _0F_D4 */ 0x2418, -/* d21 - _66_0F_D4 */ 0x2419, +/* d20 - _0F_D4 */ 0x241a, +/* d21 - _66_0F_D4 */ 0x241b, /* d22 - */ 0, /* d23 - */ 0, /* d24 - */ 0, @@ -5140,8 +5142,8 @@ _InstNode InstructionsTree[5688] = { /* d29 - */ 0, /* d2a - */ 0, /* d2b - */ 0, -/* d2c - _0F_D5 */ 0x241a, -/* d2d - _66_0F_D5 */ 0x241b, +/* d2c - _0F_D5 */ 0x241c, +/* d2d - _66_0F_D5 */ 0x241d, /* d2e - */ 0, /* d2f - */ 0, /* d30 - */ 0, @@ -5153,9 +5155,9 @@ _InstNode InstructionsTree[5688] = { /* d36 - */ 0, /* d37 - */ 0, /* d38 - */ 0, -/* d39 - _66_0F_D6 */ 0x241c, -/* d3a - _F3_0F_D6 */ 0x241d, -/* d3b - _F2_0F_D6 */ 0x241e, +/* d39 - _66_0F_D6 */ 0x241e, +/* d3a - _F3_0F_D6 */ 0x241f, +/* d3b - _F2_0F_D6 */ 0x2420, /* d3c - */ 0, /* d3d - _V_66_0F_D6 */ 0x40af, /* d3e - */ 0, @@ -5164,8 +5166,8 @@ _InstNode InstructionsTree[5688] = { /* d41 - */ 0, /* d42 - */ 0, /* d43 - */ 0, -/* d44 - _0F_D7 */ 0x241f, -/* d45 - _66_0F_D7 */ 0x2420, +/* d44 - _0F_D7 */ 0x2421, +/* d45 - _66_0F_D7 */ 0x2422, /* d46 - */ 0, /* d47 - */ 0, /* d48 - */ 0, @@ -5176,8 +5178,8 @@ _InstNode InstructionsTree[5688] = { /* d4d - */ 0, /* d4e - */ 0, /* d4f - */ 0, -/* d50 - _0F_D8 */ 0x2421, -/* d51 - _66_0F_D8 */ 0x2422, +/* d50 - _0F_D8 */ 0x2423, +/* d51 - _66_0F_D8 */ 0x2424, /* d52 - */ 0, /* d53 - */ 0, /* d54 - */ 0, @@ -5188,8 +5190,8 @@ _InstNode InstructionsTree[5688] = { /* d59 - */ 0, /* d5a - */ 0, /* d5b - */ 0, -/* d5c - _0F_D9 */ 0x2423, -/* d5d - _66_0F_D9 */ 0x2424, +/* d5c - _0F_D9 */ 0x2425, +/* d5d - _66_0F_D9 */ 0x2426, /* d5e - */ 0, /* d5f - */ 0, /* d60 - */ 0, @@ -5200,8 +5202,8 @@ _InstNode InstructionsTree[5688] = { /* d65 - */ 0, /* d66 - */ 0, /* d67 - */ 0, -/* d68 - _0F_DA */ 0x2425, -/* d69 - _66_0F_DA */ 0x2426, +/* d68 - _0F_DA */ 0x2427, +/* d69 - _66_0F_DA */ 0x2428, /* d6a - */ 0, /* d6b - */ 0, /* d6c - */ 0, @@ -5212,8 +5214,8 @@ _InstNode InstructionsTree[5688] = { /* d71 - */ 0, /* d72 - */ 0, /* d73 - */ 0, -/* d74 - _0F_DB */ 0x2427, -/* d75 - _66_0F_DB */ 0x2428, +/* d74 - _0F_DB */ 0x2429, +/* d75 - _66_0F_DB */ 0x242a, /* d76 - */ 0, /* d77 - */ 0, /* d78 - */ 0, @@ -5224,8 +5226,8 @@ _InstNode InstructionsTree[5688] = { /* d7d - */ 0, /* d7e - */ 0, /* d7f - */ 0, -/* d80 - _0F_DC */ 0x2429, -/* d81 - _66_0F_DC */ 0x242a, +/* d80 - _0F_DC */ 0x242b, +/* d81 - _66_0F_DC */ 0x242c, /* d82 - */ 0, /* d83 - */ 0, /* d84 - */ 0, @@ -5236,8 +5238,8 @@ _InstNode InstructionsTree[5688] = { /* d89 - */ 0, /* d8a - */ 0, /* d8b - */ 0, -/* d8c - _0F_DD */ 0x242b, -/* d8d - _66_0F_DD */ 0x242c, +/* d8c - _0F_DD */ 0x242d, +/* d8d - _66_0F_DD */ 0x242e, /* d8e - */ 0, /* d8f - */ 0, /* d90 - */ 0, @@ -5248,8 +5250,8 @@ _InstNode InstructionsTree[5688] = { /* d95 - */ 0, /* d96 - */ 0, /* d97 - */ 0, -/* d98 - _0F_DE */ 0x242d, -/* d99 - _66_0F_DE */ 0x242e, +/* d98 - _0F_DE */ 0x242f, +/* d99 - _66_0F_DE */ 0x2430, /* d9a - */ 0, /* d9b - */ 0, /* d9c - */ 0, @@ -5260,8 +5262,8 @@ _InstNode InstructionsTree[5688] = { /* da1 - */ 0, /* da2 - */ 0, /* da3 - */ 0, -/* da4 - _0F_DF */ 0x242f, -/* da5 - _66_0F_DF */ 0x2430, +/* da4 - _0F_DF */ 0x2431, +/* da5 - _66_0F_DF */ 0x2432, /* da6 - */ 0, /* da7 - */ 0, /* da8 - */ 0, @@ -5272,8 +5274,8 @@ _InstNode InstructionsTree[5688] = { /* dad - */ 0, /* dae - */ 0, /* daf - */ 0, -/* db0 - _0F_E0 */ 0x2431, -/* db1 - _66_0F_E0 */ 0x2432, +/* db0 - _0F_E0 */ 0x2433, +/* db1 - _66_0F_E0 */ 0x2434, /* db2 - */ 0, /* db3 - */ 0, /* db4 - */ 0, @@ -5284,8 +5286,8 @@ _InstNode InstructionsTree[5688] = { /* db9 - */ 0, /* dba - */ 0, /* dbb - */ 0, -/* dbc - _0F_E1 */ 0x2433, -/* dbd - _66_0F_E1 */ 0x2434, +/* dbc - _0F_E1 */ 0x2435, +/* dbd - _66_0F_E1 */ 0x2436, /* dbe - */ 0, /* dbf - */ 0, /* dc0 - */ 0, @@ -5296,8 +5298,8 @@ _InstNode InstructionsTree[5688] = { /* dc5 - */ 0, /* dc6 - */ 0, /* dc7 - */ 0, -/* dc8 - _0F_E2 */ 0x2435, -/* dc9 - _66_0F_E2 */ 0x2436, +/* dc8 - _0F_E2 */ 0x2437, +/* dc9 - _66_0F_E2 */ 0x2438, /* dca - */ 0, /* dcb - */ 0, /* dcc - */ 0, @@ -5308,8 +5310,8 @@ _InstNode InstructionsTree[5688] = { /* dd1 - */ 0, /* dd2 - */ 0, /* dd3 - */ 0, -/* dd4 - _0F_E3 */ 0x2437, -/* dd5 - _66_0F_E3 */ 0x2438, +/* dd4 - _0F_E3 */ 0x2439, +/* dd5 - _66_0F_E3 */ 0x243a, /* dd6 - */ 0, /* dd7 - */ 0, /* dd8 - */ 0, @@ -5320,8 +5322,8 @@ _InstNode InstructionsTree[5688] = { /* ddd - */ 0, /* dde - */ 0, /* ddf - */ 0, -/* de0 - _0F_E4 */ 0x2439, -/* de1 - _66_0F_E4 */ 0x243a, +/* de0 - _0F_E4 */ 0x243b, +/* de1 - _66_0F_E4 */ 0x243c, /* de2 - */ 0, /* de3 - */ 0, /* de4 - */ 0, @@ -5332,8 +5334,8 @@ _InstNode InstructionsTree[5688] = { /* de9 - */ 0, /* dea - */ 0, /* deb - */ 0, -/* dec - _0F_E5 */ 0x243b, -/* ded - _66_0F_E5 */ 0x243c, +/* dec - _0F_E5 */ 0x243d, +/* ded - _66_0F_E5 */ 0x243e, /* dee - */ 0, /* def - */ 0, /* df0 - */ 0, @@ -5345,9 +5347,9 @@ _InstNode InstructionsTree[5688] = { /* df6 - */ 0, /* df7 - */ 0, /* df8 - */ 0, -/* df9 - _66_0F_E6 */ 0x243d, -/* dfa - _F3_0F_E6 */ 0x243e, -/* dfb - _F2_0F_E6 */ 0x243f, +/* df9 - _66_0F_E6 */ 0x243f, +/* dfa - _F3_0F_E6 */ 0x2440, +/* dfb - _F2_0F_E6 */ 0x2441, /* dfc - */ 0, /* dfd - _V_66_0F_E6 */ 0x40bf, /* dfe - _V_F3_0F_E6 */ 0x40c0, @@ -5356,8 +5358,8 @@ _InstNode InstructionsTree[5688] = { /* e01 - */ 0, /* e02 - */ 0, /* e03 - */ 0, -/* e04 - _0F_E7 */ 0x2440, -/* e05 - _66_0F_E7 */ 0x2441, +/* e04 - _0F_E7 */ 0x2442, +/* e05 - _66_0F_E7 */ 0x2443, /* e06 - */ 0, /* e07 - */ 0, /* e08 - */ 0, @@ -5368,8 +5370,8 @@ _InstNode InstructionsTree[5688] = { /* e0d - */ 0, /* e0e - */ 0, /* e0f - */ 0, -/* e10 - _0F_E8 */ 0x2442, -/* e11 - _66_0F_E8 */ 0x2443, +/* e10 - _0F_E8 */ 0x2444, +/* e11 - _66_0F_E8 */ 0x2445, /* e12 - */ 0, /* e13 - */ 0, /* e14 - */ 0, @@ -5380,8 +5382,8 @@ _InstNode InstructionsTree[5688] = { /* e19 - */ 0, /* e1a - */ 0, /* e1b - */ 0, -/* e1c - _0F_E9 */ 0x2444, -/* e1d - _66_0F_E9 */ 0x2445, +/* e1c - _0F_E9 */ 0x2446, +/* e1d - _66_0F_E9 */ 0x2447, /* e1e - */ 0, /* e1f - */ 0, /* e20 - */ 0, @@ -5392,8 +5394,8 @@ _InstNode InstructionsTree[5688] = { /* e25 - */ 0, /* e26 - */ 0, /* e27 - */ 0, -/* e28 - _0F_EA */ 0x2446, -/* e29 - _66_0F_EA */ 0x2447, +/* e28 - _0F_EA */ 0x2448, +/* e29 - _66_0F_EA */ 0x2449, /* e2a - */ 0, /* e2b - */ 0, /* e2c - */ 0, @@ -5404,8 +5406,8 @@ _InstNode InstructionsTree[5688] = { /* e31 - */ 0, /* e32 - */ 0, /* e33 - */ 0, -/* e34 - _0F_EB */ 0x2448, -/* e35 - _66_0F_EB */ 0x2449, +/* e34 - _0F_EB */ 0x244a, +/* e35 - _66_0F_EB */ 0x244b, /* e36 - */ 0, /* e37 - */ 0, /* e38 - */ 0, @@ -5416,8 +5418,8 @@ _InstNode InstructionsTree[5688] = { /* e3d - */ 0, /* e3e - */ 0, /* e3f - */ 0, -/* e40 - _0F_EC */ 0x244a, -/* e41 - _66_0F_EC */ 0x244b, +/* e40 - _0F_EC */ 0x244c, +/* e41 - _66_0F_EC */ 0x244d, /* e42 - */ 0, /* e43 - */ 0, /* e44 - */ 0, @@ -5428,8 +5430,8 @@ _InstNode InstructionsTree[5688] = { /* e49 - */ 0, /* e4a - */ 0, /* e4b - */ 0, -/* e4c - _0F_ED */ 0x244c, -/* e4d - _66_0F_ED */ 0x244d, +/* e4c - _0F_ED */ 0x244e, +/* e4d - _66_0F_ED */ 0x244f, /* e4e - */ 0, /* e4f - */ 0, /* e50 - */ 0, @@ -5440,8 +5442,8 @@ _InstNode InstructionsTree[5688] = { /* e55 - */ 0, /* e56 - */ 0, /* e57 - */ 0, -/* e58 - _0F_EE */ 0x244e, -/* e59 - _66_0F_EE */ 0x244f, +/* e58 - _0F_EE */ 0x2450, +/* e59 - _66_0F_EE */ 0x2451, /* e5a - */ 0, /* e5b - */ 0, /* e5c - */ 0, @@ -5452,8 +5454,8 @@ _InstNode InstructionsTree[5688] = { /* e61 - */ 0, /* e62 - */ 0, /* e63 - */ 0, -/* e64 - _0F_EF */ 0x2450, -/* e65 - _66_0F_EF */ 0x2451, +/* e64 - _0F_EF */ 0x2452, +/* e65 - _66_0F_EF */ 0x2453, /* e66 - */ 0, /* e67 - */ 0, /* e68 - */ 0, @@ -5467,7 +5469,7 @@ _InstNode InstructionsTree[5688] = { /* e70 - */ 0, /* e71 - */ 0, /* e72 - */ 0, -/* e73 - _F2_0F_F0 */ 0x2452, +/* e73 - _F2_0F_F0 */ 0x2454, /* e74 - */ 0, /* e75 - */ 0, /* e76 - */ 0, @@ -5476,8 +5478,8 @@ _InstNode InstructionsTree[5688] = { /* e79 - */ 0, /* e7a - */ 0, /* e7b - */ 0, -/* e7c - _0F_F1 */ 0x2453, -/* e7d - _66_0F_F1 */ 0x2454, +/* e7c - _0F_F1 */ 0x2455, +/* e7d - _66_0F_F1 */ 0x2456, /* e7e - */ 0, /* e7f - */ 0, /* e80 - */ 0, @@ -5488,8 +5490,8 @@ _InstNode InstructionsTree[5688] = { /* e85 - */ 0, /* e86 - */ 0, /* e87 - */ 0, -/* e88 - _0F_F2 */ 0x2455, -/* e89 - _66_0F_F2 */ 0x2456, +/* e88 - _0F_F2 */ 0x2457, +/* e89 - _66_0F_F2 */ 0x2458, /* e8a - */ 0, /* e8b - */ 0, /* e8c - */ 0, @@ -5500,8 +5502,8 @@ _InstNode InstructionsTree[5688] = { /* e91 - */ 0, /* e92 - */ 0, /* e93 - */ 0, -/* e94 - _0F_F3 */ 0x2457, -/* e95 - _66_0F_F3 */ 0x2458, +/* e94 - _0F_F3 */ 0x2459, +/* e95 - _66_0F_F3 */ 0x245a, /* e96 - */ 0, /* e97 - */ 0, /* e98 - */ 0, @@ -5512,8 +5514,8 @@ _InstNode InstructionsTree[5688] = { /* e9d - */ 0, /* e9e - */ 0, /* e9f - */ 0, -/* ea0 - _0F_F4 */ 0x2459, -/* ea1 - _66_0F_F4 */ 0x245a, +/* ea0 - _0F_F4 */ 0x245b, +/* ea1 - _66_0F_F4 */ 0x245c, /* ea2 - */ 0, /* ea3 - */ 0, /* ea4 - */ 0, @@ -5524,8 +5526,8 @@ _InstNode InstructionsTree[5688] = { /* ea9 - */ 0, /* eaa - */ 0, /* eab - */ 0, -/* eac - _0F_F5 */ 0x245b, -/* ead - _66_0F_F5 */ 0x245c, +/* eac - _0F_F5 */ 0x245d, +/* ead - _66_0F_F5 */ 0x245e, /* eae - */ 0, /* eaf - */ 0, /* eb0 - */ 0, @@ -5536,8 +5538,8 @@ _InstNode InstructionsTree[5688] = { /* eb5 - */ 0, /* eb6 - */ 0, /* eb7 - */ 0, -/* eb8 - _0F_F6 */ 0x245d, -/* eb9 - _66_0F_F6 */ 0x245e, +/* eb8 - _0F_F6 */ 0x245f, +/* eb9 - _66_0F_F6 */ 0x2460, /* eba - */ 0, /* ebb - */ 0, /* ebc - */ 0, @@ -5548,8 +5550,8 @@ _InstNode InstructionsTree[5688] = { /* ec1 - */ 0, /* ec2 - */ 0, /* ec3 - */ 0, -/* ec4 - _0F_F7 */ 0x245f, -/* ec5 - _66_0F_F7 */ 0x2460, +/* ec4 - _0F_F7 */ 0x2461, +/* ec5 - _66_0F_F7 */ 0x2462, /* ec6 - */ 0, /* ec7 - */ 0, /* ec8 - */ 0, @@ -5560,8 +5562,8 @@ _InstNode InstructionsTree[5688] = { /* ecd - */ 0, /* ece - */ 0, /* ecf - */ 0, -/* ed0 - _0F_F8 */ 0x2461, -/* ed1 - _66_0F_F8 */ 0x2462, +/* ed0 - _0F_F8 */ 0x2463, +/* ed1 - _66_0F_F8 */ 0x2464, /* ed2 - */ 0, /* ed3 - */ 0, /* ed4 - */ 0, @@ -5572,8 +5574,8 @@ _InstNode InstructionsTree[5688] = { /* ed9 - */ 0, /* eda - */ 0, /* edb - */ 0, -/* edc - _0F_F9 */ 0x2463, -/* edd - _66_0F_F9 */ 0x2464, +/* edc - _0F_F9 */ 0x2465, +/* edd - _66_0F_F9 */ 0x2466, /* ede - */ 0, /* edf - */ 0, /* ee0 - */ 0, @@ -5584,8 +5586,8 @@ _InstNode InstructionsTree[5688] = { /* ee5 - */ 0, /* ee6 - */ 0, /* ee7 - */ 0, -/* ee8 - _0F_FA */ 0x2465, -/* ee9 - _66_0F_FA */ 0x2466, +/* ee8 - _0F_FA */ 0x2467, +/* ee9 - _66_0F_FA */ 0x2468, /* eea - */ 0, /* eeb - */ 0, /* eec - */ 0, @@ -5596,8 +5598,8 @@ _InstNode InstructionsTree[5688] = { /* ef1 - */ 0, /* ef2 - */ 0, /* ef3 - */ 0, -/* ef4 - _0F_FB */ 0x2467, -/* ef5 - _66_0F_FB */ 0x2468, +/* ef4 - _0F_FB */ 0x2469, +/* ef5 - _66_0F_FB */ 0x246a, /* ef6 - */ 0, /* ef7 - */ 0, /* ef8 - */ 0, @@ -5608,8 +5610,8 @@ _InstNode InstructionsTree[5688] = { /* efd - */ 0, /* efe - */ 0, /* eff - */ 0, -/* f00 - _0F_FC */ 0x2469, -/* f01 - _66_0F_FC */ 0x246a, +/* f00 - _0F_FC */ 0x246b, +/* f01 - _66_0F_FC */ 0x246c, /* f02 - */ 0, /* f03 - */ 0, /* f04 - */ 0, @@ -5620,8 +5622,8 @@ _InstNode InstructionsTree[5688] = { /* f09 - */ 0, /* f0a - */ 0, /* f0b - */ 0, -/* f0c - _0F_FD */ 0x246b, -/* f0d - _66_0F_FD */ 0x246c, +/* f0c - _0F_FD */ 0x246d, +/* f0d - _66_0F_FD */ 0x246e, /* f0e - */ 0, /* f0f - */ 0, /* f10 - */ 0, @@ -5632,8 +5634,8 @@ _InstNode InstructionsTree[5688] = { /* f15 - */ 0, /* f16 - */ 0, /* f17 - */ 0, -/* f18 - _0F_FE */ 0x246d, -/* f19 - _66_0F_FE */ 0x246e, +/* f18 - _0F_FE */ 0x246f, +/* f19 - _66_0F_FE */ 0x2470, /* f1a - */ 0, /* f1b - */ 0, /* f1c - */ 0, @@ -5644,8 +5646,8 @@ _InstNode InstructionsTree[5688] = { /* f21 - */ 0, /* f22 - */ 0, /* f23 - */ 0, -/* f24 - _D9_06 */ 0x246f, -/* f25 - _9B_D9_06 */ 0x2470, +/* f24 - _D9_06 */ 0x2471, +/* f25 - _9B_D9_06 */ 0x2472, /* f26 - */ 0, /* f27 - */ 0, /* f28 - */ 0, @@ -5656,8 +5658,8 @@ _InstNode InstructionsTree[5688] = { /* f2d - */ 0, /* f2e - */ 0, /* f2f - */ 0, -/* f30 - _D9_07 */ 0x2471, -/* f31 - _9B_D9_07 */ 0x2472, +/* f30 - _D9_07 */ 0x2473, +/* f31 - _9B_D9_07 */ 0x2474, /* f32 - */ 0, /* f33 - */ 0, /* f34 - */ 0, @@ -5668,8 +5670,8 @@ _InstNode InstructionsTree[5688] = { /* f39 - */ 0, /* f3a - */ 0, /* f3b - */ 0, -/* f3c - _DB_E2 */ 0x2473, -/* f3d - _9B_DB_E2 */ 0x2474, +/* f3c - _DB_E2 */ 0x2475, +/* f3d - _9B_DB_E2 */ 0x2476, /* f3e - */ 0, /* f3f - */ 0, /* f40 - */ 0, @@ -5680,8 +5682,8 @@ _InstNode InstructionsTree[5688] = { /* f45 - */ 0, /* f46 - */ 0, /* f47 - */ 0, -/* f48 - _DB_E3 */ 0x2475, -/* f49 - _9B_DB_E3 */ 0x2476, +/* f48 - _DB_E3 */ 0x2477, +/* f49 - _9B_DB_E3 */ 0x2478, /* f4a - */ 0, /* f4b - */ 0, /* f4c - */ 0, @@ -5692,8 +5694,8 @@ _InstNode InstructionsTree[5688] = { /* f51 - */ 0, /* f52 - */ 0, /* f53 - */ 0, -/* f54 - _DD_06 */ 0x2477, -/* f55 - _9B_DD_06 */ 0x2478, +/* f54 - _DD_06 */ 0x2479, +/* f55 - _9B_DD_06 */ 0x247a, /* f56 - */ 0, /* f57 - */ 0, /* f58 - */ 0, @@ -5704,8 +5706,8 @@ _InstNode InstructionsTree[5688] = { /* f5d - */ 0, /* f5e - */ 0, /* f5f - */ 0, -/* f60 - _DD_07 */ 0x2479, -/* f61 - _9B_DD_07 */ 0x247a, +/* f60 - _DD_07 */ 0x247b, +/* f61 - _9B_DD_07 */ 0x247c, /* f62 - */ 0, /* f63 - */ 0, /* f64 - */ 0, @@ -5716,8 +5718,8 @@ _InstNode InstructionsTree[5688] = { /* f69 - */ 0, /* f6a - */ 0, /* f6b - */ 0, -/* f6c - _DF_E0 */ 0x247b, -/* f6d - _9B_DF_E0 */ 0x247c, +/* f6c - _DF_E0 */ 0x247d, +/* f6d - _9B_DF_E0 */ 0x247e, /* f6e - */ 0, /* f6f - */ 0, /* f70 - */ 0, @@ -5728,8 +5730,8 @@ _InstNode InstructionsTree[5688] = { /* f75 - */ 0, /* f76 - */ 0, /* f77 - */ 0, -/* f78 - _0F_38_00 */ 0x247d, -/* f79 - _66_0F_38_00 */ 0x247e, +/* f78 - _0F_38_00 */ 0x247f, +/* f79 - _66_0F_38_00 */ 0x2480, /* f7a - */ 0, /* f7b - */ 0, /* f7c - */ 0, @@ -5740,8 +5742,8 @@ _InstNode InstructionsTree[5688] = { /* f81 - */ 0, /* f82 - */ 0, /* f83 - */ 0, -/* f84 - _0F_38_01 */ 0x247f, -/* f85 - _66_0F_38_01 */ 0x2480, +/* f84 - _0F_38_01 */ 0x2481, +/* f85 - _66_0F_38_01 */ 0x2482, /* f86 - */ 0, /* f87 - */ 0, /* f88 - */ 0, @@ -5752,8 +5754,8 @@ _InstNode InstructionsTree[5688] = { /* f8d - */ 0, /* f8e - */ 0, /* f8f - */ 0, -/* f90 - _0F_38_02 */ 0x2481, -/* f91 - _66_0F_38_02 */ 0x2482, +/* f90 - _0F_38_02 */ 0x2483, +/* f91 - _66_0F_38_02 */ 0x2484, /* f92 - */ 0, /* f93 - */ 0, /* f94 - */ 0, @@ -5764,8 +5766,8 @@ _InstNode InstructionsTree[5688] = { /* f99 - */ 0, /* f9a - */ 0, /* f9b - */ 0, -/* f9c - _0F_38_03 */ 0x2483, -/* f9d - _66_0F_38_03 */ 0x2484, +/* f9c - _0F_38_03 */ 0x2485, +/* f9d - _66_0F_38_03 */ 0x2486, /* f9e - */ 0, /* f9f - */ 0, /* fa0 - */ 0, @@ -5776,8 +5778,8 @@ _InstNode InstructionsTree[5688] = { /* fa5 - */ 0, /* fa6 - */ 0, /* fa7 - */ 0, -/* fa8 - _0F_38_04 */ 0x2485, -/* fa9 - _66_0F_38_04 */ 0x2486, +/* fa8 - _0F_38_04 */ 0x2487, +/* fa9 - _66_0F_38_04 */ 0x2488, /* faa - */ 0, /* fab - */ 0, /* fac - */ 0, @@ -5788,8 +5790,8 @@ _InstNode InstructionsTree[5688] = { /* fb1 - */ 0, /* fb2 - */ 0, /* fb3 - */ 0, -/* fb4 - _0F_38_05 */ 0x2487, -/* fb5 - _66_0F_38_05 */ 0x2488, +/* fb4 - _0F_38_05 */ 0x2489, +/* fb5 - _66_0F_38_05 */ 0x248a, /* fb6 - */ 0, /* fb7 - */ 0, /* fb8 - */ 0, @@ -5800,8 +5802,8 @@ _InstNode InstructionsTree[5688] = { /* fbd - */ 0, /* fbe - */ 0, /* fbf - */ 0, -/* fc0 - _0F_38_06 */ 0x2489, -/* fc1 - _66_0F_38_06 */ 0x248a, +/* fc0 - _0F_38_06 */ 0x248b, +/* fc1 - _66_0F_38_06 */ 0x248c, /* fc2 - */ 0, /* fc3 - */ 0, /* fc4 - */ 0, @@ -5812,8 +5814,8 @@ _InstNode InstructionsTree[5688] = { /* fc9 - */ 0, /* fca - */ 0, /* fcb - */ 0, -/* fcc - _0F_38_07 */ 0x248b, -/* fcd - _66_0F_38_07 */ 0x248c, +/* fcc - _0F_38_07 */ 0x248d, +/* fcd - _66_0F_38_07 */ 0x248e, /* fce - */ 0, /* fcf - */ 0, /* fd0 - */ 0, @@ -5824,8 +5826,8 @@ _InstNode InstructionsTree[5688] = { /* fd5 - */ 0, /* fd6 - */ 0, /* fd7 - */ 0, -/* fd8 - _0F_38_08 */ 0x248d, -/* fd9 - _66_0F_38_08 */ 0x248e, +/* fd8 - _0F_38_08 */ 0x248f, +/* fd9 - _66_0F_38_08 */ 0x2490, /* fda - */ 0, /* fdb - */ 0, /* fdc - */ 0, @@ -5836,8 +5838,8 @@ _InstNode InstructionsTree[5688] = { /* fe1 - */ 0, /* fe2 - */ 0, /* fe3 - */ 0, -/* fe4 - _0F_38_09 */ 0x248f, -/* fe5 - _66_0F_38_09 */ 0x2490, +/* fe4 - _0F_38_09 */ 0x2491, +/* fe5 - _66_0F_38_09 */ 0x2492, /* fe6 - */ 0, /* fe7 - */ 0, /* fe8 - */ 0, @@ -5848,8 +5850,8 @@ _InstNode InstructionsTree[5688] = { /* fed - */ 0, /* fee - */ 0, /* fef - */ 0, -/* ff0 - _0F_38_0A */ 0x2491, -/* ff1 - _66_0F_38_0A */ 0x2492, +/* ff0 - _0F_38_0A */ 0x2493, +/* ff1 - _66_0F_38_0A */ 0x2494, /* ff2 - */ 0, /* ff3 - */ 0, /* ff4 - */ 0, @@ -5860,8 +5862,8 @@ _InstNode InstructionsTree[5688] = { /* ff9 - */ 0, /* ffa - */ 0, /* ffb - */ 0, -/* ffc - _0F_38_0B */ 0x2493, -/* ffd - _66_0F_38_0B */ 0x2494, +/* ffc - _0F_38_0B */ 0x2495, +/* ffd - _66_0F_38_0B */ 0x2496, /* ffe - */ 0, /* fff - */ 0, /* 1000 - */ 0, @@ -5957,7 +5959,7 @@ _InstNode InstructionsTree[5688] = { /* 105a - */ 0, /* 105b - */ 0, /* 105c - */ 0, -/* 105d - _66_0F_38_17 */ 0x2495, +/* 105d - _66_0F_38_17 */ 0x2497, /* 105e - */ 0, /* 105f - */ 0, /* 1060 - */ 0, @@ -6004,8 +6006,8 @@ _InstNode InstructionsTree[5688] = { /* 1089 - */ 0, /* 108a - */ 0, /* 108b - */ 0, -/* 108c - _0F_38_1C */ 0x2496, -/* 108d - _66_0F_38_1C */ 0x2497, +/* 108c - _0F_38_1C */ 0x2498, +/* 108d - _66_0F_38_1C */ 0x2499, /* 108e - */ 0, /* 108f - */ 0, /* 1090 - */ 0, @@ -6016,8 +6018,8 @@ _InstNode InstructionsTree[5688] = { /* 1095 - */ 0, /* 1096 - */ 0, /* 1097 - */ 0, -/* 1098 - _0F_38_1D */ 0x2498, -/* 1099 - _66_0F_38_1D */ 0x2499, +/* 1098 - _0F_38_1D */ 0x249a, +/* 1099 - _66_0F_38_1D */ 0x249b, /* 109a - */ 0, /* 109b - */ 0, /* 109c - */ 0, @@ -6028,8 +6030,8 @@ _InstNode InstructionsTree[5688] = { /* 10a1 - */ 0, /* 10a2 - */ 0, /* 10a3 - */ 0, -/* 10a4 - _0F_38_1E */ 0x249a, -/* 10a5 - _66_0F_38_1E */ 0x249b, +/* 10a4 - _0F_38_1E */ 0x249c, +/* 10a5 - _66_0F_38_1E */ 0x249d, /* 10a6 - */ 0, /* 10a7 - */ 0, /* 10a8 - */ 0, @@ -6041,7 +6043,7 @@ _InstNode InstructionsTree[5688] = { /* 10ae - */ 0, /* 10af - */ 0, /* 10b0 - */ 0, -/* 10b1 - _66_0F_38_20 */ 0x249c, +/* 10b1 - _66_0F_38_20 */ 0x249e, /* 10b2 - */ 0, /* 10b3 - */ 0, /* 10b4 - */ 0, @@ -6053,7 +6055,7 @@ _InstNode InstructionsTree[5688] = { /* 10ba - */ 0, /* 10bb - */ 0, /* 10bc - */ 0, -/* 10bd - _66_0F_38_21 */ 0x249d, +/* 10bd - _66_0F_38_21 */ 0x249f, /* 10be - */ 0, /* 10bf - */ 0, /* 10c0 - */ 0, @@ -6065,7 +6067,7 @@ _InstNode InstructionsTree[5688] = { /* 10c6 - */ 0, /* 10c7 - */ 0, /* 10c8 - */ 0, -/* 10c9 - _66_0F_38_22 */ 0x249e, +/* 10c9 - _66_0F_38_22 */ 0x24a0, /* 10ca - */ 0, /* 10cb - */ 0, /* 10cc - */ 0, @@ -6077,7 +6079,7 @@ _InstNode InstructionsTree[5688] = { /* 10d2 - */ 0, /* 10d3 - */ 0, /* 10d4 - */ 0, -/* 10d5 - _66_0F_38_23 */ 0x249f, +/* 10d5 - _66_0F_38_23 */ 0x24a1, /* 10d6 - */ 0, /* 10d7 - */ 0, /* 10d8 - */ 0, @@ -6089,7 +6091,7 @@ _InstNode InstructionsTree[5688] = { /* 10de - */ 0, /* 10df - */ 0, /* 10e0 - */ 0, -/* 10e1 - _66_0F_38_24 */ 0x24a0, +/* 10e1 - _66_0F_38_24 */ 0x24a2, /* 10e2 - */ 0, /* 10e3 - */ 0, /* 10e4 - */ 0, @@ -6101,7 +6103,7 @@ _InstNode InstructionsTree[5688] = { /* 10ea - */ 0, /* 10eb - */ 0, /* 10ec - */ 0, -/* 10ed - _66_0F_38_25 */ 0x24a1, +/* 10ed - _66_0F_38_25 */ 0x24a3, /* 10ee - */ 0, /* 10ef - */ 0, /* 10f0 - */ 0, @@ -6113,7 +6115,7 @@ _InstNode InstructionsTree[5688] = { /* 10f6 - */ 0, /* 10f7 - */ 0, /* 10f8 - */ 0, -/* 10f9 - _66_0F_38_28 */ 0x24a2, +/* 10f9 - _66_0F_38_28 */ 0x24a4, /* 10fa - */ 0, /* 10fb - */ 0, /* 10fc - */ 0, @@ -6125,7 +6127,7 @@ _InstNode InstructionsTree[5688] = { /* 1102 - */ 0, /* 1103 - */ 0, /* 1104 - */ 0, -/* 1105 - _66_0F_38_29 */ 0x24a3, +/* 1105 - _66_0F_38_29 */ 0x24a5, /* 1106 - */ 0, /* 1107 - */ 0, /* 1108 - */ 0, @@ -6137,7 +6139,7 @@ _InstNode InstructionsTree[5688] = { /* 110e - */ 0, /* 110f - */ 0, /* 1110 - */ 0, -/* 1111 - _66_0F_38_2A */ 0x24a4, +/* 1111 - _66_0F_38_2A */ 0x24a6, /* 1112 - */ 0, /* 1113 - */ 0, /* 1114 - */ 0, @@ -6149,7 +6151,7 @@ _InstNode InstructionsTree[5688] = { /* 111a - */ 0, /* 111b - */ 0, /* 111c - */ 0, -/* 111d - _66_0F_38_2B */ 0x24a5, +/* 111d - _66_0F_38_2B */ 0x24a7, /* 111e - */ 0, /* 111f - */ 0, /* 1120 - */ 0, @@ -6209,7 +6211,7 @@ _InstNode InstructionsTree[5688] = { /* 1156 - */ 0, /* 1157 - */ 0, /* 1158 - */ 0, -/* 1159 - _66_0F_38_30 */ 0x24a6, +/* 1159 - _66_0F_38_30 */ 0x24a8, /* 115a - */ 0, /* 115b - */ 0, /* 115c - */ 0, @@ -6221,7 +6223,7 @@ _InstNode InstructionsTree[5688] = { /* 1162 - */ 0, /* 1163 - */ 0, /* 1164 - */ 0, -/* 1165 - _66_0F_38_31 */ 0x24a7, +/* 1165 - _66_0F_38_31 */ 0x24a9, /* 1166 - */ 0, /* 1167 - */ 0, /* 1168 - */ 0, @@ -6233,7 +6235,7 @@ _InstNode InstructionsTree[5688] = { /* 116e - */ 0, /* 116f - */ 0, /* 1170 - */ 0, -/* 1171 - _66_0F_38_32 */ 0x24a8, +/* 1171 - _66_0F_38_32 */ 0x24aa, /* 1172 - */ 0, /* 1173 - */ 0, /* 1174 - */ 0, @@ -6245,7 +6247,7 @@ _InstNode InstructionsTree[5688] = { /* 117a - */ 0, /* 117b - */ 0, /* 117c - */ 0, -/* 117d - _66_0F_38_33 */ 0x24a9, +/* 117d - _66_0F_38_33 */ 0x24ab, /* 117e - */ 0, /* 117f - */ 0, /* 1180 - */ 0, @@ -6257,7 +6259,7 @@ _InstNode InstructionsTree[5688] = { /* 1186 - */ 0, /* 1187 - */ 0, /* 1188 - */ 0, -/* 1189 - _66_0F_38_34 */ 0x24aa, +/* 1189 - _66_0F_38_34 */ 0x24ac, /* 118a - */ 0, /* 118b - */ 0, /* 118c - */ 0, @@ -6269,7 +6271,7 @@ _InstNode InstructionsTree[5688] = { /* 1192 - */ 0, /* 1193 - */ 0, /* 1194 - */ 0, -/* 1195 - _66_0F_38_35 */ 0x24ab, +/* 1195 - _66_0F_38_35 */ 0x24ad, /* 1196 - */ 0, /* 1197 - */ 0, /* 1198 - */ 0, @@ -6281,7 +6283,7 @@ _InstNode InstructionsTree[5688] = { /* 119e - */ 0, /* 119f - */ 0, /* 11a0 - */ 0, -/* 11a1 - _66_0F_38_37 */ 0x24ac, +/* 11a1 - _66_0F_38_37 */ 0x24ae, /* 11a2 - */ 0, /* 11a3 - */ 0, /* 11a4 - */ 0, @@ -6293,7 +6295,7 @@ _InstNode InstructionsTree[5688] = { /* 11aa - */ 0, /* 11ab - */ 0, /* 11ac - */ 0, -/* 11ad - _66_0F_38_38 */ 0x24ad, +/* 11ad - _66_0F_38_38 */ 0x24af, /* 11ae - */ 0, /* 11af - */ 0, /* 11b0 - */ 0, @@ -6305,7 +6307,7 @@ _InstNode InstructionsTree[5688] = { /* 11b6 - */ 0, /* 11b7 - */ 0, /* 11b8 - */ 0, -/* 11b9 - _66_0F_38_39 */ 0x24ae, +/* 11b9 - _66_0F_38_39 */ 0x24b0, /* 11ba - */ 0, /* 11bb - */ 0, /* 11bc - */ 0, @@ -6317,7 +6319,7 @@ _InstNode InstructionsTree[5688] = { /* 11c2 - */ 0, /* 11c3 - */ 0, /* 11c4 - */ 0, -/* 11c5 - _66_0F_38_3A */ 0x24af, +/* 11c5 - _66_0F_38_3A */ 0x24b1, /* 11c6 - */ 0, /* 11c7 - */ 0, /* 11c8 - */ 0, @@ -6329,7 +6331,7 @@ _InstNode InstructionsTree[5688] = { /* 11ce - */ 0, /* 11cf - */ 0, /* 11d0 - */ 0, -/* 11d1 - _66_0F_38_3B */ 0x24b0, +/* 11d1 - _66_0F_38_3B */ 0x24b2, /* 11d2 - */ 0, /* 11d3 - */ 0, /* 11d4 - */ 0, @@ -6341,7 +6343,7 @@ _InstNode InstructionsTree[5688] = { /* 11da - */ 0, /* 11db - */ 0, /* 11dc - */ 0, -/* 11dd - _66_0F_38_3C */ 0x24b1, +/* 11dd - _66_0F_38_3C */ 0x24b3, /* 11de - */ 0, /* 11df - */ 0, /* 11e0 - */ 0, @@ -6353,7 +6355,7 @@ _InstNode InstructionsTree[5688] = { /* 11e6 - */ 0, /* 11e7 - */ 0, /* 11e8 - */ 0, -/* 11e9 - _66_0F_38_3D */ 0x24b2, +/* 11e9 - _66_0F_38_3D */ 0x24b4, /* 11ea - */ 0, /* 11eb - */ 0, /* 11ec - */ 0, @@ -6365,7 +6367,7 @@ _InstNode InstructionsTree[5688] = { /* 11f2 - */ 0, /* 11f3 - */ 0, /* 11f4 - */ 0, -/* 11f5 - _66_0F_38_3E */ 0x24b3, +/* 11f5 - _66_0F_38_3E */ 0x24b5, /* 11f6 - */ 0, /* 11f7 - */ 0, /* 11f8 - */ 0, @@ -6377,7 +6379,7 @@ _InstNode InstructionsTree[5688] = { /* 11fe - */ 0, /* 11ff - */ 0, /* 1200 - */ 0, -/* 1201 - _66_0F_38_3F */ 0x24b4, +/* 1201 - _66_0F_38_3F */ 0x24b6, /* 1202 - */ 0, /* 1203 - */ 0, /* 1204 - */ 0, @@ -6389,7 +6391,7 @@ _InstNode InstructionsTree[5688] = { /* 120a - */ 0, /* 120b - */ 0, /* 120c - */ 0, -/* 120d - _66_0F_38_40 */ 0x24b5, +/* 120d - _66_0F_38_40 */ 0x24b7, /* 120e - */ 0, /* 120f - */ 0, /* 1210 - */ 0, @@ -6401,7 +6403,7 @@ _InstNode InstructionsTree[5688] = { /* 1216 - */ 0, /* 1217 - */ 0, /* 1218 - */ 0, -/* 1219 - _66_0F_38_41 */ 0x24b6, +/* 1219 - _66_0F_38_41 */ 0x24b8, /* 121a - */ 0, /* 121b - */ 0, /* 121c - */ 0, @@ -6413,7 +6415,7 @@ _InstNode InstructionsTree[5688] = { /* 1222 - */ 0, /* 1223 - */ 0, /* 1224 - */ 0, -/* 1225 - _66_0F_38_80 */ 0x24b7, +/* 1225 - _66_0F_38_80 */ 0x24b9, /* 1226 - */ 0, /* 1227 - */ 0, /* 1228 - */ 0, @@ -6425,7 +6427,7 @@ _InstNode InstructionsTree[5688] = { /* 122e - */ 0, /* 122f - */ 0, /* 1230 - */ 0, -/* 1231 - _66_0F_38_81 */ 0x24b8, +/* 1231 - _66_0F_38_81 */ 0x24ba, /* 1232 - */ 0, /* 1233 - */ 0, /* 1234 - */ 0, @@ -6437,7 +6439,7 @@ _InstNode InstructionsTree[5688] = { /* 123a - */ 0, /* 123b - */ 0, /* 123c - */ 0, -/* 123d - _66_0F_38_82 */ 0x24b9, +/* 123d - _66_0F_38_82 */ 0x24bb, /* 123e - */ 0, /* 123f - */ 0, /* 1240 - */ 0, @@ -6809,7 +6811,7 @@ _InstNode InstructionsTree[5688] = { /* 13ae - */ 0, /* 13af - */ 0, /* 13b0 - */ 0, -/* 13b1 - _66_0F_38_DB */ 0x24ba, +/* 13b1 - _66_0F_38_DB */ 0x24bc, /* 13b2 - */ 0, /* 13b3 - */ 0, /* 13b4 - */ 0, @@ -6821,7 +6823,7 @@ _InstNode InstructionsTree[5688] = { /* 13ba - */ 0, /* 13bb - */ 0, /* 13bc - */ 0, -/* 13bd - _66_0F_38_DC */ 0x24bb, +/* 13bd - _66_0F_38_DC */ 0x24bd, /* 13be - */ 0, /* 13bf - */ 0, /* 13c0 - */ 0, @@ -6833,7 +6835,7 @@ _InstNode InstructionsTree[5688] = { /* 13c6 - */ 0, /* 13c7 - */ 0, /* 13c8 - */ 0, -/* 13c9 - _66_0F_38_DD */ 0x24bc, +/* 13c9 - _66_0F_38_DD */ 0x24be, /* 13ca - */ 0, /* 13cb - */ 0, /* 13cc - */ 0, @@ -6845,7 +6847,7 @@ _InstNode InstructionsTree[5688] = { /* 13d2 - */ 0, /* 13d3 - */ 0, /* 13d4 - */ 0, -/* 13d5 - _66_0F_38_DE */ 0x24bd, +/* 13d5 - _66_0F_38_DE */ 0x24bf, /* 13d6 - */ 0, /* 13d7 - */ 0, /* 13d8 - */ 0, @@ -6857,7 +6859,7 @@ _InstNode InstructionsTree[5688] = { /* 13de - */ 0, /* 13df - */ 0, /* 13e0 - */ 0, -/* 13e1 - _66_0F_38_DF */ 0x24be, +/* 13e1 - _66_0F_38_DF */ 0x24c0, /* 13e2 - */ 0, /* 13e3 - */ 0, /* 13e4 - */ 0, @@ -6868,10 +6870,10 @@ _InstNode InstructionsTree[5688] = { /* 13e9 - */ 0, /* 13ea - */ 0, /* 13eb - */ 0, -/* 13ec - _0F_38_F0 */ 0x24bf, +/* 13ec - _0F_38_F0 */ 0x24c1, /* 13ed - */ 0, /* 13ee - */ 0, -/* 13ef - _F2_0F_38_F0 */ 0x24c0, +/* 13ef - _F2_0F_38_F0 */ 0x24c2, /* 13f0 - */ 0, /* 13f1 - */ 0, /* 13f2 - */ 0, @@ -6880,10 +6882,10 @@ _InstNode InstructionsTree[5688] = { /* 13f5 - */ 0, /* 13f6 - */ 0, /* 13f7 - */ 0, -/* 13f8 - _0F_38_F1 */ 0x24c1, +/* 13f8 - _0F_38_F1 */ 0x24c3, /* 13f9 - */ 0, /* 13fa - */ 0, -/* 13fb - _F2_0F_38_F1 */ 0x24c2, +/* 13fb - _F2_0F_38_F1 */ 0x24c4, /* 13fc - */ 0, /* 13fd - */ 0, /* 13fe - */ 0, @@ -7276,8 +7278,8 @@ _InstNode InstructionsTree[5688] = { /* 1581 - */ 0, /* 1582 - */ 0, /* 1583 - */ 0, -/* 1584 - _0F_71_02 */ 0x24c3, -/* 1585 - _66_0F_71_02 */ 0x24c4, +/* 1584 - _0F_71_02 */ 0x24c5, +/* 1585 - _66_0F_71_02 */ 0x24c6, /* 1586 - */ 0, /* 1587 - */ 0, /* 1588 - */ 0, @@ -7288,8 +7290,8 @@ _InstNode InstructionsTree[5688] = { /* 158d - */ 0, /* 158e - */ 0, /* 158f - */ 0, -/* 1590 - _0F_71_04 */ 0x24c5, -/* 1591 - _66_0F_71_04 */ 0x24c6, +/* 1590 - _0F_71_04 */ 0x24c7, +/* 1591 - _66_0F_71_04 */ 0x24c8, /* 1592 - */ 0, /* 1593 - */ 0, /* 1594 - */ 0, @@ -7300,8 +7302,8 @@ _InstNode InstructionsTree[5688] = { /* 1599 - */ 0, /* 159a - */ 0, /* 159b - */ 0, -/* 159c - _0F_71_06 */ 0x24c7, -/* 159d - _66_0F_71_06 */ 0x24c8, +/* 159c - _0F_71_06 */ 0x24c9, +/* 159d - _66_0F_71_06 */ 0x24ca, /* 159e - */ 0, /* 159f - */ 0, /* 15a0 - */ 0, @@ -7312,8 +7314,8 @@ _InstNode InstructionsTree[5688] = { /* 15a5 - */ 0, /* 15a6 - */ 0, /* 15a7 - */ 0, -/* 15a8 - _0F_72_02 */ 0x24c9, -/* 15a9 - _66_0F_72_02 */ 0x24ca, +/* 15a8 - _0F_72_02 */ 0x24cb, +/* 15a9 - _66_0F_72_02 */ 0x24cc, /* 15aa - */ 0, /* 15ab - */ 0, /* 15ac - */ 0, @@ -7324,8 +7326,8 @@ _InstNode InstructionsTree[5688] = { /* 15b1 - */ 0, /* 15b2 - */ 0, /* 15b3 - */ 0, -/* 15b4 - _0F_72_04 */ 0x24cb, -/* 15b5 - _66_0F_72_04 */ 0x24cc, +/* 15b4 - _0F_72_04 */ 0x24cd, +/* 15b5 - _66_0F_72_04 */ 0x24ce, /* 15b6 - */ 0, /* 15b7 - */ 0, /* 15b8 - */ 0, @@ -7336,8 +7338,8 @@ _InstNode InstructionsTree[5688] = { /* 15bd - */ 0, /* 15be - */ 0, /* 15bf - */ 0, -/* 15c0 - _0F_72_06 */ 0x24cd, -/* 15c1 - _66_0F_72_06 */ 0x24ce, +/* 15c0 - _0F_72_06 */ 0x24cf, +/* 15c1 - _66_0F_72_06 */ 0x24d0, /* 15c2 - */ 0, /* 15c3 - */ 0, /* 15c4 - */ 0, @@ -7348,8 +7350,8 @@ _InstNode InstructionsTree[5688] = { /* 15c9 - */ 0, /* 15ca - */ 0, /* 15cb - */ 0, -/* 15cc - _0F_73_02 */ 0x24cf, -/* 15cd - _66_0F_73_02 */ 0x24d0, +/* 15cc - _0F_73_02 */ 0x24d1, +/* 15cd - _66_0F_73_02 */ 0x24d2, /* 15ce - */ 0, /* 15cf - */ 0, /* 15d0 - */ 0, @@ -7361,7 +7363,7 @@ _InstNode InstructionsTree[5688] = { /* 15d6 - */ 0, /* 15d7 - */ 0, /* 15d8 - */ 0, -/* 15d9 - _66_0F_73_03 */ 0x24d1, +/* 15d9 - _66_0F_73_03 */ 0x24d3, /* 15da - */ 0, /* 15db - */ 0, /* 15dc - */ 0, @@ -7372,8 +7374,8 @@ _InstNode InstructionsTree[5688] = { /* 15e1 - */ 0, /* 15e2 - */ 0, /* 15e3 - */ 0, -/* 15e4 - _0F_73_06 */ 0x24d2, -/* 15e5 - _66_0F_73_06 */ 0x24d3, +/* 15e4 - _0F_73_06 */ 0x24d4, +/* 15e5 - _66_0F_73_06 */ 0x24d5, /* 15e6 - */ 0, /* 15e7 - */ 0, /* 15e8 - */ 0, @@ -7385,7 +7387,7 @@ _InstNode InstructionsTree[5688] = { /* 15ee - */ 0, /* 15ef - */ 0, /* 15f0 - */ 0, -/* 15f1 - _66_0F_73_07 */ 0x24d4, +/* 15f1 - _66_0F_73_07 */ 0x24d6, /* 15f2 - */ 0, /* 15f3 - */ 0, /* 15f4 - */ 0, @@ -7398,7 +7400,7 @@ _InstNode InstructionsTree[5688] = { /* 15fb - */ 0, /* 15fc - _0F_AE_00 */ 0x4179, /* 15fd - */ 0, -/* 15fe - _F3_0F_AE_00 */ 0x24d5, +/* 15fe - _F3_0F_AE_00 */ 0x24d7, /* 15ff - */ 0, /* 1600 - */ 0, /* 1601 - */ 0, @@ -7410,7 +7412,7 @@ _InstNode InstructionsTree[5688] = { /* 1607 - */ 0, /* 1608 - _0F_AE_01 */ 0x417a, /* 1609 - */ 0, -/* 160a - _F3_0F_AE_01 */ 0x24d6, +/* 160a - _F3_0F_AE_01 */ 0x24d8, /* 160b - */ 0, /* 160c - */ 0, /* 160d - */ 0, @@ -7420,9 +7422,9 @@ _InstNode InstructionsTree[5688] = { /* 1611 - */ 0, /* 1612 - */ 0, /* 1613 - */ 0, -/* 1614 - _0F_AE_02 */ 0x24d7, +/* 1614 - _0F_AE_02 */ 0x24d9, /* 1615 - */ 0, -/* 1616 - _F3_0F_AE_02 */ 0x24d8, +/* 1616 - _F3_0F_AE_02 */ 0x24da, /* 1617 - */ 0, /* 1618 - _V_0F_AE_02 */ 0x417b, /* 1619 - */ 0, @@ -7432,9 +7434,9 @@ _InstNode InstructionsTree[5688] = { /* 161d - */ 0, /* 161e - */ 0, /* 161f - */ 0, -/* 1620 - _0F_AE_03 */ 0x24d9, +/* 1620 - _0F_AE_03 */ 0x24db, /* 1621 - */ 0, -/* 1622 - _F3_0F_AE_03 */ 0x24da, +/* 1622 - _F3_0F_AE_03 */ 0x24dc, /* 1623 - */ 0, /* 1624 - _V_0F_AE_03 */ 0x417c, /* 1625 - */ 0, @@ -7444,9 +7446,9 @@ _InstNode InstructionsTree[5688] = { /* 1629 - */ 0, /* 162a - */ 0, /* 162b - */ 0, -/* 162c - _0F_C7_06 */ 0x24db, -/* 162d - _66_0F_C7_06 */ 0x24dc, -/* 162e - _F3_0F_C7_06 */ 0x24dd, +/* 162c - _0F_C7_06 */ 0x24dd, +/* 162d - _66_0F_C7_06 */ 0x24de, +/* 162e - _F3_0F_C7_06 */ 0x24df, /* 162f - */ 0, /* 1630 - */ 0, /* 1631 - */ 0, @@ -7458,478 +7460,481 @@ _InstNode InstructionsTree[5688] = { /* 1637 - */ 0 }; -_InstSharedInfo InstSharedInfoTable[471] = { -{0, 9, 15, 8, 245, 0, 0}, -{0, 11, 17, 8, 245, 0, 0}, -{0, 15, 9, 8, 245, 0, 0}, -{0, 17, 11, 8, 245, 0, 0}, -{1, 1, 33, 8, 245, 0, 0}, -{1, 3, 35, 8, 245, 0, 0}, -{2, 0, 32, 8, 0, 0, 0}, -{3, 0, 32, 8, 0, 0, 0}, -{0, 9, 15, 8, 196, 16, 0}, -{0, 11, 17, 8, 196, 16, 0}, -{0, 15, 9, 8, 196, 16, 0}, -{0, 17, 11, 8, 196, 16, 0}, -{1, 1, 33, 8, 196, 16, 0}, -{1, 3, 35, 8, 196, 16, 0}, -{4, 0, 32, 8, 0, 0, 0}, -{0, 9, 15, 8, 245, 1, 0}, -{0, 11, 17, 8, 245, 1, 0}, -{0, 15, 9, 8, 245, 1, 0}, -{0, 17, 11, 8, 245, 1, 0}, -{1, 1, 33, 8, 245, 1, 0}, -{1, 3, 35, 8, 245, 1, 0}, -{5, 0, 32, 8, 0, 0, 0}, -{6, 0, 32, 8, 0, 0, 0}, -{7, 0, 32, 8, 0, 0, 0}, -{8, 0, 32, 8, 0, 0, 0}, -{0, 9, 15, 8, 229, 0, 16}, -{0, 11, 17, 8, 229, 0, 16}, -{0, 15, 9, 8, 229, 0, 16}, -{0, 17, 11, 8, 229, 0, 16}, -{1, 1, 33, 8, 229, 0, 16}, -{1, 3, 35, 8, 229, 0, 16}, -{9, 0, 0, 8, 213, 17, 32}, -{0, 9, 15, 8, 196, 0, 16}, -{0, 11, 17, 8, 196, 0, 16}, -{0, 15, 9, 8, 196, 0, 16}, -{0, 17, 11, 8, 196, 0, 16}, -{1, 1, 33, 8, 196, 0, 16}, -{1, 3, 35, 8, 196, 0, 16}, -{9, 0, 0, 8, 17, 16, 228}, -{10, 9, 15, 8, 245, 0, 0}, -{10, 11, 17, 8, 245, 0, 0}, -{10, 15, 9, 8, 245, 0, 0}, -{10, 17, 11, 8, 245, 0, 0}, -{11, 1, 33, 8, 245, 0, 0}, -{11, 3, 35, 8, 245, 0, 0}, -{12, 0, 54, 8, 244, 0, 0}, -{13, 0, 54, 8, 0, 0, 0}, -{14, 0, 54, 8, 0, 0, 0}, -{15, 0, 0, 8, 0, 0, 0}, -{16, 42, 11, 8, 0, 0, 0}, -{10, 10, 16, 8, 64, 0, 0}, -{13, 0, 3, 8, 0, 0, 0}, -{17, 17, 11, 8, 33, 0, 212}, -{18, 0, 5, 8, 0, 0, 0}, -{19, 59, 56, 8, 0, 8, 0}, -{20, 59, 56, 8, 0, 8, 0}, -{19, 55, 59, 8, 0, 8, 0}, -{20, 55, 59, 8, 0, 8, 0}, -{13, 0, 40, 13, 0, 32, 0}, -{13, 0, 40, 13, 0, 1, 0}, -{13, 0, 40, 13, 0, 64, 0}, -{13, 0, 40, 13, 0, 65, 0}, -{13, 0, 40, 13, 0, 128, 0}, -{13, 0, 40, 13, 0, 4, 0}, -{13, 0, 40, 13, 0, 160, 0}, -{13, 0, 40, 13, 0, 224, 0}, -{10, 9, 15, 8, 196, 0, 16}, -{10, 11, 17, 8, 196, 0, 16}, -{0, 9, 15, 8, 0, 0, 0}, -{0, 11, 17, 8, 0, 0, 0}, -{21, 9, 15, 8, 0, 0, 0}, -{21, 11, 17, 8, 0, 0, 0}, -{21, 15, 9, 8, 0, 0, 0}, -{21, 17, 11, 8, 0, 0, 0}, -{21, 31, 28, 8, 0, 0, 0}, -{21, 42, 11, 8, 0, 0, 0}, -{21, 28, 31, 8, 0, 0, 0}, -{1, 35, 54, 8, 0, 0, 0}, -{22, 0, 0, 8, 0, 0, 0}, -{9, 0, 38, 9, 0, 0, 0}, -{23, 0, 0, 8, 0, 0, 0}, -{23, 0, 0, 8, 255, 0, 0}, -{11, 0, 0, 8, 213, 0, 0}, -{11, 0, 0, 8, 0, 0, 0}, -{1, 49, 33, 8, 0, 0, 0}, -{1, 50, 35, 8, 0, 0, 0}, -{1, 33, 49, 8, 0, 0, 0}, -{1, 35, 50, 8, 0, 0, 0}, -{24, 55, 56, 8, 0, 8, 0}, -{25, 55, 56, 8, 0, 8, 0}, -{19, 56, 55, 8, 245, 8, 0}, -{26, 56, 55, 8, 245, 8, 0}, -{11, 1, 33, 8, 196, 0, 16}, -{11, 3, 35, 8, 196, 0, 16}, -{19, 33, 56, 8, 0, 8, 0}, -{26, 35, 56, 8, 0, 8, 0}, -{19, 55, 33, 8, 0, 8, 0}, -{26, 55, 35, 8, 0, 8, 0}, -{19, 33, 56, 8, 245, 8, 0}, -{26, 35, 56, 8, 245, 8, 0}, -{1, 1, 53, 8, 0, 0, 0}, -{27, 3, 54, 8, 0, 0, 0}, -{13, 0, 2, 10, 0, 0, 0}, -{13, 0, 0, 10, 0, 0, 0}, -{16, 37, 11, 8, 0, 0, 0}, -{13, 8, 6, 8, 0, 0, 0}, -{13, 0, 0, 8, 0, 0, 0}, -{28, 0, 2, 10, 0, 0, 0}, -{28, 0, 0, 10, 0, 0, 0}, -{11, 0, 0, 14, 0, 0, 0}, -{11, 0, 1, 14, 0, 0, 0}, -{9, 0, 0, 14, 0, 0, 0}, -{28, 0, 0, 10, 255, 0, 0}, -{9, 0, 1, 8, 196, 0, 49}, -{9, 0, 0, 8, 0, 0, 0}, -{29, 0, 57, 8, 0, 0, 0}, -{30, 0, 40, 13, 0, 64, 0}, -{30, 0, 40, 13, 0, 0, 0}, -{31, 0, 40, 13, 0, 0, 0}, -{1, 1, 33, 8, 0, 0, 0}, -{1, 1, 36, 8, 0, 0, 0}, -{11, 33, 1, 8, 0, 0, 0}, -{11, 36, 1, 8, 0, 0, 0}, -{13, 0, 41, 9, 0, 0, 0}, -{13, 0, 41, 12, 0, 0, 0}, -{9, 0, 38, 12, 0, 0, 0}, -{13, 0, 40, 12, 0, 0, 0}, -{1, 59, 33, 8, 0, 0, 0}, -{1, 59, 36, 8, 0, 0, 0}, -{11, 33, 59, 8, 0, 0, 0}, -{11, 36, 59, 8, 0, 0, 0}, -{11, 0, 0, 8, 1, 0, 0}, -{11, 0, 0, 8, 2, 0, 0}, -{11, 0, 0, 8, 8, 0, 0}, -{10, 16, 11, 8, 64, 0, 0}, -{32, 0, 0, 27, 0, 0, 0}, -{32, 0, 0, 8, 0, 0, 0}, -{32, 0, 0, 14, 0, 0, 0}, -{11, 0, 0, 96, 0, 0, 0}, -{10, 0, 17, 8, 0, 0, 0}, -{33, 29, 14, 8, 0, 0, 0}, -{33, 30, 14, 8, 0, 0, 0}, -{33, 14, 29, 8, 0, 0, 0}, -{33, 14, 30, 8, 0, 0, 0}, -{34, 0, 0, 8, 0, 0, 0}, -{35, 17, 11, 31, 0, 32, 0}, -{35, 17, 11, 31, 0, 1, 0}, -{35, 17, 11, 31, 0, 64, 0}, -{35, 17, 11, 31, 0, 65, 0}, -{35, 17, 11, 31, 0, 128, 0}, -{35, 17, 11, 31, 0, 4, 0}, -{35, 17, 11, 31, 0, 160, 0}, -{35, 17, 11, 31, 0, 224, 0}, -{32, 0, 41, 13, 0, 32, 0}, -{32, 0, 41, 13, 0, 1, 0}, -{32, 0, 41, 13, 0, 64, 0}, -{32, 0, 41, 13, 0, 65, 0}, -{32, 0, 41, 13, 0, 128, 0}, -{32, 0, 41, 13, 0, 4, 0}, -{32, 0, 41, 13, 0, 160, 0}, -{32, 0, 41, 13, 0, 224, 0}, -{35, 0, 15, 8, 0, 32, 0}, -{35, 0, 15, 8, 0, 1, 0}, -{35, 0, 15, 8, 0, 64, 0}, -{35, 0, 15, 8, 0, 65, 0}, -{35, 0, 15, 8, 0, 128, 0}, -{35, 0, 15, 8, 0, 4, 0}, -{35, 0, 15, 8, 0, 160, 0}, -{35, 0, 15, 8, 0, 224, 0}, -{36, 0, 32, 8, 0, 0, 0}, -{37, 0, 32, 8, 0, 0, 0}, -{35, 11, 17, 8, 1, 0, 244}, -{38, 11, 17, 8, 197, 0, 48}, -{39, 0, 32, 8, 0, 0, 0}, -{40, 0, 32, 8, 0, 0, 0}, -{32, 0, 0, 8, 255, 0, 0}, -{41, 11, 17, 8, 1, 0, 244}, -{35, 17, 11, 8, 33, 0, 212}, -{41, 9, 15, 8, 245, 0, 0}, -{41, 11, 17, 8, 245, 0, 0}, -{42, 37, 11, 8, 0, 0, 0}, -{35, 15, 11, 8, 0, 0, 0}, -{43, 16, 11, 8, 0, 0, 0}, -{43, 13, 45, 48, 0, 0, 0}, -{44, 0, 54, 8, 0, 0, 0}, -{45, 1, 15, 8, 245, 0, 0}, -{45, 1, 15, 8, 196, 16, 0}, -{45, 1, 15, 8, 245, 1, 0}, -{45, 1, 15, 8, 229, 0, 16}, -{45, 1, 15, 8, 196, 0, 16}, -{46, 1, 15, 8, 245, 0, 0}, -{45, 3, 17, 8, 245, 0, 0}, -{45, 3, 17, 8, 196, 16, 0}, -{45, 3, 17, 8, 245, 1, 0}, -{45, 3, 17, 8, 229, 0, 16}, -{45, 3, 17, 8, 196, 0, 16}, -{46, 3, 17, 8, 245, 0, 0}, -{47, 1, 15, 8, 245, 0, 0}, -{47, 1, 15, 8, 196, 16, 0}, -{47, 1, 15, 8, 245, 1, 0}, -{47, 1, 15, 8, 229, 0, 16}, -{47, 1, 15, 8, 196, 0, 16}, -{48, 1, 15, 8, 245, 0, 0}, -{45, 5, 17, 8, 245, 0, 0}, -{49, 5, 17, 8, 196, 16, 0}, -{45, 5, 17, 8, 245, 1, 0}, -{49, 5, 17, 8, 229, 0, 16}, -{49, 5, 17, 8, 196, 0, 16}, -{46, 5, 17, 8, 245, 0, 0}, -{50, 0, 17, 8, 0, 0, 0}, -{51, 1, 15, 8, 1, 0, 32}, -{51, 1, 15, 8, 1, 1, 32}, -{51, 1, 15, 8, 197, 0, 48}, -{51, 1, 17, 8, 1, 0, 32}, -{51, 1, 17, 8, 1, 1, 32}, -{51, 1, 17, 8, 197, 0, 48}, -{52, 1, 15, 8, 0, 0, 0}, -{53, 0, 1, 24, 0, 0, 0}, -{52, 3, 17, 8, 0, 0, 0}, -{53, 0, 41, 24, 0, 0, 0}, -{51, 51, 15, 8, 33, 0, 0}, -{51, 51, 15, 8, 33, 1, 0}, -{51, 51, 15, 8, 229, 0, 16}, -{51, 51, 17, 8, 33, 0, 0}, -{51, 51, 17, 8, 33, 1, 0}, -{51, 51, 17, 8, 229, 0, 16}, -{51, 52, 15, 8, 1, 0, 32}, -{51, 52, 15, 8, 1, 1, 32}, -{51, 52, 15, 8, 197, 0, 48}, -{51, 52, 17, 8, 1, 0, 32}, -{51, 52, 17, 8, 1, 1, 32}, -{51, 52, 17, 8, 197, 0, 48}, -{46, 0, 21, 16, 0, 0, 0}, -{54, 0, 62, 16, 0, 0, 0}, -{54, 0, 61, 16, 0, 0, 0}, -{54, 0, 0, 16, 0, 0, 0}, -{51, 0, 21, 16, 0, 0, 0}, -{46, 0, 42, 16, 0, 0, 0}, -{46, 0, 20, 16, 0, 0, 0}, -{55, 0, 62, 24, 0, 1, 0}, -{55, 0, 62, 24, 0, 64, 0}, -{55, 0, 62, 24, 0, 65, 0}, -{55, 0, 62, 24, 0, 4, 0}, -{56, 0, 21, 56, 0, 0, 0}, -{46, 0, 23, 16, 0, 0, 0}, -{51, 0, 23, 16, 0, 0, 0}, -{55, 0, 62, 16, 69, 0, 0}, -{55, 0, 62, 24, 69, 0, 0}, -{46, 0, 22, 16, 0, 0, 0}, -{54, 0, 63, 16, 0, 0, 0}, -{56, 0, 22, 56, 0, 0, 0}, -{51, 0, 22, 16, 0, 0, 0}, -{56, 0, 20, 56, 0, 0, 0}, -{51, 0, 20, 16, 0, 0, 0}, -{46, 1, 15, 8, 196, 0, 16}, -{45, 0, 15, 8, 0, 0, 0}, -{45, 0, 15, 8, 245, 0, 0}, -{51, 0, 15, 8, 33, 0, 212}, -{51, 0, 15, 8, 0, 0, 245}, -{46, 3, 17, 8, 196, 0, 16}, -{45, 0, 17, 8, 0, 0, 0}, -{45, 0, 17, 8, 245, 0, 0}, -{51, 0, 17, 8, 33, 0, 212}, -{51, 0, 17, 8, 0, 0, 245}, -{45, 0, 15, 8, 244, 0, 0}, -{45, 0, 17, 8, 244, 0, 0}, -{57, 0, 17, 9, 0, 0, 0}, -{58, 0, 37, 9, 0, 0, 0}, -{57, 0, 17, 12, 0, 0, 0}, -{58, 0, 37, 12, 0, 0, 0}, -{57, 0, 17, 8, 0, 0, 0}, -{46, 0, 17, 8, 0, 0, 0}, -{46, 0, 16, 8, 0, 0, 0}, -{56, 0, 16, 8, 0, 0, 0}, -{46, 0, 16, 8, 64, 0, 0}, -{57, 0, 39, 8, 0, 0, 0}, -{52, 0, 28, 8, 0, 0, 0}, -{59, 0, 16, 8, 0, 0, 0}, -{56, 0, 42, 8, 0, 0, 0}, -{55, 0, 0, 112, 0, 0, 0}, -{55, 0, 0, 8, 0, 0, 0}, -{13, 0, 0, 24, 0, 0, 0}, -{56, 0, 58, 120, 0, 0, 0}, -{55, 0, 0, 120, 0, 0, 0}, -{55, 0, 58, 120, 0, 0, 0}, -{55, 60, 58, 120, 0, 0, 0}, -{60, 0, 0, 8, 0, 0, 0}, -{56, 0, 42, 96, 0, 0, 0}, -{61, 67, 64, 104, 0, 0, 0}, -{61, 67, 64, 96, 0, 0, 0}, -{35, 73, 68, 40, 0, 0, 0}, -{35, 73, 68, 48, 0, 0, 0}, -{35, 71, 68, 40, 0, 0, 0}, -{35, 72, 68, 48, 0, 0, 0}, -{62, 90, 83, 128, 0, 0, 0}, -{63, 81, 68, 128, 0, 0, 0}, -{64, 44, 68, 128, 0, 0, 0}, -{64, 46, 68, 128, 0, 0, 0}, -{35, 68, 73, 40, 0, 0, 0}, -{35, 68, 73, 48, 0, 0, 0}, -{35, 68, 71, 40, 0, 0, 0}, -{35, 68, 72, 48, 0, 0, 0}, -{62, 83, 90, 128, 0, 0, 0}, -{64, 68, 44, 128, 0, 0, 0}, -{64, 68, 46, 128, 0, 0, 0}, -{65, 72, 68, 40, 0, 0, 0}, -{35, 46, 68, 48, 0, 0, 0}, -{35, 72, 68, 56, 0, 0, 0}, -{66, 81, 68, 128, 0, 0, 0}, -{67, 81, 68, 128, 0, 0, 0}, -{62, 89, 83, 128, 0, 0, 0}, -{35, 68, 46, 40, 0, 0, 0}, -{35, 68, 46, 48, 0, 0, 0}, -{62, 68, 46, 128, 0, 0, 0}, -{34, 73, 68, 40, 0, 0, 0}, -{34, 73, 68, 48, 0, 0, 0}, -{67, 88, 83, 128, 0, 0, 0}, -{35, 73, 68, 56, 0, 0, 0}, -{56, 0, 42, 40, 0, 0, 0}, -{34, 67, 68, 40, 0, 0, 0}, -{34, 67, 68, 48, 0, 0, 0}, -{42, 18, 68, 40, 0, 0, 0}, -{42, 18, 68, 48, 0, 0, 0}, -{35, 68, 47, 40, 0, 0, 0}, -{35, 68, 47, 48, 0, 0, 0}, -{35, 68, 44, 88, 0, 0, 0}, -{35, 68, 46, 88, 0, 0, 0}, -{62, 83, 92, 128, 0, 0, 0}, -{34, 72, 64, 40, 0, 0, 0}, -{34, 73, 64, 48, 0, 0, 0}, -{42, 71, 13, 40, 0, 0, 0}, -{42, 72, 13, 48, 0, 0, 0}, -{62, 80, 78, 128, 0, 0, 0}, -{34, 71, 68, 40, 69, 0, 0}, -{34, 72, 68, 48, 0, 0, 0}, -{62, 71, 68, 128, 0, 0, 0}, -{62, 72, 68, 128, 0, 0, 0}, -{68, 69, 12, 40, 0, 0, 0}, -{68, 69, 12, 48, 0, 0, 0}, -{69, 83, 13, 128, 0, 0, 0}, -{34, 71, 68, 40, 0, 0, 0}, -{34, 71, 68, 48, 0, 0, 0}, -{62, 91, 83, 128, 0, 0, 0}, -{62, 90, 68, 128, 0, 0, 0}, -{34, 66, 64, 32, 0, 0, 0}, -{34, 67, 64, 32, 0, 0, 0}, -{70, 18, 64, 32, 0, 0, 0}, -{70, 18, 68, 48, 0, 0, 0}, -{62, 79, 68, 128, 0, 0, 0}, -{35, 67, 64, 32, 0, 0, 0}, -{71, 67, 64, 40, 0, 0, 0}, -{71, 73, 68, 48, 0, 0, 0}, -{67, 73, 68, 128, 0, 0, 0}, -{32, 0, 0, 32, 0, 0, 0}, -{72, 0, 0, 128, 0, 0, 0}, -{73, 13, 18, 112, 0, 0, 0}, -{74, 7, 69, 88, 0, 0, 0}, -{75, 69, 68, 88, 0, 0, 0}, -{73, 18, 13, 112, 0, 0, 0}, -{34, 69, 68, 88, 0, 0, 0}, -{76, 69, 68, 88, 0, 0, 0}, -{32, 72, 68, 112, 0, 0, 0}, -{32, 68, 72, 112, 0, 0, 0}, -{34, 73, 68, 56, 0, 0, 0}, -{70, 64, 18, 32, 0, 0, 0}, -{70, 68, 18, 48, 0, 0, 0}, -{62, 68, 79, 128, 0, 0, 0}, -{35, 64, 67, 32, 0, 0, 0}, -{77, 0, 42, 8, 0, 0, 0}, -{78, 0, 43, 8, 0, 0, 0}, -{79, 0, 43, 8, 0, 0, 0}, -{80, 17, 11, 80, 64, 0, 0}, -{81, 1, 17, 8, 1, 0, 244}, -{49, 1, 17, 8, 1, 0, 244}, -{34, 17, 11, 8, 64, 0, 245}, -{82, 17, 11, 112, 0, 0, 0}, -{83, 17, 11, 8, 65, 0, 180}, -{84, 73, 68, 40, 0, 0, 0}, -{84, 73, 68, 48, 0, 0, 0}, -{84, 71, 68, 40, 0, 0, 0}, -{84, 72, 68, 48, 0, 0, 0}, -{85, 88, 83, 128, 0, 0, 0}, -{85, 81, 68, 128, 0, 0, 0}, -{71, 25, 64, 40, 0, 0, 0}, -{71, 25, 68, 48, 0, 0, 0}, -{86, 81, 68, 128, 0, 0, 0}, -{87, 65, 12, 40, 0, 0, 0}, -{71, 69, 12, 48, 0, 0, 0}, -{88, 68, 13, 128, 0, 0, 0}, -{71, 73, 68, 40, 0, 0, 0}, -{86, 88, 83, 128, 0, 0, 0}, -{89, 0, 48, 8, 64, 0, 0}, -{56, 0, 46, 112, 0, 0, 0}, -{68, 65, 68, 48, 0, 0, 0}, -{68, 69, 64, 48, 0, 0, 0}, -{62, 68, 72, 128, 0, 0, 0}, -{76, 65, 12, 40, 0, 0, 0}, -{76, 69, 12, 48, 0, 0, 0}, -{69, 68, 13, 128, 0, 0, 0}, -{34, 67, 64, 40, 0, 0, 0}, -{35, 64, 46, 40, 0, 0, 0}, -{34, 42, 68, 56, 0, 0, 0}, -{62, 92, 83, 128, 0, 0, 0}, -{34, 67, 64, 48, 0, 0, 0}, -{76, 65, 64, 40, 0, 0, 0}, -{76, 69, 68, 48, 0, 0, 0}, -{90, 69, 68, 128, 0, 0, 0}, -{51, 0, 42, 16, 0, 0, 0}, -{91, 0, 42, 16, 0, 0, 0}, -{91, 0, 20, 16, 0, 0, 0}, -{92, 0, 0, 16, 0, 0, 0}, -{93, 0, 34, 16, 0, 0, 0}, -{94, 0, 34, 16, 0, 0, 0}, -{34, 67, 64, 64, 0, 0, 0}, -{34, 73, 68, 64, 0, 0, 0}, -{71, 73, 68, 72, 0, 0, 0}, -{34, 73, 68, 80, 0, 0, 0}, -{62, 44, 83, 128, 0, 0, 0}, -{62, 46, 85, 128, 0, 0, 0}, -{62, 47, 85, 128, 0, 0, 0}, -{62, 73, 68, 128, 0, 0, 0}, -{34, 72, 68, 72, 0, 0, 0}, -{34, 71, 68, 72, 0, 0, 0}, -{34, 70, 68, 72, 0, 0, 0}, -{62, 70, 68, 128, 0, 0, 0}, -{34, 73, 68, 72, 0, 0, 0}, -{35, 47, 68, 72, 0, 0, 0}, -{62, 47, 68, 128, 0, 0, 0}, -{67, 88, 92, 128, 0, 0, 0}, -{73, 47, 13, 112, 0, 0, 0}, -{67, 88, 83, 136, 0, 0, 0}, -{67, 81, 68, 136, 0, 0, 0}, -{34, 73, 68, 152, 0, 0, 0}, -{62, 73, 68, 152, 0, 0, 0}, -{67, 81, 68, 152, 0, 0, 0}, -{35, 17, 11, 8, 0, 0, 0}, -{35, 15, 13, 80, 0, 0, 0}, -{35, 11, 17, 8, 0, 0, 0}, -{35, 17, 13, 80, 0, 0, 0}, -{67, 90, 83, 128, 0, 0, 0}, -{86, 87, 85, 128, 0, 0, 0}, -{71, 71, 68, 72, 0, 0, 0}, -{71, 72, 68, 72, 0, 0, 0}, -{71, 67, 64, 64, 0, 0, 0}, -{71, 73, 68, 64, 0, 0, 0}, -{71, 68, 26, 72, 0, 0, 0}, -{88, 68, 76, 128, 0, 0, 0}, -{71, 68, 27, 72, 0, 0, 0}, -{88, 68, 77, 128, 0, 0, 0}, -{95, 68, 18, 72, 0, 0, 0}, -{67, 68, 79, 128, 0, 0, 0}, -{71, 68, 18, 72, 0, 0, 0}, -{67, 68, 75, 128, 0, 0, 0}, -{67, 85, 73, 128, 0, 0, 0}, -{71, 24, 68, 72, 0, 0, 0}, -{95, 18, 68, 72, 0, 0, 0}, -{71, 73, 68, 144, 0, 0, 0}, -{86, 81, 68, 144, 0, 0, 0}, -{71, 73, 68, 80, 0, 0, 0}, -{71, 73, 68, 152, 0, 0, 0}, -{67, 73, 68, 152, 0, 0, 0}, -{96, 1, 65, 32, 0, 0, 0}, -{56, 1, 69, 48, 0, 0, 0}, -{97, 69, 81, 128, 0, 0, 0}, -{98, 0, 13, 112, 0, 0, 0}, -{56, 0, 44, 8, 0, 0, 0}, -{64, 0, 44, 128, 0, 0, 0}, -{56, 0, 42, 112, 0, 0, 0}, -{99, 75, 13, 8, 0, 0, 0}, -{98, 0, 17, 8, 0, 0, 0}, -{100, 67, 64, 96, 0, 0, 0} +_InstSharedInfo InstSharedInfoTable[474] = { +{0, 6, 68, 245, 0, 0, 256}, +{0, 8, 72, 245, 0, 0, 256}, +{0, 68, 6, 245, 0, 0, 256}, +{0, 72, 8, 245, 0, 0, 256}, +{1, 1, 11, 245, 0, 0, 256}, +{1, 3, 13, 245, 0, 0, 256}, +{2, 0, 46, 0, 0, 0, 256}, +{3, 0, 46, 0, 0, 0, 256}, +{0, 6, 68, 196, 16, 0, 256}, +{0, 8, 72, 196, 16, 0, 256}, +{0, 68, 6, 196, 16, 0, 256}, +{0, 72, 8, 196, 16, 0, 256}, +{1, 1, 11, 196, 16, 0, 256}, +{1, 3, 13, 196, 16, 0, 256}, +{4, 0, 46, 0, 0, 0, 256}, +{0, 6, 68, 245, 1, 0, 256}, +{0, 8, 72, 245, 1, 0, 256}, +{0, 68, 6, 245, 1, 0, 256}, +{0, 72, 8, 245, 1, 0, 256}, +{1, 1, 11, 245, 1, 0, 256}, +{1, 3, 13, 245, 1, 0, 256}, +{5, 0, 46, 0, 0, 0, 256}, +{6, 0, 46, 0, 0, 0, 256}, +{7, 0, 46, 0, 0, 0, 256}, +{8, 0, 46, 0, 0, 0, 256}, +{0, 6, 68, 229, 0, 16, 256}, +{0, 8, 72, 229, 0, 16, 256}, +{0, 68, 6, 229, 0, 16, 256}, +{0, 72, 8, 229, 0, 16, 256}, +{1, 1, 11, 229, 0, 16, 256}, +{1, 3, 13, 229, 0, 16, 256}, +{9, 0, 0, 213, 17, 32, 256}, +{0, 6, 68, 196, 0, 16, 256}, +{0, 8, 72, 196, 0, 16, 256}, +{0, 68, 6, 196, 0, 16, 256}, +{0, 72, 8, 196, 0, 16, 256}, +{1, 1, 11, 196, 0, 16, 256}, +{1, 3, 13, 196, 0, 16, 256}, +{9, 0, 0, 17, 16, 228, 256}, +{10, 6, 68, 245, 0, 0, 256}, +{10, 8, 72, 245, 0, 0, 256}, +{10, 68, 6, 245, 0, 0, 256}, +{10, 72, 8, 245, 0, 0, 256}, +{11, 1, 11, 245, 0, 0, 256}, +{11, 3, 13, 245, 0, 0, 256}, +{12, 0, 18, 244, 0, 0, 256}, +{13, 0, 18, 0, 0, 0, 256}, +{14, 0, 18, 0, 0, 0, 256}, +{15, 0, 0, 0, 0, 0, 256}, +{16, 54, 8, 0, 0, 0, 256}, +{10, 7, 69, 64, 0, 0, 256}, +{13, 0, 3, 0, 0, 0, 256}, +{17, 72, 8, 33, 0, 212, 256}, +{18, 0, 5, 0, 0, 0, 256}, +{19, 25, 22, 0, 8, 0, 33024}, +{20, 25, 22, 0, 8, 0, 33024}, +{19, 21, 25, 0, 8, 0, 33024}, +{20, 21, 25, 0, 8, 0, 33024}, +{13, 0, 15, 0, 32, 0, 261}, +{13, 0, 15, 0, 1, 0, 261}, +{13, 0, 15, 0, 64, 0, 261}, +{13, 0, 15, 0, 65, 0, 261}, +{13, 0, 15, 0, 128, 0, 261}, +{13, 0, 15, 0, 4, 0, 261}, +{13, 0, 15, 0, 160, 0, 261}, +{13, 0, 15, 0, 224, 0, 261}, +{10, 6, 68, 196, 0, 16, 256}, +{10, 8, 72, 196, 0, 16, 256}, +{0, 6, 68, 0, 0, 0, 256}, +{0, 8, 72, 0, 0, 0, 256}, +{21, 6, 68, 0, 0, 0, 256}, +{21, 8, 72, 0, 0, 0, 256}, +{21, 68, 6, 0, 0, 0, 256}, +{21, 72, 8, 0, 0, 0, 256}, +{21, 45, 71, 0, 0, 0, 256}, +{21, 54, 8, 0, 0, 0, 256}, +{21, 71, 45, 0, 0, 0, 256}, +{1, 13, 18, 0, 0, 0, 256}, +{22, 0, 0, 0, 0, 0, 256}, +{9, 0, 50, 0, 0, 0, 257}, +{23, 0, 0, 0, 0, 0, 256}, +{23, 0, 0, 255, 0, 0, 256}, +{11, 0, 0, 213, 0, 0, 256}, +{11, 0, 0, 0, 0, 0, 256}, +{1, 19, 11, 0, 0, 0, 256}, +{1, 20, 13, 0, 0, 0, 256}, +{1, 11, 19, 0, 0, 0, 256}, +{1, 13, 20, 0, 0, 0, 256}, +{24, 21, 22, 0, 8, 0, 256}, +{25, 21, 22, 0, 8, 0, 256}, +{19, 22, 21, 245, 8, 0, 256}, +{26, 22, 21, 245, 8, 0, 256}, +{11, 1, 11, 196, 0, 16, 256}, +{11, 3, 13, 196, 0, 16, 256}, +{19, 11, 22, 0, 8, 0, 256}, +{26, 13, 22, 0, 8, 0, 256}, +{19, 21, 11, 0, 8, 0, 256}, +{26, 21, 13, 0, 8, 0, 256}, +{19, 11, 22, 245, 8, 0, 256}, +{26, 13, 22, 245, 8, 0, 256}, +{1, 1, 17, 0, 0, 0, 256}, +{27, 3, 18, 0, 0, 0, 256}, +{13, 0, 2, 0, 0, 0, 258}, +{13, 0, 0, 0, 0, 0, 258}, +{16, 60, 8, 0, 0, 0, 256}, +{13, 49, 47, 0, 0, 0, 256}, +{13, 0, 0, 0, 0, 0, 256}, +{28, 0, 2, 0, 0, 0, 258}, +{28, 0, 0, 0, 0, 0, 258}, +{11, 0, 1, 0, 0, 0, 262}, +{9, 0, 0, 0, 0, 0, 262}, +{28, 0, 0, 255, 0, 0, 33026}, +{9, 0, 1, 196, 0, 49, 256}, +{9, 0, 0, 0, 0, 0, 256}, +{29, 0, 23, 0, 0, 0, 256}, +{30, 0, 15, 0, 64, 0, 261}, +{30, 0, 15, 0, 0, 0, 261}, +{31, 0, 15, 0, 0, 0, 261}, +{1, 1, 11, 0, 0, 0, 33024}, +{1, 1, 14, 0, 0, 0, 33024}, +{11, 11, 1, 0, 0, 0, 33024}, +{11, 14, 1, 0, 0, 0, 33024}, +{13, 0, 16, 0, 0, 0, 257}, +{13, 0, 16, 0, 0, 0, 260}, +{9, 0, 50, 0, 0, 0, 260}, +{13, 0, 15, 0, 0, 0, 260}, +{1, 25, 11, 0, 0, 0, 33024}, +{1, 25, 14, 0, 0, 0, 33024}, +{11, 11, 25, 0, 0, 0, 33024}, +{11, 14, 25, 0, 0, 0, 33024}, +{11, 0, 0, 0, 0, 0, 262}, +{11, 0, 0, 0, 0, 0, 33032}, +{11, 0, 0, 1, 0, 0, 256}, +{11, 0, 0, 2, 0, 0, 33024}, +{11, 0, 0, 8, 0, 0, 256}, +{10, 69, 8, 64, 0, 0, 256}, +{32, 0, 0, 0, 0, 0, 771}, +{32, 0, 0, 0, 0, 0, 33024}, +{32, 0, 0, 0, 0, 0, 262}, +{11, 0, 0, 0, 0, 0, 3072}, +{10, 0, 72, 0, 0, 0, 256}, +{33, 43, 51, 0, 0, 0, 33024}, +{33, 44, 51, 0, 0, 0, 33024}, +{33, 51, 43, 0, 0, 0, 33024}, +{33, 51, 44, 0, 0, 0, 33024}, +{32, 0, 0, 0, 0, 0, 256}, +{34, 72, 8, 0, 32, 0, 775}, +{34, 72, 8, 0, 1, 0, 775}, +{34, 72, 8, 0, 64, 0, 775}, +{34, 72, 8, 0, 65, 0, 775}, +{34, 72, 8, 0, 128, 0, 775}, +{34, 72, 8, 0, 4, 0, 775}, +{34, 72, 8, 0, 160, 0, 775}, +{34, 72, 8, 0, 224, 0, 775}, +{32, 0, 16, 0, 32, 0, 261}, +{32, 0, 16, 0, 1, 0, 261}, +{32, 0, 16, 0, 64, 0, 261}, +{32, 0, 16, 0, 65, 0, 261}, +{32, 0, 16, 0, 128, 0, 261}, +{32, 0, 16, 0, 4, 0, 261}, +{32, 0, 16, 0, 160, 0, 261}, +{32, 0, 16, 0, 224, 0, 261}, +{34, 0, 68, 0, 32, 0, 256}, +{34, 0, 68, 0, 1, 0, 256}, +{34, 0, 68, 0, 64, 0, 256}, +{34, 0, 68, 0, 65, 0, 256}, +{34, 0, 68, 0, 128, 0, 256}, +{34, 0, 68, 0, 4, 0, 256}, +{34, 0, 68, 0, 160, 0, 256}, +{34, 0, 68, 0, 224, 0, 256}, +{35, 0, 46, 0, 0, 0, 256}, +{36, 0, 46, 0, 0, 0, 256}, +{34, 8, 72, 1, 0, 244, 256}, +{37, 8, 72, 197, 0, 48, 256}, +{38, 0, 46, 0, 0, 0, 256}, +{39, 0, 46, 0, 0, 0, 256}, +{32, 0, 0, 255, 0, 0, 256}, +{40, 8, 72, 1, 0, 244, 256}, +{34, 72, 8, 33, 0, 212, 256}, +{40, 6, 68, 245, 0, 0, 256}, +{40, 8, 72, 245, 0, 0, 256}, +{41, 60, 8, 0, 0, 0, 256}, +{34, 68, 8, 0, 0, 0, 256}, +{42, 69, 8, 0, 0, 0, 256}, +{42, 10, 56, 0, 0, 0, 1536}, +{43, 0, 18, 0, 0, 0, 256}, +{44, 1, 68, 245, 0, 0, 256}, +{44, 1, 68, 196, 16, 0, 256}, +{44, 1, 68, 245, 1, 0, 256}, +{44, 1, 68, 229, 0, 16, 256}, +{44, 1, 68, 196, 0, 16, 256}, +{45, 1, 68, 245, 0, 0, 256}, +{44, 3, 72, 245, 0, 0, 256}, +{44, 3, 72, 196, 16, 0, 256}, +{44, 3, 72, 245, 1, 0, 256}, +{44, 3, 72, 229, 0, 16, 256}, +{44, 3, 72, 196, 0, 16, 256}, +{45, 3, 72, 245, 0, 0, 256}, +{46, 1, 68, 245, 0, 0, 256}, +{46, 1, 68, 196, 16, 0, 256}, +{46, 1, 68, 245, 1, 0, 256}, +{46, 1, 68, 229, 0, 16, 256}, +{46, 1, 68, 196, 0, 16, 256}, +{47, 1, 68, 245, 0, 0, 256}, +{44, 5, 72, 245, 0, 0, 256}, +{48, 5, 72, 196, 16, 0, 256}, +{44, 5, 72, 245, 1, 0, 256}, +{48, 5, 72, 229, 0, 16, 256}, +{48, 5, 72, 196, 0, 16, 256}, +{45, 5, 72, 245, 0, 0, 256}, +{49, 0, 72, 0, 0, 0, 256}, +{50, 1, 68, 1, 0, 32, 256}, +{50, 1, 68, 1, 1, 32, 256}, +{50, 1, 68, 197, 0, 48, 256}, +{50, 1, 72, 1, 0, 32, 256}, +{50, 1, 72, 1, 1, 32, 256}, +{50, 1, 72, 197, 0, 48, 256}, +{51, 1, 68, 0, 0, 0, 256}, +{52, 0, 1, 0, 0, 0, 768}, +{51, 3, 72, 0, 0, 0, 256}, +{52, 0, 16, 0, 0, 0, 768}, +{50, 41, 68, 33, 0, 0, 256}, +{50, 41, 68, 33, 1, 0, 256}, +{50, 41, 68, 229, 0, 16, 256}, +{50, 41, 72, 33, 0, 0, 256}, +{50, 41, 72, 33, 1, 0, 256}, +{50, 41, 72, 229, 0, 16, 256}, +{50, 42, 68, 1, 0, 32, 256}, +{50, 42, 68, 1, 1, 32, 256}, +{50, 42, 68, 197, 0, 48, 256}, +{50, 42, 72, 1, 0, 32, 256}, +{50, 42, 72, 1, 1, 32, 256}, +{50, 42, 72, 197, 0, 48, 256}, +{45, 0, 64, 0, 0, 0, 512}, +{53, 0, 28, 0, 0, 0, 512}, +{53, 0, 27, 0, 0, 0, 512}, +{53, 0, 0, 0, 0, 0, 512}, +{50, 0, 64, 0, 0, 0, 512}, +{45, 0, 54, 0, 0, 0, 512}, +{45, 0, 63, 0, 0, 0, 512}, +{54, 0, 28, 0, 1, 0, 768}, +{54, 0, 28, 0, 64, 0, 768}, +{54, 0, 28, 0, 65, 0, 768}, +{54, 0, 28, 0, 4, 0, 768}, +{55, 0, 64, 0, 0, 0, 1792}, +{45, 0, 66, 0, 0, 0, 512}, +{50, 0, 66, 0, 0, 0, 512}, +{54, 0, 28, 69, 0, 0, 512}, +{54, 0, 28, 69, 0, 0, 768}, +{45, 0, 65, 0, 0, 0, 512}, +{53, 0, 29, 0, 0, 0, 512}, +{55, 0, 65, 0, 0, 0, 1792}, +{50, 0, 65, 0, 0, 0, 512}, +{55, 0, 63, 0, 0, 0, 1792}, +{50, 0, 63, 0, 0, 0, 512}, +{45, 1, 68, 196, 0, 16, 256}, +{44, 0, 68, 0, 0, 0, 256}, +{44, 0, 68, 245, 0, 0, 256}, +{50, 0, 68, 33, 0, 212, 256}, +{50, 0, 68, 0, 0, 245, 256}, +{45, 3, 72, 196, 0, 16, 256}, +{44, 0, 72, 0, 0, 0, 256}, +{44, 0, 72, 245, 0, 0, 256}, +{50, 0, 72, 33, 0, 212, 256}, +{50, 0, 72, 0, 0, 245, 256}, +{44, 0, 68, 244, 0, 0, 256}, +{44, 0, 72, 244, 0, 0, 256}, +{56, 0, 72, 0, 0, 0, 257}, +{57, 0, 60, 0, 0, 0, 257}, +{56, 0, 72, 0, 0, 0, 260}, +{57, 0, 60, 0, 0, 0, 260}, +{56, 0, 72, 0, 0, 0, 256}, +{45, 0, 72, 0, 0, 0, 256}, +{45, 0, 69, 0, 0, 0, 256}, +{45, 0, 69, 0, 0, 0, 33024}, +{55, 0, 69, 0, 0, 0, 33024}, +{45, 0, 69, 64, 0, 0, 256}, +{56, 0, 61, 0, 0, 0, 256}, +{56, 0, 61, 0, 0, 0, 33024}, +{51, 0, 71, 0, 0, 0, 256}, +{58, 0, 69, 0, 0, 0, 33024}, +{55, 0, 54, 0, 0, 0, 33024}, +{54, 0, 0, 0, 0, 0, 3584}, +{54, 0, 0, 0, 0, 0, 256}, +{13, 0, 0, 0, 0, 0, 768}, +{55, 0, 24, 0, 0, 0, 3840}, +{54, 0, 0, 0, 0, 0, 3840}, +{54, 0, 24, 0, 0, 0, 3840}, +{54, 26, 24, 0, 0, 0, 3840}, +{59, 0, 0, 0, 0, 0, 256}, +{55, 0, 54, 0, 0, 0, 3072}, +{60, 83, 52, 0, 0, 0, 3328}, +{60, 83, 52, 0, 0, 0, 3072}, +{34, 87, 30, 0, 0, 0, 1280}, +{34, 87, 30, 0, 0, 0, 1536}, +{34, 85, 30, 0, 0, 0, 1280}, +{34, 86, 30, 0, 0, 0, 1536}, +{61, 91, 36, 0, 0, 0, 4096}, +{62, 34, 30, 0, 0, 0, 4096}, +{63, 55, 30, 0, 0, 0, 4096}, +{63, 57, 30, 0, 0, 0, 4096}, +{34, 30, 87, 0, 0, 0, 1280}, +{34, 30, 87, 0, 0, 0, 1536}, +{34, 30, 85, 0, 0, 0, 1280}, +{34, 30, 86, 0, 0, 0, 1536}, +{61, 36, 91, 0, 0, 0, 4096}, +{63, 30, 55, 0, 0, 0, 4096}, +{63, 30, 57, 0, 0, 0, 4096}, +{64, 86, 30, 0, 0, 0, 1280}, +{34, 57, 30, 0, 0, 0, 1536}, +{34, 86, 30, 0, 0, 0, 1792}, +{65, 34, 30, 0, 0, 0, 4096}, +{66, 34, 30, 0, 0, 0, 4096}, +{61, 90, 36, 0, 0, 0, 4096}, +{34, 30, 57, 0, 0, 0, 1280}, +{34, 30, 57, 0, 0, 0, 1536}, +{61, 30, 57, 0, 0, 0, 4096}, +{67, 87, 30, 0, 0, 0, 1280}, +{67, 87, 30, 0, 0, 0, 1536}, +{66, 40, 36, 0, 0, 0, 4096}, +{34, 87, 30, 0, 0, 0, 1792}, +{55, 0, 54, 0, 0, 0, 1280}, +{67, 83, 30, 0, 0, 0, 1280}, +{67, 83, 30, 0, 0, 0, 1536}, +{41, 76, 30, 0, 0, 0, 1280}, +{41, 76, 30, 0, 0, 0, 1536}, +{34, 30, 59, 0, 0, 0, 1280}, +{34, 30, 59, 0, 0, 0, 1536}, +{34, 30, 55, 0, 0, 0, 2816}, +{34, 30, 57, 0, 0, 0, 2816}, +{61, 36, 67, 0, 0, 0, 4096}, +{67, 86, 52, 0, 0, 0, 1280}, +{67, 87, 52, 0, 0, 0, 1536}, +{41, 85, 10, 0, 0, 0, 1280}, +{41, 86, 10, 0, 0, 0, 1536}, +{61, 88, 33, 0, 0, 0, 4096}, +{67, 85, 30, 69, 0, 0, 1280}, +{67, 86, 30, 0, 0, 0, 1536}, +{61, 85, 30, 0, 0, 0, 4096}, +{61, 86, 30, 0, 0, 0, 4096}, +{68, 31, 9, 0, 0, 0, 1280}, +{68, 31, 9, 0, 0, 0, 1536}, +{69, 36, 10, 0, 0, 0, 4096}, +{67, 85, 30, 0, 0, 0, 1280}, +{67, 85, 30, 0, 0, 0, 1536}, +{61, 92, 36, 0, 0, 0, 4096}, +{61, 91, 30, 0, 0, 0, 4096}, +{67, 82, 52, 0, 0, 0, 1024}, +{67, 83, 52, 0, 0, 0, 1024}, +{70, 76, 52, 0, 0, 0, 1024}, +{70, 76, 30, 0, 0, 0, 1536}, +{61, 73, 30, 0, 0, 0, 4096}, +{34, 83, 52, 0, 0, 0, 1024}, +{71, 83, 52, 0, 0, 0, 1280}, +{71, 87, 30, 0, 0, 0, 1536}, +{66, 87, 30, 0, 0, 0, 4096}, +{32, 0, 0, 0, 0, 0, 1024}, +{72, 0, 0, 0, 0, 0, 4096}, +{73, 10, 76, 0, 0, 0, 3584}, +{74, 48, 31, 0, 0, 0, 2816}, +{75, 31, 30, 0, 0, 0, 2816}, +{73, 76, 10, 0, 0, 0, 3584}, +{67, 31, 30, 0, 0, 0, 2816}, +{76, 31, 30, 0, 0, 0, 2816}, +{32, 86, 30, 0, 0, 0, 3584}, +{32, 30, 86, 0, 0, 0, 3584}, +{67, 87, 30, 0, 0, 0, 1792}, +{70, 52, 76, 0, 0, 0, 1024}, +{70, 30, 76, 0, 0, 0, 1536}, +{61, 30, 73, 0, 0, 0, 4096}, +{34, 52, 83, 0, 0, 0, 1024}, +{77, 0, 54, 0, 0, 0, 256}, +{78, 0, 62, 0, 0, 0, 256}, +{79, 0, 62, 0, 0, 0, 256}, +{80, 72, 8, 64, 0, 0, 2560}, +{81, 1, 72, 1, 0, 244, 256}, +{48, 1, 72, 1, 0, 244, 256}, +{67, 72, 8, 64, 0, 245, 256}, +{82, 72, 8, 0, 0, 0, 3584}, +{83, 72, 8, 65, 0, 180, 256}, +{84, 87, 30, 0, 0, 0, 1280}, +{84, 87, 30, 0, 0, 0, 1536}, +{84, 85, 30, 0, 0, 0, 1280}, +{84, 86, 30, 0, 0, 0, 1536}, +{85, 40, 36, 0, 0, 0, 4096}, +{85, 34, 30, 0, 0, 0, 4096}, +{71, 79, 52, 0, 0, 0, 1280}, +{71, 79, 30, 0, 0, 0, 1536}, +{86, 34, 30, 0, 0, 0, 4096}, +{87, 53, 9, 0, 0, 0, 1280}, +{71, 31, 9, 0, 0, 0, 1536}, +{88, 30, 10, 0, 0, 0, 4096}, +{71, 87, 30, 0, 0, 0, 1280}, +{86, 40, 36, 0, 0, 0, 4096}, +{89, 0, 58, 64, 0, 0, 256}, +{55, 0, 57, 0, 0, 0, 3584}, +{68, 53, 30, 0, 0, 0, 1536}, +{68, 31, 52, 0, 0, 0, 1536}, +{61, 30, 86, 0, 0, 0, 4096}, +{76, 53, 9, 0, 0, 0, 1280}, +{76, 31, 9, 0, 0, 0, 1536}, +{69, 30, 10, 0, 0, 0, 4096}, +{67, 83, 52, 0, 0, 0, 1280}, +{34, 52, 57, 0, 0, 0, 1280}, +{67, 54, 30, 0, 0, 0, 1792}, +{61, 67, 36, 0, 0, 0, 4096}, +{67, 83, 52, 0, 0, 0, 1536}, +{76, 53, 52, 0, 0, 0, 1280}, +{76, 31, 30, 0, 0, 0, 1536}, +{90, 31, 30, 0, 0, 0, 4096}, +{50, 0, 54, 0, 0, 0, 512}, +{91, 0, 54, 0, 0, 0, 512}, +{91, 0, 63, 0, 0, 0, 512}, +{92, 0, 0, 0, 0, 0, 512}, +{93, 0, 12, 0, 0, 0, 512}, +{94, 0, 12, 0, 0, 0, 512}, +{67, 83, 52, 0, 0, 0, 2048}, +{67, 87, 30, 0, 0, 0, 2048}, +{71, 87, 30, 0, 0, 0, 2304}, +{67, 87, 30, 0, 0, 0, 2560}, +{61, 55, 36, 0, 0, 0, 4096}, +{61, 57, 38, 0, 0, 0, 4096}, +{61, 59, 38, 0, 0, 0, 4096}, +{61, 87, 30, 0, 0, 0, 4096}, +{67, 86, 30, 0, 0, 0, 2304}, +{67, 85, 30, 0, 0, 0, 2304}, +{67, 84, 30, 0, 0, 0, 2304}, +{61, 84, 30, 0, 0, 0, 4096}, +{67, 87, 30, 0, 0, 0, 2304}, +{34, 59, 30, 0, 0, 0, 2304}, +{61, 59, 30, 0, 0, 0, 4096}, +{66, 40, 67, 0, 0, 0, 4096}, +{73, 59, 10, 0, 0, 0, 3584}, +{66, 40, 36, 0, 0, 0, 4352}, +{66, 34, 30, 0, 0, 0, 4352}, +{67, 87, 30, 0, 0, 0, 4864}, +{61, 87, 30, 0, 0, 0, 4864}, +{66, 34, 30, 0, 0, 0, 4864}, +{34, 72, 8, 0, 0, 0, 256}, +{34, 68, 10, 0, 0, 0, 2560}, +{34, 8, 72, 0, 0, 0, 256}, +{34, 72, 10, 0, 0, 0, 2560}, +{66, 91, 36, 0, 0, 0, 4096}, +{86, 39, 38, 0, 0, 0, 4096}, +{71, 85, 30, 0, 0, 0, 2304}, +{71, 86, 30, 0, 0, 0, 2304}, +{71, 83, 52, 0, 0, 0, 2048}, +{71, 87, 30, 0, 0, 0, 2048}, +{71, 30, 74, 0, 0, 0, 2304}, +{88, 30, 80, 0, 0, 0, 4096}, +{71, 30, 75, 0, 0, 0, 2304}, +{88, 30, 81, 0, 0, 0, 4096}, +{95, 30, 76, 0, 0, 0, 2304}, +{66, 30, 73, 0, 0, 0, 4096}, +{71, 30, 76, 0, 0, 0, 2304}, +{66, 30, 70, 0, 0, 0, 4096}, +{66, 38, 87, 0, 0, 0, 4096}, +{71, 78, 30, 0, 0, 0, 2304}, +{95, 76, 30, 0, 0, 0, 2304}, +{71, 87, 30, 0, 0, 0, 4608}, +{86, 34, 30, 0, 0, 0, 4608}, +{71, 87, 30, 0, 0, 0, 2560}, +{71, 87, 30, 0, 0, 0, 4864}, +{66, 87, 30, 0, 0, 0, 4864}, +{96, 1, 53, 0, 0, 0, 1024}, +{55, 1, 31, 0, 0, 0, 1536}, +{97, 31, 34, 0, 0, 0, 4096}, +{98, 0, 10, 0, 0, 0, 3584}, +{55, 0, 55, 0, 0, 0, 256}, +{63, 0, 55, 0, 0, 0, 4096}, +{55, 0, 54, 0, 0, 0, 3584}, +{99, 70, 10, 0, 0, 0, 256}, +{98, 0, 72, 0, 0, 0, 256}, +{100, 83, 52, 0, 0, 0, 3072} }; uint16_t CmpMnemonicOffsets[8] = { diff --git a/NativeCore/Dependencies/distorm/src/insts.h b/NativeCore/Dependencies/distorm/src/insts.h index 77db087b..675ecf96 100644 --- a/NativeCore/Dependencies/distorm/src/insts.h +++ b/NativeCore/Dependencies/distorm/src/insts.h @@ -4,7 +4,7 @@ insts.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ diff --git a/NativeCore/Dependencies/distorm/src/mnemonics.c b/NativeCore/Dependencies/distorm/src/mnemonics.c index 7df13601..91be7a8e 100644 --- a/NativeCore/Dependencies/distorm/src/mnemonics.c +++ b/NativeCore/Dependencies/distorm/src/mnemonics.c @@ -4,7 +4,7 @@ mnemonics.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -27,32 +27,32 @@ const unsigned char _MNEMONICS[] = "\x03" "cqo\0" "\x08" "call far\0" "\x05" "pushf\0" "\x04" "popf\0" \ "\x04" "sahf\0" "\x04" "lahf\0" "\x04" "movs\0" "\x04" "cmps\0" "\x04" "stos\0" \ "\x04" "lods\0" "\x04" "scas\0" "\x03" "ret\0" "\x03" "les\0" "\x03" "lds\0" \ -"\x05" "enter\0" "\x05" "leave\0" "\x04" "retf\0" "\x05" "int 3\0" \ -"\x03" "int\0" "\x04" "into\0" "\x04" "iret\0" "\x03" "aam\0" "\x03" "aad\0" \ -"\x04" "salc\0" "\x04" "xlat\0" "\x06" "loopnz\0" "\x05" "loopz\0" \ -"\x04" "loop\0" "\x04" "jcxz\0" "\x05" "jecxz\0" "\x05" "jrcxz\0" "\x02" "in\0" \ -"\x03" "out\0" "\x04" "call\0" "\x03" "jmp\0" "\x07" "jmp far\0" "\x04" "int1\0" \ -"\x03" "hlt\0" "\x03" "cmc\0" "\x03" "clc\0" "\x03" "stc\0" "\x03" "cli\0" \ -"\x03" "sti\0" "\x03" "cld\0" "\x03" "std\0" "\x03" "lar\0" "\x03" "lsl\0" \ -"\x07" "syscall\0" "\x04" "clts\0" "\x06" "sysret\0" "\x04" "invd\0" \ -"\x06" "wbinvd\0" "\x03" "ud2\0" "\x05" "femms\0" "\x03" "nop\0" "\x05" "wrmsr\0" \ -"\x05" "rdtsc\0" "\x05" "rdmsr\0" "\x05" "rdpmc\0" "\x08" "sysenter\0" \ -"\x07" "sysexit\0" "\x06" "getsec\0" "\x05" "cmovo\0" "\x06" "cmovno\0" \ -"\x05" "cmovb\0" "\x06" "cmovae\0" "\x05" "cmovz\0" "\x06" "cmovnz\0" \ -"\x06" "cmovbe\0" "\x05" "cmova\0" "\x05" "cmovs\0" "\x06" "cmovns\0" \ -"\x05" "cmovp\0" "\x06" "cmovnp\0" "\x05" "cmovl\0" "\x06" "cmovge\0" \ -"\x06" "cmovle\0" "\x05" "cmovg\0" "\x04" "seto\0" "\x05" "setno\0" \ -"\x04" "setb\0" "\x05" "setae\0" "\x04" "setz\0" "\x05" "setnz\0" "\x05" "setbe\0" \ -"\x04" "seta\0" "\x04" "sets\0" "\x05" "setns\0" "\x04" "setp\0" "\x05" "setnp\0" \ -"\x04" "setl\0" "\x05" "setge\0" "\x05" "setle\0" "\x04" "setg\0" "\x05" "cpuid\0" \ -"\x02" "bt\0" "\x04" "shld\0" "\x03" "rsm\0" "\x03" "bts\0" "\x04" "shrd\0" \ -"\x07" "cmpxchg\0" "\x03" "lss\0" "\x03" "btr\0" "\x03" "lfs\0" "\x03" "lgs\0" \ -"\x05" "movzx\0" "\x03" "btc\0" "\x05" "movsx\0" "\x04" "xadd\0" "\x06" "movnti\0" \ -"\x05" "bswap\0" "\x03" "rol\0" "\x03" "ror\0" "\x03" "rcl\0" "\x03" "rcr\0" \ -"\x03" "shl\0" "\x03" "shr\0" "\x03" "sal\0" "\x03" "sar\0" "\x06" "xabort\0" \ -"\x06" "xbegin\0" "\x04" "fadd\0" "\x04" "fmul\0" "\x04" "fcom\0" "\x05" "fcomp\0" \ -"\x04" "fsub\0" "\x05" "fsubr\0" "\x04" "fdiv\0" "\x05" "fdivr\0" "\x03" "fld\0" \ -"\x03" "fst\0" "\x04" "fstp\0" "\x06" "fldenv\0" "\x05" "fldcw\0" "\x04" "fxch\0" \ +"\x05" "enter\0" "\x05" "leave\0" "\x04" "retf\0" "\x04" "int3\0" "\x03" "int\0" \ +"\x04" "into\0" "\x04" "iret\0" "\x03" "aam\0" "\x03" "aad\0" "\x04" "salc\0" \ +"\x04" "xlat\0" "\x06" "loopnz\0" "\x05" "loopz\0" "\x04" "loop\0" \ +"\x04" "jcxz\0" "\x05" "jecxz\0" "\x05" "jrcxz\0" "\x02" "in\0" "\x03" "out\0" \ +"\x04" "call\0" "\x03" "jmp\0" "\x07" "jmp far\0" "\x04" "int1\0" "\x03" "hlt\0" \ +"\x03" "cmc\0" "\x03" "clc\0" "\x03" "stc\0" "\x03" "cli\0" "\x03" "sti\0" \ +"\x03" "cld\0" "\x03" "std\0" "\x03" "lar\0" "\x03" "lsl\0" "\x07" "syscall\0" \ +"\x04" "clts\0" "\x06" "sysret\0" "\x04" "invd\0" "\x06" "wbinvd\0" \ +"\x03" "ud2\0" "\x05" "femms\0" "\x03" "nop\0" "\x05" "wrmsr\0" "\x05" "rdtsc\0" \ +"\x05" "rdmsr\0" "\x05" "rdpmc\0" "\x08" "sysenter\0" "\x07" "sysexit\0" \ +"\x06" "getsec\0" "\x05" "cmovo\0" "\x06" "cmovno\0" "\x05" "cmovb\0" \ +"\x06" "cmovae\0" "\x05" "cmovz\0" "\x06" "cmovnz\0" "\x06" "cmovbe\0" \ +"\x05" "cmova\0" "\x05" "cmovs\0" "\x06" "cmovns\0" "\x05" "cmovp\0" \ +"\x06" "cmovnp\0" "\x05" "cmovl\0" "\x06" "cmovge\0" "\x06" "cmovle\0" \ +"\x05" "cmovg\0" "\x04" "seto\0" "\x05" "setno\0" "\x04" "setb\0" "\x05" "setae\0" \ +"\x04" "setz\0" "\x05" "setnz\0" "\x05" "setbe\0" "\x04" "seta\0" "\x04" "sets\0" \ +"\x05" "setns\0" "\x04" "setp\0" "\x05" "setnp\0" "\x04" "setl\0" "\x05" "setge\0" \ +"\x05" "setle\0" "\x04" "setg\0" "\x05" "cpuid\0" "\x02" "bt\0" "\x04" "shld\0" \ +"\x03" "rsm\0" "\x03" "bts\0" "\x04" "shrd\0" "\x07" "cmpxchg\0" "\x03" "lss\0" \ +"\x03" "btr\0" "\x03" "lfs\0" "\x03" "lgs\0" "\x05" "movzx\0" "\x03" "btc\0" \ +"\x05" "movsx\0" "\x04" "xadd\0" "\x06" "movnti\0" "\x05" "bswap\0" \ +"\x03" "rol\0" "\x03" "ror\0" "\x03" "rcl\0" "\x03" "rcr\0" "\x03" "shl\0" \ +"\x03" "shr\0" "\x03" "sal\0" "\x03" "sar\0" "\x06" "xabort\0" "\x06" "xbegin\0" \ +"\x04" "fadd\0" "\x04" "fmul\0" "\x04" "fcom\0" "\x05" "fcomp\0" "\x04" "fsub\0" \ +"\x05" "fsubr\0" "\x04" "fdiv\0" "\x05" "fdivr\0" "\x03" "fld\0" "\x03" "fst\0" \ +"\x04" "fstp\0" "\x06" "fldenv\0" "\x05" "fldcw\0" "\x04" "fxch\0" \ "\x04" "fnop\0" "\x04" "fchs\0" "\x04" "fabs\0" "\x04" "ftst\0" "\x04" "fxam\0" \ "\x04" "fld1\0" "\x06" "fldl2t\0" "\x06" "fldl2e\0" "\x05" "fldpi\0" \ "\x06" "fldlg2\0" "\x06" "fldln2\0" "\x04" "fldz\0" "\x05" "f2xm1\0" \ @@ -75,238 +75,241 @@ const unsigned char _MNEMONICS[] = "\x04" "verw\0" "\x04" "sgdt\0" "\x04" "sidt\0" "\x04" "lgdt\0" "\x04" "lidt\0" \ "\x04" "smsw\0" "\x04" "lmsw\0" "\x06" "invlpg\0" "\x06" "vmcall\0" \ "\x08" "vmlaunch\0" "\x08" "vmresume\0" "\x06" "vmxoff\0" "\x07" "monitor\0" \ -"\x05" "mwait\0" "\x06" "xgetbv\0" "\x06" "xsetbv\0" "\x06" "vmfunc\0" \ -"\x04" "xend\0" "\x05" "vmrun\0" "\x07" "vmmcall\0" "\x06" "vmload\0" \ -"\x06" "vmsave\0" "\x04" "stgi\0" "\x04" "clgi\0" "\x06" "skinit\0" \ -"\x07" "invlpga\0" "\x06" "swapgs\0" "\x06" "rdtscp\0" "\x08" "prefetch\0" \ -"\x09" "prefetchw\0" "\x05" "pi2fw\0" "\x05" "pi2fd\0" "\x05" "pf2iw\0" \ -"\x05" "pf2id\0" "\x06" "pfnacc\0" "\x07" "pfpnacc\0" "\x07" "pfcmpge\0" \ -"\x05" "pfmin\0" "\x05" "pfrcp\0" "\x07" "pfrsqrt\0" "\x05" "pfsub\0" \ -"\x05" "pfadd\0" "\x07" "pfcmpgt\0" "\x05" "pfmax\0" "\x08" "pfrcpit1\0" \ -"\x08" "pfrsqit1\0" "\x06" "pfsubr\0" "\x05" "pfacc\0" "\x07" "pfcmpeq\0" \ -"\x05" "pfmul\0" "\x08" "pfrcpit2\0" "\x07" "pmulhrw\0" "\x06" "pswapd\0" \ -"\x07" "pavgusb\0" "\x06" "movups\0" "\x06" "movupd\0" "\x05" "movss\0" \ -"\x05" "movsd\0" "\x07" "vmovups\0" "\x07" "vmovupd\0" "\x06" "vmovss\0" \ -"\x06" "vmovsd\0" "\x07" "movhlps\0" "\x06" "movlps\0" "\x06" "movlpd\0" \ -"\x08" "movsldup\0" "\x07" "movddup\0" "\x08" "vmovhlps\0" "\x07" "vmovlps\0" \ -"\x07" "vmovlpd\0" "\x09" "vmovsldup\0" "\x08" "vmovddup\0" "\x08" "unpcklps\0" \ -"\x08" "unpcklpd\0" "\x09" "vunpcklps\0" "\x09" "vunpcklpd\0" "\x08" "unpckhps\0" \ -"\x08" "unpckhpd\0" "\x09" "vunpckhps\0" "\x09" "vunpckhpd\0" "\x07" "movlhps\0" \ -"\x06" "movhps\0" "\x06" "movhpd\0" "\x08" "movshdup\0" "\x08" "vmovlhps\0" \ -"\x07" "vmovhps\0" "\x07" "vmovhpd\0" "\x09" "vmovshdup\0" "\x0b" "prefetchnta\0" \ -"\x0a" "prefetcht0\0" "\x0a" "prefetcht1\0" "\x0a" "prefetcht2\0" "\x06" "movaps\0" \ -"\x06" "movapd\0" "\x07" "vmovaps\0" "\x07" "vmovapd\0" "\x08" "cvtpi2ps\0" \ -"\x08" "cvtpi2pd\0" "\x08" "cvtsi2ss\0" "\x08" "cvtsi2sd\0" "\x09" "vcvtsi2ss\0" \ -"\x09" "vcvtsi2sd\0" "\x07" "movntps\0" "\x07" "movntpd\0" "\x07" "movntss\0" \ -"\x07" "movntsd\0" "\x08" "vmovntps\0" "\x08" "vmovntpd\0" "\x09" "cvttps2pi\0" \ -"\x09" "cvttpd2pi\0" "\x09" "cvttss2si\0" "\x09" "cvttsd2si\0" "\x0a" "vcvttss2si\0" \ -"\x0a" "vcvttsd2si\0" "\x08" "cvtps2pi\0" "\x08" "cvtpd2pi\0" "\x08" "cvtss2si\0" \ -"\x08" "cvtsd2si\0" "\x09" "vcvtss2si\0" "\x09" "vcvtsd2si\0" "\x07" "ucomiss\0" \ -"\x07" "ucomisd\0" "\x08" "vucomiss\0" "\x08" "vucomisd\0" "\x06" "comiss\0" \ -"\x06" "comisd\0" "\x07" "vcomiss\0" "\x07" "vcomisd\0" "\x08" "movmskps\0" \ -"\x08" "movmskpd\0" "\x09" "vmovmskps\0" "\x09" "vmovmskpd\0" "\x06" "sqrtps\0" \ -"\x06" "sqrtpd\0" "\x06" "sqrtss\0" "\x06" "sqrtsd\0" "\x07" "vsqrtps\0" \ -"\x07" "vsqrtpd\0" "\x07" "vsqrtss\0" "\x07" "vsqrtsd\0" "\x07" "rsqrtps\0" \ -"\x07" "rsqrtss\0" "\x08" "vrsqrtps\0" "\x08" "vrsqrtss\0" "\x05" "rcpps\0" \ -"\x05" "rcpss\0" "\x06" "vrcpps\0" "\x06" "vrcpss\0" "\x05" "andps\0" \ -"\x05" "andpd\0" "\x06" "vandps\0" "\x06" "vandpd\0" "\x06" "andnps\0" \ -"\x06" "andnpd\0" "\x07" "vandnps\0" "\x07" "vandnpd\0" "\x04" "orps\0" \ -"\x04" "orpd\0" "\x05" "vorps\0" "\x05" "vorpd\0" "\x05" "xorps\0" \ -"\x05" "xorpd\0" "\x06" "vxorps\0" "\x06" "vxorpd\0" "\x05" "addps\0" \ -"\x05" "addpd\0" "\x05" "addss\0" "\x05" "addsd\0" "\x06" "vaddps\0" \ -"\x06" "vaddpd\0" "\x06" "vaddss\0" "\x06" "vaddsd\0" "\x05" "mulps\0" \ -"\x05" "mulpd\0" "\x05" "mulss\0" "\x05" "mulsd\0" "\x06" "vmulps\0" \ -"\x06" "vmulpd\0" "\x06" "vmulss\0" "\x06" "vmulsd\0" "\x08" "cvtps2pd\0" \ -"\x08" "cvtpd2ps\0" "\x08" "cvtss2sd\0" "\x08" "cvtsd2ss\0" "\x09" "vcvtps2pd\0" \ -"\x09" "vcvtpd2ps\0" "\x09" "vcvtss2sd\0" "\x09" "vcvtsd2ss\0" "\x08" "cvtdq2ps\0" \ -"\x08" "cvtps2dq\0" "\x09" "cvttps2dq\0" "\x09" "vcvtdq2ps\0" "\x09" "vcvtps2dq\0" \ -"\x0a" "vcvttps2dq\0" "\x05" "subps\0" "\x05" "subpd\0" "\x05" "subss\0" \ -"\x05" "subsd\0" "\x06" "vsubps\0" "\x06" "vsubpd\0" "\x06" "vsubss\0" \ -"\x06" "vsubsd\0" "\x05" "minps\0" "\x05" "minpd\0" "\x05" "minss\0" \ -"\x05" "minsd\0" "\x06" "vminps\0" "\x06" "vminpd\0" "\x06" "vminss\0" \ -"\x06" "vminsd\0" "\x05" "divps\0" "\x05" "divpd\0" "\x05" "divss\0" \ -"\x05" "divsd\0" "\x06" "vdivps\0" "\x06" "vdivpd\0" "\x06" "vdivss\0" \ -"\x06" "vdivsd\0" "\x05" "maxps\0" "\x05" "maxpd\0" "\x05" "maxss\0" \ -"\x05" "maxsd\0" "\x06" "vmaxps\0" "\x06" "vmaxpd\0" "\x06" "vmaxss\0" \ -"\x06" "vmaxsd\0" "\x09" "punpcklbw\0" "\x0a" "vpunpcklbw\0" "\x09" "punpcklwd\0" \ -"\x0a" "vpunpcklwd\0" "\x09" "punpckldq\0" "\x0a" "vpunpckldq\0" "\x08" "packsswb\0" \ -"\x09" "vpacksswb\0" "\x07" "pcmpgtb\0" "\x08" "vpcmpgtb\0" "\x07" "pcmpgtw\0" \ -"\x08" "vpcmpgtw\0" "\x07" "pcmpgtd\0" "\x08" "vpcmpgtd\0" "\x08" "packuswb\0" \ -"\x09" "vpackuswb\0" "\x09" "punpckhbw\0" "\x0a" "vpunpckhbw\0" "\x09" "punpckhwd\0" \ -"\x0a" "vpunpckhwd\0" "\x09" "punpckhdq\0" "\x0a" "vpunpckhdq\0" "\x08" "packssdw\0" \ -"\x09" "vpackssdw\0" "\x0a" "punpcklqdq\0" "\x0b" "vpunpcklqdq\0" "\x0a" "punpckhqdq\0" \ -"\x0b" "vpunpckhqdq\0" "\x04" "movd\0" "\x04" "movq\0" "\x05" "vmovd\0" \ -"\x05" "vmovq\0" "\x06" "movdqa\0" "\x06" "movdqu\0" "\x07" "vmovdqa\0" \ -"\x07" "vmovdqu\0" "\x06" "pshufw\0" "\x06" "pshufd\0" "\x07" "pshufhw\0" \ -"\x07" "pshuflw\0" "\x07" "vpshufd\0" "\x08" "vpshufhw\0" "\x08" "vpshuflw\0" \ -"\x07" "pcmpeqb\0" "\x08" "vpcmpeqb\0" "\x07" "pcmpeqw\0" "\x08" "vpcmpeqw\0" \ -"\x07" "pcmpeqd\0" "\x08" "vpcmpeqd\0" "\x04" "emms\0" "\x0a" "vzeroupper\0" \ -"\x08" "vzeroall\0" "\x06" "vmread\0" "\x05" "extrq\0" "\x07" "insertq\0" \ -"\x07" "vmwrite\0" "\x08" "cvtph2ps\0" "\x08" "cvtps2ph\0" "\x06" "haddpd\0" \ -"\x06" "haddps\0" "\x07" "vhaddpd\0" "\x07" "vhaddps\0" "\x06" "hsubpd\0" \ -"\x06" "hsubps\0" "\x07" "vhsubpd\0" "\x07" "vhsubps\0" "\x05" "xsave\0" \ -"\x07" "xsave64\0" "\x06" "lfence\0" "\x06" "xrstor\0" "\x08" "xrstor64\0" \ -"\x06" "mfence\0" "\x08" "xsaveopt\0" "\x0a" "xsaveopt64\0" "\x06" "sfence\0" \ -"\x07" "clflush\0" "\x06" "popcnt\0" "\x03" "bsf\0" "\x05" "tzcnt\0" \ -"\x03" "bsr\0" "\x05" "lzcnt\0" "\x07" "cmpeqps\0" "\x07" "cmpltps\0" \ -"\x07" "cmpleps\0" "\x0a" "cmpunordps\0" "\x08" "cmpneqps\0" "\x08" "cmpnltps\0" \ -"\x08" "cmpnleps\0" "\x08" "cmpordps\0" "\x07" "cmpeqpd\0" "\x07" "cmpltpd\0" \ -"\x07" "cmplepd\0" "\x0a" "cmpunordpd\0" "\x08" "cmpneqpd\0" "\x08" "cmpnltpd\0" \ -"\x08" "cmpnlepd\0" "\x08" "cmpordpd\0" "\x07" "cmpeqss\0" "\x07" "cmpltss\0" \ -"\x07" "cmpless\0" "\x0a" "cmpunordss\0" "\x08" "cmpneqss\0" "\x08" "cmpnltss\0" \ -"\x08" "cmpnless\0" "\x08" "cmpordss\0" "\x07" "cmpeqsd\0" "\x07" "cmpltsd\0" \ -"\x07" "cmplesd\0" "\x0a" "cmpunordsd\0" "\x08" "cmpneqsd\0" "\x08" "cmpnltsd\0" \ -"\x08" "cmpnlesd\0" "\x08" "cmpordsd\0" "\x08" "vcmpeqps\0" "\x08" "vcmpltps\0" \ -"\x08" "vcmpleps\0" "\x0b" "vcmpunordps\0" "\x09" "vcmpneqps\0" "\x09" "vcmpnltps\0" \ -"\x09" "vcmpnleps\0" "\x09" "vcmpordps\0" "\x0b" "vcmpeq_uqps\0" "\x09" "vcmpngeps\0" \ -"\x09" "vcmpngtps\0" "\x0b" "vcmpfalseps\0" "\x0c" "vcmpneq_oqps\0" "\x08" "vcmpgeps\0" \ -"\x08" "vcmpgtps\0" "\x0a" "vcmptrueps\0" "\x0b" "vcmpeq_osps\0" "\x0b" "vcmplt_oqps\0" \ -"\x0b" "vcmple_oqps\0" "\x0d" "vcmpunord_sps\0" "\x0c" "vcmpneq_usps\0" \ -"\x0c" "vcmpnlt_uqps\0" "\x0c" "vcmpnle_uqps\0" "\x0b" "vcmpord_sps\0" \ -"\x0b" "vcmpeq_usps\0" "\x0c" "vcmpnge_uqps\0" "\x0c" "vcmpngt_uqps\0" \ -"\x0e" "vcmpfalse_osps\0" "\x0c" "vcmpneq_osps\0" "\x0b" "vcmpge_oqps\0" \ -"\x0b" "vcmpgt_oqps\0" "\x0d" "vcmptrue_usps\0" "\x08" "vcmpeqpd\0" "\x08" "vcmpltpd\0" \ -"\x08" "vcmplepd\0" "\x0b" "vcmpunordpd\0" "\x09" "vcmpneqpd\0" "\x09" "vcmpnltpd\0" \ -"\x09" "vcmpnlepd\0" "\x09" "vcmpordpd\0" "\x0b" "vcmpeq_uqpd\0" "\x09" "vcmpngepd\0" \ -"\x09" "vcmpngtpd\0" "\x0b" "vcmpfalsepd\0" "\x0c" "vcmpneq_oqpd\0" "\x08" "vcmpgepd\0" \ -"\x08" "vcmpgtpd\0" "\x0a" "vcmptruepd\0" "\x0b" "vcmpeq_ospd\0" "\x0b" "vcmplt_oqpd\0" \ -"\x0b" "vcmple_oqpd\0" "\x0d" "vcmpunord_spd\0" "\x0c" "vcmpneq_uspd\0" \ -"\x0c" "vcmpnlt_uqpd\0" "\x0c" "vcmpnle_uqpd\0" "\x0b" "vcmpord_spd\0" \ -"\x0b" "vcmpeq_uspd\0" "\x0c" "vcmpnge_uqpd\0" "\x0c" "vcmpngt_uqpd\0" \ -"\x0e" "vcmpfalse_ospd\0" "\x0c" "vcmpneq_ospd\0" "\x0b" "vcmpge_oqpd\0" \ -"\x0b" "vcmpgt_oqpd\0" "\x0d" "vcmptrue_uspd\0" "\x08" "vcmpeqss\0" "\x08" "vcmpltss\0" \ -"\x08" "vcmpless\0" "\x0b" "vcmpunordss\0" "\x09" "vcmpneqss\0" "\x09" "vcmpnltss\0" \ -"\x09" "vcmpnless\0" "\x09" "vcmpordss\0" "\x0b" "vcmpeq_uqss\0" "\x09" "vcmpngess\0" \ -"\x09" "vcmpngtss\0" "\x0b" "vcmpfalsess\0" "\x0c" "vcmpneq_oqss\0" "\x08" "vcmpgess\0" \ -"\x08" "vcmpgtss\0" "\x0a" "vcmptruess\0" "\x0b" "vcmpeq_osss\0" "\x0b" "vcmplt_oqss\0" \ -"\x0b" "vcmple_oqss\0" "\x0d" "vcmpunord_sss\0" "\x0c" "vcmpneq_usss\0" \ -"\x0c" "vcmpnlt_uqss\0" "\x0c" "vcmpnle_uqss\0" "\x0b" "vcmpord_sss\0" \ -"\x0b" "vcmpeq_usss\0" "\x0c" "vcmpnge_uqss\0" "\x0c" "vcmpngt_uqss\0" \ -"\x0e" "vcmpfalse_osss\0" "\x0c" "vcmpneq_osss\0" "\x0b" "vcmpge_oqss\0" \ -"\x0b" "vcmpgt_oqss\0" "\x0d" "vcmptrue_usss\0" "\x08" "vcmpeqsd\0" "\x08" "vcmpltsd\0" \ -"\x08" "vcmplesd\0" "\x0b" "vcmpunordsd\0" "\x09" "vcmpneqsd\0" "\x09" "vcmpnltsd\0" \ -"\x09" "vcmpnlesd\0" "\x09" "vcmpordsd\0" "\x0b" "vcmpeq_uqsd\0" "\x09" "vcmpngesd\0" \ -"\x09" "vcmpngtsd\0" "\x0b" "vcmpfalsesd\0" "\x0c" "vcmpneq_oqsd\0" "\x08" "vcmpgesd\0" \ -"\x08" "vcmpgtsd\0" "\x0a" "vcmptruesd\0" "\x0b" "vcmpeq_ossd\0" "\x0b" "vcmplt_oqsd\0" \ -"\x0b" "vcmple_oqsd\0" "\x0d" "vcmpunord_ssd\0" "\x0c" "vcmpneq_ussd\0" \ -"\x0c" "vcmpnlt_uqsd\0" "\x0c" "vcmpnle_uqsd\0" "\x0b" "vcmpord_ssd\0" \ -"\x0b" "vcmpeq_ussd\0" "\x0c" "vcmpnge_uqsd\0" "\x0c" "vcmpngt_uqsd\0" \ -"\x0e" "vcmpfalse_ossd\0" "\x0c" "vcmpneq_ossd\0" "\x0b" "vcmpge_oqsd\0" \ -"\x0b" "vcmpgt_oqsd\0" "\x0d" "vcmptrue_ussd\0" "\x06" "pinsrw\0" "\x07" "vpinsrw\0" \ -"\x06" "pextrw\0" "\x07" "vpextrw\0" "\x06" "shufps\0" "\x06" "shufpd\0" \ -"\x07" "vshufps\0" "\x07" "vshufpd\0" "\x09" "cmpxchg8b\0" "\x0a" "cmpxchg16b\0" \ -"\x07" "vmptrst\0" "\x08" "addsubpd\0" "\x08" "addsubps\0" "\x09" "vaddsubpd\0" \ -"\x09" "vaddsubps\0" "\x05" "psrlw\0" "\x06" "vpsrlw\0" "\x05" "psrld\0" \ -"\x06" "vpsrld\0" "\x05" "psrlq\0" "\x06" "vpsrlq\0" "\x05" "paddq\0" \ -"\x06" "vpaddq\0" "\x06" "pmullw\0" "\x07" "vpmullw\0" "\x07" "movq2dq\0" \ -"\x07" "movdq2q\0" "\x08" "pmovmskb\0" "\x09" "vpmovmskb\0" "\x07" "psubusb\0" \ -"\x08" "vpsubusb\0" "\x07" "psubusw\0" "\x08" "vpsubusw\0" "\x06" "pminub\0" \ -"\x07" "vpminub\0" "\x04" "pand\0" "\x05" "vpand\0" "\x07" "paddusb\0" \ -"\x08" "vpaddusw\0" "\x07" "paddusw\0" "\x06" "pmaxub\0" "\x07" "vpmaxub\0" \ -"\x05" "pandn\0" "\x06" "vpandn\0" "\x05" "pavgb\0" "\x06" "vpavgb\0" \ -"\x05" "psraw\0" "\x06" "vpsraw\0" "\x05" "psrad\0" "\x06" "vpsrad\0" \ -"\x05" "pavgw\0" "\x06" "vpavgw\0" "\x07" "pmulhuw\0" "\x08" "vpmulhuw\0" \ -"\x06" "pmulhw\0" "\x07" "vpmulhw\0" "\x09" "cvttpd2dq\0" "\x08" "cvtdq2pd\0" \ -"\x08" "cvtpd2dq\0" "\x0a" "vcvttpd2dq\0" "\x09" "vcvtdq2pd\0" "\x09" "vcvtpd2dq\0" \ -"\x06" "movntq\0" "\x07" "movntdq\0" "\x08" "vmovntdq\0" "\x06" "psubsb\0" \ -"\x07" "vpsubsb\0" "\x06" "psubsw\0" "\x07" "vpsubsw\0" "\x06" "pminsw\0" \ -"\x07" "vpminsw\0" "\x03" "por\0" "\x04" "vpor\0" "\x06" "paddsb\0" \ -"\x07" "vpaddsb\0" "\x06" "paddsw\0" "\x07" "vpaddsw\0" "\x06" "pmaxsw\0" \ -"\x07" "vpmaxsw\0" "\x04" "pxor\0" "\x05" "vpxor\0" "\x05" "lddqu\0" \ -"\x06" "vlddqu\0" "\x05" "psllw\0" "\x06" "vpsllw\0" "\x05" "pslld\0" \ -"\x06" "vpslld\0" "\x05" "psllq\0" "\x06" "vpsllq\0" "\x07" "pmuludq\0" \ -"\x08" "vpmuludq\0" "\x07" "pmaddwd\0" "\x08" "vpmaddwd\0" "\x06" "psadbw\0" \ -"\x07" "vpsadbw\0" "\x08" "maskmovq\0" "\x0a" "maskmovdqu\0" "\x0b" "vmaskmovdqu\0" \ -"\x05" "psubb\0" "\x06" "vpsubb\0" "\x05" "psubw\0" "\x06" "vpsubw\0" \ -"\x05" "psubd\0" "\x06" "vpsubd\0" "\x05" "psubq\0" "\x06" "vpsubq\0" \ -"\x05" "paddb\0" "\x06" "vpaddb\0" "\x05" "paddw\0" "\x06" "vpaddw\0" \ -"\x05" "paddd\0" "\x06" "vpaddd\0" "\x07" "fnstenv\0" "\x06" "fstenv\0" \ -"\x06" "fnstcw\0" "\x05" "fstcw\0" "\x06" "fnclex\0" "\x05" "fclex\0" \ -"\x06" "fninit\0" "\x05" "finit\0" "\x06" "fnsave\0" "\x05" "fsave\0" \ -"\x06" "fnstsw\0" "\x05" "fstsw\0" "\x06" "pshufb\0" "\x07" "vpshufb\0" \ -"\x06" "phaddw\0" "\x07" "vphaddw\0" "\x06" "phaddd\0" "\x07" "vphaddd\0" \ -"\x07" "phaddsw\0" "\x08" "vphaddsw\0" "\x09" "pmaddubsw\0" "\x0a" "vpmaddubsw\0" \ -"\x06" "phsubw\0" "\x07" "vphsubw\0" "\x06" "phsubd\0" "\x07" "vphsubd\0" \ -"\x07" "phsubsw\0" "\x08" "vphsubsw\0" "\x06" "psignb\0" "\x07" "vpsignb\0" \ -"\x06" "psignw\0" "\x07" "vpsignw\0" "\x06" "psignd\0" "\x07" "vpsignd\0" \ -"\x08" "pmulhrsw\0" "\x09" "vpmulhrsw\0" "\x09" "vpermilps\0" "\x09" "vpermilpd\0" \ -"\x07" "vtestps\0" "\x07" "vtestpd\0" "\x08" "pblendvb\0" "\x08" "blendvps\0" \ -"\x08" "blendvpd\0" "\x05" "ptest\0" "\x06" "vptest\0" "\x0c" "vbroadcastss\0" \ -"\x0c" "vbroadcastsd\0" "\x0e" "vbroadcastf128\0" "\x05" "pabsb\0" "\x06" "vpabsb\0" \ -"\x05" "pabsw\0" "\x06" "vpabsw\0" "\x05" "pabsd\0" "\x06" "vpabsd\0" \ -"\x08" "pmovsxbw\0" "\x09" "vpmovsxbw\0" "\x08" "pmovsxbd\0" "\x09" "vpmovsxbd\0" \ -"\x08" "pmovsxbq\0" "\x09" "vpmovsxbq\0" "\x08" "pmovsxwd\0" "\x09" "vpmovsxwd\0" \ -"\x08" "pmovsxwq\0" "\x09" "vpmovsxwq\0" "\x08" "pmovsxdq\0" "\x09" "vpmovsxdq\0" \ -"\x06" "pmuldq\0" "\x07" "vpmuldq\0" "\x07" "pcmpeqq\0" "\x08" "vpcmpeqq\0" \ -"\x08" "movntdqa\0" "\x09" "vmovntdqa\0" "\x08" "packusdw\0" "\x09" "vpackusdw\0" \ -"\x0a" "vmaskmovps\0" "\x0a" "vmaskmovpd\0" "\x08" "pmovzxbw\0" "\x09" "vpmovzxbw\0" \ -"\x08" "pmovzxbd\0" "\x09" "vpmovzxbd\0" "\x08" "pmovzxbq\0" "\x09" "vpmovzxbq\0" \ -"\x08" "pmovzxwd\0" "\x09" "vpmovzxwd\0" "\x08" "pmovzxwq\0" "\x09" "vpmovzxwq\0" \ -"\x08" "pmovzxdq\0" "\x09" "vpmovzxdq\0" "\x07" "pcmpgtq\0" "\x08" "vpcmpgtq\0" \ -"\x06" "pminsb\0" "\x07" "vpminsb\0" "\x06" "pminsd\0" "\x07" "vpminsd\0" \ -"\x06" "pminuw\0" "\x07" "vpminuw\0" "\x06" "pminud\0" "\x07" "vpminud\0" \ -"\x06" "pmaxsb\0" "\x07" "vpmaxsb\0" "\x06" "pmaxsd\0" "\x07" "vpmaxsd\0" \ -"\x06" "pmaxuw\0" "\x07" "vpmaxuw\0" "\x06" "pmaxud\0" "\x07" "vpmaxud\0" \ -"\x06" "pmulld\0" "\x07" "vpmulld\0" "\x0a" "phminposuw\0" "\x0b" "vphminposuw\0" \ -"\x06" "invept\0" "\x07" "invvpid\0" "\x07" "invpcid\0" "\x0e" "vfmaddsub132ps\0" \ -"\x0e" "vfmaddsub132pd\0" "\x0e" "vfmsubadd132ps\0" "\x0e" "vfmsubadd132pd\0" \ -"\x0b" "vfmadd132ps\0" "\x0b" "vfmadd132pd\0" "\x0b" "vfmadd132ss\0" \ -"\x0b" "vfmadd132sd\0" "\x0b" "vfmsub132ps\0" "\x0b" "vfmsub132pd\0" \ -"\x0b" "vfmsub132ss\0" "\x0b" "vfmsub132sd\0" "\x0c" "vfnmadd132ps\0" \ -"\x0c" "vfnmadd132pd\0" "\x0c" "vfnmadd132ss\0" "\x0c" "vfnmadd132sd\0" \ -"\x0c" "vfnmsub132ps\0" "\x0c" "vfnmsub132pd\0" "\x0c" "vfnmsub132ss\0" \ -"\x0c" "vfnmsub132sd\0" "\x0e" "vfmaddsub213ps\0" "\x0e" "vfmaddsub213pd\0" \ -"\x0e" "vfmsubadd213ps\0" "\x0e" "vfmsubadd213pd\0" "\x0b" "vfmadd213ps\0" \ -"\x0b" "vfmadd213pd\0" "\x0b" "vfmadd213ss\0" "\x0b" "vfmadd213sd\0" \ -"\x0b" "vfmsub213ps\0" "\x0b" "vfmsub213pd\0" "\x0b" "vfmsub213ss\0" \ -"\x0b" "vfmsub213sd\0" "\x0c" "vfnmadd213ps\0" "\x0c" "vfnmadd213pd\0" \ -"\x0c" "vfnmadd213ss\0" "\x0c" "vfnmadd213sd\0" "\x0c" "vfnmsub213ps\0" \ -"\x0c" "vfnmsub213pd\0" "\x0c" "vfnmsub213ss\0" "\x0c" "vfnmsub213sd\0" \ -"\x0e" "vfmaddsub231ps\0" "\x0e" "vfmaddsub231pd\0" "\x0e" "vfmsubadd231ps\0" \ -"\x0e" "vfmsubadd231pd\0" "\x0b" "vfmadd231ps\0" "\x0b" "vfmadd231pd\0" \ -"\x0b" "vfmadd231ss\0" "\x0b" "vfmadd231sd\0" "\x0b" "vfmsub231ps\0" \ -"\x0b" "vfmsub231pd\0" "\x0b" "vfmsub231ss\0" "\x0b" "vfmsub231sd\0" \ -"\x0c" "vfnmadd231ps\0" "\x0c" "vfnmadd231pd\0" "\x0c" "vfnmadd231ss\0" \ -"\x0c" "vfnmadd231sd\0" "\x0c" "vfnmsub231ps\0" "\x0c" "vfnmsub231pd\0" \ -"\x0c" "vfnmsub231ss\0" "\x0c" "vfnmsub231sd\0" "\x06" "aesimc\0" "\x07" "vaesimc\0" \ -"\x06" "aesenc\0" "\x07" "vaesenc\0" "\x0a" "aesenclast\0" "\x0b" "vaesenclast\0" \ -"\x06" "aesdec\0" "\x07" "vaesdec\0" "\x0a" "aesdeclast\0" "\x0b" "vaesdeclast\0" \ -"\x05" "movbe\0" "\x05" "crc32\0" "\x0a" "vperm2f128\0" "\x07" "roundps\0" \ -"\x08" "vroundps\0" "\x07" "roundpd\0" "\x08" "vroundpd\0" "\x07" "roundss\0" \ -"\x08" "vroundss\0" "\x07" "roundsd\0" "\x08" "vroundsd\0" "\x07" "blendps\0" \ -"\x08" "vblendps\0" "\x07" "blendpd\0" "\x08" "vblendpd\0" "\x07" "pblendw\0" \ -"\x08" "vpblendw\0" "\x07" "palignr\0" "\x08" "vpalignr\0" "\x06" "pextrb\0" \ -"\x07" "vpextrb\0" "\x06" "pextrd\0" "\x06" "pextrq\0" "\x07" "vpextrd\0" \ -"\x07" "vpextrq\0" "\x09" "extractps\0" "\x0a" "vextractps\0" "\x0b" "vinsertf128\0" \ -"\x0c" "vextractf128\0" "\x06" "pinsrb\0" "\x07" "vpinsrb\0" "\x08" "insertps\0" \ -"\x09" "vinsertps\0" "\x06" "pinsrd\0" "\x06" "pinsrq\0" "\x07" "vpinsrd\0" \ -"\x07" "vpinsrq\0" "\x04" "dpps\0" "\x05" "vdpps\0" "\x04" "dppd\0" \ -"\x05" "vdppd\0" "\x07" "mpsadbw\0" "\x08" "vmpsadbw\0" "\x09" "pclmulqdq\0" \ -"\x0a" "vpclmulqdq\0" "\x09" "vblendvps\0" "\x09" "vblendvpd\0" "\x09" "vpblendvb\0" \ -"\x09" "pcmpestrm\0" "\x0a" "vpcmpestrm\0" "\x09" "pcmpestri\0" "\x0a" "vpcmpestri\0" \ -"\x09" "pcmpistrm\0" "\x0a" "vpcmpistrm\0" "\x09" "pcmpistri\0" "\x0a" "vpcmpistri\0" \ -"\x0f" "aeskeygenassist\0" "\x10" "vaeskeygenassist\0" "\x06" "psrldq\0" \ -"\x07" "vpsrldq\0" "\x06" "pslldq\0" "\x07" "vpslldq\0" "\x06" "fxsave\0" \ -"\x08" "fxsave64\0" "\x08" "rdfsbase\0" "\x07" "fxrstor\0" "\x09" "fxrstor64\0" \ -"\x08" "rdgsbase\0" "\x07" "ldmxcsr\0" "\x08" "wrfsbase\0" "\x08" "vldmxcsr\0" \ -"\x07" "stmxcsr\0" "\x08" "wrgsbase\0" "\x08" "vstmxcsr\0" "\x07" "vmptrld\0" \ -"\x07" "vmclear\0" "\x05" "vmxon\0" "\x06" "movsxd\0" "\x05" "pause\0" \ -"\x04" "wait\0" "\x06" "rdrand\0" "\x06" "_3dnow\0"; +"\x05" "mwait\0" "\x04" "clac\0" "\x04" "stac\0" "\x06" "xgetbv\0" \ +"\x06" "xsetbv\0" "\x06" "vmfunc\0" "\x04" "xend\0" "\x05" "vmrun\0" \ +"\x07" "vmmcall\0" "\x06" "vmload\0" "\x06" "vmsave\0" "\x04" "stgi\0" \ +"\x04" "clgi\0" "\x06" "skinit\0" "\x07" "invlpga\0" "\x06" "swapgs\0" \ +"\x06" "rdtscp\0" "\x08" "prefetch\0" "\x09" "prefetchw\0" "\x05" "pi2fw\0" \ +"\x05" "pi2fd\0" "\x05" "pf2iw\0" "\x05" "pf2id\0" "\x06" "pfnacc\0" \ +"\x07" "pfpnacc\0" "\x07" "pfcmpge\0" "\x05" "pfmin\0" "\x05" "pfrcp\0" \ +"\x07" "pfrsqrt\0" "\x05" "pfsub\0" "\x05" "pfadd\0" "\x07" "pfcmpgt\0" \ +"\x05" "pfmax\0" "\x08" "pfrcpit1\0" "\x08" "pfrsqit1\0" "\x06" "pfsubr\0" \ +"\x05" "pfacc\0" "\x07" "pfcmpeq\0" "\x05" "pfmul\0" "\x08" "pfrcpit2\0" \ +"\x07" "pmulhrw\0" "\x06" "pswapd\0" "\x07" "pavgusb\0" "\x06" "movups\0" \ +"\x06" "movupd\0" "\x05" "movss\0" "\x05" "movsd\0" "\x07" "vmovups\0" \ +"\x07" "vmovupd\0" "\x06" "vmovss\0" "\x06" "vmovsd\0" "\x07" "movhlps\0" \ +"\x06" "movlps\0" "\x06" "movlpd\0" "\x08" "movsldup\0" "\x07" "movddup\0" \ +"\x08" "vmovhlps\0" "\x07" "vmovlps\0" "\x07" "vmovlpd\0" "\x09" "vmovsldup\0" \ +"\x08" "vmovddup\0" "\x08" "unpcklps\0" "\x08" "unpcklpd\0" "\x09" "vunpcklps\0" \ +"\x09" "vunpcklpd\0" "\x08" "unpckhps\0" "\x08" "unpckhpd\0" "\x09" "vunpckhps\0" \ +"\x09" "vunpckhpd\0" "\x07" "movlhps\0" "\x06" "movhps\0" "\x06" "movhpd\0" \ +"\x08" "movshdup\0" "\x08" "vmovlhps\0" "\x07" "vmovhps\0" "\x07" "vmovhpd\0" \ +"\x09" "vmovshdup\0" "\x0b" "prefetchnta\0" "\x0a" "prefetcht0\0" "\x0a" "prefetcht1\0" \ +"\x0a" "prefetcht2\0" "\x06" "movaps\0" "\x06" "movapd\0" "\x07" "vmovaps\0" \ +"\x07" "vmovapd\0" "\x08" "cvtpi2ps\0" "\x08" "cvtpi2pd\0" "\x08" "cvtsi2ss\0" \ +"\x08" "cvtsi2sd\0" "\x09" "vcvtsi2ss\0" "\x09" "vcvtsi2sd\0" "\x07" "movntps\0" \ +"\x07" "movntpd\0" "\x07" "movntss\0" "\x07" "movntsd\0" "\x08" "vmovntps\0" \ +"\x08" "vmovntpd\0" "\x09" "cvttps2pi\0" "\x09" "cvttpd2pi\0" "\x09" "cvttss2si\0" \ +"\x09" "cvttsd2si\0" "\x0a" "vcvttss2si\0" "\x0a" "vcvttsd2si\0" "\x08" "cvtps2pi\0" \ +"\x08" "cvtpd2pi\0" "\x08" "cvtss2si\0" "\x08" "cvtsd2si\0" "\x09" "vcvtss2si\0" \ +"\x09" "vcvtsd2si\0" "\x07" "ucomiss\0" "\x07" "ucomisd\0" "\x08" "vucomiss\0" \ +"\x08" "vucomisd\0" "\x06" "comiss\0" "\x06" "comisd\0" "\x07" "vcomiss\0" \ +"\x07" "vcomisd\0" "\x08" "movmskps\0" "\x08" "movmskpd\0" "\x09" "vmovmskps\0" \ +"\x09" "vmovmskpd\0" "\x06" "sqrtps\0" "\x06" "sqrtpd\0" "\x06" "sqrtss\0" \ +"\x06" "sqrtsd\0" "\x07" "vsqrtps\0" "\x07" "vsqrtpd\0" "\x07" "vsqrtss\0" \ +"\x07" "vsqrtsd\0" "\x07" "rsqrtps\0" "\x07" "rsqrtss\0" "\x08" "vrsqrtps\0" \ +"\x08" "vrsqrtss\0" "\x05" "rcpps\0" "\x05" "rcpss\0" "\x06" "vrcpps\0" \ +"\x06" "vrcpss\0" "\x05" "andps\0" "\x05" "andpd\0" "\x06" "vandps\0" \ +"\x06" "vandpd\0" "\x06" "andnps\0" "\x06" "andnpd\0" "\x07" "vandnps\0" \ +"\x07" "vandnpd\0" "\x04" "orps\0" "\x04" "orpd\0" "\x05" "vorps\0" \ +"\x05" "vorpd\0" "\x05" "xorps\0" "\x05" "xorpd\0" "\x06" "vxorps\0" \ +"\x06" "vxorpd\0" "\x05" "addps\0" "\x05" "addpd\0" "\x05" "addss\0" \ +"\x05" "addsd\0" "\x06" "vaddps\0" "\x06" "vaddpd\0" "\x06" "vaddss\0" \ +"\x06" "vaddsd\0" "\x05" "mulps\0" "\x05" "mulpd\0" "\x05" "mulss\0" \ +"\x05" "mulsd\0" "\x06" "vmulps\0" "\x06" "vmulpd\0" "\x06" "vmulss\0" \ +"\x06" "vmulsd\0" "\x08" "cvtps2pd\0" "\x08" "cvtpd2ps\0" "\x08" "cvtss2sd\0" \ +"\x08" "cvtsd2ss\0" "\x09" "vcvtps2pd\0" "\x09" "vcvtpd2ps\0" "\x09" "vcvtss2sd\0" \ +"\x09" "vcvtsd2ss\0" "\x08" "cvtdq2ps\0" "\x08" "cvtps2dq\0" "\x09" "cvttps2dq\0" \ +"\x09" "vcvtdq2ps\0" "\x09" "vcvtps2dq\0" "\x0a" "vcvttps2dq\0" "\x05" "subps\0" \ +"\x05" "subpd\0" "\x05" "subss\0" "\x05" "subsd\0" "\x06" "vsubps\0" \ +"\x06" "vsubpd\0" "\x06" "vsubss\0" "\x06" "vsubsd\0" "\x05" "minps\0" \ +"\x05" "minpd\0" "\x05" "minss\0" "\x05" "minsd\0" "\x06" "vminps\0" \ +"\x06" "vminpd\0" "\x06" "vminss\0" "\x06" "vminsd\0" "\x05" "divps\0" \ +"\x05" "divpd\0" "\x05" "divss\0" "\x05" "divsd\0" "\x06" "vdivps\0" \ +"\x06" "vdivpd\0" "\x06" "vdivss\0" "\x06" "vdivsd\0" "\x05" "maxps\0" \ +"\x05" "maxpd\0" "\x05" "maxss\0" "\x05" "maxsd\0" "\x06" "vmaxps\0" \ +"\x06" "vmaxpd\0" "\x06" "vmaxss\0" "\x06" "vmaxsd\0" "\x09" "punpcklbw\0" \ +"\x0a" "vpunpcklbw\0" "\x09" "punpcklwd\0" "\x0a" "vpunpcklwd\0" "\x09" "punpckldq\0" \ +"\x0a" "vpunpckldq\0" "\x08" "packsswb\0" "\x09" "vpacksswb\0" "\x07" "pcmpgtb\0" \ +"\x08" "vpcmpgtb\0" "\x07" "pcmpgtw\0" "\x08" "vpcmpgtw\0" "\x07" "pcmpgtd\0" \ +"\x08" "vpcmpgtd\0" "\x08" "packuswb\0" "\x09" "vpackuswb\0" "\x09" "punpckhbw\0" \ +"\x0a" "vpunpckhbw\0" "\x09" "punpckhwd\0" "\x0a" "vpunpckhwd\0" "\x09" "punpckhdq\0" \ +"\x0a" "vpunpckhdq\0" "\x08" "packssdw\0" "\x09" "vpackssdw\0" "\x0a" "punpcklqdq\0" \ +"\x0b" "vpunpcklqdq\0" "\x0a" "punpckhqdq\0" "\x0b" "vpunpckhqdq\0" "\x04" "movd\0" \ +"\x04" "movq\0" "\x05" "vmovd\0" "\x05" "vmovq\0" "\x06" "movdqa\0" \ +"\x06" "movdqu\0" "\x07" "vmovdqa\0" "\x07" "vmovdqu\0" "\x06" "pshufw\0" \ +"\x06" "pshufd\0" "\x07" "pshufhw\0" "\x07" "pshuflw\0" "\x07" "vpshufd\0" \ +"\x08" "vpshufhw\0" "\x08" "vpshuflw\0" "\x07" "pcmpeqb\0" "\x08" "vpcmpeqb\0" \ +"\x07" "pcmpeqw\0" "\x08" "vpcmpeqw\0" "\x07" "pcmpeqd\0" "\x08" "vpcmpeqd\0" \ +"\x04" "emms\0" "\x0a" "vzeroupper\0" "\x08" "vzeroall\0" "\x06" "vmread\0" \ +"\x05" "extrq\0" "\x07" "insertq\0" "\x07" "vmwrite\0" "\x08" "cvtph2ps\0" \ +"\x08" "cvtps2ph\0" "\x06" "haddpd\0" "\x06" "haddps\0" "\x07" "vhaddpd\0" \ +"\x07" "vhaddps\0" "\x06" "hsubpd\0" "\x06" "hsubps\0" "\x07" "vhsubpd\0" \ +"\x07" "vhsubps\0" "\x05" "xsave\0" "\x07" "xsave64\0" "\x06" "lfence\0" \ +"\x06" "xrstor\0" "\x08" "xrstor64\0" "\x06" "mfence\0" "\x08" "xsaveopt\0" \ +"\x0a" "xsaveopt64\0" "\x06" "sfence\0" "\x07" "clflush\0" "\x06" "popcnt\0" \ +"\x03" "bsf\0" "\x05" "tzcnt\0" "\x03" "bsr\0" "\x05" "lzcnt\0" "\x07" "cmpeqps\0" \ +"\x07" "cmpltps\0" "\x07" "cmpleps\0" "\x0a" "cmpunordps\0" "\x08" "cmpneqps\0" \ +"\x08" "cmpnltps\0" "\x08" "cmpnleps\0" "\x08" "cmpordps\0" "\x07" "cmpeqpd\0" \ +"\x07" "cmpltpd\0" "\x07" "cmplepd\0" "\x0a" "cmpunordpd\0" "\x08" "cmpneqpd\0" \ +"\x08" "cmpnltpd\0" "\x08" "cmpnlepd\0" "\x08" "cmpordpd\0" "\x07" "cmpeqss\0" \ +"\x07" "cmpltss\0" "\x07" "cmpless\0" "\x0a" "cmpunordss\0" "\x08" "cmpneqss\0" \ +"\x08" "cmpnltss\0" "\x08" "cmpnless\0" "\x08" "cmpordss\0" "\x07" "cmpeqsd\0" \ +"\x07" "cmpltsd\0" "\x07" "cmplesd\0" "\x0a" "cmpunordsd\0" "\x08" "cmpneqsd\0" \ +"\x08" "cmpnltsd\0" "\x08" "cmpnlesd\0" "\x08" "cmpordsd\0" "\x08" "vcmpeqps\0" \ +"\x08" "vcmpltps\0" "\x08" "vcmpleps\0" "\x0b" "vcmpunordps\0" "\x09" "vcmpneqps\0" \ +"\x09" "vcmpnltps\0" "\x09" "vcmpnleps\0" "\x09" "vcmpordps\0" "\x0b" "vcmpeq_uqps\0" \ +"\x09" "vcmpngeps\0" "\x09" "vcmpngtps\0" "\x0b" "vcmpfalseps\0" "\x0c" "vcmpneq_oqps\0" \ +"\x08" "vcmpgeps\0" "\x08" "vcmpgtps\0" "\x0a" "vcmptrueps\0" "\x0b" "vcmpeq_osps\0" \ +"\x0b" "vcmplt_oqps\0" "\x0b" "vcmple_oqps\0" "\x0d" "vcmpunord_sps\0" \ +"\x0c" "vcmpneq_usps\0" "\x0c" "vcmpnlt_uqps\0" "\x0c" "vcmpnle_uqps\0" \ +"\x0b" "vcmpord_sps\0" "\x0b" "vcmpeq_usps\0" "\x0c" "vcmpnge_uqps\0" \ +"\x0c" "vcmpngt_uqps\0" "\x0e" "vcmpfalse_osps\0" "\x0c" "vcmpneq_osps\0" \ +"\x0b" "vcmpge_oqps\0" "\x0b" "vcmpgt_oqps\0" "\x0d" "vcmptrue_usps\0" \ +"\x08" "vcmpeqpd\0" "\x08" "vcmpltpd\0" "\x08" "vcmplepd\0" "\x0b" "vcmpunordpd\0" \ +"\x09" "vcmpneqpd\0" "\x09" "vcmpnltpd\0" "\x09" "vcmpnlepd\0" "\x09" "vcmpordpd\0" \ +"\x0b" "vcmpeq_uqpd\0" "\x09" "vcmpngepd\0" "\x09" "vcmpngtpd\0" "\x0b" "vcmpfalsepd\0" \ +"\x0c" "vcmpneq_oqpd\0" "\x08" "vcmpgepd\0" "\x08" "vcmpgtpd\0" "\x0a" "vcmptruepd\0" \ +"\x0b" "vcmpeq_ospd\0" "\x0b" "vcmplt_oqpd\0" "\x0b" "vcmple_oqpd\0" \ +"\x0d" "vcmpunord_spd\0" "\x0c" "vcmpneq_uspd\0" "\x0c" "vcmpnlt_uqpd\0" \ +"\x0c" "vcmpnle_uqpd\0" "\x0b" "vcmpord_spd\0" "\x0b" "vcmpeq_uspd\0" \ +"\x0c" "vcmpnge_uqpd\0" "\x0c" "vcmpngt_uqpd\0" "\x0e" "vcmpfalse_ospd\0" \ +"\x0c" "vcmpneq_ospd\0" "\x0b" "vcmpge_oqpd\0" "\x0b" "vcmpgt_oqpd\0" \ +"\x0d" "vcmptrue_uspd\0" "\x08" "vcmpeqss\0" "\x08" "vcmpltss\0" "\x08" "vcmpless\0" \ +"\x0b" "vcmpunordss\0" "\x09" "vcmpneqss\0" "\x09" "vcmpnltss\0" "\x09" "vcmpnless\0" \ +"\x09" "vcmpordss\0" "\x0b" "vcmpeq_uqss\0" "\x09" "vcmpngess\0" "\x09" "vcmpngtss\0" \ +"\x0b" "vcmpfalsess\0" "\x0c" "vcmpneq_oqss\0" "\x08" "vcmpgess\0" "\x08" "vcmpgtss\0" \ +"\x0a" "vcmptruess\0" "\x0b" "vcmpeq_osss\0" "\x0b" "vcmplt_oqss\0" "\x0b" "vcmple_oqss\0" \ +"\x0d" "vcmpunord_sss\0" "\x0c" "vcmpneq_usss\0" "\x0c" "vcmpnlt_uqss\0" \ +"\x0c" "vcmpnle_uqss\0" "\x0b" "vcmpord_sss\0" "\x0b" "vcmpeq_usss\0" \ +"\x0c" "vcmpnge_uqss\0" "\x0c" "vcmpngt_uqss\0" "\x0e" "vcmpfalse_osss\0" \ +"\x0c" "vcmpneq_osss\0" "\x0b" "vcmpge_oqss\0" "\x0b" "vcmpgt_oqss\0" \ +"\x0d" "vcmptrue_usss\0" "\x08" "vcmpeqsd\0" "\x08" "vcmpltsd\0" "\x08" "vcmplesd\0" \ +"\x0b" "vcmpunordsd\0" "\x09" "vcmpneqsd\0" "\x09" "vcmpnltsd\0" "\x09" "vcmpnlesd\0" \ +"\x09" "vcmpordsd\0" "\x0b" "vcmpeq_uqsd\0" "\x09" "vcmpngesd\0" "\x09" "vcmpngtsd\0" \ +"\x0b" "vcmpfalsesd\0" "\x0c" "vcmpneq_oqsd\0" "\x08" "vcmpgesd\0" "\x08" "vcmpgtsd\0" \ +"\x0a" "vcmptruesd\0" "\x0b" "vcmpeq_ossd\0" "\x0b" "vcmplt_oqsd\0" "\x0b" "vcmple_oqsd\0" \ +"\x0d" "vcmpunord_ssd\0" "\x0c" "vcmpneq_ussd\0" "\x0c" "vcmpnlt_uqsd\0" \ +"\x0c" "vcmpnle_uqsd\0" "\x0b" "vcmpord_ssd\0" "\x0b" "vcmpeq_ussd\0" \ +"\x0c" "vcmpnge_uqsd\0" "\x0c" "vcmpngt_uqsd\0" "\x0e" "vcmpfalse_ossd\0" \ +"\x0c" "vcmpneq_ossd\0" "\x0b" "vcmpge_oqsd\0" "\x0b" "vcmpgt_oqsd\0" \ +"\x0d" "vcmptrue_ussd\0" "\x06" "pinsrw\0" "\x07" "vpinsrw\0" "\x06" "pextrw\0" \ +"\x07" "vpextrw\0" "\x06" "shufps\0" "\x06" "shufpd\0" "\x07" "vshufps\0" \ +"\x07" "vshufpd\0" "\x09" "cmpxchg8b\0" "\x0a" "cmpxchg16b\0" "\x07" "vmptrst\0" \ +"\x08" "addsubpd\0" "\x08" "addsubps\0" "\x09" "vaddsubpd\0" "\x09" "vaddsubps\0" \ +"\x05" "psrlw\0" "\x06" "vpsrlw\0" "\x05" "psrld\0" "\x06" "vpsrld\0" \ +"\x05" "psrlq\0" "\x06" "vpsrlq\0" "\x05" "paddq\0" "\x06" "vpaddq\0" \ +"\x06" "pmullw\0" "\x07" "vpmullw\0" "\x07" "movq2dq\0" "\x07" "movdq2q\0" \ +"\x08" "pmovmskb\0" "\x09" "vpmovmskb\0" "\x07" "psubusb\0" "\x08" "vpsubusb\0" \ +"\x07" "psubusw\0" "\x08" "vpsubusw\0" "\x06" "pminub\0" "\x07" "vpminub\0" \ +"\x04" "pand\0" "\x05" "vpand\0" "\x07" "paddusb\0" "\x08" "vpaddusw\0" \ +"\x07" "paddusw\0" "\x06" "pmaxub\0" "\x07" "vpmaxub\0" "\x05" "pandn\0" \ +"\x06" "vpandn\0" "\x05" "pavgb\0" "\x06" "vpavgb\0" "\x05" "psraw\0" \ +"\x06" "vpsraw\0" "\x05" "psrad\0" "\x06" "vpsrad\0" "\x05" "pavgw\0" \ +"\x06" "vpavgw\0" "\x07" "pmulhuw\0" "\x08" "vpmulhuw\0" "\x06" "pmulhw\0" \ +"\x07" "vpmulhw\0" "\x09" "cvttpd2dq\0" "\x08" "cvtdq2pd\0" "\x08" "cvtpd2dq\0" \ +"\x0a" "vcvttpd2dq\0" "\x09" "vcvtdq2pd\0" "\x09" "vcvtpd2dq\0" "\x06" "movntq\0" \ +"\x07" "movntdq\0" "\x08" "vmovntdq\0" "\x06" "psubsb\0" "\x07" "vpsubsb\0" \ +"\x06" "psubsw\0" "\x07" "vpsubsw\0" "\x06" "pminsw\0" "\x07" "vpminsw\0" \ +"\x03" "por\0" "\x04" "vpor\0" "\x06" "paddsb\0" "\x07" "vpaddsb\0" \ +"\x06" "paddsw\0" "\x07" "vpaddsw\0" "\x06" "pmaxsw\0" "\x07" "vpmaxsw\0" \ +"\x04" "pxor\0" "\x05" "vpxor\0" "\x05" "lddqu\0" "\x06" "vlddqu\0" \ +"\x05" "psllw\0" "\x06" "vpsllw\0" "\x05" "pslld\0" "\x06" "vpslld\0" \ +"\x05" "psllq\0" "\x06" "vpsllq\0" "\x07" "pmuludq\0" "\x08" "vpmuludq\0" \ +"\x07" "pmaddwd\0" "\x08" "vpmaddwd\0" "\x06" "psadbw\0" "\x07" "vpsadbw\0" \ +"\x08" "maskmovq\0" "\x0a" "maskmovdqu\0" "\x0b" "vmaskmovdqu\0" "\x05" "psubb\0" \ +"\x06" "vpsubb\0" "\x05" "psubw\0" "\x06" "vpsubw\0" "\x05" "psubd\0" \ +"\x06" "vpsubd\0" "\x05" "psubq\0" "\x06" "vpsubq\0" "\x05" "paddb\0" \ +"\x06" "vpaddb\0" "\x05" "paddw\0" "\x06" "vpaddw\0" "\x05" "paddd\0" \ +"\x06" "vpaddd\0" "\x07" "fnstenv\0" "\x06" "fstenv\0" "\x06" "fnstcw\0" \ +"\x05" "fstcw\0" "\x06" "fnclex\0" "\x05" "fclex\0" "\x06" "fninit\0" \ +"\x05" "finit\0" "\x06" "fnsave\0" "\x05" "fsave\0" "\x06" "fnstsw\0" \ +"\x05" "fstsw\0" "\x06" "pshufb\0" "\x07" "vpshufb\0" "\x06" "phaddw\0" \ +"\x07" "vphaddw\0" "\x06" "phaddd\0" "\x07" "vphaddd\0" "\x07" "phaddsw\0" \ +"\x08" "vphaddsw\0" "\x09" "pmaddubsw\0" "\x0a" "vpmaddubsw\0" "\x06" "phsubw\0" \ +"\x07" "vphsubw\0" "\x06" "phsubd\0" "\x07" "vphsubd\0" "\x07" "phsubsw\0" \ +"\x08" "vphsubsw\0" "\x06" "psignb\0" "\x07" "vpsignb\0" "\x06" "psignw\0" \ +"\x07" "vpsignw\0" "\x06" "psignd\0" "\x07" "vpsignd\0" "\x08" "pmulhrsw\0" \ +"\x09" "vpmulhrsw\0" "\x09" "vpermilps\0" "\x09" "vpermilpd\0" "\x07" "vtestps\0" \ +"\x07" "vtestpd\0" "\x08" "pblendvb\0" "\x08" "blendvps\0" "\x08" "blendvpd\0" \ +"\x05" "ptest\0" "\x06" "vptest\0" "\x0c" "vbroadcastss\0" "\x0c" "vbroadcastsd\0" \ +"\x0e" "vbroadcastf128\0" "\x05" "pabsb\0" "\x06" "vpabsb\0" "\x05" "pabsw\0" \ +"\x06" "vpabsw\0" "\x05" "pabsd\0" "\x06" "vpabsd\0" "\x08" "pmovsxbw\0" \ +"\x09" "vpmovsxbw\0" "\x08" "pmovsxbd\0" "\x09" "vpmovsxbd\0" "\x08" "pmovsxbq\0" \ +"\x09" "vpmovsxbq\0" "\x08" "pmovsxwd\0" "\x09" "vpmovsxwd\0" "\x08" "pmovsxwq\0" \ +"\x09" "vpmovsxwq\0" "\x08" "pmovsxdq\0" "\x09" "vpmovsxdq\0" "\x06" "pmuldq\0" \ +"\x07" "vpmuldq\0" "\x07" "pcmpeqq\0" "\x08" "vpcmpeqq\0" "\x08" "movntdqa\0" \ +"\x09" "vmovntdqa\0" "\x08" "packusdw\0" "\x09" "vpackusdw\0" "\x0a" "vmaskmovps\0" \ +"\x0a" "vmaskmovpd\0" "\x08" "pmovzxbw\0" "\x09" "vpmovzxbw\0" "\x08" "pmovzxbd\0" \ +"\x09" "vpmovzxbd\0" "\x08" "pmovzxbq\0" "\x09" "vpmovzxbq\0" "\x08" "pmovzxwd\0" \ +"\x09" "vpmovzxwd\0" "\x08" "pmovzxwq\0" "\x09" "vpmovzxwq\0" "\x08" "pmovzxdq\0" \ +"\x09" "vpmovzxdq\0" "\x07" "pcmpgtq\0" "\x08" "vpcmpgtq\0" "\x06" "pminsb\0" \ +"\x07" "vpminsb\0" "\x06" "pminsd\0" "\x07" "vpminsd\0" "\x06" "pminuw\0" \ +"\x07" "vpminuw\0" "\x06" "pminud\0" "\x07" "vpminud\0" "\x06" "pmaxsb\0" \ +"\x07" "vpmaxsb\0" "\x06" "pmaxsd\0" "\x07" "vpmaxsd\0" "\x06" "pmaxuw\0" \ +"\x07" "vpmaxuw\0" "\x06" "pmaxud\0" "\x07" "vpmaxud\0" "\x06" "pmulld\0" \ +"\x07" "vpmulld\0" "\x0a" "phminposuw\0" "\x0b" "vphminposuw\0" "\x06" "invept\0" \ +"\x07" "invvpid\0" "\x07" "invpcid\0" "\x0e" "vfmaddsub132ps\0" "\x0e" "vfmaddsub132pd\0" \ +"\x0e" "vfmsubadd132ps\0" "\x0e" "vfmsubadd132pd\0" "\x0b" "vfmadd132ps\0" \ +"\x0b" "vfmadd132pd\0" "\x0b" "vfmadd132ss\0" "\x0b" "vfmadd132sd\0" \ +"\x0b" "vfmsub132ps\0" "\x0b" "vfmsub132pd\0" "\x0b" "vfmsub132ss\0" \ +"\x0b" "vfmsub132sd\0" "\x0c" "vfnmadd132ps\0" "\x0c" "vfnmadd132pd\0" \ +"\x0c" "vfnmadd132ss\0" "\x0c" "vfnmadd132sd\0" "\x0c" "vfnmsub132ps\0" \ +"\x0c" "vfnmsub132pd\0" "\x0c" "vfnmsub132ss\0" "\x0c" "vfnmsub132sd\0" \ +"\x0e" "vfmaddsub213ps\0" "\x0e" "vfmaddsub213pd\0" "\x0e" "vfmsubadd213ps\0" \ +"\x0e" "vfmsubadd213pd\0" "\x0b" "vfmadd213ps\0" "\x0b" "vfmadd213pd\0" \ +"\x0b" "vfmadd213ss\0" "\x0b" "vfmadd213sd\0" "\x0b" "vfmsub213ps\0" \ +"\x0b" "vfmsub213pd\0" "\x0b" "vfmsub213ss\0" "\x0b" "vfmsub213sd\0" \ +"\x0c" "vfnmadd213ps\0" "\x0c" "vfnmadd213pd\0" "\x0c" "vfnmadd213ss\0" \ +"\x0c" "vfnmadd213sd\0" "\x0c" "vfnmsub213ps\0" "\x0c" "vfnmsub213pd\0" \ +"\x0c" "vfnmsub213ss\0" "\x0c" "vfnmsub213sd\0" "\x0e" "vfmaddsub231ps\0" \ +"\x0e" "vfmaddsub231pd\0" "\x0e" "vfmsubadd231ps\0" "\x0e" "vfmsubadd231pd\0" \ +"\x0b" "vfmadd231ps\0" "\x0b" "vfmadd231pd\0" "\x0b" "vfmadd231ss\0" \ +"\x0b" "vfmadd231sd\0" "\x0b" "vfmsub231ps\0" "\x0b" "vfmsub231pd\0" \ +"\x0b" "vfmsub231ss\0" "\x0b" "vfmsub231sd\0" "\x0c" "vfnmadd231ps\0" \ +"\x0c" "vfnmadd231pd\0" "\x0c" "vfnmadd231ss\0" "\x0c" "vfnmadd231sd\0" \ +"\x0c" "vfnmsub231ps\0" "\x0c" "vfnmsub231pd\0" "\x0c" "vfnmsub231ss\0" \ +"\x0c" "vfnmsub231sd\0" "\x06" "aesimc\0" "\x07" "vaesimc\0" "\x06" "aesenc\0" \ +"\x07" "vaesenc\0" "\x0a" "aesenclast\0" "\x0b" "vaesenclast\0" "\x06" "aesdec\0" \ +"\x07" "vaesdec\0" "\x0a" "aesdeclast\0" "\x0b" "vaesdeclast\0" "\x05" "movbe\0" \ +"\x05" "crc32\0" "\x0a" "vperm2f128\0" "\x07" "roundps\0" "\x08" "vroundps\0" \ +"\x07" "roundpd\0" "\x08" "vroundpd\0" "\x07" "roundss\0" "\x08" "vroundss\0" \ +"\x07" "roundsd\0" "\x08" "vroundsd\0" "\x07" "blendps\0" "\x08" "vblendps\0" \ +"\x07" "blendpd\0" "\x08" "vblendpd\0" "\x07" "pblendw\0" "\x08" "vpblendw\0" \ +"\x07" "palignr\0" "\x08" "vpalignr\0" "\x06" "pextrb\0" "\x07" "vpextrb\0" \ +"\x06" "pextrd\0" "\x06" "pextrq\0" "\x07" "vpextrd\0" "\x07" "vpextrq\0" \ +"\x09" "extractps\0" "\x0a" "vextractps\0" "\x0b" "vinsertf128\0" "\x0c" "vextractf128\0" \ +"\x06" "pinsrb\0" "\x07" "vpinsrb\0" "\x08" "insertps\0" "\x09" "vinsertps\0" \ +"\x06" "pinsrd\0" "\x06" "pinsrq\0" "\x07" "vpinsrd\0" "\x07" "vpinsrq\0" \ +"\x04" "dpps\0" "\x05" "vdpps\0" "\x04" "dppd\0" "\x05" "vdppd\0" "\x07" "mpsadbw\0" \ +"\x08" "vmpsadbw\0" "\x09" "pclmulqdq\0" "\x0a" "vpclmulqdq\0" "\x09" "vblendvps\0" \ +"\x09" "vblendvpd\0" "\x09" "vpblendvb\0" "\x09" "pcmpestrm\0" "\x0a" "vpcmpestrm\0" \ +"\x09" "pcmpestri\0" "\x0a" "vpcmpestri\0" "\x09" "pcmpistrm\0" "\x0a" "vpcmpistrm\0" \ +"\x09" "pcmpistri\0" "\x0a" "vpcmpistri\0" "\x0f" "aeskeygenassist\0" \ +"\x10" "vaeskeygenassist\0" "\x06" "psrldq\0" "\x07" "vpsrldq\0" "\x06" "pslldq\0" \ +"\x07" "vpslldq\0" "\x06" "fxsave\0" "\x08" "fxsave64\0" "\x08" "rdfsbase\0" \ +"\x07" "fxrstor\0" "\x09" "fxrstor64\0" "\x08" "rdgsbase\0" "\x07" "ldmxcsr\0" \ +"\x08" "wrfsbase\0" "\x08" "vldmxcsr\0" "\x07" "stmxcsr\0" "\x08" "wrgsbase\0" \ +"\x08" "vstmxcsr\0" "\x07" "vmptrld\0" "\x07" "vmclear\0" "\x05" "vmxon\0" \ +"\x06" "movsxd\0" "\x05" "pause\0" "\x04" "wait\0" "\x06" "rdrand\0" \ +"\x06" "_3dnow\0" \ +"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; /* Sentinel mnemonic. */ const _WRegister _REGISTERS[] = { - { 3, "rax" }, { 3, "rcx" }, { 3, "rdx" }, { 3, "rbx" }, { 3, "rsp" }, { 3, "rbp" }, { 3, "rsi" }, { 3, "rdi" }, { 2, "r8" }, { 2, "r9" }, { 3, "r10" }, { 3, "r11" }, { 3, "r12" }, { 3, "r13" }, { 3, "r14" }, { 3, "r15" }, - { 3, "eax" }, { 3, "ecx" }, { 3, "edx" }, { 3, "ebx" }, { 3, "esp" }, { 3, "ebp" }, { 3, "esi" }, { 3, "edi" }, { 3, "r8d" }, { 3, "r9d" }, { 4, "r10d" }, { 4, "r11d" }, { 4, "r12d" }, { 4, "r13d" }, { 4, "r14d" }, { 4, "r15d" }, - { 2, "ax" }, { 2, "cx" }, { 2, "dx" }, { 2, "bx" }, { 2, "sp" }, { 2, "bp" }, { 2, "si" }, { 2, "di" }, { 3, "r8w" }, { 3, "r9w" }, { 4, "r10w" }, { 4, "r11w" }, { 4, "r12w" }, { 4, "r13w" }, { 4, "r14w" }, { 4, "r15w" }, - { 2, "al" }, { 2, "cl" }, { 2, "dl" }, { 2, "bl" }, { 2, "ah" }, { 2, "ch" }, { 2, "dh" }, { 2, "bh" }, { 3, "r8b" }, { 3, "r9b" }, { 4, "r10b" }, { 4, "r11b" }, { 4, "r12b" }, { 4, "r13b" }, { 4, "r14b" }, { 4, "r15b" }, - { 3, "spl" }, { 3, "bpl" }, { 3, "sil" }, { 3, "dil" }, - { 2, "es" }, { 2, "cs" }, { 2, "ss" }, { 2, "ds" }, { 2, "fs" }, { 2, "gs" }, - { 3, "rip" }, - { 3, "st0" }, { 3, "st1" }, { 3, "st2" }, { 3, "st3" }, { 3, "st4" }, { 3, "st5" }, { 3, "st6" }, { 3, "st7" }, - { 3, "mm0" }, { 3, "mm1" }, { 3, "mm2" }, { 3, "mm3" }, { 3, "mm4" }, { 3, "mm5" }, { 3, "mm6" }, { 3, "mm7" }, - { 4, "xmm0" }, { 4, "xmm1" }, { 4, "xmm2" }, { 4, "xmm3" }, { 4, "xmm4" }, { 4, "xmm5" }, { 4, "xmm6" }, { 4, "xmm7" }, { 4, "xmm8" }, { 4, "xmm9" }, { 5, "xmm10" }, { 5, "xmm11" }, { 5, "xmm12" }, { 5, "xmm13" }, { 5, "xmm14" }, { 5, "xmm15" }, - { 4, "ymm0" }, { 4, "ymm1" }, { 4, "ymm2" }, { 4, "ymm3" }, { 4, "ymm4" }, { 4, "ymm5" }, { 4, "ymm6" }, { 4, "ymm7" }, { 4, "ymm8" }, { 4, "ymm9" }, { 5, "ymm10" }, { 5, "ymm11" }, { 5, "ymm12" }, { 5, "ymm13" }, { 5, "ymm14" }, { 5, "ymm15" }, - { 3, "cr0" }, { 0, "" }, { 3, "cr2" }, { 3, "cr3" }, { 3, "cr4" }, { 0, "" }, { 0, "" }, { 0, "" }, { 3, "cr8" }, - { 3, "dr0" }, { 3, "dr1" }, { 3, "dr2" }, { 3, "dr3" }, { 0, "" }, { 0, "" }, { 3, "dr6" }, { 3, "dr7" } + {3, "rax"}, {3, "rcx"}, {3, "rdx"}, {3, "rbx"}, {3, "rsp"}, {3, "rbp"}, {3, "rsi"}, {3, "rdi"}, {2, "r8"}, {2, "r9"}, {3, "r10"}, {3, "r11"}, {3, "r12"}, {3, "r13"}, {3, "r14"}, {3, "r15"}, + {3, "eax"}, {3, "ecx"}, {3, "edx"}, {3, "ebx"}, {3, "esp"}, {3, "ebp"}, {3, "esi"}, {3, "edi"}, {3, "r8d"}, {3, "r9d"}, {4, "r10d"}, {4, "r11d"}, {4, "r12d"}, {4, "r13d"}, {4, "r14d"}, {4, "r15d"}, + {2, "ax"}, {2, "cx"}, {2, "dx"}, {2, "bx"}, {2, "sp"}, {2, "bp"}, {2, "si"}, {2, "di"}, {3, "r8w"}, {3, "r9w"}, {4, "r10w"}, {4, "r11w"}, {4, "r12w"}, {4, "r13w"}, {4, "r14w"}, {4, "r15w"}, + {2, "al"}, {2, "cl"}, {2, "dl"}, {2, "bl"}, {2, "ah"}, {2, "ch"}, {2, "dh"}, {2, "bh"}, {3, "r8b"}, {3, "r9b"}, {4, "r10b"}, {4, "r11b"}, {4, "r12b"}, {4, "r13b"}, {4, "r14b"}, {4, "r15b"}, + {3, "spl"}, {3, "bpl"}, {3, "sil"}, {3, "dil"}, + {2, "es"}, {2, "cs"}, {2, "ss"}, {2, "ds"}, {2, "fs"}, {2, "gs"}, + {3, "rip"}, + {3, "st0"}, {3, "st1"}, {3, "st2"}, {3, "st3"}, {3, "st4"}, {3, "st5"}, {3, "st6"}, {3, "st7"}, + {3, "mm0"}, {3, "mm1"}, {3, "mm2"}, {3, "mm3"}, {3, "mm4"}, {3, "mm5"}, {3, "mm6"}, {3, "mm7"}, + {4, "xmm0"}, {4, "xmm1"}, {4, "xmm2"}, {4, "xmm3"}, {4, "xmm4"}, {4, "xmm5"}, {4, "xmm6"}, {4, "xmm7"}, {4, "xmm8"}, {4, "xmm9"}, {5, "xmm10"}, {5, "xmm11"}, {5, "xmm12"}, {5, "xmm13"}, {5, "xmm14"}, {5, "xmm15"}, + {4, "ymm0"}, {4, "ymm1"}, {4, "ymm2"}, {4, "ymm3"}, {4, "ymm4"}, {4, "ymm5"}, {4, "ymm6"}, {4, "ymm7"}, {4, "ymm8"}, {4, "ymm9"}, {5, "ymm10"}, {5, "ymm11"}, {5, "ymm12"}, {5, "ymm13"}, {5, "ymm14"}, {5, "ymm15"}, + {3, "cr0"}, {0, ""}, {3, "cr2"}, {3, "cr3"}, {3, "cr4"}, {0, ""}, {0, ""}, {0, ""}, {3, "cr8"}, + {3, "dr0"}, {3, "dr1"}, {3, "dr2"}, {3, "dr3"}, {0, ""}, {0, ""}, {3, "dr6"}, {3, "dr7"}, + {0, ""} /* There must be an empty last reg, see strcat_WSR. */ }; #endif /* DISTORM_LIGHT */ diff --git a/NativeCore/Dependencies/distorm/src/operands.c b/NativeCore/Dependencies/distorm/src/operands.c index 506780c4..b5da260b 100644 --- a/NativeCore/Dependencies/distorm/src/operands.c +++ b/NativeCore/Dependencies/distorm/src/operands.c @@ -4,7 +4,7 @@ operands.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -23,7 +23,7 @@ uint32_t _REGISTERTORCLASS[] = /* Based on _RegisterType enumeration! */ RM_AX, RM_CX, RM_DX, RM_BX, RM_SP, RM_BP, RM_SI, RM_DI, RM_R8, RM_R9, RM_R10, RM_R11, RM_R12, RM_R13, RM_R14, RM_R15, RM_AX, RM_CX, RM_DX, RM_BX, RM_AX, RM_CX, RM_DX, RM_BX, RM_R8, RM_R9, RM_R10, RM_R11, RM_R12, RM_R13, RM_R14, RM_R15, RM_SP, RM_BP, RM_SI, RM_DI, - 0, 0, 0, 0, 0, 0, + RM_SEG, RM_SEG, RM_SEG, RM_SEG, RM_SEG, RM_SEG, 0, RM_FPU, RM_FPU, RM_FPU, RM_FPU, RM_FPU, RM_FPU, RM_FPU, RM_FPU, RM_MMX, RM_MMX, RM_MMX, RM_MMX, RM_MMX, RM_MMX, RM_MMX, RM_MMX, @@ -33,60 +33,96 @@ uint32_t _REGISTERTORCLASS[] = /* Based on _RegisterType enumeration! */ RM_DR, RM_DR, RM_DR, RM_DR, 0, 0, RM_DR, RM_DR }; -typedef enum {OPERAND_SIZE_NONE = 0, OPERAND_SIZE8, OPERAND_SIZE16, OPERAND_SIZE32, OPERAND_SIZE64, OPERAND_SIZE80, OPERAND_SIZE128, OPERAND_SIZE256} _OperandSizeType; -static uint16_t _OPSIZETOINT[] = {0, 8, 16, 32, 64, 80, 128, 256}; - /* A helper function to fix the 8 bits register if REX is used (to support SIL, DIL, etc). */ -static unsigned int _FASTCALL_ operands_fix_8bit_rex_base(unsigned int reg) +_INLINE_ unsigned int _FASTCALL_ operands_fix_8bit_rex_base(unsigned int reg) { if ((reg >= 4) && (reg < 8)) return reg + REGS8_REX_BASE - 4; return reg + REGS8_BASE; } /* A helper function to set operand's type and size. */ -static void _FASTCALL_ operands_set_ts(_Operand* op, _OperandType type, uint16_t size) +_INLINE_ void operands_set_ts(_Operand* op, _OperandType type, uint16_t size) { op->type = type; op->size = size; } /* A helper function to set operand's type, size and index. */ -static void _FASTCALL_ operands_set_tsi(_Operand* op, _OperandType type, uint16_t size, unsigned int index) +_INLINE_ void operands_set_tsi(_DInst* di, _Operand* op, _OperandType type, uint16_t size, unsigned int index) { op->type = type; op->index = (uint8_t)index; op->size = size; + di->usedRegistersMask |= _REGISTERTORCLASS[index]; } /* A helper function to read an unsigned integer from the stream safely. */ -static int _FASTCALL_ read_stream_safe_uint(_CodeInfo* ci, void* result, unsigned int size) +_INLINE_ int read_stream_safe_uint8(_CodeInfo* ci, void* result) { - ci->codeLen -= size; + ci->codeLen -= 1; if (ci->codeLen < 0) return FALSE; - switch (size) - { - case 1: *(uint8_t*)result = *(uint8_t*)ci->code; break; - case 2: *(uint16_t*)result = RUSHORT(ci->code); break; - case 4: *(uint32_t*)result = RULONG(ci->code); break; - case 8: *(uint64_t*)result = RULLONG(ci->code); break; - } - ci->code += size; + *(uint8_t*)result = *(uint8_t*)ci->code; + ci->code += 1; + return TRUE; +} + +/* A helper function to read an unsigned integer from the stream safely. */ +_INLINE_ int read_stream_safe_uint16(_CodeInfo* ci, void* result) +{ + ci->codeLen -= 2; + if (ci->codeLen < 0) return FALSE; + *(uint16_t*)result = RUSHORT(ci->code); + ci->code += 2; + return TRUE; +} + +/* A helper function to read an unsigned integer from the stream safely. */ +_INLINE_ int read_stream_safe_uint32(_CodeInfo* ci, void* result) +{ + ci->codeLen -= 4; + if (ci->codeLen < 0) return FALSE; + *(uint32_t*)result = RULONG(ci->code); + ci->code += 4; + return TRUE; +} + +/* A helper function to read an unsigned integer from the stream safely. */ +_INLINE_ int read_stream_safe_uint64(_CodeInfo* ci, void* result) +{ + ci->codeLen -= 8; + if (ci->codeLen < 0) return FALSE; + *(uint64_t*)result = RULLONG(ci->code); + ci->code += 8; return TRUE; } /* A helper function to read a signed integer from the stream safely. */ -static int _FASTCALL_ read_stream_safe_sint(_CodeInfo* ci, int64_t* result, unsigned int size) +_INLINE_ int read_stream_safe_sint8(_CodeInfo* ci, int64_t* result) { - ci->codeLen -= size; + ci->codeLen -= 1; if (ci->codeLen < 0) return FALSE; - switch (size) - { - case 1: *result = *(int8_t*)ci->code; break; - case 2: *result = RSHORT(ci->code); break; - case 4: *result = RLONG(ci->code); break; - case 8: *result = RLLONG(ci->code); break; - } - ci->code += size; + *result = *(int8_t*)ci->code; + ci->code += 1; + return TRUE; +} + +/* A helper function to read a signed integer from the stream safely. */ +_INLINE_ int read_stream_safe_sint16(_CodeInfo* ci, int64_t* result) +{ + ci->codeLen -= 2; + if (ci->codeLen < 0) return FALSE; + *result = RSHORT(ci->code); + ci->code += 2; + return TRUE; +} + +/* A helper function to read a signed integer from the stream safely. */ +_INLINE_ int read_stream_safe_sint32(_CodeInfo* ci, int64_t* result) +{ + ci->codeLen -= 4; + if (ci->codeLen < 0) return FALSE; + *result = RLONG(ci->code); + ci->code += 4; return TRUE; } @@ -108,23 +144,20 @@ static int _FASTCALL_ read_stream_safe_sint(_CodeInfo* ci, int64_t* result, unsi * NOTE: base could specify None (no base register) if base==5 and mod==0, but then you also need DISP32. * } */ -static void operands_extract_sib(_DInst* di, _OperandNumberType opNum, +static void operands_extract_sib(_DInst* di, _PrefixState* ps, _DecodeType effAdrSz, - unsigned int sib, unsigned int mod) + unsigned int sib, unsigned int mod, _Operand* op) { - unsigned int scale = 0, index = 0, base = 0; + unsigned char scale, index, base; unsigned int vrex = ps->vrex; uint8_t* pIndex = NULL; - _Operand* op = &di->ops[opNum]; - /* * SIB bits: * |7---6-5----3-2---0| * |SCALE| INDEX| BASE| * |------------------| */ - scale = (sib >> 6) & 3; index = (sib >> 3) & 7; base = sib & 7; @@ -154,6 +187,8 @@ static void operands_extract_sib(_DInst* di, _OperandNumberType opNum, if (vrex & PREFIX_EX_B) ps->usedPrefixes |= INST_PRE_REX; *pIndex = effAdrSz == Decode64Bits ? REGS64_BASE : REGS32_BASE; *pIndex += (uint8_t)(base + ((vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0)); + + if (di->base != R_NONE) di->usedRegistersMask |= _REGISTERTORCLASS[di->base]; } else if (mod != 0) { /* * if base == 5 then you have to decode according to MOD. @@ -166,6 +201,8 @@ static void operands_extract_sib(_DInst* di, _OperandNumberType opNum, if (vrex & PREFIX_EX_B) ps->usedPrefixes |= INST_PRE_REX; if (effAdrSz == Decode64Bits) *pIndex = REGS64_BASE + 5 + ((vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0); else *pIndex = REGS32_BASE + 5 + ((vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0); + + if (di->base != R_NONE) di->usedRegistersMask |= _REGISTERTORCLASS[di->base]; } else if (index == 4) { /* 32bits displacement only. */ op->type = O_DISP; @@ -173,6 +210,7 @@ static void operands_extract_sib(_DInst* di, _OperandNumberType opNum, } if (index != 4) { /* In 64 bits decoding mode, if index == R12, it's valid! */ + scale = (sib >> 6) & 3; if (effAdrSz == Decode64Bits) op->index = (uint8_t)(REGS64_BASE + index); else op->index = (uint8_t)(REGS32_BASE + index); di->scale = scale != 0 ? (1 << scale) : 0; @@ -191,70 +229,393 @@ static void operands_extract_sib(_DInst* di, _OperandNumberType opNum, * Some instructions force the use of RM16 or other specific types, so take it into account. */ -static int operands_extract_modrm(_CodeInfo* ci, - _DInst* di, _OpType type, - _OperandNumberType opNum, _PrefixState* ps, - _DecodeType effOpSz, _DecodeType effAdrSz, - int* lockableInstruction, unsigned int mod, unsigned int rm, - _iflags instFlags) +static int operands_extract_modrm(_CodeInfo* ci, _PrefixState* ps, _DInst* di, + _DecodeType effAdrSz, unsigned int mod, unsigned int rm, + _iflags instFlags, _Operand* op) { - unsigned int vrex = ps->vrex, sib = 0, base = 0; - _Operand* op = &di->ops[opNum]; - uint16_t size = 0; + unsigned char sib = 0, base = 0; - if (mod == 3) { - /* - * General-purpose register is handled the same way in 16/32/64 bits decoding modes. - * NOTE!! that we have to override the size of the register, since it was set earlier as Memory and not Register! - */ - op->type = O_REG; - /* Start with original size which was set earlier, some registers have same size of memory and depend on it. */ - size = op->size; - switch(type) + /* Memory indirection decoding ahead:) */ + + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + if ((instFlags & INST_PRE_LOCK) && (ps->decodedPrefixes & INST_PRE_LOCK)) { + ps->usedPrefixes |= INST_PRE_LOCK; + di->flags |= FLAG_LOCK; + } + + if (effAdrSz != Decode16Bits) { /* Decode32Bits or Decode64Bits! */ + /* Remember that from a 32/64 bits ModR/M byte a SIB byte could follow! */ + if ((rm == 5) && (mod == 0)) { + /* 5 is a special case - only 32 bits displacement, or RIP relative. */ + di->dispSize = 32; + if (!read_stream_safe_sint32(ci, (int64_t*)&di->disp)) return FALSE; + + /* Absolute address: */ + op->type = O_DISP; + + if (ci->dt == Decode64Bits) { + /* In 64 bits decoding mode depsite of the address size, a RIP-relative address it is. */ + op->type = O_SMEM; + op->index = R_RIP; + di->flags |= FLAG_RIP_RELATIVE; + } + + prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); + } + else { + if (rm == 4) { + /* 4 is a special case - SIB byte + disp8/32 follows! */ + /* Read SIB byte. */ + if (!read_stream_safe_uint8(ci, &sib)) return FALSE; + operands_extract_sib(di, ps, effAdrSz, sib, mod, op); + } + else { + op->type = O_SMEM; + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + + if (effAdrSz == Decode64Bits) op->index = (uint8_t)(REGS64_BASE + rm); + else op->index = (uint8_t)(REGS32_BASE + rm); + } + + if (mod == 1) { + di->dispSize = 8; + if (!read_stream_safe_sint8(ci, (int64_t*)&di->disp)) return FALSE; + } + else if ((mod == 2) || ((sib & 7) == 5)) { /* If there is no BASE, read DISP32! */ + di->dispSize = 32; + if (!read_stream_safe_sint32(ci, (int64_t*)&di->disp)) return FALSE; + } + + /* Get the base register. */ + base = op->index; + if (di->base != R_NONE) base = di->base; + else if (di->scale >= 2) base = 0; /* If it's only an index but got scale, it's still DS. */ + /* Default for EBP/ESP is SS segment. 64 bits mode ignores DS anyway. */ + if ((base == R_EBP) || (base == R_ESP)) prefixes_use_segment(INST_PRE_SS, ps, ci->dt, di); + else prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); + } + } + else { /* Decode16Bits */ + /* Decoding according to Table 2-1. (16 bits) */ + if ((mod == 0) && (rm == 6)) { + /* 6 is a special case - only 16 bits displacement. */ + op->type = O_DISP; + di->dispSize = 16; + if (!read_stream_safe_sint16(ci, (int64_t*)&di->disp)) return FALSE; + } + else { + /* + * Create the O_MEM for 16 bits indirection that requires 2 registers, E.G: [BS+SI]. + * or create O_SMEM for a single register indirection, E.G: [BP]. + */ + static uint8_t MODS[] = { R_BX, R_BX, R_BP, R_BP, R_SI, R_DI, R_BP, R_BX }; + static uint8_t MODS2[] = { R_SI, R_DI, R_SI, R_DI }; + if (rm < 4) { + op->type = O_MEM; + di->base = MODS[rm]; + di->usedRegistersMask |= _REGISTERTORCLASS[MODS[rm]]; + op->index = MODS2[rm]; + } + else { + op->type = O_SMEM; + op->index = MODS[rm]; + } + + if (mod == 1) { /* 8 bits displacement + indirection */ + di->dispSize = 8; + if (!read_stream_safe_sint8(ci, (int64_t*)&di->disp)) return FALSE; + } + else if (mod == 2) { /* 16 bits displacement + indirection */ + di->dispSize = 16; + if (!read_stream_safe_sint16(ci, (int64_t*)&di->disp)) return FALSE; + } + } + + if ((rm == 2) || (rm == 3) || ((rm == 6) && (mod != 0))) { + /* BP's default segment is SS, so ignore it. */ + prefixes_use_segment(INST_PRE_SS, ps, ci->dt, di); + } + else { + /* Ignore default DS segment. */ + prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); + } + } + + return TRUE; +} + + +/* + * This function is reponsible to textually format a required operand according to its type. + * It is vital to understand that there are other operands than what the ModR/M byte specifies. + + * Only by decoding the operands of an instruction which got a LOCK prefix, we could tell whether it may use the LOCK prefix. + * According to Intel, LOCK prefix must precede some specific instructions AND in their memory destination operand form (which means first operand). + * LOCK INC EAX, would generate an exception, but LOCK INC [EAX] is alright. + * Also LOCK ADD BX, [BP] would generate an exception. + + * Return code: + * TRUE - continue parsing the instruction and its operands, everything went right 'till now. + * FALSE - not enough bytes, or invalid operands. + */ + +int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, + _iflags instFlags, _OpType type, + unsigned int modrm, _PrefixState* ps, _DecodeType effOpSz, + _DecodeType effAdrSz, _Operand* op) +{ + int ret = 0; + unsigned int mod, reg, rm; + unsigned int size = 0; + + /* + * ModRM bits: + * |7-6-5--------3-2-0| + * |MOD|REG/OPCODE|RM | + * |------------------| + */ + /* mod = (modrm >> 6) & 3; */ /* Mode(register-indirection, disp8+reg+indirection, disp16+reg+indirection, general-purpose register) */ + /* reg = (modrm >> 3) & 7; */ /* Register(could be part of the opcode itself or general-purpose register) */ + /* rm = modrm & 7; */ /* Specifies which general-purpose register or disp+reg to use. */ + + /* -- Memory Indirection Operands (that cannot be a general purpose register) -- */ + if ((type >= OT_MEM) && (type <= OT_LMEM128_256)) { + /* All of the above types can't use a general-purpose register (a MOD of 3)!. */ + mod = (modrm >> 6) & 3; + + if (mod == 3) { + if (type == OT_MEM_OPT) { + /* Since the MEM is optional, only when mod != 3, then return true as if the operand was alright. */ + return TRUE; + } + return FALSE; + } + + switch (type) { - case OT_RFULL_M16: - case OT_RM_FULL: + case OT_MEM64_128: /* Used only by CMPXCHG8/16B. */ + if (effOpSz == Decode64Bits) { + ps->usedPrefixes |= INST_PRE_REX; + size = 128; + } + else size = 64; + break; + case OT_MEM32: size = 32; break; + case OT_MEM32_64: + /* Used by MOVNTI. Default size is 32bits, 64bits with REX. */ + if (effOpSz == Decode64Bits) { + ps->usedPrefixes |= INST_PRE_REX; + size = 64; + } + else size = 32; + break; + case OT_MEM64: size = 64; break; + case OT_MEM128: size = 128; break; + case OT_MEM16_FULL: /* The size indicates about the second item of the pair. */ switch (effOpSz) { case Decode16Bits: ps->usedPrefixes |= INST_PRE_OP_SIZE; - if (vrex & PREFIX_EX_B) { - ps->usedPrefixes |= INST_PRE_REX; - rm += EX_GPR_BASE; - } size = 16; - rm += REGS16_BASE; break; case Decode32Bits: ps->usedPrefixes |= INST_PRE_OP_SIZE; - if (vrex & PREFIX_EX_B) { - ps->usedPrefixes |= INST_PRE_REX; - rm += EX_GPR_BASE; - } size = 32; - rm += REGS32_BASE; break; case Decode64Bits: - /* A fix for SMSW RAX which use the REX prefix. */ - if (type == OT_RFULL_M16) ps->usedPrefixes |= INST_PRE_REX; - /* CALL NEAR/PUSH/POP defaults to 64 bits. --> INST_64BITS, REX isn't required, thus ignored anyways. */ - if (instFlags & INST_PRE_REX) ps->usedPrefixes |= INST_PRE_REX; - /* Include REX if used for REX.B. */ - if (vrex & PREFIX_EX_B) { - ps->usedPrefixes |= INST_PRE_REX; - rm += EX_GPR_BASE; - } + /* Mark usage of REX only if it was required. */ + if ((instFlags & (INST_64BITS | INST_PRE_REX)) == (INST_64BITS | INST_PRE_REX)) ps->usedPrefixes |= INST_PRE_REX; size = 64; - rm += REGS64_BASE; break; } break; + case OT_MEM16_3264: /* The size indicates about the second item of the pair. */ + if (ci->dt == Decode64Bits) size = 64; + else size = 32; + break; + case OT_FPUM16: size = 16; break; + case OT_FPUM32: size = 32; break; + case OT_FPUM64: size = 64; break; + case OT_FPUM80: size = 80; break; + case OT_LMEM128_256: + if (ps->vrex & PREFIX_EX_L) size = 256; + else size = 128; + break; + case OT_MEM_OPT: /* Here we know it's not optional. */ + case OT_MEM: size = 0; /* Size is unknown, but still handled. */ break; + default: return FALSE; + } + rm = modrm & 7; + ret = operands_extract_modrm(ci, ps, di, effAdrSz, mod, rm, instFlags, op); + op->size = (uint16_t)size; + if ((op->type == O_SMEM) || (op->type == O_MEM)) { + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; + } + return ret; + } + + /* -- Memory Indirection Operands (that can be a register) -- */ + if ((type >= OT_RM8) && (type <= OT_LXMM64_128)) { + mod = (modrm >> 6) & 3; + if (mod != 3) { + switch (type) + { + case OT_RM_FULL: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + /* PUSH/JMP/CALL are automatically promoted to 64 bits! */ + if (effOpSz == Decode32Bits) { + size = 32; + break; + } + else if (effOpSz == Decode64Bits) { + /* Mark usage of REX only if it was required. */ + if ((instFlags & INST_64BITS) == 0) ps->usedPrefixes |= INST_PRE_REX; + size = 64; + break; + } + /* FALL THROUGH BECAUSE dt==Decoded16Bits @-<----*/ + case OT_RM16: + /* If we got here not from OT_RM16, then the prefix was used. */ + if (type != OT_RM16) ps->usedPrefixes |= INST_PRE_OP_SIZE; + size = 16; + break; + case OT_RM32_64: + /* The default size is 32, which can be 64 with a REX only. */ + if (effOpSz == Decode64Bits) { + size = 64; + /* Mark REX prefix as used if non-promoted instruction. */ + if ((instFlags & (INST_64BITS | INST_PRE_REX)) == (INST_64BITS | INST_PRE_REX)) { + ps->usedPrefixes |= INST_PRE_REX; + } + } + else size = 32; + break; + case OT_RM16_32: + /* Ignore REX, it's either 32 or 16 bits RM. */ + if (ps->decodedPrefixes & INST_PRE_OP_SIZE) { + ps->usedPrefixes |= INST_PRE_OP_SIZE; + /* Assume: We are in 64bits when we have this operand used. */ + size = 16; + } + else size = 32; + break; + case OT_WXMM32_64: + case OT_WRM32_64: + if (ps->vrex & PREFIX_EX_W) size = 64; + else size = 32; + break; + case OT_YXMM64_256: + if (ps->vrex & PREFIX_EX_L) size = 256; + else size = 64; + break; + case OT_YXMM128_256: + if (ps->vrex & PREFIX_EX_L) size = 256; + else size = 128; + break; + case OT_LXMM64_128: + if (ps->vrex & PREFIX_EX_L) size = 128; + else size = 64; + break; + case OT_RFULL_M16: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + size = 16; + break; + + case OT_RM8: + case OT_R32_M8: + case OT_R32_64_M8: + case OT_REG32_64_M8: + size = 8; + break; + + case OT_XMM16: + case OT_R32_M16: + case OT_R32_64_M16: + case OT_REG32_64_M16: + size = 16; + break; + + case OT_RM32: + case OT_MM32: + case OT_XMM32: + size = 32; + break; + + case OT_MM64: + case OT_XMM64: + size = 64; + break; + + case OT_XMM128: size = 128; break; + case OT_YMM256: size = 256; break; + default: return FALSE; + } + /* Fill size of memory dereference for operand. */ + rm = modrm & 7; + ret = operands_extract_modrm(ci, ps, di, effAdrSz, mod, rm, instFlags, op); + op->size = (uint16_t)size; + if ((op->type == O_SMEM) || (op->type == O_MEM)) { + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; + } + return ret; + } + else { + /* + * General-purpose register is handled the same way in 16/32/64 bits decoding modes. + * NOTE!! that we have to override the size of the register, since it was set earlier as Memory and not Register! + */ + rm = modrm & 7; + size = 0; + switch (type) + { + case OT_RFULL_M16: + case OT_RM_FULL: + switch (effOpSz) + { + case Decode16Bits: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + size = 16; + rm += REGS16_BASE; + break; + case Decode32Bits: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + size = 32; + rm += REGS32_BASE; + break; + case Decode64Bits: + /* A fix for SMSW RAX which use the REX prefix. */ + if (type == OT_RFULL_M16) ps->usedPrefixes |= INST_PRE_REX; + /* CALL NEAR/PUSH/POP defaults to 64 bits. --> INST_64BITS, REX isn't required, thus ignored anyways. */ + if (instFlags & INST_PRE_REX) ps->usedPrefixes |= INST_PRE_REX; + /* Mark usage of REX only if it was required. */ + if ((instFlags & INST_64BITS) == 0) ps->usedPrefixes |= INST_PRE_REX; + /* Include REX if used for REX.B. */ + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + size = 64; + rm += REGS64_BASE; + break; + } + break; case OT_R32_64_M8: - /* FALL THROUGH, decode 32 or 64 bits register. */ + /* FALL THROUGH, decode 32 or 64 bits register. */ case OT_R32_64_M16: - /* FALL THROUGH, decode 32 or 64 bits register. */ + /* FALL THROUGH, decode 32 or 64 bits register. */ case OT_RM32_64: /* Take care specifically in MOVNTI/MOVD/CVT's instructions, making it _REG64 with REX or if they are promoted. */ - if (vrex & PREFIX_EX_B) { + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; rm += EX_GPR_BASE; } @@ -265,17 +626,18 @@ static int operands_extract_modrm(_CodeInfo* ci, break; } /* Give a chance to REX.W. Because if it was a promoted instruction we don't care about REX.W anyways. */ - if (vrex & PREFIX_EX_W) { + if (ps->vrex & PREFIX_EX_W) { ps->usedPrefixes |= INST_PRE_REX; size = 64; rm += REGS64_BASE; - } else { + } + else { size = 32; rm += REGS32_BASE; } - break; + break; case OT_RM16_32: /* Used only with MOVZXD instruction to support 16 bits operand. */ - if (vrex & PREFIX_EX_B) { + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; rm += EX_GPR_BASE; } @@ -284,412 +646,113 @@ static int operands_extract_modrm(_CodeInfo* ci, ps->usedPrefixes |= INST_PRE_OP_SIZE; size = 16; rm += REGS16_BASE; - } else { + } + else { size = 32; rm += REGS32_BASE; } - break; + break; case OT_RM16: - if (vrex & PREFIX_EX_B) { + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; rm += EX_GPR_BASE; } rm += REGS16_BASE; - break; + size = 16; + break; case OT_RM8: if (ps->prefixExtType == PET_REX) { ps->usedPrefixes |= INST_PRE_REX; - rm = operands_fix_8bit_rex_base(rm + ((vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0)); - } else rm += REGS8_BASE; - break; + rm = operands_fix_8bit_rex_base(rm + ((ps->vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0)); + } + else rm += REGS8_BASE; + size = 8; + break; case OT_MM32: case OT_MM64: /* MMX doesn't support extended registers. */ size = 64; rm += MMXREGS_BASE; - break; + break; case OT_XMM16: case OT_XMM32: case OT_XMM64: case OT_XMM128: - if (vrex & PREFIX_EX_B) { + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; rm += EX_GPR_BASE; } size = 128; rm += SSEREGS_BASE; - break; + break; case OT_RM32: case OT_R32_M8: case OT_R32_M16: - if (vrex & PREFIX_EX_B) { + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; rm += EX_GPR_BASE; } size = 32; rm += REGS32_BASE; - break; + break; case OT_YMM256: - if (vrex & PREFIX_EX_B) rm += EX_GPR_BASE; + if (ps->vrex & PREFIX_EX_B) rm += EX_GPR_BASE; rm += AVXREGS_BASE; - break; + size = 256; + break; case OT_YXMM64_256: case OT_YXMM128_256: - if (vrex & PREFIX_EX_B) rm += EX_GPR_BASE; - if (vrex & PREFIX_EX_L) { + if (ps->vrex & PREFIX_EX_B) rm += EX_GPR_BASE; + if (ps->vrex & PREFIX_EX_L) { size = 256; rm += AVXREGS_BASE; - } else { + } + else { size = 128; rm += SSEREGS_BASE; } - break; + break; case OT_WXMM32_64: case OT_LXMM64_128: - if (vrex & PREFIX_EX_B) rm += EX_GPR_BASE; + if (ps->vrex & PREFIX_EX_B) rm += EX_GPR_BASE; size = 128; rm += SSEREGS_BASE; - break; + break; case OT_WRM32_64: case OT_REG32_64_M8: case OT_REG32_64_M16: - if (vrex & PREFIX_EX_B) rm += EX_GPR_BASE; - if (vrex & PREFIX_EX_W) { + if (ps->vrex & PREFIX_EX_B) rm += EX_GPR_BASE; + if (ps->vrex & PREFIX_EX_W) { size = 64; rm += REGS64_BASE; - } else { + } + else { size = 32; rm += REGS32_BASE; } - break; - - default: return FALSE; - } - op->size = size; - op->index = (uint8_t)rm; - return TRUE; - } - - /* Memory indirection decoding ahead:) */ - - ps->usedPrefixes |= INST_PRE_ADDR_SIZE; - if (lockableInstruction && (ps->decodedPrefixes & INST_PRE_LOCK)) *lockableInstruction = TRUE; - - if (effAdrSz == Decode16Bits) { - /* Decoding according to Table 2-1. (16 bits) */ - if ((mod == 0) && (rm == 6)) { - /* 6 is a special case - only 16 bits displacement. */ - op->type = O_DISP; - di->dispSize = 16; - if (!read_stream_safe_sint(ci, (int64_t*)&di->disp, sizeof(int16_t))) return FALSE; - } else { - /* - * Create the O_MEM for 16 bits indirection that requires 2 registers, E.G: [BS+SI]. - * or create O_SMEM for a single register indirection, E.G: [BP]. - */ - static uint8_t MODS[] = {R_BX, R_BX, R_BP, R_BP, R_SI, R_DI, R_BP, R_BX}; - static uint8_t MODS2[] = {R_SI, R_DI, R_SI, R_DI}; - if (rm < 4) { - op->type = O_MEM; - di->base = MODS[rm]; - op->index = MODS2[rm]; - } else { - op->type = O_SMEM; - op->index = MODS[rm]; - } - - if (mod == 1) { /* 8 bits displacement + indirection */ - di->dispSize = 8; - if (!read_stream_safe_sint(ci, (int64_t*)&di->disp, sizeof(int8_t))) return FALSE; - } else if (mod == 2) { /* 16 bits displacement + indirection */ - di->dispSize = 16; - if (!read_stream_safe_sint(ci, (int64_t*)&di->disp, sizeof(int16_t))) return FALSE; - } - } - - if ((rm == 2) || (rm == 3) || ((rm == 6) && (mod != 0))) { - /* BP's default segment is SS, so ignore it. */ - prefixes_use_segment(INST_PRE_SS, ps, ci->dt, di); - } else { - /* Ignore default DS segment. */ - prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); - } - } else { /* Decode32Bits or Decode64Bits! */ - /* Remember that from a 32/64 bits ModR/M byte a SIB byte could follow! */ - if ((mod == 0) && (rm == 5)) { - - /* 5 is a special case - only 32 bits displacement, or RIP relative. */ - di->dispSize = 32; - if (!read_stream_safe_sint(ci, (int64_t*)&di->disp, sizeof(int32_t))) return FALSE; - - if (ci->dt == Decode64Bits) { - /* In 64 bits decoding mode depsite of the address size, a RIP-relative address it is. */ - op->type = O_SMEM; - op->index = R_RIP; - di->flags |= FLAG_RIP_RELATIVE; - } else { - /* Absolute address: */ - op->type = O_DISP; - } - } else { - if (rm == 4) { - /* 4 is a special case - SIB byte + disp8/32 follows! */ - /* Read SIB byte. */ - if (!read_stream_safe_uint(ci, &sib, sizeof(int8_t))) return FALSE; - operands_extract_sib(di, opNum, ps, effAdrSz, sib, mod); - } else { - op->type = O_SMEM; - if (vrex & PREFIX_EX_B) { - ps->usedPrefixes |= INST_PRE_REX; - rm += EX_GPR_BASE; - } - - if (effAdrSz == Decode64Bits) op->index = (uint8_t)(REGS64_BASE + rm); - else op->index = (uint8_t)(REGS32_BASE + rm); - } - - if (mod == 1) { - di->dispSize = 8; - if (!read_stream_safe_sint(ci, (int64_t*)&di->disp, sizeof(int8_t))) return FALSE; - } else if ((mod == 2) || ((sib & 7) == 5)) { /* If there is no BASE, read DISP32! */ - di->dispSize = 32; - if (!read_stream_safe_sint(ci, (int64_t*)&di->disp, sizeof(int32_t))) return FALSE; - } - } - - /* Get the base register. */ - base = op->index; - if (di->base != R_NONE) base = di->base; - else if (di->scale >= 2) base = 0; /* If it's only an index but got scale, it's still DS. */ - /* Default for EBP/ESP is SS segment. 64 bits mode ignores DS anyway. */ - if ((base == R_EBP) || (base == R_ESP)) prefixes_use_segment(INST_PRE_SS, ps, ci->dt, di); - else prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); - } - - return TRUE; -} - - -/* - * This function is reponsible to textually format a required operand according to its type. - * It is vital to understand that there are other operands than what the ModR/M byte specifies. - - * Only by decoding the operands of an instruction which got a LOCK prefix, we could tell whether it may use the LOCK prefix. - * According to Intel, LOCK prefix must precede some specific instructions AND in their memory destination operand form (which means first operand). - * LOCK INC EAX, would generate an exception, but LOCK INC [EAX] is alright. - * Also LOCK ADD BX, [BP] would generate an exception. - - * Return code: - * TRUE - continue parsing the instruction and its operands, everything went right 'till now. - * FALSE - not enough bytes, or invalid operands. - */ - -int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, - _iflags instFlags, _OpType type, _OperandNumberType opNum, - unsigned int modrm, _PrefixState* ps, _DecodeType effOpSz, - _DecodeType effAdrSz, int* lockableInstruction) -{ - int ret = 0; - unsigned int mod = 0, reg = 0, rm = 0, vexV = ps->vexV; - unsigned int vrex = ps->vrex, typeHandled = TRUE; - _Operand* op = &di->ops[opNum]; - - /* Used to indicate the size of the MEMORY INDIRECTION only. */ - _OperandSizeType opSize = OPERAND_SIZE_NONE; - - /* - * ModRM bits: - * |7-6-5--------3-2-0| - * |MOD|REG/OPCODE|RM | - * |------------------| - */ - mod = (modrm >> 6) & 3; /* Mode(register-indirection, disp8+reg+indirection, disp16+reg+indirection, general-purpose register) */ - reg = (modrm >> 3) & 7; /* Register(could be part of the opcode itself or general-purpose register) */ - rm = modrm & 7; /* Specifies which general-purpose register or disp+reg to use. */ - - /* -- Memory Indirection Operands (that cannot be a general purpose register) -- */ - switch (type) - { - case OT_MEM64_128: /* Used only by CMPXCHG8/16B. */ - /* Make a specific check when the type is OT_MEM64_128 since the lockable CMPXCHG8B uses this one... */ - if (lockableInstruction && (ps->decodedPrefixes & INST_PRE_LOCK)) *lockableInstruction = TRUE; - if (effOpSz == Decode64Bits) { - ps->usedPrefixes |= INST_PRE_REX; - opSize = OPERAND_SIZE128; - } else opSize = OPERAND_SIZE64; - break; - case OT_MEM32: opSize = OPERAND_SIZE32; break; - case OT_MEM32_64: - /* Used by MOVNTI. Default size is 32bits, 64bits with REX. */ - if (effOpSz == Decode64Bits) { - ps->usedPrefixes |= INST_PRE_REX; - opSize = OPERAND_SIZE64; - } else opSize = OPERAND_SIZE32; - break; - case OT_MEM64: opSize = OPERAND_SIZE64; break; - case OT_MEM128: opSize = OPERAND_SIZE128; break; - case OT_MEM16_FULL: /* The size indicates about the second item of the pair. */ - switch (effOpSz) - { - case Decode16Bits: - ps->usedPrefixes |= INST_PRE_OP_SIZE; - opSize = OPERAND_SIZE16; - break; - case Decode32Bits: - ps->usedPrefixes |= INST_PRE_OP_SIZE; - opSize = OPERAND_SIZE32; - break; - case Decode64Bits: - /* Mark usage of REX only if it was required. */ - if ((instFlags & (INST_64BITS | INST_PRE_REX)) == (INST_64BITS | INST_PRE_REX)) ps->usedPrefixes |= INST_PRE_REX; - opSize = OPERAND_SIZE64; break; - } - break; - case OT_MEM16_3264: /* The size indicates about the second item of the pair. */ - if (ci->dt == Decode64Bits) opSize = OPERAND_SIZE64; - else opSize = OPERAND_SIZE32; - break; - case OT_MEM_OPT: - /* Since the MEM is optional, only when mod != 3, then return true as if the operand was alright. */ - if (mod == 0x3) return TRUE; - break; - case OT_FPUM16: opSize = OPERAND_SIZE16; break; - case OT_FPUM32: opSize = OPERAND_SIZE32; break; - case OT_FPUM64: opSize = OPERAND_SIZE64; break; - case OT_FPUM80: opSize = OPERAND_SIZE80; break; - case OT_LMEM128_256: - if (vrex & PREFIX_EX_L) opSize = OPERAND_SIZE256; - else opSize = OPERAND_SIZE128; - break; - case OT_MEM: /* Size is unknown, but still handled. */ break; - default: typeHandled = FALSE; break; - } - if (typeHandled) { - /* All of the above types can't use a general-purpose register (a MOD of 3)!. */ - if (mod == 0x3) { - if (lockableInstruction) *lockableInstruction = FALSE; - return FALSE; - } - op->size = _OPSIZETOINT[opSize]; - ret = operands_extract_modrm(ci, di, type, opNum, ps, effOpSz, effAdrSz, lockableInstruction, mod, rm, instFlags); - if ((op->type == O_REG) || (op->type == O_SMEM) || (op->type == O_MEM)) { - di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; - } - return ret; - } - /* -- Memory Indirection Operands (that can be a register) -- */ - typeHandled = TRUE; - switch (type) - { - case OT_RM_FULL: - ps->usedPrefixes |= INST_PRE_OP_SIZE; - /* PUSH/JMP/CALL are automatically promoted to 64 bits! */ - if (effOpSz == Decode32Bits) { - opSize = OPERAND_SIZE32; - break; - } else if (effOpSz == Decode64Bits) { - /* Mark usage of REX only if it was required. */ - if ((instFlags & INST_64BITS) == 0) ps->usedPrefixes |= INST_PRE_REX; - opSize = OPERAND_SIZE64; - break; + default: return FALSE; } - /* FALL THROUGH BECAUSE dt==Decoded16Bits @-<----*/ - case OT_RM16: - /* If we got here not from OT_RM16, then the prefix was used. */ - if (type != OT_RM16) ps->usedPrefixes |= INST_PRE_OP_SIZE; - opSize = OPERAND_SIZE16; - break; - case OT_RM32_64: - /* The default size is 32, which can be 64 with a REX only. */ - if (effOpSz == Decode64Bits) { - opSize = OPERAND_SIZE64; - /* Mark REX prefix as used if non-promoted instruction. */ - if ((instFlags & (INST_64BITS | INST_PRE_REX)) == (INST_64BITS | INST_PRE_REX)) { - ps->usedPrefixes |= INST_PRE_REX; - } - } else opSize = OPERAND_SIZE32; - break; - case OT_RM16_32: - /* Ignore REX, it's either 32 or 16 bits RM. */ - if (ps->decodedPrefixes & INST_PRE_OP_SIZE) { - ps->usedPrefixes |= INST_PRE_OP_SIZE; - /* Assume: We are in 64bits when we have this operand used. */ - opSize = OPERAND_SIZE16; - } else opSize = OPERAND_SIZE32; - break; - case OT_WXMM32_64: - case OT_WRM32_64: - if (vrex & PREFIX_EX_W) opSize = OPERAND_SIZE64; - else opSize = OPERAND_SIZE32; - break; - case OT_YXMM64_256: - if (vrex & PREFIX_EX_L) opSize = OPERAND_SIZE256; - else opSize = OPERAND_SIZE64; - break; - case OT_YXMM128_256: - if (vrex & PREFIX_EX_L) opSize = OPERAND_SIZE256; - else opSize = OPERAND_SIZE128; - break; - case OT_LXMM64_128: - if (vrex & PREFIX_EX_L) opSize = OPERAND_SIZE128; - else opSize = OPERAND_SIZE64; - break; - case OT_RFULL_M16: - ps->usedPrefixes |= INST_PRE_OP_SIZE; - opSize = OPERAND_SIZE16; - break; - - case OT_RM8: - case OT_R32_M8: - case OT_R32_64_M8: - case OT_REG32_64_M8: - opSize = OPERAND_SIZE8; - break; - - case OT_XMM16: - case OT_R32_M16: - case OT_R32_64_M16: - case OT_REG32_64_M16: - opSize = OPERAND_SIZE16; - break; - - case OT_RM32: - case OT_MM32: - case OT_XMM32: - opSize = OPERAND_SIZE32; - break; - - case OT_MM64: - case OT_XMM64: - opSize = OPERAND_SIZE64; - break; - - case OT_XMM128: opSize = OPERAND_SIZE128; break; - case OT_YMM256: opSize = OPERAND_SIZE256; break; - default: typeHandled = FALSE; break; - } - if (typeHandled) { - /* Fill size of memory dereference for operand. */ - op->size = _OPSIZETOINT[opSize]; - ret = operands_extract_modrm(ci, di, type, opNum, ps, effOpSz, effAdrSz, lockableInstruction, mod, rm, instFlags); - if ((op->type == O_REG) || (op->type == O_SMEM) || (op->type == O_MEM)) { - di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; + op->size = (uint16_t)size; + op->index = (uint8_t)rm; + op->type = O_REG; + di->usedRegistersMask |= _REGISTERTORCLASS[rm]; + return TRUE; } - return ret; } - /* Simple operand type (no ModRM byte). */ + /* Simple operand type (ModRM reg). */ + reg = (modrm >> 3) & 7; switch (type) { case OT_IMM8: operands_set_ts(op, O_IMM, 8); - if (!read_stream_safe_uint(ci, &di->imm.byte, sizeof(int8_t))) return FALSE; + if (!read_stream_safe_uint8(ci, &di->imm.byte)) return FALSE; break; case OT_IMM_FULL: /* 16, 32 or 64, depends on prefixes. */ if (effOpSz == Decode16Bits) { @@ -697,7 +760,7 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, /* FALL THROUGH */ case OT_IMM16: /* Force 16 bits imm. */ operands_set_ts(op, O_IMM, 16); - if (!read_stream_safe_uint(ci, &di->imm.word, sizeof(int16_t))) return FALSE; + if (!read_stream_safe_uint16(ci, &di->imm.word)) return FALSE; break; /* * Extension: MOV imm64, requires REX. @@ -709,7 +772,7 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, ps->usedPrefixes |= INST_PRE_REX; operands_set_ts(op, O_IMM, 64); - if (!read_stream_safe_uint(ci, &di->imm.qword, sizeof(int64_t))) return FALSE; + if (!read_stream_safe_uint64(ci, &di->imm.qword)) return FALSE; break; } else ps->usedPrefixes |= INST_PRE_OP_SIZE; /* FALL THROUGH BECAUSE dt==Decoded32Bits @-<----*/ @@ -723,10 +786,10 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, op->size = 32; /* Use this as an indicator that it should be signed extended. */ di->flags |= FLAG_IMM_SIGNED; - if (!read_stream_safe_sint(ci, &di->imm.sqword, sizeof(int32_t))) return FALSE; + if (!read_stream_safe_sint32(ci, &di->imm.sqword)) return FALSE; } else { op->size = 32; - if (!read_stream_safe_uint(ci, &di->imm.dword, sizeof(int32_t))) return FALSE; + if (!read_stream_safe_uint32(ci, &di->imm.dword)) return FALSE; } break; case OT_SEIMM8: /* Sign extended immediate. */ @@ -752,19 +815,19 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, } } else op->size = 8; di->flags |= FLAG_IMM_SIGNED; - if (!read_stream_safe_sint(ci, &di->imm.sqword, sizeof(int8_t))) return FALSE; + if (!read_stream_safe_sint8(ci, &di->imm.sqword)) return FALSE; break; case OT_IMM16_1: operands_set_ts(op, O_IMM1, 16); - if (!read_stream_safe_uint(ci, &di->imm.ex.i1, sizeof(int16_t))) return FALSE; + if (!read_stream_safe_uint16(ci, &di->imm.ex.i1)) return FALSE; break; case OT_IMM8_1: operands_set_ts(op, O_IMM1, 8); - if (!read_stream_safe_uint(ci, &di->imm.ex.i1, sizeof(int8_t))) return FALSE; + if (!read_stream_safe_uint8(ci, &di->imm.ex.i1)) return FALSE; break; case OT_IMM8_2: operands_set_ts(op, O_IMM2, 8); - if (!read_stream_safe_uint(ci, &di->imm.ex.i2, sizeof(int8_t))) return FALSE; + if (!read_stream_safe_uint8(ci, &di->imm.ex.i2)) return FALSE; break; case OT_REG8: operands_set_ts(op, O_REG, 8); @@ -774,99 +837,102 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, * This is a PASSIVE behavior changer of REX prefix, it affects operands even if its value is 0x40 ! */ ps->usedPrefixes |= INST_PRE_REX; - op->index = (uint8_t)operands_fix_8bit_rex_base(reg + ((vrex & PREFIX_EX_R) ? EX_GPR_BASE : 0)); + op->index = (uint8_t)operands_fix_8bit_rex_base(reg + ((ps->vrex & PREFIX_EX_R) ? EX_GPR_BASE : 0)); } else op->index = (uint8_t)(REGS8_BASE + reg); + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; break; case OT_REG16: - operands_set_tsi(op, O_REG, 16, REGS16_BASE + reg); + operands_set_tsi(di, op, O_REG, 16, REGS16_BASE + reg); break; case OT_REG_FULL: switch (effOpSz) { case Decode16Bits: ps->usedPrefixes |= INST_PRE_OP_SIZE; - if (vrex & PREFIX_EX_R) { + if (ps->vrex & PREFIX_EX_R) { ps->usedPrefixes |= INST_PRE_REX; reg += EX_GPR_BASE; } - operands_set_tsi(op, O_REG, 16, REGS16_BASE + reg); + operands_set_tsi(di, op, O_REG, 16, REGS16_BASE + reg); break; case Decode32Bits: - if (vrex & PREFIX_EX_R) { + if (ps->vrex & PREFIX_EX_R) { ps->usedPrefixes |= INST_PRE_REX; reg += EX_GPR_BASE; } else ps->usedPrefixes |= INST_PRE_OP_SIZE; - operands_set_tsi(op, O_REG, 32, REGS32_BASE + reg); + operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + reg); break; case Decode64Bits: /* rex must be presented. */ ps->usedPrefixes |= INST_PRE_REX; - operands_set_tsi(op, O_REG, 64, REGS64_BASE + reg + ((vrex & PREFIX_EX_R) ? EX_GPR_BASE : 0)); + operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + reg + ((ps->vrex & PREFIX_EX_R) ? EX_GPR_BASE : 0)); break; } break; case OT_REG32: - if (vrex & PREFIX_EX_R) { + if (ps->vrex & PREFIX_EX_R) { ps->usedPrefixes |= INST_PRE_REX; reg += EX_GPR_BASE; } - operands_set_tsi(op, O_REG, 32, REGS32_BASE + reg); + operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + reg); break; case OT_REG32_64: /* Handle CVT's, MOVxX and MOVNTI instructions which could be extended to 64 bits registers with REX. */ - if (vrex & PREFIX_EX_R) { + if (ps->vrex & PREFIX_EX_R) { ps->usedPrefixes |= INST_PRE_REX; reg += EX_GPR_BASE; } /* Is it a promoted instruction? (only INST_64BITS is set and REX isn't required.) */ if ((ci->dt == Decode64Bits) && ((instFlags & (INST_64BITS | INST_PRE_REX)) == INST_64BITS)) { - operands_set_tsi(op, O_REG, 64, REGS64_BASE + reg); + operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + reg); break; } /* Give a chance to REX.W. Because if it was a promoted instruction we don't care about REX.W anyways. */ - if (vrex & PREFIX_EX_W) { + if (ps->vrex & PREFIX_EX_W) { ps->usedPrefixes |= INST_PRE_REX; - operands_set_tsi(op, O_REG, 64, REGS64_BASE + reg); - } else operands_set_tsi(op, O_REG, 32, REGS32_BASE + reg); + operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + reg); + } else operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + reg); break; case OT_FREG32_64_RM: /* Force decoding mode. Used for MOV CR(n)/DR(n) which defaults to 64 bits operand size in 64 bits. */ - if (vrex & PREFIX_EX_B) { + rm = modrm & 7; + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; rm += EX_GPR_BASE; } - if (ci->dt == Decode64Bits) operands_set_tsi(op, O_REG, 64, REGS64_BASE + rm); - else operands_set_tsi(op, O_REG, 32, REGS32_BASE + rm); + if (ci->dt == Decode64Bits) operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + rm); + else operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + rm); break; case OT_MM: /* MMX register */ - operands_set_tsi(op, O_REG, 64, MMXREGS_BASE + reg); + operands_set_tsi(di, op, O_REG, 64, MMXREGS_BASE + reg); break; case OT_MM_RM: /* MMX register, this time from the RM field */ - operands_set_tsi(op, O_REG, 64, MMXREGS_BASE + rm); + rm = modrm & 7; + operands_set_tsi(di, op, O_REG, 64, MMXREGS_BASE + rm); break; case OT_REGXMM0: /* Implicit XMM0 operand. */ - reg = 0; - vrex = 0; - /* FALL THROUGH */ + operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + 0); + break; case OT_XMM: /* SSE register */ - if (vrex & PREFIX_EX_R) { + if (ps->vrex & PREFIX_EX_R) { ps->usedPrefixes |= INST_PRE_REX; reg += EX_GPR_BASE; } - operands_set_tsi(op, O_REG, 128, SSEREGS_BASE + reg); + operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + reg); break; case OT_XMM_RM: /* SSE register, this time from the RM field */ - if (vrex & PREFIX_EX_B) { + rm = modrm & 7; + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; rm += EX_GPR_BASE; } - operands_set_tsi(op, O_REG, 128, SSEREGS_BASE + rm); + operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + rm); break; case OT_CREG: /* * Don't parse if the reg exceeds the bounds of the array. * Most of the CR's are not implemented, so if there's no matching string, the operand is invalid. */ - if (vrex & PREFIX_EX_R) { + if (ps->vrex & PREFIX_EX_R) { ps->usedPrefixes |= INST_PRE_REX; reg += EX_GPR_BASE; } else if ((ci->dt == Decode32Bits) && (ps->decodedPrefixes & INST_PRE_LOCK)) { @@ -884,24 +950,25 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, if (ci->dt == Decode64Bits) op->size = 64; else op->size = 32; op->index = (uint8_t)(CREGS_BASE + reg); + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; break; case OT_DREG: /* * In 64 bits there are 16 debug registers. * but accessing any of dr8-15 which aren't implemented will cause an #ud. */ - if ((reg == 4) || (reg == 5) || (vrex & PREFIX_EX_R)) return FALSE; + if ((reg == 4) || (reg == 5) || (ps->vrex & PREFIX_EX_R)) return FALSE; op->type = O_REG; if (ci->dt == Decode64Bits) op->size = 64; else op->size = 32; op->index = (uint8_t)(DREGS_BASE + reg); + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; break; case OT_SREG: /* Works with REG16 only! */ - /* If lockableInstruction pointer is non-null we know it's the first operand. */ - if (lockableInstruction && (reg == 1)) return FALSE; /* Can't MOV CS, . */ + if ((&di->ops[0] == op) && (reg == 1)) return FALSE; /* Can't MOV CS, . */ /*Don't parse if the reg exceeds the bounds of the array. */ - if (reg <= SEG_REGS_MAX - 1) operands_set_tsi(op, O_REG, 16, SREGS_BASE + reg); + if (reg <= SEG_REGS_MAX - 1) operands_set_tsi(di, op, O_REG, 16, SREGS_BASE + reg); else return FALSE; break; case OT_SEG: @@ -922,29 +989,31 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, case INST_PRE_FS: op->index = R_FS; break; case INST_PRE_GS: op->index = R_GS; break; } + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; break; case OT_ACC8: - operands_set_tsi(op, O_REG, 8, R_AL); + operands_set_tsi(di, op, O_REG, 8, R_AL); break; case OT_ACC16: - operands_set_tsi(op, O_REG, 16, R_AX); + operands_set_tsi(di, op, O_REG, 16, R_AX); break; - case OT_ACC_FULL_NOT64: /* No REX.W support for IN/OUT. */ - vrex &= ~PREFIX_EX_W; + case OT_ACC_FULL_NOT64: + /* No REX.W support for IN/OUT. */ + /* FALL THROUGH */ case OT_ACC_FULL: if (effOpSz == Decode16Bits) { ps->usedPrefixes |= INST_PRE_OP_SIZE; - operands_set_tsi(op, O_REG, 16, R_AX); - } else if (effOpSz == Decode32Bits) { + operands_set_tsi(di, op, O_REG, 16, R_AX); + } else if ((effOpSz == Decode32Bits) || (type == OT_ACC_FULL_NOT64)) { ps->usedPrefixes |= INST_PRE_OP_SIZE; - operands_set_tsi(op, O_REG, 32, R_EAX); + operands_set_tsi(di, op, O_REG, 32, R_EAX); } else { /* Decode64Bits */ /* Only non-promoted instructions need REX in order to decode in 64 bits. */ /* MEM-OFFSET MOV's are NOT automatically promoted to 64 bits. */ - if (~instFlags & INST_64BITS) { + if (!(instFlags & INST_64BITS)) { ps->usedPrefixes |= INST_PRE_REX; } - operands_set_tsi(op, O_REG, 64, R_RAX); + operands_set_tsi(di, op, O_REG, 64, R_RAX); } break; case OT_PTR16_FULL: @@ -976,17 +1045,17 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, if (type == OT_RELCB) { operands_set_ts(op, O_PC, 8); - if (!read_stream_safe_sint(ci, &di->imm.sqword, sizeof(int8_t))) return FALSE; + if (!read_stream_safe_sint8(ci, &di->imm.sqword)) return FALSE; } else { /* OT_RELC_FULL */ /* Yep, operand size prefix affects relc also. */ ps->usedPrefixes |= INST_PRE_OP_SIZE; if (effOpSz == Decode16Bits) { operands_set_ts(op, O_PC, 16); - if (!read_stream_safe_sint(ci, &di->imm.sqword, sizeof(int16_t))) return FALSE; + if (!read_stream_safe_sint16(ci, &di->imm.sqword)) return FALSE; } else { /* Decode32Bits or Decode64Bits = for now they are the same */ operands_set_ts(op, O_PC, 32); - if (!read_stream_safe_sint(ci, &di->imm.sqword, sizeof(int32_t))) return FALSE; + if (!read_stream_safe_sint32(ci, &di->imm.sqword)) return FALSE; } } @@ -1026,15 +1095,15 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, ps->usedPrefixes |= INST_PRE_ADDR_SIZE; di->dispSize = 16; - if (!read_stream_safe_uint(ci, &di->disp, sizeof(int16_t))) return FALSE; + if (!read_stream_safe_uint16(ci, &di->disp)) return FALSE; } else if (effAdrSz == Decode32Bits) { ps->usedPrefixes |= INST_PRE_ADDR_SIZE; di->dispSize = 32; - if (!read_stream_safe_uint(ci, &di->disp, sizeof(int32_t))) return FALSE; + if (!read_stream_safe_uint32(ci, &di->disp)) return FALSE; } else { /* Decode64Bits */ di->dispSize = 64; - if (!read_stream_safe_uint(ci, &di->disp, sizeof(int64_t))) return FALSE; + if (!read_stream_safe_uint64(ci, &di->disp)) return FALSE; } break; case OT_CONST1: @@ -1042,20 +1111,22 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, di->imm.byte = 1; break; case OT_REGCL: - operands_set_tsi(op, O_REG, 8, R_CL); + operands_set_tsi(di, op, O_REG, 8, R_CL); break; case OT_FPU_SI: /* Low 3 bits specify the REG, similar to the MODR/M byte reg. */ - operands_set_tsi(op, O_REG, 32, FPUREGS_BASE + (*(ci->code-1) & 7)); + operands_set_tsi(di, op, O_REG, 32, FPUREGS_BASE + (*(ci->code-1) & 7)); break; case OT_FPU_SSI: - operands_set_tsi(op, O_REG, 32, R_ST0); - operands_set_tsi(op + 1, O_REG, 32, FPUREGS_BASE + (*(ci->code-1) & 7)); + operands_set_tsi(di, op, O_REG, 32, R_ST0); + operands_set_tsi(di, op + 1, O_REG, 32, FPUREGS_BASE + (*(ci->code-1) & 7)); + di->opsNo++; break; case OT_FPU_SIS: - operands_set_tsi(op, O_REG, 32, FPUREGS_BASE + (*(ci->code-1) & 7)); - operands_set_tsi(op + 1, O_REG, 32, R_ST0); + operands_set_tsi(di, op, O_REG, 32, FPUREGS_BASE + (*(ci->code-1) & 7)); + operands_set_tsi(di, op + 1, O_REG, 32, R_ST0); + di->opsNo++; break; /* @@ -1070,13 +1141,15 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, /* Low 3 bits specify the REG, similar to the MODR/M byte reg. */ operands_set_ts(op, O_REG, 8); reg = *(ci->code-1) & 7; - if (vrex & PREFIX_EX_B) { + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; op->index = (uint8_t)operands_fix_8bit_rex_base(reg + EX_GPR_BASE); } else if (ps->prefixExtType == PET_REX) { ps->usedPrefixes |= INST_PRE_REX; op->index = (uint8_t)operands_fix_8bit_rex_base(reg); } else op->index = (uint8_t)(REGS8_BASE + reg); + + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; break; case OT_IB_R_FULL: reg = *(ci->code-1) & 7; @@ -1084,18 +1157,18 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, { case Decode16Bits: ps->usedPrefixes |= INST_PRE_OP_SIZE; - if (vrex & PREFIX_EX_B) { + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; reg += EX_GPR_BASE; } - operands_set_tsi(op, O_REG, 16, REGS16_BASE + reg); + operands_set_tsi(di, op, O_REG, 16, REGS16_BASE + reg); break; case Decode32Bits: - if (vrex & PREFIX_EX_B) { + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; reg += EX_GPR_BASE; } else ps->usedPrefixes |= INST_PRE_OP_SIZE; - operands_set_tsi(op, O_REG, 32, REGS32_BASE + reg); + operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + reg); break; case Decode64Bits: /* @@ -1104,15 +1177,15 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, * MOV imm64 / BSWAP requires REX.W to be 64 bits --> INST_64BITS | INST_PRE_REX */ if ((instFlags & INST_64BITS) && ((instFlags & INST_PRE_REX) == 0)) { - if (vrex & PREFIX_EX_B) { + if (ps->vrex & PREFIX_EX_B) { ps->usedPrefixes |= INST_PRE_REX; reg += EX_GPR_BASE; } } else { ps->usedPrefixes |= INST_PRE_REX; - reg += (vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0; + reg += (ps->vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0; } - operands_set_tsi(op, O_REG, 64, REGS64_BASE + reg); + operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + reg); break; } break; @@ -1161,12 +1234,14 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, * Clear segment in case OT_REGI_EDI was parsed earlier, * DS can be overridden and therefore has precedence. */ - di->segment = 0; + di->segment = R_NONE; prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); if (effAdrSz == Decode16Bits) op->index = R_SI; else if (effAdrSz == Decode32Bits) op->index = R_ESI; else op->index = R_RSI; + + di->usedRegistersMask |= _REGISTERTORCLASS[R_RSI]; /* Maps to RM_SI. */ break; case OT_REGI_EDI: ps->usedPrefixes |= INST_PRE_ADDR_SIZE; @@ -1185,22 +1260,24 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, } else op->size = 8; /* Note: The [rDI] operand can't be prefixed by a segment override, therefore we don't set usedPrefixes. */ - if ((opNum == ONT_1) && (ci->dt != Decode64Bits)) di->segment = R_ES | SEGMENT_DEFAULT; /* No ES in 64 bits mode. */ + if ((di->segment == R_NONE) && (ci->dt != Decode64Bits)) di->segment = R_ES | SEGMENT_DEFAULT; /* No ES in 64 bits mode. */ if (effAdrSz == Decode16Bits) op->index = R_DI; else if (effAdrSz == Decode32Bits) op->index = R_EDI; else op->index = R_RDI; + + di->usedRegistersMask |= _REGISTERTORCLASS[R_RDI]; /* Maps to RM_DI. */ break; /* Used for In/Out instructions varying forms. */ case OT_REGDX: /* Simple single IN/OUT instruction. */ - operands_set_tsi(op, O_REG, 16, R_DX); + operands_set_tsi(di, op, O_REG, 16, R_DX); break; - /* Used for INVLPGA instruction. */ + /* Used for INVLPGA instruction. */ case OT_REGECX: - operands_set_tsi(op, O_REG, 32, R_ECX); + operands_set_tsi(di, op, O_REG, 32, R_ECX); break; case OT_REGI_EBXAL: /* XLAT BYTE [rBX + AL] */ @@ -1209,7 +1286,7 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); /* Size of deref is always 8 for xlat. */ - operands_set_tsi(op, O_MEM, 8, R_AL); + operands_set_tsi(di, op, O_MEM, 8, R_AL); if (effAdrSz == Decode16Bits) di->base = R_BX; else if (effAdrSz == Decode32Bits) di->base = R_EBX; @@ -1217,6 +1294,8 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, ps->usedPrefixes |= INST_PRE_REX; di->base = R_RBX; } + + di->usedRegistersMask |= _REGISTERTORCLASS[di->base]; break; case OT_REGI_EAX: /* @@ -1224,17 +1303,18 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, * Since this is a memory indirection, the default address size in 64bits decoding mode is 64. */ - if (effAdrSz == Decode64Bits) operands_set_tsi(op, O_SMEM, 64, R_RAX); + if (effAdrSz == Decode64Bits) operands_set_tsi(di, op, O_SMEM, 64, R_RAX); else if (effAdrSz == Decode32Bits) { ps->usedPrefixes |= INST_PRE_ADDR_SIZE; - operands_set_tsi(op, O_SMEM, 32, R_EAX); - } else { + operands_set_tsi(di, op, O_SMEM, 32, R_EAX); + } + else { ps->usedPrefixes |= INST_PRE_ADDR_SIZE; - operands_set_tsi(op, O_SMEM, 16, R_AX); + operands_set_tsi(di, op, O_SMEM, 16, R_AX); } break; case OT_VXMM: - operands_set_tsi(op, O_REG, 128, SSEREGS_BASE + vexV); + operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + ps->vexV); break; case OT_XMM_IMM: ci->codeLen -= sizeof(int8_t); @@ -1242,14 +1322,14 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, if (ci->dt == Decode32Bits) reg = (*ci->code >> 4) & 0x7; else reg = (*ci->code >> 4) & 0xf; - operands_set_tsi(op, O_REG, 128, SSEREGS_BASE + reg); + operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + reg); ci->code += sizeof(int8_t); break; case OT_YXMM: - if (vrex & PREFIX_EX_R) reg += EX_GPR_BASE; - if (ps->vrex & PREFIX_EX_L) operands_set_tsi(op, O_REG, 256, AVXREGS_BASE + reg); - else operands_set_tsi(op, O_REG, 128, SSEREGS_BASE + reg); + if (ps->vrex & PREFIX_EX_R) reg += EX_GPR_BASE; + if (ps->vrex & PREFIX_EX_L) operands_set_tsi(di, op, O_REG, 256, AVXREGS_BASE + reg); + else operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + reg); break; case OT_YXMM_IMM: ci->codeLen -= sizeof(int8_t); @@ -1258,33 +1338,28 @@ int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, if (ci->dt == Decode32Bits) reg = (*ci->code >> 4) & 0x7; else reg = (*ci->code >> 4) & 0xf; - if (ps->vrex & PREFIX_EX_L) operands_set_tsi(op, O_REG, 256, AVXREGS_BASE + reg); - else operands_set_tsi(op, O_REG, 128, SSEREGS_BASE + reg); + if (ps->vrex & PREFIX_EX_L) operands_set_tsi(di, op, O_REG, 256, AVXREGS_BASE + reg); + else operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + reg); ci->code += sizeof(int8_t); break; case OT_YMM: - if (vrex & PREFIX_EX_R) reg += EX_GPR_BASE; - operands_set_tsi(op, O_REG, 256, AVXREGS_BASE + reg); + if (ps->vrex & PREFIX_EX_R) reg += EX_GPR_BASE; + operands_set_tsi(di, op, O_REG, 256, AVXREGS_BASE + reg); break; case OT_VYMM: - operands_set_tsi(op, O_REG, 256, AVXREGS_BASE + vexV); + operands_set_tsi(di, op, O_REG, 256, AVXREGS_BASE + ps->vexV); break; case OT_VYXMM: - if (ps->vrex & PREFIX_EX_L) operands_set_tsi(op, O_REG, 256, AVXREGS_BASE + vexV); - else operands_set_tsi(op, O_REG, 128, SSEREGS_BASE + vexV); + if (ps->vrex & PREFIX_EX_L) operands_set_tsi(di, op, O_REG, 256, AVXREGS_BASE + ps->vexV); + else operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + ps->vexV); break; case OT_WREG32_64: - if (vrex & PREFIX_EX_R) reg += EX_GPR_BASE; - if (ps->vrex & PREFIX_EX_W) operands_set_tsi(op, O_REG, 64, REGS64_BASE + reg); - else operands_set_tsi(op, O_REG, 32, REGS32_BASE + reg); + if (ps->vrex & PREFIX_EX_R) reg += EX_GPR_BASE; + if (ps->vrex & PREFIX_EX_W) operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + reg); + else operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + reg); break; default: return FALSE; } - - if ((op->type == O_REG) || (op->type == O_SMEM) || (op->type == O_MEM)) { - di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; - } - return TRUE; } diff --git a/NativeCore/Dependencies/distorm/src/operands.h b/NativeCore/Dependencies/distorm/src/operands.h index 2d916474..c4e48224 100644 --- a/NativeCore/Dependencies/distorm/src/operands.h +++ b/NativeCore/Dependencies/distorm/src/operands.h @@ -4,7 +4,7 @@ operands.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -17,12 +17,9 @@ This library is licensed under the BSD license. See the file COPYING. #include "prefix.h" #include "instructions.h" - -extern uint32_t _REGISTERTORCLASS[]; - int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, - _iflags instFlags, _OpType type, _OperandNumberType opNum, + _iflags instFlags, _OpType type, unsigned int modrm, _PrefixState* ps, _DecodeType effOpSz, - _DecodeType effAdrSz, int* lockableInstruction); + _DecodeType effAdrSz, _Operand* op); #endif /* OPERANDS_H */ diff --git a/NativeCore/Dependencies/distorm/src/prefix.c b/NativeCore/Dependencies/distorm/src/prefix.c index b1c26954..40b0ac2b 100644 --- a/NativeCore/Dependencies/distorm/src/prefix.c +++ b/NativeCore/Dependencies/distorm/src/prefix.c @@ -4,7 +4,7 @@ prefix.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -22,53 +22,43 @@ This library is licensed under the BSD license. See the file COPYING. * That's why I have to detect such cases and drop those excess prefixes. */ -int prefixes_is_valid(unsigned int ch, _DecodeType dt) -{ - switch (ch) { - /* for i in xrange(0x40, 0x50): print "case 0x%2x:" % i */ - case 0x40: /* REX: */ - case 0x41: - case 0x42: - case 0x43: - case 0x44: - case 0x45: - case 0x46: - case 0x47: - case 0x48: - case 0x49: - case 0x4a: - case 0x4b: - case 0x4c: - case 0x4d: - case 0x4e: - case 0x4f: return (dt == Decode64Bits); - case PREFIX_LOCK: return TRUE; - case PREFIX_REPNZ: return TRUE; - case PREFIX_REP: return TRUE; - case PREFIX_CS: return TRUE; - case PREFIX_SS: return TRUE; - case PREFIX_DS: return TRUE; - case PREFIX_ES: return TRUE; - case PREFIX_FS: return TRUE; - case PREFIX_GS: return TRUE; - case PREFIX_OP_SIZE: return TRUE; - case PREFIX_ADDR_SIZE: return TRUE; - /* The VEXs might be false positives, the decode_perfixes will determine for sure. */ - case PREFIX_VEX2b: /* VEX is supported for all modes, because 16 bits Pmode is included. */ - case PREFIX_VEX3b: return TRUE; - } - return FALSE; -} -/* Ignore a specific prefix type. */ -void prefixes_ignore(_PrefixState* ps, _PrefixIndexer pi) -{ - /* - * If that type of prefix appeared already, set the bit of that *former* prefix. - * Anyway, set the new index of that prefix type to the current index, so next time we know its position. - */ - if (ps->pfxIndexer[pi] != PFXIDX_NONE) ps->unusedPrefixesMask |= (1 << ps->pfxIndexer[pi]); -} +int PrefixTables[256 * 2] = { + /* Decode 16/32 Bits */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, /* ES (0x26) CS (0x2e) */ + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, /* DS (0x3e) SS (0x36) */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* FS(0x64) GS(0x65) OP_SIZE(0x66) ADDR_SIZE(0x67) */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* VEX2b (0xc5) VEX3b (0xc4) */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* LOCK (0xf0) REPNZ (0xf2) REP (0xf3) */ + /* Decode64Bits */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* REX: 0x40 - 0x4f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; /* Ignore all prefix. */ void prefixes_ignore_all(_PrefixState* ps) @@ -93,6 +83,7 @@ uint16_t prefixes_set_unused_mask(_PrefixState* ps) * So now we know which bits we need to set exactly in the mask. */ _iflags unusedPrefixesDiff = ps->decodedPrefixes ^ ps->usedPrefixes; + uint16_t unusedPrefixesMask = ps->unusedPrefixesMask; /* Examine unused prefixes by type: */ /* @@ -102,14 +93,16 @@ uint16_t prefixes_set_unused_mask(_PrefixState* ps) * It's not a big problem, because the prefixes_ignore func will ignore it anyway, * since it wasn't seen earlier. But it's important to know this. */ - if (unusedPrefixesDiff & INST_PRE_REX) prefixes_ignore(ps, PFXIDX_REX); - if (unusedPrefixesDiff & INST_PRE_SEGOVRD_MASK) prefixes_ignore(ps, PFXIDX_SEG); - if (unusedPrefixesDiff & INST_PRE_LOKREP_MASK) prefixes_ignore(ps, PFXIDX_LOREP); - if (unusedPrefixesDiff & INST_PRE_OP_SIZE) prefixes_ignore(ps, PFXIDX_OP_SIZE); - if (unusedPrefixesDiff & INST_PRE_ADDR_SIZE) prefixes_ignore(ps, PFXIDX_ADRS); - /* If a VEX instruction was found, its prefix is considered as used, therefore no point for checking for it. */ - - return ps->unusedPrefixesMask; + if (unusedPrefixesDiff) { + if (unusedPrefixesDiff & INST_PRE_REX) unusedPrefixesMask |= ps->pfxIndexer[PFXIDX_REX]; + if (unusedPrefixesDiff & INST_PRE_SEGOVRD_MASK) unusedPrefixesMask |= ps->pfxIndexer[PFXIDX_SEG]; + if (unusedPrefixesDiff & INST_PRE_LOKREP_MASK) unusedPrefixesMask |= ps->pfxIndexer[PFXIDX_LOREP]; + if (unusedPrefixesDiff & INST_PRE_OP_SIZE) unusedPrefixesMask |= ps->pfxIndexer[PFXIDX_OP_SIZE]; + if (unusedPrefixesDiff & INST_PRE_ADDR_SIZE) unusedPrefixesMask |= ps->pfxIndexer[PFXIDX_ADRS]; + /* If a VEX instruction was found, its prefix is considered as used, therefore no point for checking for it. */ + } + + return unusedPrefixesMask; } /* @@ -118,9 +111,10 @@ uint16_t prefixes_set_unused_mask(_PrefixState* ps) */ _INLINE_ void prefixes_track_unused(_PrefixState* ps, int index, _PrefixIndexer pi) { + /* Mark the previously used prefix (if exists) in the unused mask. */ prefixes_ignore(ps, pi); /* Book-keep the current index for this type. */ - ps->pfxIndexer[pi] = index; + ps->pfxIndexer[pi] = 1 << index; } /* @@ -129,11 +123,12 @@ _INLINE_ void prefixes_track_unused(_PrefixState* ps, int index, _PrefixIndexer * The tiny complexity is that we want to know when a prefix was superfluous and mark any copy of it as unused. * Note that the last prefix of its type will be considered as used, and all the others (of same type) before it as unused. */ -void prefixes_decode(const uint8_t* code, int codeLen, _PrefixState* ps, _DecodeType dt) +void prefixes_decode(_CodeInfo* ci, _PrefixState* ps) { - int index, done; - uint8_t vex; - + const uint8_t* rexPos = NULL; + const uint8_t* start = ci->code; + uint8_t byte, vex; + unsigned int index; /* * First thing to do, scan for prefixes, there are six types of prefixes. * There may be up to six prefixes before a single instruction, not the same type, no special order, @@ -145,9 +140,9 @@ void prefixes_decode(const uint8_t* code, int codeLen, _PrefixState* ps, _Decode * We attach all prefixes to the next instruction, there might be two or more occurrences from the same prefix. * Also, since VEX can be allowed only once we will test it separately. */ - for (index = 0, done = FALSE; - (codeLen > 0) && (code - ps->start < INST_MAXIMUM_SIZE); - code++, codeLen--, index++) { + for (index = 0; + (ci->codeLen > 0) && (index < INST_MAXIMUM_SIZE); + ci->code++, ci->codeLen--, index++) { /* NOTE: AMD treat lock/rep as two different groups... But I am based on Intel. @@ -175,102 +170,90 @@ void prefixes_decode(const uint8_t* code, int codeLen, _PrefixState* ps, _Decode */ /* Examine what type of prefix we got. */ - switch (*code) + byte = *ci->code; + switch (byte) { - /* REX type, 64 bits decoding mode only: */ - case 0x40: - case 0x41: - case 0x42: - case 0x43: - case 0x44: - case 0x45: - case 0x46: - case 0x47: - case 0x48: - case 0x49: - case 0x4a: - case 0x4b: - case 0x4c: - case 0x4d: - case 0x4e: - case 0x4f: - if (dt == Decode64Bits) { - ps->decodedPrefixes |= INST_PRE_REX; - ps->vrex = *code & 0xf; /* Keep only BXRW. */ - ps->rexPos = code; - ps->prefixExtType = PET_REX; - prefixes_track_unused(ps, index, PFXIDX_REX); - } else done = TRUE; /* If we are not in 64 bits mode, it's an instruction, then halt. */ - break; - + case PREFIX_OP_SIZE: {/* Op Size type: */ + ps->decodedPrefixes |= INST_PRE_OP_SIZE; + prefixes_track_unused(ps, index, PFXIDX_OP_SIZE); + } break; + /* Look for both common arch prefixes. */ + case PREFIX_LOCK: { /* LOCK and REPx type: */ - case PREFIX_LOCK: - ps->decodedPrefixes |= INST_PRE_LOCK; - prefixes_track_unused(ps, index, PFXIDX_LOREP); - break; - case PREFIX_REPNZ: - ps->decodedPrefixes |= INST_PRE_REPNZ; - prefixes_track_unused(ps, index, PFXIDX_LOREP); - break; - case PREFIX_REP: - ps->decodedPrefixes |= INST_PRE_REP; - prefixes_track_unused(ps, index, PFXIDX_LOREP); - break; - + ps->decodedPrefixes |= INST_PRE_LOCK; + prefixes_track_unused(ps, index, PFXIDX_LOREP); + } break; + case PREFIX_REPNZ: { + ps->decodedPrefixes |= INST_PRE_REPNZ; + prefixes_track_unused(ps, index, PFXIDX_LOREP); + } break; + case PREFIX_REP: { + ps->decodedPrefixes |= INST_PRE_REP; + prefixes_track_unused(ps, index, PFXIDX_LOREP); + } break; + case PREFIX_CS: { /* Seg Overide type: */ - case PREFIX_CS: - ps->decodedPrefixes |= INST_PRE_CS; - prefixes_track_unused(ps, index, PFXIDX_SEG); - break; - case PREFIX_SS: - ps->decodedPrefixes |= INST_PRE_SS; - prefixes_track_unused(ps, index, PFXIDX_SEG); - break; - case PREFIX_DS: - ps->decodedPrefixes |= INST_PRE_DS; - prefixes_track_unused(ps, index, PFXIDX_SEG); - break; - case PREFIX_ES: - ps->decodedPrefixes |= INST_PRE_ES; - prefixes_track_unused(ps, index, PFXIDX_SEG); - break; - case PREFIX_FS: - ps->decodedPrefixes |= INST_PRE_FS; - prefixes_track_unused(ps, index, PFXIDX_SEG); - break; - case PREFIX_GS: - ps->decodedPrefixes |= INST_PRE_GS; - prefixes_track_unused(ps, index, PFXIDX_SEG); - break; - - /* Op Size type: */ - case PREFIX_OP_SIZE: - ps->decodedPrefixes |= INST_PRE_OP_SIZE; - prefixes_track_unused(ps, index, PFXIDX_OP_SIZE); - break; - + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_CS; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_SS: { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_SS; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_DS: { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_DS; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_ES: { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_ES; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_FS: { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_FS; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_GS: { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_GS; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_ADDR_SIZE: { /* Addr Size type: */ - case PREFIX_ADDR_SIZE: - ps->decodedPrefixes |= INST_PRE_ADDR_SIZE; - prefixes_track_unused(ps, index, PFXIDX_ADRS); - break; - - /* Non-prefix byte now, so break 2. */ - default: done = TRUE; break; + ps->decodedPrefixes |= INST_PRE_ADDR_SIZE; + prefixes_track_unused(ps, index, PFXIDX_ADRS); + } break; + default: + if (ci->dt == Decode64Bits) { + /* REX type, 64 bits decoding mode only: */ + if ((byte & 0xf0) == 0x40) { + ps->decodedPrefixes |= INST_PRE_REX; + rexPos = ci->code; + ps->vrex = byte & 0xf; /* Keep only BXRW. */ + ps->prefixExtType = PET_REX; + prefixes_track_unused(ps, index, PFXIDX_REX); + continue; + } + } + goto _Break2; } - if (done) break; } +_Break2: /* 2 Bytes VEX: */ - if ((codeLen >= 2) && - (*code == PREFIX_VEX2b) && - ((code - ps->start) <= INST_MAXIMUM_SIZE - 2)) { + if ((ci->codeLen >= 2) && + (*ci->code == PREFIX_VEX2b) && + ((ci->code - start) <= INST_MAXIMUM_SIZE - 2)) { /* * In 32 bits the second byte has to be in the special range of Mod=11. * Otherwise it might be a normal LDS instruction. */ - if ((dt == Decode64Bits) || (*(code + 1) >= INST_DIVIDED_MODRM)) { - ps->vexPos = code + 1; + if ((ci->dt == Decode64Bits) || (*(ci->code + 1) >= INST_DIVIDED_MODRM)) { + ps->vexPos = ci->code + 1; ps->decodedPrefixes |= INST_PRE_VEX; ps->prefixExtType = PET_VEX2BYTES; @@ -283,25 +266,26 @@ void prefixes_decode(const uint8_t* code, int codeLen, _PrefixState* ps, _Decode /* -- Convert from VEX prefix to VREX flags -- */ vex = *ps->vexPos; - if (~vex & 0x80 && dt == Decode64Bits) ps->vrex |= PREFIX_EX_R; /* Convert VEX.R. */ + if (!(vex & 0x80) && (ci->dt == Decode64Bits)) ps->vrex |= PREFIX_EX_R; /* Convert VEX.R. */ if (vex & 4) ps->vrex |= PREFIX_EX_L; /* Convert VEX.L. */ - code += 2; + ci->code += 2; + ci->codeLen -= 2; } } /* 3 Bytes VEX: */ - if ((codeLen >= 3) && - (*code == PREFIX_VEX3b) && - ((code - ps->start) <= INST_MAXIMUM_SIZE - 3) && - (~ps->decodedPrefixes & INST_PRE_VEX)) { + if ((ci->codeLen >= 3) && + (*ci->code == PREFIX_VEX3b) && + ((ci->code - start) <= INST_MAXIMUM_SIZE - 3) && + (!(ps->decodedPrefixes & INST_PRE_VEX))) { /* * In 32 bits the second byte has to be in the special range of Mod=11. * Otherwise it might be a normal LES instruction. * And we don't care now about the 3rd byte. */ - if ((dt == Decode64Bits) || (*(code + 1) >= INST_DIVIDED_MODRM)) { - ps->vexPos = code + 1; + if ((ci->dt == Decode64Bits) || (*(ci->code + 1) >= INST_DIVIDED_MODRM)) { + ps->vexPos = ci->code + 1; ps->decodedPrefixes |= INST_PRE_VEX; ps->prefixExtType = PET_VEX3BYTES; @@ -320,49 +304,78 @@ void prefixes_decode(const uint8_t* code, int codeLen, _PrefixState* ps, _Decode if (vex & 0x80) ps->vrex |= PREFIX_EX_W; /* Convert VEX.W. */ /* Clear some flags if the mode isn't 64 bits. */ - if (dt != Decode64Bits) ps->vrex &= ~(PREFIX_EX_B | PREFIX_EX_X | PREFIX_EX_R | PREFIX_EX_W); + if (ci->dt != Decode64Bits) ps->vrex &= ~(PREFIX_EX_B | PREFIX_EX_X | PREFIX_EX_R | PREFIX_EX_W); - code += 3; + ci->code += 3; + ci->codeLen -= 3; } } - /* - * Save last byte scanned address, so the decoder could keep on scanning from this point and on and on and on. - * In addition the decoder is able to know that the last byte could lead to MMX/SSE instructions (preceding REX if exists). - */ - ps->last = code; /* ps->last points to an opcode byte. */ + if (ci->dt == Decode64Bits) { + if (ps->decodedPrefixes & INST_PRE_REX) { + /* REX prefix must precede first byte of instruction. */ + if (rexPos != (ci->code - 1)) { + ps->decodedPrefixes &= ~INST_PRE_REX; + if (ps->prefixExtType == PET_REX) ps->prefixExtType = PET_NONE; /* It might be a VEX by now, keep it that way. */ + prefixes_ignore(ps, PFXIDX_REX); + } + /* + * We will disable operand size prefix, + * if it exists only after decoding the instruction, since it might be a mandatory prefix. + * This will be done after calling inst_lookup in decode_inst. + */ + } + /* In 64 bits, segment overrides of CS, DS, ES and SS are ignored. So don't take'em into account. */ + if (ps->decodedPrefixes & INST_PRE_SEGOVRD_MASK32) { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK32; + prefixes_ignore(ps, PFXIDX_SEG); + } + } + + /* Store number of prefixes scanned. */ + ps->count = (uint8_t)(ci->code - start); } /* - * For every memory-indirection operand we want to set its corresponding default segment. - * If the segment is being overrided, we need to see whether we use it or not. - * We will use it only if it's not the default one already. + * For every memory-indirection operand we want to set a used segment. + * If the segment is being overrided with a prefix, we will need to check if it's a default. + * Defaults don't use their prefix, e.g "mov [rsp]" can ignore a given SS: prefix, + * but still set the used segment as SS. + * This function is called only with SS and DS as defaults. + * If there's a segment prefix used, it will override the default one. + * And If the prefix is a default seg in 64 bits, it will be ignored. */ void prefixes_use_segment(_iflags defaultSeg, _PrefixState* ps, _DecodeType dt, _DInst* di) { - _iflags flags = 0; - if (dt == Decode64Bits) flags = ps->decodedPrefixes & INST_PRE_SEGOVRD_MASK64; - else flags = ps->decodedPrefixes & INST_PRE_SEGOVRD_MASK; - - if ((flags == 0) || (flags == defaultSeg)) { - flags = defaultSeg; - di->segment |= SEGMENT_DEFAULT; - } else if (flags != defaultSeg) { - /* Use it only if it's non-default segment. */ - ps->usedPrefixes |= flags; - } + /* Extract given segment prefix from the decoded prefixes. */ + _iflags flags; - /* ASSERT: R_XX must be below 128. */ - switch (flags) - { - case INST_PRE_ES: di->segment |= R_ES; break; - case INST_PRE_CS: di->segment |= R_CS; break; - case INST_PRE_SS: di->segment |= R_SS; break; - case INST_PRE_DS: di->segment |= R_DS; break; - case INST_PRE_FS: di->segment |= R_FS; break; - case INST_PRE_GS: di->segment |= R_GS; break; + if (dt == Decode64Bits) { + if (ps->decodedPrefixes & INST_PRE_SEGOVRD_MASK64) { /* Either GS or FS. */ + di->segment = ps->decodedPrefixes & INST_PRE_GS ? R_GS : R_FS; + } + + return; } - /* If it's one of the CS,SS,DS,ES and the mode is 64 bits, set segment it to none, since it's ignored. */ - if ((dt == Decode64Bits) && (flags & INST_PRE_SEGOVRD_MASK32)) di->segment = R_NONE; + flags = ps->decodedPrefixes & INST_PRE_SEGOVRD_MASK; + + /* Use the given prefix only if it's not the default. */ + if (flags && (flags != defaultSeg)) { + ps->usedPrefixes |= flags; + + switch (flags >> 7) /* INST_PRE_CS is 1 << 7. And the rest of the prefixes follow as bit fields. */ + { + case 1: di->segment = R_CS; break; + case 2: di->segment = R_SS; break; + case 4: di->segment = R_DS; break; + case 8: di->segment = R_ES; break; + case 0x10: di->segment = R_FS; break; + case 0x20: di->segment = R_GS; break; + } + } + else { + if (defaultSeg == INST_PRE_SS) di->segment = SEGMENT_DEFAULT | R_SS; + else di->segment = SEGMENT_DEFAULT | R_DS; + } } diff --git a/NativeCore/Dependencies/distorm/src/prefix.h b/NativeCore/Dependencies/distorm/src/prefix.h index f205e697..bc9b6e7d 100644 --- a/NativeCore/Dependencies/distorm/src/prefix.h +++ b/NativeCore/Dependencies/distorm/src/prefix.h @@ -4,7 +4,7 @@ prefix.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -31,20 +31,19 @@ typedef enum {PFXIDX_NONE = -1, PFXIDX_REX, PFXIDX_LOREP, PFXIDX_SEG, PFXIDX_OP_ */ typedef struct { _iflags decodedPrefixes, usedPrefixes; - const uint8_t *start, *last, *vexPos, *rexPos; - _PrefixExtType prefixExtType; + /* Number of prefixes scanned for current instruction, including VEX! */ + unsigned int count; uint16_t unusedPrefixesMask; + /* Holds the offset to the prefix byte by its type. */ + uint16_t pfxIndexer[PFXIDX_MAX]; + _PrefixExtType prefixExtType; /* Indicates whether the operand size prefix (0x66) was used as a mandatory prefix. */ int isOpSizeMandatory; /* If VEX prefix is used, store the VEX.vvvv field. */ unsigned int vexV; /* The fields B/X/R/W/L of REX and VEX are stored together in this byte. */ unsigned int vrex; - - /* !! Make sure pfxIndexer is LAST! Otherwise memset won't work well with it. !! */ - - /* Holds the offset to the prefix byte by its type. */ - int pfxIndexer[PFXIDX_MAX]; + const uint8_t* vexPos; } _PrefixState; /* @@ -54,11 +53,27 @@ typedef struct { */ #define MAX_PREFIXES (5) -int prefixes_is_valid(unsigned int ch, _DecodeType dt); -void prefixes_ignore(_PrefixState* ps, _PrefixIndexer pi); +extern int PrefixTables[256 * 2]; + +_INLINE_ int prefixes_is_valid(unsigned char ch, _DecodeType dt) +{ + /* The predicate selects (branchlessly) second half table for 64 bits otherwise selects first half. */ + return PrefixTables[ch + ((dt >> 1) << 8)]; +} + +/* Ignore a specific prefix type. */ +_INLINE_ void prefixes_ignore(_PrefixState* ps, _PrefixIndexer pi) +{ + /* + * If that type of prefix appeared already, set the bit of that *former* prefix. + * Anyway, set the new index of that prefix type to the current index, so next time we know its position. + */ + ps->unusedPrefixesMask |= ps->pfxIndexer[pi]; +} + void prefixes_ignore_all(_PrefixState* ps); uint16_t prefixes_set_unused_mask(_PrefixState* ps); -void prefixes_decode(const uint8_t* code, int codeLen, _PrefixState* ps, _DecodeType dt); +void prefixes_decode(_CodeInfo* ci, _PrefixState* ps); void prefixes_use_segment(_iflags defaultSeg, _PrefixState* ps, _DecodeType dt, _DInst* di); #endif /* PREFIX_H */ diff --git a/NativeCore/Dependencies/distorm/src/textdefs.c b/NativeCore/Dependencies/distorm/src/textdefs.c index 48419d91..cf56a8f6 100644 --- a/NativeCore/Dependencies/distorm/src/textdefs.c +++ b/NativeCore/Dependencies/distorm/src/textdefs.c @@ -4,7 +4,7 @@ textdefs.c diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -13,116 +13,84 @@ This library is licensed under the BSD license. See the file COPYING. #ifndef DISTORM_LIGHT -static uint8_t Nibble2ChrTable[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; +static uint8_t Nibble2ChrTable[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; #define NIBBLE_TO_CHR Nibble2ChrTable[t] -void _FASTCALL_ str_hex_b(_WString* s, unsigned int x) +void str_hex(_WString* s, const uint8_t* buf, unsigned int len) { - /* - * def prebuilt(): - * s = "" - * for i in xrange(256): - * if ((i % 0x10) == 0): - * s += "\r\n" - * s += "\"%02X\", " % (i) - * return s - */ - static int8_t TextBTable[256][3] = { - "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0A", "0B", "0C", "0D", "0E", "0F", - "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B", "1C", "1D", "1E", "1F", - "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F", - "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C", "3D", "3E", "3F", - "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F", - "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D", "5E", "5F", - "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", - "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", "7B", "7C", "7D", "7E", "7F", - "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8A", "8B", "8C", "8D", "8E", "8F", - "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9A", "9B", "9C", "9D", "9E", "9F", - "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "AA", "AB", "AC", "AD", "AE", "AF", - "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF", - "C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "CA", "CB", "CC", "CD", "CE", "CF", - "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF", - "E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF", - "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "FA", "FB", "FC", "FD", "FE", "FF" - }; - - /* - * Fixed length of 3 including null terminate character. - */ - memcpy(&s->p[s->length], TextBTable[x & 255], 3); - s->length += 2; + /* 256 * 2 : 2 chars per byte value. */ + static const char* TextBTable = + "000102030405060708090a0b0c0d0e0f" \ + "101112131415161718191a1b1c1d1e1f" \ + "202122232425262728292a2b2c2d2e2f" \ + "303132333435363738393a3b3c3d3e3f" \ + "404142434445464748494a4b4c4d4e4f" \ + "505152535455565758595a5b5c5d5e5f" \ + "606162636465666768696a6b6c6d6e6f" \ + "707172737475767778797a7b7c7d7e7f" \ + "808182838485868788898a8b8c8d8e8f" \ + "909192939495969798999a9b9c9d9e9f" \ + "a0a1a2a3a4a5a6a7a8a9aaabacadaeaf" \ + "b0b1b2b3b4b5b6b7b8b9babbbcbdbebf" \ + "c0c1c2c3c4c5c6c7c8c9cacbcccdcecf" \ + "d0d1d2d3d4d5d6d7d8d9dadbdcdddedf" \ + "e0e1e2e3e4e5e6e7e8e9eaebecedeeef" \ + "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"; + + unsigned int i = 0; + /* Length is at least 1, enter loop. */ + s->length = len * 2; + s->p[len * 2] = 0; + do { + RSHORT(&s->p[i]) = RSHORT(&TextBTable[(*buf) * 2]); + buf++; + i += 2; + } while (i < len * 2); } -void _FASTCALL_ str_code_hb(_WString* s, unsigned int x) -{ - static int8_t TextHBTable[256][5] = { - /* - * def prebuilt(): - * s = "" - * for i in xrange(256): - * if ((i % 0x10) == 0): - * s += "\r\n" - * s += "\"0x%X\", " % (i) - * return s - */ - "0x0", "0x1", "0x2", "0x3", "0x4", "0x5", "0x6", "0x7", "0x8", "0x9", "0xA", "0xB", "0xC", "0xD", "0xE", "0xF", - "0x10", "0x11", "0x12", "0x13", "0x14", "0x15", "0x16", "0x17", "0x18", "0x19", "0x1A", "0x1B", "0x1C", "0x1D", "0x1E", "0x1F", - "0x20", "0x21", "0x22", "0x23", "0x24", "0x25", "0x26", "0x27", "0x28", "0x29", "0x2A", "0x2B", "0x2C", "0x2D", "0x2E", "0x2F", - "0x30", "0x31", "0x32", "0x33", "0x34", "0x35", "0x36", "0x37", "0x38", "0x39", "0x3A", "0x3B", "0x3C", "0x3D", "0x3E", "0x3F", - "0x40", "0x41", "0x42", "0x43", "0x44", "0x45", "0x46", "0x47", "0x48", "0x49", "0x4A", "0x4B", "0x4C", "0x4D", "0x4E", "0x4F", - "0x50", "0x51", "0x52", "0x53", "0x54", "0x55", "0x56", "0x57", "0x58", "0x59", "0x5A", "0x5B", "0x5C", "0x5D", "0x5E", "0x5F", - "0x60", "0x61", "0x62", "0x63", "0x64", "0x65", "0x66", "0x67", "0x68", "0x69", "0x6A", "0x6B", "0x6C", "0x6D", "0x6E", "0x6F", - "0x70", "0x71", "0x72", "0x73", "0x74", "0x75", "0x76", "0x77", "0x78", "0x79", "0x7A", "0x7B", "0x7C", "0x7D", "0x7E", "0x7F", - "0x80", "0x81", "0x82", "0x83", "0x84", "0x85", "0x86", "0x87", "0x88", "0x89", "0x8A", "0x8B", "0x8C", "0x8D", "0x8E", "0x8F", - "0x90", "0x91", "0x92", "0x93", "0x94", "0x95", "0x96", "0x97", "0x98", "0x99", "0x9A", "0x9B", "0x9C", "0x9D", "0x9E", "0x9F", - "0xA0", "0xA1", "0xA2", "0xA3", "0xA4", "0xA5", "0xA6", "0xA7", "0xA8", "0xA9", "0xAA", "0xAB", "0xAC", "0xAD", "0xAE", "0xAF", - "0xB0", "0xB1", "0xB2", "0xB3", "0xB4", "0xB5", "0xB6", "0xB7", "0xB8", "0xB9", "0xBA", "0xBB", "0xBC", "0xBD", "0xBE", "0xBF", - "0xC0", "0xC1", "0xC2", "0xC3", "0xC4", "0xC5", "0xC6", "0xC7", "0xC8", "0xC9", "0xCA", "0xCB", "0xCC", "0xCD", "0xCE", "0xCF", - "0xD0", "0xD1", "0xD2", "0xD3", "0xD4", "0xD5", "0xD6", "0xD7", "0xD8", "0xD9", "0xDA", "0xDB", "0xDC", "0xDD", "0xDE", "0xDF", - "0xE0", "0xE1", "0xE2", "0xE3", "0xE4", "0xE5", "0xE6", "0xE7", "0xE8", "0xE9", "0xEA", "0xEB", "0xEC", "0xED", "0xEE", "0xEF", - "0xF0", "0xF1", "0xF2", "0xF3", "0xF4", "0xF5", "0xF6", "0xF7", "0xF8", "0xF9", "0xFA", "0xFB", "0xFC", "0xFD", "0xFE", "0xFF" - }; - - if (x < 0x10) { /* < 0x10 has a fixed length of 4 including null terminate. */ - memcpy(&s->p[s->length], TextHBTable[x & 255], 4); - s->length += 3; - } else { /* >= 0x10 has a fixed length of 5 including null terminate. */ - memcpy(&s->p[s->length], TextHBTable[x & 255], 5); - s->length += 4; - } -} +#ifdef SUPPORT_64BIT_OFFSET -void _FASTCALL_ str_code_hdw(_WString* s, uint32_t x) +void str_int_impl(unsigned char** s, uint64_t x) { int8_t* buf; - int i = 0, shift = 0; - unsigned int t = 0; + int shift = 0; + OFFSET_INTEGER t = x; - buf = (int8_t*)&s->p[s->length]; + buf = (int8_t*)*s; - buf[0] = '0'; - buf[1] = 'x'; - buf += 2; + *buf++ = '0'; + *buf++ = 'x'; - for (shift = 28; shift != 0; shift -= 4) { - t = (x >> shift) & 0xf; - if (i | t) buf[i++] = NIBBLE_TO_CHR; + if (x == 0) { + *buf = '0'; + *s += 3; + return; } - t = x & 0xf; - buf[i++] = NIBBLE_TO_CHR; - s->length += i + 2; - buf[i] = '\0'; + do { + t >>= 4; + shift += 4; + } while (t); + + do { + shift -= 4; + t = (x >> shift) & 0xf; + *buf++ = NIBBLE_TO_CHR; + } while (shift > 0); + + *s = (unsigned char*)buf; } -void _FASTCALL_ str_code_hqw(_WString* s, uint8_t src[8]) +#else + +void str_int_impl(unsigned char** s, uint8_t src[8]) { int8_t* buf; int i = 0, shift = 0; uint32_t x = RULONG(&src[sizeof(int32_t)]); int t; - buf = (int8_t*)&s->p[s->length]; + buf = (int8_t*)*s; buf[0] = '0'; buf[1] = 'x'; buf += 2; @@ -140,33 +108,9 @@ void _FASTCALL_ str_code_hqw(_WString* s, uint8_t src[8]) t = x & 0xf; buf[i++] = NIBBLE_TO_CHR; - s->length += i + 2; - buf[i] = '\0'; + *s += (size_t)(i + 2); } -#ifdef SUPPORT_64BIT_OFFSET -void _FASTCALL_ str_off64(_WString* s, OFFSET_INTEGER x) -{ - int8_t* buf; - int i = 0, shift = 0; - OFFSET_INTEGER t = 0; - - buf = (int8_t*)&s->p[s->length]; - - buf[0] = '0'; - buf[1] = 'x'; - buf += 2; - - for (shift = 60; shift != 0; shift -= 4) { - t = (x >> shift) & 0xf; - if (i | t) buf[i++] = NIBBLE_TO_CHR; - } - t = x & 0xf; - buf[i++] = NIBBLE_TO_CHR; - - s->length += i + 2; - buf[i] = '\0'; -} #endif /* SUPPORT_64BIT_OFFSET */ #endif /* DISTORM_LIGHT */ diff --git a/NativeCore/Dependencies/distorm/src/textdefs.h b/NativeCore/Dependencies/distorm/src/textdefs.h index a923626f..27170bb3 100644 --- a/NativeCore/Dependencies/distorm/src/textdefs.h +++ b/NativeCore/Dependencies/distorm/src/textdefs.h @@ -4,7 +4,7 @@ textdefs.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -43,13 +43,14 @@ Naming Convention: * all numbers are in HEX. */ -void _FASTCALL_ str_hex_b(_WString* s, unsigned int x); -void _FASTCALL_ str_code_hb(_WString* s, unsigned int x); -void _FASTCALL_ str_code_hdw(_WString* s, uint32_t x); -void _FASTCALL_ str_code_hqw(_WString* s, uint8_t src[8]); +void str_hex(_WString* s, const uint8_t* buf, unsigned int len); #ifdef SUPPORT_64BIT_OFFSET -void _FASTCALL_ str_off64(_WString* s, OFFSET_INTEGER x); +#define str_int(s, x) str_int_impl((s), (x)) +void str_int_impl(unsigned char** s, uint64_t x); +#else +#define str_int(s, x) str_int_impl((s), (uint8_t*)&(x)) +void str_int_impl(unsigned char** s, uint8_t src[8]); #endif #endif /* DISTORM_LIGHT */ diff --git a/NativeCore/Dependencies/distorm/src/wstring.c b/NativeCore/Dependencies/distorm/src/wstring.c deleted file mode 100644 index 083200b4..00000000 --- a/NativeCore/Dependencies/distorm/src/wstring.c +++ /dev/null @@ -1,47 +0,0 @@ -/* -wstring.c - -diStorm3 - Powerful disassembler for X86/AMD64 -http://ragestorm.net/distorm/ -distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah -This library is licensed under the BSD license. See the file COPYING. -*/ - - -#include "wstring.h" - -#ifndef DISTORM_LIGHT - -void strclear_WS(_WString* s) -{ - s->p[0] = '\0'; - s->length = 0; -} - -void chrcat_WS(_WString* s, uint8_t ch) -{ - s->p[s->length] = ch; - s->p[s->length + 1] = '\0'; - s->length += 1; -} - -void strcpylen_WS(_WString* s, const int8_t* buf, unsigned int len) -{ - s->length = len; - memcpy((int8_t*)s->p, buf, len + 1); -} - -void strcatlen_WS(_WString* s, const int8_t* buf, unsigned int len) -{ - memcpy((int8_t*)&s->p[s->length], buf, len + 1); - s->length += len; -} - -void strcat_WS(_WString* s, const _WString* s2) -{ - memcpy((int8_t*)&s->p[s->length], s2->p, s2->length + 1); - s->length += s2->length; -} - -#endif /* DISTORM_LIGHT */ diff --git a/NativeCore/Dependencies/distorm/src/wstring.h b/NativeCore/Dependencies/distorm/src/wstring.h index 6b3a2a3f..6303f90d 100644 --- a/NativeCore/Dependencies/distorm/src/wstring.h +++ b/NativeCore/Dependencies/distorm/src/wstring.h @@ -4,7 +4,7 @@ wstring.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ @@ -13,22 +13,25 @@ This library is licensed under the BSD license. See the file COPYING. #define WSTRING_H #include "config.h" +#include "../include/mnemonics.h" #ifndef DISTORM_LIGHT -void strclear_WS(_WString* s); -void chrcat_WS(_WString* s, uint8_t ch); -void strcpylen_WS(_WString* s, const int8_t* buf, unsigned int len); -void strcatlen_WS(_WString* s, const int8_t* buf, unsigned int len); -void strcat_WS(_WString* s, const _WString* s2); - -/* -* Warning, this macro should be used only when the compiler knows the size of string in advance! -* This macro is used in order to spare the call to strlen when the strings are known already. -* Note: sizeof includes NULL terminated character. -*/ -#define strcat_WSN(s, t) strcatlen_WS((s), ((const int8_t*)t), sizeof((t))-1) -#define strcpy_WSN(s, t) strcpylen_WS((s), ((const int8_t*)t), sizeof((t))-1) +_INLINE_ void strcat_WSR(unsigned char** str, const _WRegister* reg) +{ + /* + * Longest register name is YMM15 - 5 characters, + * Copy 8 so compiler can do a QWORD move. + * We copy nul termination and fix the length, so it's okay to copy more to the output buffer. + * There's a sentinel register to make sure we don't read past the end of the registers table. + */ + memcpy((int8_t*)*str, (const int8_t*)reg->p, 8); + *str += reg->length; +} + +#define strfinalize_WS(s, end) do { *end = 0; s.length = (unsigned int)((size_t)end - (size_t)s.p); } while (0) +#define chrcat_WS(s, ch) do { *s = ch; s += 1; } while (0) +#define strcat_WS(s, buf, copylen, advancelen) do { memcpy((int8_t*)s, buf, copylen); s += advancelen; } while(0) #endif /* DISTORM_LIGHT */ diff --git a/NativeCore/Dependencies/distorm/src/x86defs.h b/NativeCore/Dependencies/distorm/src/x86defs.h index ca3a3adf..8b7b5414 100644 --- a/NativeCore/Dependencies/distorm/src/x86defs.h +++ b/NativeCore/Dependencies/distorm/src/x86defs.h @@ -4,7 +4,7 @@ x86defs.h diStorm3 - Powerful disassembler for X86/AMD64 http://ragestorm.net/distorm/ distorm at gmail dot com -Copyright (C) 2003-2018 Gil Dabah +Copyright (C) 2003-2021 Gil Dabah This library is licensed under the BSD license. See the file COPYING. */ diff --git a/NativeCore/Shared/DistormHelper.cpp b/NativeCore/Shared/DistormHelper.cpp index dbc08ad8..092b1670 100644 --- a/NativeCore/Shared/DistormHelper.cpp +++ b/NativeCore/Shared/DistormHelper.cpp @@ -58,99 +58,87 @@ bool AreOperandsStatic(const _DInst &instruction, const int prefixLength) return true; } -int GetStaticInstructionBytes(const _DInst &instruction, const uint8_t *data) +_CodeInfo CreateCodeInfo(const uint8_t* address, int length, const _OffsetType virtualAddress) { _CodeInfo info = {}; - info.codeOffset = reinterpret_cast<_OffsetType>(data); - info.code = data; - info.codeLen = instruction.size; + info.codeOffset = virtualAddress; + info.code = address; + info.codeLen = length; info.features = DF_NONE; -#ifdef RECLASSNET32 - info.dt = Decode32Bits; -#else + +#ifdef RECLASSNET64 info.dt = Decode64Bits; +#else + info.dt = Decode32Bits; #endif - _PrefixState ps = {}; - memset(ps.pfxIndexer, PFXIDX_NONE, sizeof(int) * PFXIDX_MAX); - ps.start = data; - ps.last = data; - - prefixes_decode(data, info.codeLen, &ps, info.dt); + return info; +} - info.codeOffset = reinterpret_cast<_OffsetType>(ps.last); - info.code = ps.last; - const auto prefixLength = static_cast(ps.start - ps.last); - info.codeLen -= prefixLength; +int GetStaticInstructionBytes(const _DInst &instruction, const uint8_t *data) +{ + auto info = CreateCodeInfo(data, instruction.size, reinterpret_cast<_OffsetType>(data)); - inst_lookup(&info, &ps); + _PrefixState ps = {}; + int isPrefixed; + inst_lookup(&info, &ps, &isPrefixed); - if (AreOperandsStatic(instruction, prefixLength)) + if (AreOperandsStatic(instruction, ps.count)) { return instruction.size; } - return instruction.size - info.codeLen; + return instruction.size - info.codeLen - ps.count; } -_CodeInfo CreateCodeInfo(const RC_Pointer address, const RC_Size length, const RC_Pointer virtualAddress) -{ - _CodeInfo info = {}; - info.codeOffset = reinterpret_cast<_OffsetType>(virtualAddress); - info.code = reinterpret_cast(address); - info.codeLen = static_cast(length); - info.features = DF_NONE; - -#ifdef RECLASSNET32 - info.dt = Decode32Bits; -#else - info.dt = Decode64Bits; -#endif - - return info; -} - -void FillInstructionData(const RC_Pointer address, const _DInst& instruction, const _DecodedInst& instructionInfo, const bool determineStaticInstructionBytes, InstructionData* data) +void FillInstructionData(const _CodeInfo& info, const RC_Pointer address, const _DInst& instruction, const bool determineStaticInstructionBytes, InstructionData* data) { data->Address = reinterpret_cast(instruction.addr); - data->Length = instructionInfo.size; - std::memcpy(data->Data, address, instructionInfo.size); - - MultiByteToUnicode( - reinterpret_cast(instructionInfo.mnemonic.p), - data->Instruction, - instructionInfo.mnemonic.length - ); - if (instructionInfo.operands.length != 0) - { - data->Instruction[instructionInfo.mnemonic.length] = ' '; - - MultiByteToUnicode( - reinterpret_cast(instructionInfo.operands.p), - 0, - data->Instruction, - instructionInfo.mnemonic.length + 1, - std::min(64 - 1 - instructionInfo.mnemonic.length, instructionInfo.operands.length) - ); - } + data->Length = instruction.size; + std::memcpy(data->Data, address, instruction.size); + data->StaticInstructionBytes = -1; - if (determineStaticInstructionBytes) + if (instruction.flags == FLAG_NOT_DECODABLE) { - data->StaticInstructionBytes = GetStaticInstructionBytes( - instruction, - reinterpret_cast(address) - ); + std::memcpy(data->Instruction, L"???", sizeof(RC_UnicodeChar) * 3); } else { - data->StaticInstructionBytes = -1; + _DecodedInst instructionInfo = {}; + distorm_format(&info, &instruction, &instructionInfo); + + MultiByteToUnicode( + reinterpret_cast(instructionInfo.mnemonic.p), + data->Instruction, + instructionInfo.mnemonic.length + ); + if (instructionInfo.operands.length != 0) + { + data->Instruction[instructionInfo.mnemonic.length] = ' '; + + MultiByteToUnicode( + reinterpret_cast(instructionInfo.operands.p), + 0, + data->Instruction, + instructionInfo.mnemonic.length + 1, + std::min(64 - 1 - instructionInfo.mnemonic.length, instructionInfo.operands.length) + ); + } + + if (determineStaticInstructionBytes) + { + data->StaticInstructionBytes = GetStaticInstructionBytes( + instruction, + reinterpret_cast(address) + ); + } } } bool DisassembleInstructionsImpl(const RC_Pointer address, const RC_Size length, const RC_Pointer virtualAddress, const bool determineStaticInstructionBytes, EnumerateInstructionCallback callback) { - auto info = CreateCodeInfo(address, length, virtualAddress); + auto info = CreateCodeInfo(static_cast(address), static_cast(length), reinterpret_cast<_OffsetType>(virtualAddress)); const unsigned MaxInstructions = 50; @@ -169,18 +157,17 @@ bool DisassembleInstructionsImpl(const RC_Pointer address, const RC_Size length, for (auto i = 0u; i < count; ++i) { - _DecodedInst instructionInfo = {}; - distorm_format(&info, &decodedInstructions[i], &instructionInfo); + const auto& instruction = decodedInstructions[i]; InstructionData data = {}; - FillInstructionData(instructionAddress, decodedInstructions[i], instructionInfo, determineStaticInstructionBytes, &data); + FillInstructionData(info, instructionAddress, instruction, determineStaticInstructionBytes, &data); if (callback(&data) == false) { return true; } - instructionAddress += decodedInstructions[i].size; + instructionAddress += instruction.size; } if (res == DECRES_SUCCESS || count == 0) @@ -188,7 +175,7 @@ bool DisassembleInstructionsImpl(const RC_Pointer address, const RC_Size length, return true; } - const auto offset = static_cast(decodedInstructions[count - 1].addr - info.codeOffset); + const auto offset = static_cast(decodedInstructions[count - 1].addr + decodedInstructions[count - 1].size - info.codeOffset); info.codeOffset += offset; info.code += offset; diff --git a/NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp b/NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp index a3ef6d8b..9d821cfe 100644 --- a/NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp +++ b/NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp @@ -50,7 +50,9 @@ extern "C" void RC_CallConv EnumerateRemoteSectionsAndModules(RC_Pointer handle, RC_UnicodeChar Path[PATH_MAXIMUM_LENGTH] = {}; }; - std::ifstream input(static_cast(std::stringstream() << "/proc/" << reinterpret_cast(handle) << "/maps").str()); + auto path = std::stringstream(); + path << "/proc/" << reinterpret_cast(handle) << "/maps"; + std::ifstream input(path.str()); std::unordered_map modules; diff --git a/NativeCore/Unix/Makefile b/NativeCore/Unix/Makefile index 1a99feff..f18ff1fb 100644 --- a/NativeCore/Unix/Makefile +++ b/NativeCore/Unix/Makefile @@ -7,198 +7,338 @@ LD = g++ WINDRES = windres INC = -I../Dependencies/distorm/include -CFLAGS = -Wall -fPIC -DRECLASSNET64=1 +CFLAGS32 = -Wall -fPIC -m32 +CFLAGS64 = -Wall -fPIC -m64 -DRECLASSNET64=1 RESINC = LIBDIR = LIB = -lstdc++fs -lstdc++ -LDFLAGS = -shared -Wl,--no-undefined +LDFLAGS32 = -m32 -shared -Wl,--no-undefined +LDFLAGS64 = -m64 -shared -Wl,--no-undefined INC_DEBUG = $(INC) -CFLAGS_DEBUG = $(CFLAGS) -g +CFLAGS32_DEBUG = $(CFLAGS32) -g +CFLAGS64_DEBUG = $(CFLAGS64) -g RESINC_DEBUG = $(RESINC) RCFLAGS_DEBUG = $(RCFLAGS) LIBDIR_DEBUG = $(LIBDIR) LIB_DEBUG = $(LIB) -LDFLAGS_DEBUG = $(LDFLAGS) -OBJDIR_DEBUG = obj/debug +LDFLAGS32_DEBUG = $(LDFLAGS32) +LDFLAGS64_DEBUG = $(LDFLAGS64) +OBJDIR32_DEBUG = obj/debug/x86 +OBJDIR64_DEBUG = obj/debug/x64 DEP_DEBUG = -OUT_DEBUG = build/debug/NativeCore.so +OUT32_DEBUG = build/debug/x86/NativeCore.so +OUT64_DEBUG = build/debug/x64/NativeCore.so INC_RELEASE = $(INC) -CFLAGS_RELEASE = $(CFLAGS) -O2 +CFLAGS32_RELEASE = $(CFLAGS32) -O2 +CFLAGS64_RELEASE = $(CFLAGS64) -O2 RESINC_RELEASE = $(RESINC) RCFLAGS_RELEASE = $(RCFLAGS) LIBDIR_RELEASE = $(LIBDIR) LIB_RELEASE = $(LIB) -LDFLAGS_RELEASE = $(LDFLAGS) -s -OBJDIR_RELEASE = obj/release +LDFLAGS32_RELEASE = $(LDFLAGS32) -s +LDFLAGS64_RELEASE = $(LDFLAGS64) -s +OBJDIR32_RELEASE = obj/release/x86 +OBJDIR64_RELEASE = obj/release/x64 DEP_RELEASE = -OUT_RELEASE = build/release/NativeCore.so +OUT32_RELEASE = build/release/x86/NativeCore.so +OUT64_RELEASE = build/release/x64/NativeCore.so -OBJ_DEBUG = $(OBJDIR_DEBUG)/WriteRemoteMemory.o $(OBJDIR_DEBUG)/ReadRemoteMemory.o $(OBJDIR_DEBUG)/OpenRemoteProcess.o $(OBJDIR_DEBUG)/IsProcessValid.o $(OBJDIR_DEBUG)/Input.o $(OBJDIR_DEBUG)/EnumerateRemoteSectionsAndModules.o $(OBJDIR_DEBUG)/EnumerateProcesses.o $(OBJDIR_DEBUG)/DisassembleCode.o $(OBJDIR_DEBUG)/DistormHelper.o $(OBJDIR_DEBUG)/Debugger.o $(OBJDIR_DEBUG)/ControlRemoteProcess.o $(OBJDIR_DEBUG)/CloseRemoteProcess.o $(OBJDIR_DEBUG)/decoder.o $(OBJDIR_DEBUG)/distorm.o $(OBJDIR_DEBUG)/instructions.o $(OBJDIR_DEBUG)/insts.o $(OBJDIR_DEBUG)/mnemonics.o $(OBJDIR_DEBUG)/operands.o $(OBJDIR_DEBUG)/prefix.o $(OBJDIR_DEBUG)/textdefs.o $(OBJDIR_DEBUG)/wstring.o +OBJ32_DEBUG = $(OBJDIR32_DEBUG)/WriteRemoteMemory.o $(OBJDIR32_DEBUG)/ReadRemoteMemory.o $(OBJDIR32_DEBUG)/OpenRemoteProcess.o $(OBJDIR32_DEBUG)/IsProcessValid.o $(OBJDIR32_DEBUG)/Input.o $(OBJDIR32_DEBUG)/EnumerateRemoteSectionsAndModules.o $(OBJDIR32_DEBUG)/EnumerateProcesses.o $(OBJDIR32_DEBUG)/DisassembleCode.o $(OBJDIR32_DEBUG)/DistormHelper.o $(OBJDIR32_DEBUG)/Debugger.o $(OBJDIR32_DEBUG)/ControlRemoteProcess.o $(OBJDIR32_DEBUG)/CloseRemoteProcess.o $(OBJDIR32_DEBUG)/decoder.o $(OBJDIR32_DEBUG)/distorm.o $(OBJDIR32_DEBUG)/instructions.o $(OBJDIR32_DEBUG)/insts.o $(OBJDIR32_DEBUG)/mnemonics.o $(OBJDIR32_DEBUG)/operands.o $(OBJDIR32_DEBUG)/prefix.o $(OBJDIR32_DEBUG)/textdefs.o +OBJ64_DEBUG = $(OBJDIR64_DEBUG)/WriteRemoteMemory.o $(OBJDIR64_DEBUG)/ReadRemoteMemory.o $(OBJDIR64_DEBUG)/OpenRemoteProcess.o $(OBJDIR64_DEBUG)/IsProcessValid.o $(OBJDIR64_DEBUG)/Input.o $(OBJDIR64_DEBUG)/EnumerateRemoteSectionsAndModules.o $(OBJDIR64_DEBUG)/EnumerateProcesses.o $(OBJDIR64_DEBUG)/DisassembleCode.o $(OBJDIR64_DEBUG)/DistormHelper.o $(OBJDIR64_DEBUG)/Debugger.o $(OBJDIR64_DEBUG)/ControlRemoteProcess.o $(OBJDIR64_DEBUG)/CloseRemoteProcess.o $(OBJDIR64_DEBUG)/decoder.o $(OBJDIR64_DEBUG)/distorm.o $(OBJDIR64_DEBUG)/instructions.o $(OBJDIR64_DEBUG)/insts.o $(OBJDIR64_DEBUG)/mnemonics.o $(OBJDIR64_DEBUG)/operands.o $(OBJDIR64_DEBUG)/prefix.o $(OBJDIR64_DEBUG)/textdefs.o -OBJ_RELEASE = $(OBJDIR_RELEASE)/WriteRemoteMemory.o $(OBJDIR_RELEASE)/ReadRemoteMemory.o $(OBJDIR_RELEASE)/OpenRemoteProcess.o $(OBJDIR_RELEASE)/IsProcessValid.o $(OBJDIR_RELEASE)/Input.o $(OBJDIR_RELEASE)/EnumerateRemoteSectionsAndModules.o $(OBJDIR_RELEASE)/EnumerateProcesses.o $(OBJDIR_RELEASE)/DisassembleCode.o $(OBJDIR_RELEASE)/DistormHelper.o $(OBJDIR_RELEASE)/Debugger.o $(OBJDIR_RELEASE)/ControlRemoteProcess.o $(OBJDIR_RELEASE)/CloseRemoteProcess.o $(OBJDIR_RELEASE)/decoder.o $(OBJDIR_RELEASE)/distorm.o $(OBJDIR_RELEASE)/instructions.o $(OBJDIR_RELEASE)/insts.o $(OBJDIR_RELEASE)/mnemonics.o $(OBJDIR_RELEASE)/operands.o $(OBJDIR_RELEASE)/prefix.o $(OBJDIR_RELEASE)/textdefs.o $(OBJDIR_RELEASE)/wstring.o +OBJ32_RELEASE = $(OBJDIR32_RELEASE)/WriteRemoteMemory.o $(OBJDIR32_RELEASE)/ReadRemoteMemory.o $(OBJDIR32_RELEASE)/OpenRemoteProcess.o $(OBJDIR32_RELEASE)/IsProcessValid.o $(OBJDIR32_RELEASE)/Input.o $(OBJDIR32_RELEASE)/EnumerateRemoteSectionsAndModules.o $(OBJDIR32_RELEASE)/EnumerateProcesses.o $(OBJDIR32_RELEASE)/DisassembleCode.o $(OBJDIR32_RELEASE)/DistormHelper.o $(OBJDIR32_RELEASE)/Debugger.o $(OBJDIR32_RELEASE)/ControlRemoteProcess.o $(OBJDIR32_RELEASE)/CloseRemoteProcess.o $(OBJDIR32_RELEASE)/decoder.o $(OBJDIR32_RELEASE)/distorm.o $(OBJDIR32_RELEASE)/instructions.o $(OBJDIR32_RELEASE)/insts.o $(OBJDIR32_RELEASE)/mnemonics.o $(OBJDIR32_RELEASE)/operands.o $(OBJDIR32_RELEASE)/prefix.o $(OBJDIR32_RELEASE)/textdefs.o +OBJ64_RELEASE = $(OBJDIR64_RELEASE)/WriteRemoteMemory.o $(OBJDIR64_RELEASE)/ReadRemoteMemory.o $(OBJDIR64_RELEASE)/OpenRemoteProcess.o $(OBJDIR64_RELEASE)/IsProcessValid.o $(OBJDIR64_RELEASE)/Input.o $(OBJDIR64_RELEASE)/EnumerateRemoteSectionsAndModules.o $(OBJDIR64_RELEASE)/EnumerateProcesses.o $(OBJDIR64_RELEASE)/DisassembleCode.o $(OBJDIR64_RELEASE)/DistormHelper.o $(OBJDIR64_RELEASE)/Debugger.o $(OBJDIR64_RELEASE)/ControlRemoteProcess.o $(OBJDIR64_RELEASE)/CloseRemoteProcess.o $(OBJDIR64_RELEASE)/decoder.o $(OBJDIR64_RELEASE)/distorm.o $(OBJDIR64_RELEASE)/instructions.o $(OBJDIR64_RELEASE)/insts.o $(OBJDIR64_RELEASE)/mnemonics.o $(OBJDIR64_RELEASE)/operands.o $(OBJDIR64_RELEASE)/prefix.o $(OBJDIR64_RELEASE)/textdefs.o all: debug release clean: clean_debug clean_release before_debug: - test -d build/debug || mkdir -p build/debug - test -d $(OBJDIR_DEBUG) || mkdir -p $(OBJDIR_DEBUG) + test -d build/debug/x86 || mkdir -p build/debug/x86 + test -d build/debug/x64 || mkdir -p build/debug/x64 + test -d $(OBJDIR32_DEBUG) || mkdir -p $(OBJDIR32_DEBUG) + test -d $(OBJDIR64_DEBUG) || mkdir -p $(OBJDIR64_DEBUG) after_debug: -debug: before_debug out_debug after_debug +debug: before_debug out_debug32 out_debug64 after_debug -out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG) - $(CXX) $(LIBDIR_DEBUG) -o $(OUT_DEBUG) $(OBJ_DEBUG) $(LDFLAGS_DEBUG) $(LIB_DEBUG) +out_debug32: before_debug $(OBJ32_DEBUG) $(DEP_DEBUG) + $(CXX) $(LIBDIR_DEBUG) -o $(OUT32_DEBUG) $(OBJ32_DEBUG) $(LDFLAGS32_DEBUG) $(LIB_DEBUG) -$(OBJDIR_DEBUG)/WriteRemoteMemory.o: WriteRemoteMemory.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c WriteRemoteMemory.cpp -o $(OBJDIR_DEBUG)/WriteRemoteMemory.o +$(OBJDIR32_DEBUG)/WriteRemoteMemory.o: WriteRemoteMemory.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c WriteRemoteMemory.cpp -o $(OBJDIR32_DEBUG)/WriteRemoteMemory.o -$(OBJDIR_DEBUG)/ReadRemoteMemory.o: ReadRemoteMemory.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ReadRemoteMemory.cpp -o $(OBJDIR_DEBUG)/ReadRemoteMemory.o +$(OBJDIR32_DEBUG)/ReadRemoteMemory.o: ReadRemoteMemory.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ReadRemoteMemory.cpp -o $(OBJDIR32_DEBUG)/ReadRemoteMemory.o -$(OBJDIR_DEBUG)/OpenRemoteProcess.o: OpenRemoteProcess.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c OpenRemoteProcess.cpp -o $(OBJDIR_DEBUG)/OpenRemoteProcess.o +$(OBJDIR32_DEBUG)/OpenRemoteProcess.o: OpenRemoteProcess.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c OpenRemoteProcess.cpp -o $(OBJDIR32_DEBUG)/OpenRemoteProcess.o -$(OBJDIR_DEBUG)/IsProcessValid.o: IsProcessValid.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c IsProcessValid.cpp -o $(OBJDIR_DEBUG)/IsProcessValid.o +$(OBJDIR32_DEBUG)/IsProcessValid.o: IsProcessValid.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c IsProcessValid.cpp -o $(OBJDIR32_DEBUG)/IsProcessValid.o -$(OBJDIR_DEBUG)/Input.o: Input.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c Input.cpp -o $(OBJDIR_DEBUG)/Input.o +$(OBJDIR32_DEBUG)/Input.o: Input.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c Input.cpp -o $(OBJDIR32_DEBUG)/Input.o -$(OBJDIR_DEBUG)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR_DEBUG)/EnumerateRemoteSectionsAndModules.o +$(OBJDIR32_DEBUG)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR32_DEBUG)/EnumerateRemoteSectionsAndModules.o -$(OBJDIR_DEBUG)/EnumerateProcesses.o: EnumerateProcesses.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c EnumerateProcesses.cpp -o $(OBJDIR_DEBUG)/EnumerateProcesses.o +$(OBJDIR32_DEBUG)/EnumerateProcesses.o: EnumerateProcesses.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c EnumerateProcesses.cpp -o $(OBJDIR32_DEBUG)/EnumerateProcesses.o -$(OBJDIR_DEBUG)/DisassembleCode.o: DisassembleCode.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c DisassembleCode.cpp -o $(OBJDIR_DEBUG)/DisassembleCode.o +$(OBJDIR32_DEBUG)/DisassembleCode.o: DisassembleCode.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c DisassembleCode.cpp -o $(OBJDIR32_DEBUG)/DisassembleCode.o -$(OBJDIR_DEBUG)/DistormHelper.o: ../Shared/DistormHelper.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../Shared/DistormHelper.cpp -o $(OBJDIR_DEBUG)/DistormHelper.o +$(OBJDIR32_DEBUG)/DistormHelper.o: ../Shared/DistormHelper.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Shared/DistormHelper.cpp -o $(OBJDIR32_DEBUG)/DistormHelper.o -$(OBJDIR_DEBUG)/Debugger.o: Debugger.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c Debugger.cpp -o $(OBJDIR_DEBUG)/Debugger.o +$(OBJDIR32_DEBUG)/Debugger.o: Debugger.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c Debugger.cpp -o $(OBJDIR32_DEBUG)/Debugger.o -$(OBJDIR_DEBUG)/ControlRemoteProcess.o: ControlRemoteProcess.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ControlRemoteProcess.cpp -o $(OBJDIR_DEBUG)/ControlRemoteProcess.o +$(OBJDIR32_DEBUG)/ControlRemoteProcess.o: ControlRemoteProcess.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ControlRemoteProcess.cpp -o $(OBJDIR32_DEBUG)/ControlRemoteProcess.o -$(OBJDIR_DEBUG)/CloseRemoteProcess.o: CloseRemoteProcess.cpp - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c CloseRemoteProcess.cpp -o $(OBJDIR_DEBUG)/CloseRemoteProcess.o +$(OBJDIR32_DEBUG)/CloseRemoteProcess.o: CloseRemoteProcess.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c CloseRemoteProcess.cpp -o $(OBJDIR32_DEBUG)/CloseRemoteProcess.o -$(OBJDIR_DEBUG)/decoder.o: ../Dependencies/distorm/src/decoder.c - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR_DEBUG)/decoder.o +$(OBJDIR32_DEBUG)/decoder.o: ../Dependencies/distorm/src/decoder.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR32_DEBUG)/decoder.o -$(OBJDIR_DEBUG)/distorm.o: ../Dependencies/distorm/src/distorm.c - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR_DEBUG)/distorm.o +$(OBJDIR32_DEBUG)/distorm.o: ../Dependencies/distorm/src/distorm.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR32_DEBUG)/distorm.o -$(OBJDIR_DEBUG)/instructions.o: ../Dependencies/distorm/src/instructions.c - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR_DEBUG)/instructions.o +$(OBJDIR32_DEBUG)/instructions.o: ../Dependencies/distorm/src/instructions.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR32_DEBUG)/instructions.o -$(OBJDIR_DEBUG)/insts.o: ../Dependencies/distorm/src/insts.c - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR_DEBUG)/insts.o +$(OBJDIR32_DEBUG)/insts.o: ../Dependencies/distorm/src/insts.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR32_DEBUG)/insts.o -$(OBJDIR_DEBUG)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR_DEBUG)/mnemonics.o +$(OBJDIR32_DEBUG)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR32_DEBUG)/mnemonics.o -$(OBJDIR_DEBUG)/operands.o: ../Dependencies/distorm/src/operands.c - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR_DEBUG)/operands.o +$(OBJDIR32_DEBUG)/operands.o: ../Dependencies/distorm/src/operands.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR32_DEBUG)/operands.o -$(OBJDIR_DEBUG)/prefix.o: ../Dependencies/distorm/src/prefix.c - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR_DEBUG)/prefix.o +$(OBJDIR32_DEBUG)/prefix.o: ../Dependencies/distorm/src/prefix.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR32_DEBUG)/prefix.o -$(OBJDIR_DEBUG)/textdefs.o: ../Dependencies/distorm/src/textdefs.c - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR_DEBUG)/textdefs.o +$(OBJDIR32_DEBUG)/textdefs.o: ../Dependencies/distorm/src/textdefs.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR32_DEBUG)/textdefs.o -$(OBJDIR_DEBUG)/wstring.o: ../Dependencies/distorm/src/wstring.c - $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/wstring.c -o $(OBJDIR_DEBUG)/wstring.o +out_debug64: before_debug $(OBJ64_DEBUG) $(DEP_DEBUG) + $(CXX) $(LIBDIR_DEBUG) -o $(OUT64_DEBUG) $(OBJ64_DEBUG) $(LDFLAGS64_DEBUG) $(LIB_DEBUG) + +$(OBJDIR64_DEBUG)/WriteRemoteMemory.o: WriteRemoteMemory.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c WriteRemoteMemory.cpp -o $(OBJDIR64_DEBUG)/WriteRemoteMemory.o + +$(OBJDIR64_DEBUG)/ReadRemoteMemory.o: ReadRemoteMemory.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ReadRemoteMemory.cpp -o $(OBJDIR64_DEBUG)/ReadRemoteMemory.o + +$(OBJDIR64_DEBUG)/OpenRemoteProcess.o: OpenRemoteProcess.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c OpenRemoteProcess.cpp -o $(OBJDIR64_DEBUG)/OpenRemoteProcess.o + +$(OBJDIR64_DEBUG)/IsProcessValid.o: IsProcessValid.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c IsProcessValid.cpp -o $(OBJDIR64_DEBUG)/IsProcessValid.o + +$(OBJDIR64_DEBUG)/Input.o: Input.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c Input.cpp -o $(OBJDIR64_DEBUG)/Input.o + +$(OBJDIR64_DEBUG)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR64_DEBUG)/EnumerateRemoteSectionsAndModules.o + +$(OBJDIR64_DEBUG)/EnumerateProcesses.o: EnumerateProcesses.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c EnumerateProcesses.cpp -o $(OBJDIR64_DEBUG)/EnumerateProcesses.o + +$(OBJDIR64_DEBUG)/DisassembleCode.o: DisassembleCode.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c DisassembleCode.cpp -o $(OBJDIR64_DEBUG)/DisassembleCode.o + +$(OBJDIR64_DEBUG)/DistormHelper.o: ../Shared/DistormHelper.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Shared/DistormHelper.cpp -o $(OBJDIR64_DEBUG)/DistormHelper.o + +$(OBJDIR64_DEBUG)/Debugger.o: Debugger.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c Debugger.cpp -o $(OBJDIR64_DEBUG)/Debugger.o + +$(OBJDIR64_DEBUG)/ControlRemoteProcess.o: ControlRemoteProcess.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ControlRemoteProcess.cpp -o $(OBJDIR64_DEBUG)/ControlRemoteProcess.o + +$(OBJDIR64_DEBUG)/CloseRemoteProcess.o: CloseRemoteProcess.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c CloseRemoteProcess.cpp -o $(OBJDIR64_DEBUG)/CloseRemoteProcess.o + +$(OBJDIR64_DEBUG)/decoder.o: ../Dependencies/distorm/src/decoder.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR64_DEBUG)/decoder.o + +$(OBJDIR64_DEBUG)/distorm.o: ../Dependencies/distorm/src/distorm.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR64_DEBUG)/distorm.o + +$(OBJDIR64_DEBUG)/instructions.o: ../Dependencies/distorm/src/instructions.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR64_DEBUG)/instructions.o + +$(OBJDIR64_DEBUG)/insts.o: ../Dependencies/distorm/src/insts.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR64_DEBUG)/insts.o + +$(OBJDIR64_DEBUG)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR64_DEBUG)/mnemonics.o + +$(OBJDIR64_DEBUG)/operands.o: ../Dependencies/distorm/src/operands.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR64_DEBUG)/operands.o + +$(OBJDIR64_DEBUG)/prefix.o: ../Dependencies/distorm/src/prefix.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR64_DEBUG)/prefix.o + +$(OBJDIR64_DEBUG)/textdefs.o: ../Dependencies/distorm/src/textdefs.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR64_DEBUG)/textdefs.o clean_debug: - rm -f $(OBJ_DEBUG) $(OUT_DEBUG) + rm -f $(OBJ32_DEBUG) $(OUT32_DEBUG) + rm -f $(OBJ64_DEBUG) $(OUT64_DEBUG) rm -rf build/debug - rm -rf $(OBJDIR_DEBUG) + rm -rf $(OBJDIR32_DEBUG) + rm -rf $(OBJDIR64_DEBUG) before_release: - test -d build/release || mkdir -p build/release - test -d $(OBJDIR_RELEASE) || mkdir -p $(OBJDIR_RELEASE) + test -d build/release/x86 || mkdir -p build/release/x86 + test -d build/release/x64 || mkdir -p build/release/x64 + test -d $(OBJDIR32_RELEASE) || mkdir -p $(OBJDIR32_RELEASE) + test -d $(OBJDIR64_RELEASE) || mkdir -p $(OBJDIR64_RELEASE) after_release: -release: before_release out_release after_release +release: before_release out_release32 out_release64 after_release + +out_release32: before_release $(OBJ32_RELEASE) $(DEP_RELEASE) + $(CXX) $(LIBDIR_RELEASE) -o $(OUT32_RELEASE) $(OBJ32_RELEASE) $(LDFLAGS32_RELEASE) $(LIB_RELEASE) + +$(OBJDIR32_RELEASE)/WriteRemoteMemory.o: WriteRemoteMemory.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c WriteRemoteMemory.cpp -o $(OBJDIR32_RELEASE)/WriteRemoteMemory.o + +$(OBJDIR32_RELEASE)/ReadRemoteMemory.o: ReadRemoteMemory.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ReadRemoteMemory.cpp -o $(OBJDIR32_RELEASE)/ReadRemoteMemory.o + +$(OBJDIR32_RELEASE)/OpenRemoteProcess.o: OpenRemoteProcess.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c OpenRemoteProcess.cpp -o $(OBJDIR32_RELEASE)/OpenRemoteProcess.o + +$(OBJDIR32_RELEASE)/IsProcessValid.o: IsProcessValid.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c IsProcessValid.cpp -o $(OBJDIR32_RELEASE)/IsProcessValid.o + +$(OBJDIR32_RELEASE)/Input.o: Input.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c Input.cpp -o $(OBJDIR32_RELEASE)/Input.o + +$(OBJDIR32_RELEASE)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR32_RELEASE)/EnumerateRemoteSectionsAndModules.o + +$(OBJDIR32_RELEASE)/EnumerateProcesses.o: EnumerateProcesses.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c EnumerateProcesses.cpp -o $(OBJDIR32_RELEASE)/EnumerateProcesses.o + +$(OBJDIR32_RELEASE)/DisassembleCode.o: DisassembleCode.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c DisassembleCode.cpp -o $(OBJDIR32_RELEASE)/DisassembleCode.o + +$(OBJDIR32_RELEASE)/DistormHelper.o: ../Shared/DistormHelper.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Shared/DistormHelper.cpp -o $(OBJDIR32_RELEASE)/DistormHelper.o + +$(OBJDIR32_RELEASE)/Debugger.o: Debugger.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c Debugger.cpp -o $(OBJDIR32_RELEASE)/Debugger.o + +$(OBJDIR32_RELEASE)/ControlRemoteProcess.o: ControlRemoteProcess.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ControlRemoteProcess.cpp -o $(OBJDIR32_RELEASE)/ControlRemoteProcess.o + +$(OBJDIR32_RELEASE)/CloseRemoteProcess.o: CloseRemoteProcess.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c CloseRemoteProcess.cpp -o $(OBJDIR32_RELEASE)/CloseRemoteProcess.o + +$(OBJDIR32_RELEASE)/decoder.o: ../Dependencies/distorm/src/decoder.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR32_RELEASE)/decoder.o + +$(OBJDIR32_RELEASE)/distorm.o: ../Dependencies/distorm/src/distorm.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR32_RELEASE)/distorm.o + +$(OBJDIR32_RELEASE)/instructions.o: ../Dependencies/distorm/src/instructions.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR32_RELEASE)/instructions.o + +$(OBJDIR32_RELEASE)/insts.o: ../Dependencies/distorm/src/insts.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR32_RELEASE)/insts.o + +$(OBJDIR32_RELEASE)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR32_RELEASE)/mnemonics.o + +$(OBJDIR32_RELEASE)/operands.o: ../Dependencies/distorm/src/operands.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR32_RELEASE)/operands.o + +$(OBJDIR32_RELEASE)/prefix.o: ../Dependencies/distorm/src/prefix.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR32_RELEASE)/prefix.o -out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE) - $(LD) $(LIBDIR_RELEASE) -o $(OUT_RELEASE) $(OBJ_RELEASE) $(LDFLAGS_RELEASE) $(LIB_RELEASE) +$(OBJDIR32_RELEASE)/textdefs.o: ../Dependencies/distorm/src/textdefs.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR32_RELEASE)/textdefs.o -$(OBJDIR_RELEASE)/WriteRemoteMemory.o: WriteRemoteMemory.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c WriteRemoteMemory.cpp -o $(OBJDIR_RELEASE)/WriteRemoteMemory.o +out_release64: before_release $(OBJ64_RELEASE) $(DEP_RELEASE) + $(CXX) $(LIBDIR_RELEASE) -o $(OUT64_RELEASE) $(OBJ64_RELEASE) $(LDFLAGS64_RELEASE) $(LIB_RELEASE) -$(OBJDIR_RELEASE)/ReadRemoteMemory.o: ReadRemoteMemory.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ReadRemoteMemory.cpp -o $(OBJDIR_RELEASE)/ReadRemoteMemory.o +$(OBJDIR64_RELEASE)/WriteRemoteMemory.o: WriteRemoteMemory.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c WriteRemoteMemory.cpp -o $(OBJDIR64_RELEASE)/WriteRemoteMemory.o -$(OBJDIR_RELEASE)/OpenRemoteProcess.o: OpenRemoteProcess.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c OpenRemoteProcess.cpp -o $(OBJDIR_RELEASE)/OpenRemoteProcess.o +$(OBJDIR64_RELEASE)/ReadRemoteMemory.o: ReadRemoteMemory.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ReadRemoteMemory.cpp -o $(OBJDIR64_RELEASE)/ReadRemoteMemory.o -$(OBJDIR_RELEASE)/IsProcessValid.o: IsProcessValid.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c IsProcessValid.cpp -o $(OBJDIR_RELEASE)/IsProcessValid.o +$(OBJDIR64_RELEASE)/OpenRemoteProcess.o: OpenRemoteProcess.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c OpenRemoteProcess.cpp -o $(OBJDIR64_RELEASE)/OpenRemoteProcess.o -$(OBJDIR_RELEASE)/Input.o: Input.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c Input.cpp -o $(OBJDIR_RELEASE)/Input.o +$(OBJDIR64_RELEASE)/IsProcessValid.o: IsProcessValid.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c IsProcessValid.cpp -o $(OBJDIR64_RELEASE)/IsProcessValid.o -$(OBJDIR_RELEASE)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR_RELEASE)/EnumerateRemoteSectionsAndModules.o +$(OBJDIR64_RELEASE)/Input.o: Input.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c Input.cpp -o $(OBJDIR64_RELEASE)/Input.o -$(OBJDIR_RELEASE)/EnumerateProcesses.o: EnumerateProcesses.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c EnumerateProcesses.cpp -o $(OBJDIR_RELEASE)/EnumerateProcesses.o +$(OBJDIR64_RELEASE)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR64_RELEASE)/EnumerateRemoteSectionsAndModules.o -$(OBJDIR_RELEASE)/DisassembleCode.o: DisassembleCode.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c DisassembleCode.cpp -o $(OBJDIR_RELEASE)/DisassembleCode.o +$(OBJDIR64_RELEASE)/EnumerateProcesses.o: EnumerateProcesses.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c EnumerateProcesses.cpp -o $(OBJDIR64_RELEASE)/EnumerateProcesses.o -$(OBJDIR_RELEASE)/DistormHelper.o: ../Shared/DistormHelper.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../Shared/DistormHelper.cpp -o $(OBJDIR_RELEASE)/DistormHelper.o +$(OBJDIR64_RELEASE)/DisassembleCode.o: DisassembleCode.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c DisassembleCode.cpp -o $(OBJDIR64_RELEASE)/DisassembleCode.o -$(OBJDIR_RELEASE)/Debugger.o: Debugger.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c Debugger.cpp -o $(OBJDIR_RELEASE)/Debugger.o +$(OBJDIR64_RELEASE)/DistormHelper.o: ../Shared/DistormHelper.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Shared/DistormHelper.cpp -o $(OBJDIR64_RELEASE)/DistormHelper.o -$(OBJDIR_RELEASE)/ControlRemoteProcess.o: ControlRemoteProcess.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ControlRemoteProcess.cpp -o $(OBJDIR_RELEASE)/ControlRemoteProcess.o +$(OBJDIR64_RELEASE)/Debugger.o: Debugger.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c Debugger.cpp -o $(OBJDIR64_RELEASE)/Debugger.o -$(OBJDIR_RELEASE)/CloseRemoteProcess.o: CloseRemoteProcess.cpp - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c CloseRemoteProcess.cpp -o $(OBJDIR_RELEASE)/CloseRemoteProcess.o +$(OBJDIR64_RELEASE)/ControlRemoteProcess.o: ControlRemoteProcess.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ControlRemoteProcess.cpp -o $(OBJDIR64_RELEASE)/ControlRemoteProcess.o -$(OBJDIR_RELEASE)/decoder.o: ../Dependencies/distorm/src/decoder.c - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR_RELEASE)/decoder.o +$(OBJDIR64_RELEASE)/CloseRemoteProcess.o: CloseRemoteProcess.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c CloseRemoteProcess.cpp -o $(OBJDIR64_RELEASE)/CloseRemoteProcess.o -$(OBJDIR_RELEASE)/distorm.o: ../Dependencies/distorm/src/distorm.c - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR_RELEASE)/distorm.o +$(OBJDIR64_RELEASE)/decoder.o: ../Dependencies/distorm/src/decoder.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR64_RELEASE)/decoder.o -$(OBJDIR_RELEASE)/instructions.o: ../Dependencies/distorm/src/instructions.c - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR_RELEASE)/instructions.o +$(OBJDIR64_RELEASE)/distorm.o: ../Dependencies/distorm/src/distorm.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR64_RELEASE)/distorm.o -$(OBJDIR_RELEASE)/insts.o: ../Dependencies/distorm/src/insts.c - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR_RELEASE)/insts.o +$(OBJDIR64_RELEASE)/instructions.o: ../Dependencies/distorm/src/instructions.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR64_RELEASE)/instructions.o -$(OBJDIR_RELEASE)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR_RELEASE)/mnemonics.o +$(OBJDIR64_RELEASE)/insts.o: ../Dependencies/distorm/src/insts.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR64_RELEASE)/insts.o -$(OBJDIR_RELEASE)/operands.o: ../Dependencies/distorm/src/operands.c - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR_RELEASE)/operands.o +$(OBJDIR64_RELEASE)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR64_RELEASE)/mnemonics.o -$(OBJDIR_RELEASE)/prefix.o: ../Dependencies/distorm/src/prefix.c - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR_RELEASE)/prefix.o +$(OBJDIR64_RELEASE)/operands.o: ../Dependencies/distorm/src/operands.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR64_RELEASE)/operands.o -$(OBJDIR_RELEASE)/textdefs.o: ../Dependencies/distorm/src/textdefs.c - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR_RELEASE)/textdefs.o +$(OBJDIR64_RELEASE)/prefix.o: ../Dependencies/distorm/src/prefix.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR64_RELEASE)/prefix.o -$(OBJDIR_RELEASE)/wstring.o: ../Dependencies/distorm/src/wstring.c - $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/wstring.c -o $(OBJDIR_RELEASE)/wstring.o +$(OBJDIR64_RELEASE)/textdefs.o: ../Dependencies/distorm/src/textdefs.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR64_RELEASE)/textdefs.o clean_release: - rm -f $(OBJ_RELEASE) $(OUT_RELEASE) + rm -f $(OBJ32_RELEASE) $(OUT32_RELEASE) + rm -f $(OBJ64_RELEASE) $(OUT64_RELEASE) rm -rf build/release - rm -rf $(OBJDIR_RELEASE) + rm -rf $(OBJDIR32_RELEASE) + rm -rf $(OBJDIR64_RELEASE) .PHONY: before_debug after_debug clean_debug before_release after_release clean_release diff --git a/NativeCore/Unix/NativeCore.Unix.vcxproj b/NativeCore/Unix/NativeCore.Unix.vcxproj index 539434ad..83bff48a 100644 --- a/NativeCore/Unix/NativeCore.Unix.vcxproj +++ b/NativeCore/Unix/NativeCore.Unix.vcxproj @@ -33,18 +33,22 @@ true DynamicLibrary + WSL2_1_0 false DynamicLibrary + WSL2_1_0 true DynamicLibrary + WSL2_1_0 false DynamicLibrary + WSL2_1_0 @@ -84,7 +88,6 @@ - @@ -152,7 +155,6 @@ c++1y ../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories) -m32 %(AdditionalOptions) - RECLASSNET32 -m32 %(AdditionalOptions) @@ -165,7 +167,6 @@ c++1y ../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories) -m32 %(AdditionalOptions) - RECLASSNET32;%(PreprocessorDefinitions) None true false diff --git a/NativeCore/Unix/NativeCore.Unix.vcxproj.filters b/NativeCore/Unix/NativeCore.Unix.vcxproj.filters index bbefa0a1..3076be6b 100644 --- a/NativeCore/Unix/NativeCore.Unix.vcxproj.filters +++ b/NativeCore/Unix/NativeCore.Unix.vcxproj.filters @@ -72,9 +72,6 @@ Dependencies\distorm - - Dependencies\distorm - Shared @@ -115,9 +112,6 @@ Dependencies\distorm - - Dependencies\distorm - Dependencies\distorm diff --git a/NativeCore/Windows/EnumerateProcesses.cpp b/NativeCore/Windows/EnumerateProcesses.cpp index e7d14faf..534b4a84 100644 --- a/NativeCore/Windows/EnumerateProcesses.cpp +++ b/NativeCore/Windows/EnumerateProcesses.cpp @@ -1,8 +1,7 @@ #include #include #include -#include -namespace fs = std::experimental::filesystem; +#include #include "NativeCore.hpp" @@ -73,7 +72,7 @@ void RC_CallConv EnumerateProcesses(EnumerateProcessCallback callbackProcess) EnumerateProcessData data = { }; data.Id = pe32.th32ProcessID; GetModuleFileNameExW(process, nullptr, reinterpret_cast(data.Path), PATH_MAXIMUM_LENGTH); - const auto name = fs::path(data.Path).filename().u16string(); + const auto name = std::filesystem::path(data.Path).filename().u16string(); str16cpy(data.Name, name.c_str(), std::min(name.length(), PATH_MAXIMUM_LENGTH - 1)); callbackProcess(&data); diff --git a/NativeCore/Windows/EnumerateRemoteSectionsAndModules.cpp b/NativeCore/Windows/EnumerateRemoteSectionsAndModules.cpp index f21f2539..066b077b 100644 --- a/NativeCore/Windows/EnumerateRemoteSectionsAndModules.cpp +++ b/NativeCore/Windows/EnumerateRemoteSectionsAndModules.cpp @@ -1,10 +1,115 @@ #include +#include #include #include #include +#include #include "NativeCore.hpp" +PPEB GetRemotePeb(const HANDLE process) +{ + static auto* const ntdll = GetModuleHandle(TEXT("ntdll")); + if (!ntdll) + { + return nullptr; + } + + using tNtQueryInformationProcess = NTSTATUS (NTAPI*)(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_writes_bytes_(ProcessInformationLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength); + + static const auto pNtQueryInformationProcess = tNtQueryInformationProcess(GetProcAddress(ntdll, "NtQueryInformationProcess")); + if (!pNtQueryInformationProcess) + { + return nullptr; + } + + PROCESS_BASIC_INFORMATION pbi; + if (!NT_SUCCESS(pNtQueryInformationProcess(process, ProcessBasicInformation, &pbi, sizeof(PROCESS_BASIC_INFORMATION), nullptr))) + { + return nullptr; + } + + return pbi.PebBaseAddress; +} + +using InternalEnumerateRemoteModulesCallback = std::function; + +bool EnumerateRemoteModulesNative(const RC_Pointer process, const InternalEnumerateRemoteModulesCallback& callback) +{ + auto* const ppeb = GetRemotePeb(process); + if (ppeb == nullptr) + { + return false; + } + + PPEB_LDR_DATA ldr; + if (!ReadRemoteMemory(process, &ppeb->Ldr, &ldr, 0, sizeof(PPEB_LDR_DATA))) + { + return false; + } + + auto* const head = &ldr->InMemoryOrderModuleList; + PLIST_ENTRY current; + if (!ReadRemoteMemory(process, &head->Flink, ¤t, 0, sizeof(PLIST_ENTRY))) + { + return false; + } + + while (current != head) + { + LDR_DATA_TABLE_ENTRY entry; + if (!ReadRemoteMemory(process, CONTAINING_RECORD(current, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks), &entry, 0, sizeof(entry))) + { + break; + } + + EnumerateRemoteModuleData data = {}; + data.BaseAddress = entry.DllBase; + data.Size = *reinterpret_cast(&entry.Reserved3[1]); // instead of undocced member could read ImageSize from headers + + const auto length = std::min(sizeof(RC_UnicodeChar) * (PATH_MAXIMUM_LENGTH - 1), entry.FullDllName.Length); + if (!ReadRemoteMemory(process, entry.FullDllName.Buffer, data.Path, 0, length)) + { + break; + } + data.Path[length / 2] = 0; + + callback(data); + + current = entry.InMemoryOrderLinks.Flink; + } + + return true; +} + +bool EnumerateRemoteModulesWinapi(const RC_Pointer process, const InternalEnumerateRemoteModulesCallback& callback) +{ + auto* const handle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetProcessId(process)); + if (handle == INVALID_HANDLE_VALUE) + { + return false; + } + + MODULEENTRY32W me32 = {}; + me32.dwSize = sizeof(MODULEENTRY32W); + if (Module32FirstW(handle, &me32)) + { + do + { + EnumerateRemoteModuleData data = {}; + data.BaseAddress = me32.modBaseAddr; + data.Size = me32.modBaseSize; + std::memcpy(data.Path, me32.szExePath, std::min(MAX_PATH, PATH_MAXIMUM_LENGTH)); + + callback(data); + } while (Module32NextW(handle, &me32)); + } + + CloseHandle(handle); + + return true; +} + void RC_CallConv EnumerateRemoteSectionsAndModules(RC_Pointer process, EnumerateRemoteSectionsCallback callbackSection, EnumerateRemoteModulesCallback callbackModule) { if (callbackSection == nullptr && callbackModule == nullptr) @@ -14,28 +119,28 @@ void RC_CallConv EnumerateRemoteSectionsAndModules(RC_Pointer process, Enumerate std::vector sections; - MEMORY_BASIC_INFORMATION memInfo = { }; - memInfo.RegionSize = 0x1000; + MEMORY_BASIC_INFORMATION memory = { }; + memory.RegionSize = 0x1000; size_t address = 0; - while (VirtualQueryEx(process, reinterpret_cast(address), &memInfo, sizeof(MEMORY_BASIC_INFORMATION)) != 0 && address + memInfo.RegionSize > address) + while (VirtualQueryEx(process, reinterpret_cast(address), &memory, sizeof(MEMORY_BASIC_INFORMATION)) != 0 && address + memory.RegionSize > address) { - if (memInfo.State == MEM_COMMIT) + if (memory.State == MEM_COMMIT) { EnumerateRemoteSectionData section = {}; - section.BaseAddress = memInfo.BaseAddress; - section.Size = memInfo.RegionSize; + section.BaseAddress = memory.BaseAddress; + section.Size = memory.RegionSize; section.Protection = SectionProtection::NoAccess; - if ((memInfo.Protect & PAGE_EXECUTE) == PAGE_EXECUTE) section.Protection |= SectionProtection::Execute; - if ((memInfo.Protect & PAGE_EXECUTE_READ) == PAGE_EXECUTE_READ) section.Protection |= SectionProtection::Execute | SectionProtection::Read; - if ((memInfo.Protect & PAGE_EXECUTE_READWRITE) == PAGE_EXECUTE_READWRITE) section.Protection |= SectionProtection::Execute | SectionProtection::Read | SectionProtection::Write; - if ((memInfo.Protect & PAGE_EXECUTE_WRITECOPY) == PAGE_EXECUTE_WRITECOPY) section.Protection |= SectionProtection::Execute | SectionProtection::Read | SectionProtection::CopyOnWrite; - if ((memInfo.Protect & PAGE_READONLY) == PAGE_READONLY) section.Protection |= SectionProtection::Read; - if ((memInfo.Protect & PAGE_READWRITE) == PAGE_READWRITE) section.Protection |= SectionProtection::Read | SectionProtection::Write; - if ((memInfo.Protect & PAGE_WRITECOPY) == PAGE_WRITECOPY) section.Protection |= SectionProtection::Read | SectionProtection::CopyOnWrite; - if ((memInfo.Protect & PAGE_GUARD) == PAGE_GUARD) section.Protection |= SectionProtection::Guard; + if ((memory.Protect & PAGE_EXECUTE) == PAGE_EXECUTE) section.Protection |= SectionProtection::Execute; + if ((memory.Protect & PAGE_EXECUTE_READ) == PAGE_EXECUTE_READ) section.Protection |= SectionProtection::Execute | SectionProtection::Read; + if ((memory.Protect & PAGE_EXECUTE_READWRITE) == PAGE_EXECUTE_READWRITE) section.Protection |= SectionProtection::Execute | SectionProtection::Read | SectionProtection::Write; + if ((memory.Protect & PAGE_EXECUTE_WRITECOPY) == PAGE_EXECUTE_WRITECOPY) section.Protection |= SectionProtection::Execute | SectionProtection::Read | SectionProtection::CopyOnWrite; + if ((memory.Protect & PAGE_READONLY) == PAGE_READONLY) section.Protection |= SectionProtection::Read; + if ((memory.Protect & PAGE_READWRITE) == PAGE_READWRITE) section.Protection |= SectionProtection::Read | SectionProtection::Write; + if ((memory.Protect & PAGE_WRITECOPY) == PAGE_WRITECOPY) section.Protection |= SectionProtection::Read | SectionProtection::CopyOnWrite; + if ((memory.Protect & PAGE_GUARD) == PAGE_GUARD) section.Protection |= SectionProtection::Guard; - switch (memInfo.Type) + switch (memory.Type) { case MEM_IMAGE: section.Type = SectionType::Image; @@ -50,87 +155,87 @@ void RC_CallConv EnumerateRemoteSectionsAndModules(RC_Pointer process, Enumerate section.Category = section.Type == SectionType::Private ? SectionCategory::HEAP : SectionCategory::Unknown; - sections.push_back(std::move(section)); + sections.push_back(section); } - address = reinterpret_cast(memInfo.BaseAddress) + memInfo.RegionSize; + address = reinterpret_cast(memory.BaseAddress) + memory.RegionSize; } - const auto handle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetProcessId(process)); - if (handle != INVALID_HANDLE_VALUE) + const auto moduleEnumerator = [&](EnumerateRemoteModuleData& data) { - MODULEENTRY32W me32 = {}; - me32.dwSize = sizeof(MODULEENTRY32W); - if (Module32FirstW(handle, &me32)) + if (callbackModule != nullptr) { - do - { - if (callbackModule != nullptr) - { - EnumerateRemoteModuleData data = {}; - data.BaseAddress = me32.modBaseAddr; - data.Size = me32.modBaseSize; - std::memcpy(data.Path, me32.szExePath, std::min(MAX_PATH, PATH_MAXIMUM_LENGTH)); + callbackModule(&data); + } - callbackModule(&data); - } + if (callbackSection != nullptr) + { + auto it = std::lower_bound(std::begin(sections), std::end(sections), static_cast(data.BaseAddress), [§ions](const auto& lhs, const LPVOID& rhs) + { + return lhs.BaseAddress < rhs; + }); - if (callbackSection != nullptr) - { - auto it = std::lower_bound(std::begin(sections), std::end(sections), static_cast(me32.modBaseAddr), [§ions](const auto& lhs, const LPVOID& rhs) - { - return lhs.BaseAddress < rhs; - }); + IMAGE_DOS_HEADER imageDosHeader = {}; + IMAGE_NT_HEADERS imageNtHeaders = {}; - IMAGE_DOS_HEADER DosHdr = {}; - IMAGE_NT_HEADERS NtHdr = {}; + if (!ReadRemoteMemory(process, data.BaseAddress, &imageDosHeader, 0, sizeof(IMAGE_DOS_HEADER)) + || !ReadRemoteMemory(process, PUCHAR(data.BaseAddress) + imageDosHeader.e_lfanew, &imageNtHeaders, 0, sizeof(IMAGE_NT_HEADERS))) + { + return; + } - ReadRemoteMemory(process, me32.modBaseAddr, &DosHdr, 0, sizeof(IMAGE_DOS_HEADER)); - ReadRemoteMemory(process, me32.modBaseAddr + DosHdr.e_lfanew, &NtHdr, 0, sizeof(IMAGE_NT_HEADERS)); + std::vector sectionHeaders(imageNtHeaders.FileHeader.NumberOfSections); + ReadRemoteMemory(process, PUCHAR(data.BaseAddress) + imageDosHeader.e_lfanew + sizeof(IMAGE_NT_HEADERS), sectionHeaders.data(), 0, imageNtHeaders.FileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER)); + for (auto&& sectionHeader : sectionHeaders) + { + const auto sectionAddress = reinterpret_cast(data.BaseAddress) + sectionHeader.VirtualAddress; - std::vector sectionHeaders(NtHdr.FileHeader.NumberOfSections); - ReadRemoteMemory(process, me32.modBaseAddr + DosHdr.e_lfanew + sizeof(IMAGE_NT_HEADERS), sectionHeaders.data(), 0, NtHdr.FileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER)); - for (auto i = 0; i < NtHdr.FileHeader.NumberOfSections; ++i) + for (; it != std::end(sections); ++it) + { + auto&& section = *it; + + if (sectionAddress >= reinterpret_cast(section.BaseAddress) + && sectionAddress < reinterpret_cast(section.BaseAddress) + static_cast(section.Size) + && sectionHeader.VirtualAddress + sectionHeader.Misc.VirtualSize <= data.Size) { - auto&& sectionHeader = sectionHeaders[i]; + if ((sectionHeader.Characteristics & IMAGE_SCN_CNT_CODE) == IMAGE_SCN_CNT_CODE) + { + section.Category = SectionCategory::CODE; + } + else if (sectionHeader.Characteristics & (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_CNT_UNINITIALIZED_DATA)) + { + section.Category = SectionCategory::DATA; + } - const auto sectionAddress = reinterpret_cast(me32.modBaseAddr) + sectionHeader.VirtualAddress; - for (auto j = it; j != std::end(sections); ++j) + try + { + // Copy the name because it is not null padded. + char buffer[IMAGE_SIZEOF_SHORT_NAME + 1] = { 0 }; + std::memcpy(buffer, sectionHeader.Name, IMAGE_SIZEOF_SHORT_NAME); + MultiByteToUnicode(buffer, section.Name, IMAGE_SIZEOF_SHORT_NAME); + } + catch (std::range_error &) { - if (sectionAddress >= reinterpret_cast(j->BaseAddress) && sectionAddress < reinterpret_cast(j->BaseAddress) + static_cast(j->Size)) - { - // Copy the name because it is not null padded. - char buffer[IMAGE_SIZEOF_SHORT_NAME + 1] = { 0 }; - std::memcpy(buffer, sectionHeader.Name, IMAGE_SIZEOF_SHORT_NAME); - - if (std::strcmp(buffer, ".text") == 0 || std::strcmp(buffer, "code") == 0) - { - j->Category = SectionCategory::CODE; - } - else if (std::strcmp(buffer, ".data") == 0 || std::strcmp(buffer, "data") == 0 || std::strcmp(buffer, ".rdata") == 0 || std::strcmp(buffer, ".idata") == 0) - { - j->Category = SectionCategory::DATA; - } - - MultiByteToUnicode(buffer, j->Name, IMAGE_SIZEOF_SHORT_NAME); - std::memcpy(j->ModulePath, me32.szExePath, std::min(MAX_PATH, PATH_MAXIMUM_LENGTH)); - - break; - } + std::memset(section.Name, 0, sizeof(section.Name)); } + std::memcpy(section.ModulePath, data.Path, std::min(MAX_PATH, PATH_MAXIMUM_LENGTH)); + break; } } - } while (Module32NextW(handle, &me32)); + } } + }; + + if (!EnumerateRemoteModulesNative(process, moduleEnumerator)) + { + EnumerateRemoteModulesWinapi(process, moduleEnumerator); + } - CloseHandle(handle); - - if (callbackSection != nullptr) + if (callbackSection != nullptr) + { + for (auto&& section : sections) { - for (auto&& section : sections) - { - callbackSection(§ion); - } + callbackSection(§ion); } } } diff --git a/NativeCore/Windows/NativeCore.vcxproj b/NativeCore/Windows/NativeCore.vcxproj index 6af17c1f..5600a51a 100644 --- a/NativeCore/Windows/NativeCore.vcxproj +++ b/NativeCore/Windows/NativeCore.vcxproj @@ -22,32 +22,32 @@ {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F} Win32Proj NativeCore - 10.0.17134.0 + 10.0 DynamicLibrary true - v141 + v143 Unicode DynamicLibrary false - v141 + v143 true MultiByte DynamicLibrary true - v141 + v143 MultiByte DynamicLibrary false - v141 + v143 true MultiByte @@ -103,7 +103,8 @@ Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;RECLASSNET32;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions) + stdcpp17 Windows @@ -118,7 +119,8 @@ Level3 Disabled - _DEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;RECLASSNET64;%(PreprocessorDefinitions) + _DEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;RECLASSNET64;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions) + stdcpp17 Windows @@ -135,7 +137,8 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;RECLASSNET32;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions) + stdcpp17 Windows @@ -154,7 +157,8 @@ MaxSpeed true true - NDEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;RECLASSNET64;%(PreprocessorDefinitions) + NDEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;RECLASSNET64;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions) + stdcpp17 Windows @@ -174,7 +178,6 @@ - diff --git a/NativeCore/Windows/NativeCore.vcxproj.filters b/NativeCore/Windows/NativeCore.vcxproj.filters index a8eb2be9..eb42b939 100644 --- a/NativeCore/Windows/NativeCore.vcxproj.filters +++ b/NativeCore/Windows/NativeCore.vcxproj.filters @@ -58,9 +58,6 @@ Dependencies\distorm - - Dependencies\distorm - Shared diff --git a/README.md b/README.md index 0040f004..82a8a53d 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,8 @@ This is a port of ReClass to the .NET platform with lots of additional features. - [MemoryPipe Plugin](https://github.com/ReClassNET/ReClass.NET-MemoryPipePlugin) - [LoadBinary Plugin](https://github.com/ReClassNET/ReClass.NET-LoadBinaryPlugin) - [Handle Abuser Plugin](https://github.com/ReClassNET/ReClass.NET-HandleAbuser) -- [Unreal Plugin](https://github.com/DrP3pp3r/ReClass.NET-UnrealPlugin) (by [DrP3pp3r](https://github.com/DrP3pp3r)) +- Unreal Plugin (not available anymore) (by [DrP3pp3r](https://github.com/DrP3pp3r)) +- [DriverReader](https://github.com/niemand-sec/ReClass.NET-DriverReader) (by [Niemand](https://github.com/niemand-sec)) To install a plugin just copy it in the "Plugins" folder. If you want to develop your own plugin just learn from the code of the [Sample Plugins](https://github.com/ReClassNET/ReClass.NET-SamplePlugin) and [Frostbite Plugin](https://github.com/ReClassNET/ReClass.NET-FrostbitePlugin) repositories. If you have developed a nice plugin, leave me a message and I will add it to the list above. @@ -73,9 +74,24 @@ Just download the [latest version](https://github.com/ReClassNET/ReClass.NET/rel Valid operations are read ([..]), add (+), sub (-), mul (*) and div (/). Please note that all operations are integer calculations. ## Compiling -If you want to compile ReClass.NET just fork the repository and open the ReClass.NET.sln file with Visual Studio 2017. +If you want to compile ReClass.NET just fork the repository and open the ReClass.NET.sln file with Visual Studio 2019. Compile the project and copy the dependencies to the output folder. +To compile the linux native core library, you need WSL [installed and configured](https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2). If you do not need linux support, simply unload the project in the Solution Explorer. If you want to build cross-platform (x86/x64) you have to install `g++-multilib` too. + +If you use the `Makefile` with `docker` or `podman` you have to build the needed image `gcc_multilib` from the following `Dockerfile` (`docker build -t gcc_multi .`): + +``` +FROM ubuntu:latest + +RUN apt-get update \ + && apt-get install --assume-yes --no-install-recommends --quiet \ + make \ + g++ \ + g++-multilib \ + && apt-get clean all +``` + ## Videos [Youtube Playlist](https://www.youtube.com/playlist?list=PLO246BmtoITanq3ygMCL8_w0eov4D8hjk) @@ -91,7 +107,7 @@ Memory Scanner ![](https://abload.de/img/scannerytub1.jpg) Pointer Preview -![](http://abload.de/img/memorypreview2gsfp.jpg) +![](https://abload.de/img/memorypreview2gsfp.jpg) Code Generator ![](https://abload.de/img/codegeneratorqdat2.jpg) @@ -118,4 +134,5 @@ Settings - leveln - [buddyfavors](https://github.com/buddyfavors) - [DrP3pp3r](https://github.com/DrP3pp3r) -- [ko1N](https://github.com/ko1N) \ No newline at end of file +- [ko1N](https://github.com/ko1N) +- [Niemand](https://github.com/niemand-sec) (see his talk at [BlackHat Europe 2019 (London) "Unveiling the underground world of Anti-Cheats"](https://www.blackhat.com/eu-19/briefings/schedule/index.html#unveiling-the-underground-world-of-anti-cheats-17358)) \ No newline at end of file diff --git a/ReClass.NET.sln b/ReClass.NET.sln index fed7d3e0..6345bb67 100644 --- a/ReClass.NET.sln +++ b/ReClass.NET.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.10 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28803.156 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReClass.NET", "ReClass.NET\ReClass.NET.csproj", "{BFB8917D-E9B4-463F-A6E8-612C35728C78}" ProjectSection(ProjectDependencies) = postProject @@ -17,49 +17,74 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReClass.NET_Launcher", "ReC EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{19CF2B0F-2722-4108-8308-B628D91F7A1E}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig README.md = README.md EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReClass.NET_Tests", "ReClass.NET_Tests\ReClass.NET_Tests.csproj", "{E2D0424D-738F-41C3-9935-1B282624600F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Debug|Any CPU.ActiveCfg = Debug|x86 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Debug|x64.ActiveCfg = Debug|x64 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Debug|x64.Build.0 = Debug|x64 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Debug|x86.ActiveCfg = Debug|x86 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Debug|x86.Build.0 = Debug|x86 + {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Release|Any CPU.ActiveCfg = Release|x86 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Release|x64.ActiveCfg = Release|x64 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Release|x64.Build.0 = Release|x64 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Release|x86.ActiveCfg = Release|x86 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Release|x86.Build.0 = Release|x86 + {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Debug|Any CPU.ActiveCfg = Debug|Win32 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Debug|x64.ActiveCfg = Debug|x64 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Debug|x64.Build.0 = Debug|x64 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Debug|x86.ActiveCfg = Debug|Win32 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Debug|x86.Build.0 = Debug|Win32 + {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|Any CPU.ActiveCfg = Release|Win32 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x64.ActiveCfg = Release|x64 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x64.Build.0 = Release|x64 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x86.ActiveCfg = Release|Win32 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x86.Build.0 = Release|Win32 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|Any CPU.ActiveCfg = Debug|x86 {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x64.ActiveCfg = Debug|x64 {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x64.Build.0 = Debug|x64 {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x86.ActiveCfg = Debug|x86 {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x86.Build.0 = Debug|x86 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|Any CPU.ActiveCfg = Release|x86 {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x64.ActiveCfg = Release|x64 {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x64.Build.0 = Release|x64 {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x86.ActiveCfg = Release|x86 {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x86.Build.0 = Release|x86 + {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|Any CPU.Build.0 = Debug|Any CPU {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|x64.ActiveCfg = Debug|Any CPU {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|x64.Build.0 = Debug|Any CPU {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|x86.ActiveCfg = Debug|Any CPU {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|x86.Build.0 = Debug|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Release|Any CPU.ActiveCfg = Release|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Release|Any CPU.Build.0 = Release|Any CPU {16591D29-2370-428A-BA11-87E38D0F3551}.Release|x64.ActiveCfg = Release|Any CPU {16591D29-2370-428A-BA11-87E38D0F3551}.Release|x64.Build.0 = Release|Any CPU {16591D29-2370-428A-BA11-87E38D0F3551}.Release|x86.ActiveCfg = Release|Any CPU {16591D29-2370-428A-BA11-87E38D0F3551}.Release|x86.Build.0 = Release|Any CPU + {E2D0424D-738F-41C3-9935-1B282624600F}.Debug|Any CPU.ActiveCfg = Debug|x86 + {E2D0424D-738F-41C3-9935-1B282624600F}.Debug|x64.ActiveCfg = Debug|x64 + {E2D0424D-738F-41C3-9935-1B282624600F}.Debug|x64.Build.0 = Debug|x64 + {E2D0424D-738F-41C3-9935-1B282624600F}.Debug|x86.ActiveCfg = Debug|x86 + {E2D0424D-738F-41C3-9935-1B282624600F}.Debug|x86.Build.0 = Debug|x86 + {E2D0424D-738F-41C3-9935-1B282624600F}.Release|Any CPU.ActiveCfg = Release|x86 + {E2D0424D-738F-41C3-9935-1B282624600F}.Release|x64.ActiveCfg = Release|x64 + {E2D0424D-738F-41C3-9935-1B282624600F}.Release|x64.Build.0 = Release|x64 + {E2D0424D-738F-41C3-9935-1B282624600F}.Release|x86.ActiveCfg = Release|x86 + {E2D0424D-738F-41C3-9935-1B282624600F}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ReClass.NET/AddressParser/DynamicCompiler.cs b/ReClass.NET/AddressParser/DynamicCompiler.cs index 15ee1795..2ffd110b 100644 --- a/ReClass.NET/AddressParser/DynamicCompiler.cs +++ b/ReClass.NET/AddressParser/DynamicCompiler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Linq.Expressions; using System.Reflection; @@ -7,35 +7,51 @@ namespace ReClassNET.AddressParser { - public class DynamicCompiler : IExecuter + public class DynamicCompiler : IExecutor { - public IntPtr Execute(IExpression operation, RemoteProcess process) + public IntPtr Execute(IExpression expression, IProcessReader processReader) { - Contract.Requires(operation != null); - Contract.Requires(process != null); + Contract.Requires(expression != null); + Contract.Requires(processReader != null); - return CompileAddressFormula(operation)(process); + return CompileExpression(expression)(processReader); } - public static Func CompileAddressFormula(IExpression expression) + public static Func CompileExpression(IExpression expression) { Contract.Requires(expression != null); - var processParameter = Expression.Parameter(typeof(RemoteProcess)); + var processParameter = Expression.Parameter(typeof(IProcessReader)); - return Expression.Lambda>( + return Expression.Lambda>( GenerateMethodBody(expression, processParameter), processParameter ).Compile(); } - private static Expression GenerateMethodBody(IExpression operation, ParameterExpression processParameter) + private static Expression GenerateMethodBody(IExpression expression, Expression processParameter) { - Contract.Requires(operation != null); + Contract.Requires(expression != null); Contract.Requires(processParameter != null); - switch (operation) + static MethodInfo GetIntPtrExtension(string name) => typeof(IntPtrExtension).GetRuntimeMethod(name, new[] { typeof(IntPtr), typeof(IntPtr) }); + + switch (expression) { + case ConstantExpression constantExpression: + { + var convertFn = typeof(IntPtrExtension).GetRuntimeMethod(nameof(IntPtrExtension.From), new[] { typeof(long) }); + + return Expression.Call(null, convertFn, Expression.Constant(constantExpression.Value)); + } + case NegateExpression negateExpression: + { + var argument = GenerateMethodBody(negateExpression.Expression, processParameter); + + var negateFn = typeof(IntPtrExtension).GetRuntimeMethod(nameof(IntPtrExtension.Negate), new[] { typeof(IntPtr) }); + + return Expression.Call(null, negateFn, argument); + } case AddExpression addExpression: { var argument1 = GenerateMethodBody(addExpression.Lhs, processParameter); @@ -66,7 +82,7 @@ private static Expression GenerateMethodBody(IExpression operation, ParameterExp } case ModuleExpression moduleExpression: { - var getModuleByNameFunc = typeof(RemoteProcess).GetRuntimeMethod(nameof(RemoteProcess.GetModuleByName), new[] { typeof(string) }); + var getModuleByNameFunc = typeof(IProcessReader).GetRuntimeMethod(nameof(IProcessReader.GetModuleByName), new[] { typeof(string) }); var moduleNameConstant = Expression.Constant(moduleExpression.Name); var moduleVariable = Expression.Variable(typeof(Memory.Module)); @@ -78,24 +94,18 @@ private static Expression GenerateMethodBody(IExpression operation, ParameterExp Expression.Condition( Expression.Equal(moduleVariable, Expression.Constant(null)), Expression.Constant(IntPtr.Zero), - Expression.MakeMemberAccess(moduleVariable, typeof(Memory.Module).GetProperty(nameof(Memory.Module.Start))) + Expression.MakeMemberAccess(moduleVariable, typeof(Memory.Module).GetProperty(nameof(Memory.Module.Start))!) ) ); } - case ConstantExpression constantExpression: - { - var convertFn = typeof(IntPtrExtension).GetRuntimeMethod(nameof(IntPtrExtension.From), new[] { typeof(long) }); - - return Expression.Call(null, convertFn, Expression.Constant(constantExpression.Value)); - } case ReadMemoryExpression readMemoryExpression: { - var argument = GenerateMethodBody(readMemoryExpression.Expression, processParameter); + var addressParameter = GenerateMethodBody(readMemoryExpression.Expression, processParameter); - var functionName = readMemoryExpression.ByteCount == 4 ? nameof(RemoteProcess.ReadRemoteInt32) : nameof(RemoteProcess.ReadRemoteInt64); - var readRemoteIntFn = typeof(RemoteProcess).GetRuntimeMethod(functionName, new[] { typeof(IntPtr) }); + var functionName = readMemoryExpression.ByteCount == 4 ? nameof(IRemoteMemoryReaderExtension.ReadRemoteInt32) : nameof(IRemoteMemoryReaderExtension.ReadRemoteInt64); + var readRemoteIntPtrFn = typeof(IRemoteMemoryReaderExtension).GetRuntimeMethod(functionName, new[] { typeof(IRemoteMemoryReader), typeof(IntPtr) }); - var callExpression = Expression.Call(processParameter, readRemoteIntFn, argument); + var callExpression = Expression.Call(null, readRemoteIntPtrFn, processParameter, addressParameter); var paramType = readMemoryExpression.ByteCount == 4 ? typeof(int) : typeof(long); var convertFn = typeof(IntPtrExtension).GetRuntimeMethod(nameof(IntPtrExtension.From), new[] { paramType }); @@ -104,14 +114,7 @@ private static Expression GenerateMethodBody(IExpression operation, ParameterExp } } - throw new ArgumentException($"Unsupported operation '{operation.GetType().FullName}'."); - } - - private static MethodInfo GetIntPtrExtension(string name) - { - Contract.Requires(name != null); - - return typeof(IntPtrExtension).GetRuntimeMethod(name, new[] { typeof(IntPtr), typeof(IntPtr) }); + throw new ArgumentException($"Unsupported operation '{expression.GetType().FullName}'."); } } } diff --git a/ReClass.NET/AddressParser/IExecuter.cs b/ReClass.NET/AddressParser/IExecuter.cs deleted file mode 100644 index 07e036ad..00000000 --- a/ReClass.NET/AddressParser/IExecuter.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using ReClassNET.Memory; - -namespace ReClassNET.AddressParser -{ - public interface IExecuter - { - IntPtr Execute(IExpression expression, RemoteProcess process); - } -} diff --git a/ReClass.NET/AddressParser/IExecutor.cs b/ReClass.NET/AddressParser/IExecutor.cs new file mode 100644 index 00000000..0620d0e4 --- /dev/null +++ b/ReClass.NET/AddressParser/IExecutor.cs @@ -0,0 +1,10 @@ +using System; +using ReClassNET.Memory; + +namespace ReClassNET.AddressParser +{ + public interface IExecutor + { + IntPtr Execute(IExpression expression, IProcessReader processReader); + } +} diff --git a/ReClass.NET/AddressParser/ITokenizer.cs b/ReClass.NET/AddressParser/ITokenizer.cs new file mode 100644 index 00000000..171113a1 --- /dev/null +++ b/ReClass.NET/AddressParser/ITokenizer.cs @@ -0,0 +1,25 @@ +namespace ReClassNET.AddressParser +{ + public interface ITokenizer + { + /// + /// The current token. It is set to if no more tokens are avaiable. + /// + Token Token { get; } + + /// + /// The current identifier. + /// + string Identifier { get; } + + /// + /// The current number. + /// + long Number { get; } + + /// + /// Reads the next token. + /// + void ReadNextToken(); + } +} diff --git a/ReClass.NET/AddressParser/Interpreter.cs b/ReClass.NET/AddressParser/Interpreter.cs index b113f57d..ad7ee372 100644 --- a/ReClass.NET/AddressParser/Interpreter.cs +++ b/ReClass.NET/AddressParser/Interpreter.cs @@ -5,20 +5,22 @@ namespace ReClassNET.AddressParser { - public class Interpreter : IExecuter + public class Interpreter : IExecutor { - public IntPtr Execute(IExpression expression, RemoteProcess process) + public IntPtr Execute(IExpression expression, IProcessReader processReader) { Contract.Requires(expression != null); - Contract.Requires(process != null); + Contract.Requires(processReader != null); switch (expression) { case ConstantExpression constantExpression: return IntPtrExtension.From(constantExpression.Value); + case NegateExpression negateExpression: + return Execute(negateExpression.Expression, processReader).Negate(); case ModuleExpression moduleExpression: { - var module = process.GetModuleByName(moduleExpression.Name); + var module = processReader.GetModuleByName(moduleExpression.Name); if (module != null) { return module.Start; @@ -27,22 +29,22 @@ public IntPtr Execute(IExpression expression, RemoteProcess process) return IntPtr.Zero; } case AddExpression addExpression: - return Execute(addExpression.Lhs, process).Add(Execute(addExpression.Rhs, process)); + return Execute(addExpression.Lhs, processReader).Add(Execute(addExpression.Rhs, processReader)); case SubtractExpression subtractExpression: - return Execute(subtractExpression.Lhs, process).Sub(Execute(subtractExpression.Rhs, process)); + return Execute(subtractExpression.Lhs, processReader).Sub(Execute(subtractExpression.Rhs, processReader)); case MultiplyExpression multiplyExpression: - return Execute(multiplyExpression.Lhs, process).Mul(Execute(multiplyExpression.Rhs, process)); + return Execute(multiplyExpression.Lhs, processReader).Mul(Execute(multiplyExpression.Rhs, processReader)); case DivideExpression divideExpression: - return Execute(divideExpression.Lhs, process).Div(Execute(divideExpression.Rhs, process)); + return Execute(divideExpression.Lhs, processReader).Div(Execute(divideExpression.Rhs, processReader)); case ReadMemoryExpression readMemoryExpression: - var readFromAddress = Execute(readMemoryExpression.Expression, process); + var readFromAddress = Execute(readMemoryExpression.Expression, processReader); if (readMemoryExpression.ByteCount == 4) { - return IntPtrExtension.From(process.ReadRemoteInt32(readFromAddress)); + return IntPtrExtension.From(processReader.ReadRemoteInt32(readFromAddress)); } else { - return IntPtrExtension.From(process.ReadRemoteInt64(readFromAddress)); + return IntPtrExtension.From(processReader.ReadRemoteInt64(readFromAddress)); } default: throw new ArgumentException($"Unsupported operation '{expression.GetType().FullName}'."); diff --git a/ReClass.NET/AddressParser/ExpressionParser.cs b/ReClass.NET/AddressParser/Parser.cs similarity index 88% rename from ReClass.NET/AddressParser/ExpressionParser.cs rename to ReClass.NET/AddressParser/Parser.cs index 5d20aa09..4db14fda 100644 --- a/ReClass.NET/AddressParser/ExpressionParser.cs +++ b/ReClass.NET/AddressParser/Parser.cs @@ -1,13 +1,13 @@ -using System; +using System; using System.IO; namespace ReClassNET.AddressParser { - public class ExpressionParser + public class Parser { - private readonly Tokenizer tokenizer; + private readonly ITokenizer tokenizer; - public ExpressionParser(Tokenizer tokenizer) + public Parser(ITokenizer tokenizer) { this.tokenizer = tokenizer; } @@ -151,6 +151,11 @@ private IExpression ParseLeaf() throw new ParseException("Missing read byte count"); } + if (tokenizer.Number != 4 && tokenizer.Number != 8) + { + throw new ParseException("The byte count must be 4 or 8."); + } + byteCount = (int)tokenizer.Number; tokenizer.ReadNextToken(); @@ -178,22 +183,17 @@ private IExpression ParseLeaf() } } - #region Convenience Helpers - public static IExpression Parse(string str) { - using (var sr = new StringReader(str)) - { - return Parse(new Tokenizer(sr)); - } + using var sr = new StringReader(str); + + return Parse(new Tokenizer(sr)); } - public static IExpression Parse(Tokenizer tokenizer) + private static IExpression Parse(ITokenizer tokenizer) { - var parser = new ExpressionParser(tokenizer); + var parser = new Parser(tokenizer); return parser.ParseExpression(); } - - #endregion } } diff --git a/ReClass.NET/AddressParser/TokenReader.cs b/ReClass.NET/AddressParser/Tokenizer.cs similarity index 59% rename from ReClass.NET/AddressParser/TokenReader.cs rename to ReClass.NET/AddressParser/Tokenizer.cs index d3abb4bc..a43907ec 100644 --- a/ReClass.NET/AddressParser/TokenReader.cs +++ b/ReClass.NET/AddressParser/Tokenizer.cs @@ -8,25 +8,16 @@ namespace ReClassNET.AddressParser /// /// Parses the given text and reads individual tokens from it. /// - public class Tokenizer + public class Tokenizer : ITokenizer { private readonly TextReader reader; private char currentCharacter; - /// - /// The current token. It is set to if no more tokens are avaiable. - /// public Token Token { get; private set; } - /// - /// The current identifier. - /// public string Identifier { get; private set; } - /// - /// The current number. - /// public long Number { get; private set; } public Tokenizer(TextReader reader) @@ -39,9 +30,6 @@ public Tokenizer(TextReader reader) ReadNextToken(); } - /// - /// Reads the next token from the input. - /// public void ReadNextToken() { SkipWhitespaces(); @@ -71,6 +59,8 @@ public void ReadNextToken() { return; } + + throw new ParseException($"Invalid character '{currentCharacter}'."); } private void ReadNextCharacter() @@ -138,7 +128,10 @@ private bool TryReadNumberToken() { sb.Append(currentCharacter); - hasHexadecimalIdentifier = !hasHexadecimalIdentifier && IsHexadecimalIdentifier(currentCharacter); + if (!hasHexadecimalIdentifier) + { + hasHexadecimalIdentifier = IsHexadecimalIdentifier(currentCharacter); + } ReadNextCharacter(); } @@ -148,57 +141,11 @@ private bool TryReadNumberToken() sb.Remove(0, 2); } - Number = long.Parse(sb.ToString(), NumberStyles.HexNumber); - - Token = Token.Number; - - return true; - } - - return false; - } - - /*private bool TryReadNumberToken() - { - bool IsDigit(char c) => char.IsDigit(c); - bool IsDecimalPoint(char c) => c == '.'; - bool IsHexadecimalIdentifier(char c) => c == 'x' || c == 'X'; - bool IsHexadecimalDigit(char c) => 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F'; - - if (char.IsDigit(currentCharacter) || currentCharacter == '.') - { - var sb = new StringBuilder(); - var hasDecimalPoint = false; - var hasHexadecimalIdentifier = false; - var hasHexadecimalDigit = false; - - while (IsDigit(currentCharacter) - || IsDecimalPoint(currentCharacter) && !hasDecimalPoint && !hasHexadecimalIdentifier && !hasHexadecimalDigit - || IsHexadecimalIdentifier(currentCharacter) && !hasDecimalPoint && !hasHexadecimalIdentifier && sb.Length == 1 && sb[0] == '0' - || IsHexadecimalDigit(currentCharacter) && !hasDecimalPoint) - { - sb.Append(currentCharacter); - - hasDecimalPoint = !hasDecimalPoint && IsDecimalPoint(currentCharacter); - hasHexadecimalIdentifier = !hasHexadecimalIdentifier && IsHexadecimalIdentifier(currentCharacter); - hasHexadecimalDigit = !hasHexadecimalDigit && IsHexadecimalDigit(currentCharacter); - - ReadNextCharacter(); - } - - if (hasHexadecimalIdentifier || hasHexadecimalDigit) - { - if (hasHexadecimalIdentifier) - { - sb.Remove(0, 2); - } - - Number = long.Parse(sb.ToString(), NumberStyles.HexNumber); - } - else + if (!long.TryParse(sb.ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var number)) { - Number = double.Parse(sb.ToString(), CultureInfo.InvariantCulture); + throw new ParseException($"Could not parse '{sb}' as number."); } + Number = number; Token = Token.Number; @@ -206,7 +153,7 @@ private bool TryReadNumberToken() } return false; - }*/ + } private bool TryReadIdentifierToken() { @@ -225,7 +172,7 @@ private bool TryReadIdentifierToken() if (currentCharacter != '>') { - return false; + throw new ParseException("Invalid identifier, missing '>'."); } ReadNextCharacter(); diff --git a/ReClass.NET/App.config b/ReClass.NET/App.config index 731f6de6..1b379a17 100644 --- a/ReClass.NET/App.config +++ b/ReClass.NET/App.config @@ -1,6 +1,9 @@ - + - - - + + + + + + \ No newline at end of file diff --git a/ReClass.NET/CodeGenerator/CSharpCodeGenerator.cs b/ReClass.NET/CodeGenerator/CSharpCodeGenerator.cs index b4d36d17..c46bb836 100644 --- a/ReClass.NET/CodeGenerator/CSharpCodeGenerator.cs +++ b/ReClass.NET/CodeGenerator/CSharpCodeGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Diagnostics.Contracts; @@ -22,73 +22,100 @@ public class CSharpCodeGenerator : ICodeGenerator [typeof(Int16Node)] = "short", [typeof(Int32Node)] = "int", [typeof(Int64Node)] = "long", + [typeof(NIntNode)] = "IntPtr", [typeof(UInt8Node)] = "byte", [typeof(UInt16Node)] = "ushort", [typeof(UInt32Node)] = "uint", [typeof(UInt64Node)] = "ulong", + [typeof(NUIntNode)] = "UIntPtr", [typeof(FunctionPtrNode)] = "IntPtr", [typeof(Utf8TextPtrNode)] = "IntPtr", [typeof(Utf16TextPtrNode)] = "IntPtr", [typeof(Utf32TextPtrNode)] = "IntPtr", [typeof(PointerNode)] = "IntPtr", - [typeof(VirtualMethodTableNode)] = "IntPtr" + [typeof(VirtualMethodTableNode)] = "IntPtr", + + [typeof(Vector2Node)] = "Vector2", + [typeof(Vector3Node)] = "Vector3", + [typeof(Vector4Node)] = "Vector4" }; public Language Language => Language.CSharp; public string GenerateCode(IReadOnlyList classes, IReadOnlyList enums, ILogger logger) { - using (var sw = new StringWriter()) + using var sw = new StringWriter(); + using var iw = new IndentedTextWriter(sw, "\t"); + + iw.WriteLine($"// Created with {Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"); + iw.WriteLine(); + iw.WriteLine("// Warning: The C# code generator doesn't support all node types!"); + iw.WriteLine(); + iw.WriteLine("using System.Runtime.InteropServices;"); + + iw.WriteLine("// optional namespace, only for vectors"); + iw.WriteLine("using System.Numerics;"); + iw.WriteLine(); + + using (var en = enums.GetEnumerator()) { - using (var iw = new IndentedTextWriter(sw, "\t")) + if (en.MoveNext()) { - iw.WriteLine($"// Created with {Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"); - iw.WriteLine(); - iw.WriteLine("// Warning: The C# code generator doesn't support all node types!"); - iw.WriteLine(); - iw.WriteLine("using System.Runtime.InteropServices;"); - iw.WriteLine(); + WriteEnum(iw, en.Current); - using (var en = enums.GetEnumerator()) + while (en.MoveNext()) { - if (en.MoveNext()) - { - WriteEnum(iw, en.Current); + iw.WriteLine(); + + WriteEnum(iw, en.Current); + } + + iw.WriteLine(); + } + } - while (en.MoveNext()) - { - iw.WriteLine(); + var classesToWrite = classes + .Where(c => c.Nodes.None(n => n is FunctionNode)) // Skip class which contains FunctionNodes because these are not data classes. + .Distinct(); - WriteEnum(iw, en.Current); - } + var unicodeStringClassLengthsToGenerate = new HashSet(); - iw.WriteLine(); - } + using (var en = classesToWrite.GetEnumerator()) + { + if (en.MoveNext()) + { + void FindUnicodeStringClasses(IEnumerable nodes) + { + unicodeStringClassLengthsToGenerate.UnionWith(nodes.OfType().Select(n => n.Length)); } - var classesToWrite = classes - .Where(c => c.Nodes.None(n => n is FunctionNode)) // Skip class which contains FunctionNodes because these are not data classes. - .Distinct(); + FindUnicodeStringClasses(en.Current!.Nodes); + + WriteClass(iw, en.Current, logger); - using (var en = classesToWrite.GetEnumerator()) + while (en.MoveNext()) { - if (en.MoveNext()) - { - WriteClass(iw, en.Current, logger); + iw.WriteLine(); - while (en.MoveNext()) - { - iw.WriteLine(); + FindUnicodeStringClasses(en.Current!.Nodes); - WriteClass(iw, en.Current, logger); - } - } + WriteClass(iw, en.Current, logger); } } + } + + if (unicodeStringClassLengthsToGenerate.Any()) + { + foreach (var length in unicodeStringClassLengthsToGenerate) + { + iw.WriteLine(); - return sw.ToString(); + WriteUnicodeStringClass(iw, length); + } } + + return sw.ToString(); } /// @@ -148,8 +175,8 @@ private static void WriteClass(IndentedTextWriter writer, ClassNode @class, ILog Contract.Requires(@class != null); Contract.Requires(logger != null); - writer.WriteLine("[StructLayout(LayoutKind.Explicit)]"); - writer.Write("class "); + writer.WriteLine("[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi)]"); + writer.Write("public struct "); writer.Write(@class.Name); if (!string.IsNullOrEmpty(@class.Comment)) @@ -167,22 +194,19 @@ private static void WriteClass(IndentedTextWriter writer, ClassNode @class, ILog .WhereNot(n => n is FunctionNode || n is BaseHexNode); foreach (var node in nodes) { - var type = GetTypeDefinition(node); + var (type, attribute) = GetTypeDefinition(node); if (type != null) { - writer.Write("[FieldOffset("); - writer.Write(node.Offset); - writer.WriteLine(")]"); - - writer.Write("public "); - writer.Write(type); - writer.Write(" "); - writer.Write(node.Name); - writer.Write("; //0x"); - writer.Write($"{node.Offset:X04}"); + if (attribute != null) + { + writer.WriteLine(attribute); + } + + writer.WriteLine($"[FieldOffset(0x{node.Offset:X})]"); + writer.Write($"public readonly {type} {node.Name};"); if (!string.IsNullOrEmpty(node.Comment)) { - writer.Write(" "); + writer.Write(" //"); writer.Write(node.Comment); } writer.WriteLine(); @@ -198,11 +222,11 @@ private static void WriteClass(IndentedTextWriter writer, ClassNode @class, ILog } /// - /// Gets the type definition for the given node. If the node is not a simple node null is returned. + /// Gets the type definition for the given node. If the node is not expressible null as typename is returned. /// /// The target node. - /// The type definition for the node or null if no simple type is available. - private static string GetTypeDefinition(BaseNode node) + /// The type definition for the node or null as typename if the node is not expressible. + private static (string typeName, string attribute) GetTypeDefinition(BaseNode node) { Contract.Requires(node != null); @@ -215,15 +239,39 @@ private static string GetTypeDefinition(BaseNode node) if (nodeTypeToTypeDefinationMap.TryGetValue(node.GetType(), out var type)) { - return type; + return (type, null); } - if (node is EnumNode enumNode) + return node switch { - return enumNode.Enum.Name; - } + EnumNode enumNode => (enumNode.Enum.Name, null), + Utf8TextNode utf8TextNode => ("string", $"[MarshalAs(UnmanagedType.ByValTStr, SizeConst = {utf8TextNode.Length})]"), + Utf16TextNode utf16TextNode => (GetUnicodeStringClassName(utf16TextNode.Length), "[MarshalAs(UnmanagedType.Struct)]"), + _ => (null, null) + }; + } + + private static string GetUnicodeStringClassName(int length) => $"__UnicodeString{length}"; - return null; + /// + /// Writes a helper class for unicode strings with the specific length. + /// + /// The writer to output to. + /// The string length for this class. + private static void WriteUnicodeStringClass(IndentedTextWriter writer, int length) + { + var className = GetUnicodeStringClassName(length); + + writer.WriteLine("[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]"); + writer.WriteLine($"public struct {className}"); + writer.WriteLine("{"); + writer.Indent++; + writer.WriteLine($"[MarshalAs(UnmanagedType.ByValTStr, SizeConst = {length})]"); + writer.WriteLine("public string Value;"); + writer.WriteLine(); + writer.WriteLine($"public static implicit operator string({className} value) => value.Value;"); + writer.Indent--; + writer.WriteLine("}"); } } } diff --git a/ReClass.NET/CodeGenerator/CppCodeGenerator.cs b/ReClass.NET/CodeGenerator/CppCodeGenerator.cs index 80971e61..b6495aab 100644 --- a/ReClass.NET/CodeGenerator/CppCodeGenerator.cs +++ b/ReClass.NET/CodeGenerator/CppCodeGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Diagnostics.Contracts; @@ -6,11 +6,11 @@ using System.IO; using System.Linq; using System.Text; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Logger; using ReClassNET.Nodes; using ReClassNET.Project; -using ReClassNET.UI; namespace ReClassNET.CodeGenerator { @@ -100,24 +100,24 @@ private class Utf8CharacterNode : BaseNode { public override int MemorySize => throw new NotImplementedException(); public override void GetUserInterfaceInfo(out string name, out Image icon) => throw new NotImplementedException(); - public override Size Draw(ViewInfo view, int x, int y) => throw new NotImplementedException(); - public override int CalculateDrawnHeight(ViewInfo view) => throw new NotImplementedException(); + public override Size Draw(DrawContext context, int x, int y) => throw new NotImplementedException(); + public override int CalculateDrawnHeight(DrawContext context) => throw new NotImplementedException(); } private class Utf16CharacterNode : BaseNode { public override int MemorySize => throw new NotImplementedException(); public override void GetUserInterfaceInfo(out string name, out Image icon) => throw new NotImplementedException(); - public override Size Draw(ViewInfo view, int x, int y) => throw new NotImplementedException(); - public override int CalculateDrawnHeight(ViewInfo view) => throw new NotImplementedException(); + public override Size Draw(DrawContext context, int x, int y) => throw new NotImplementedException(); + public override int CalculateDrawnHeight(DrawContext context) => throw new NotImplementedException(); } private class Utf32CharacterNode : BaseNode { public override int MemorySize => throw new NotImplementedException(); public override void GetUserInterfaceInfo(out string name, out Image icon) => throw new NotImplementedException(); - public override Size Draw(ViewInfo view, int x, int y) => throw new NotImplementedException(); - public override int CalculateDrawnHeight(ViewInfo view) => throw new NotImplementedException(); + public override Size Draw(DrawContext context, int x, int y) => throw new NotImplementedException(); + public override int CalculateDrawnHeight(DrawContext context) => throw new NotImplementedException(); } #endregion @@ -136,6 +136,7 @@ public CppCodeGenerator(CppTypeMapping typeMapping) [typeof(Int16Node)] = typeMapping.TypeInt16, [typeof(Int32Node)] = typeMapping.TypeInt32, [typeof(Int64Node)] = typeMapping.TypeInt64, + [typeof(NIntNode)] = typeMapping.TypeNInt, [typeof(Matrix3x3Node)] = typeMapping.TypeMatrix3x3, [typeof(Matrix3x4Node)] = typeMapping.TypeMatrix3x4, [typeof(Matrix4x4Node)] = typeMapping.TypeMatrix4x4, @@ -143,6 +144,7 @@ public CppCodeGenerator(CppTypeMapping typeMapping) [typeof(UInt16Node)] = typeMapping.TypeUInt16, [typeof(UInt32Node)] = typeMapping.TypeUInt32, [typeof(UInt64Node)] = typeMapping.TypeUInt64, + [typeof(NUIntNode)] = typeMapping.TypeNUInt, [typeof(Utf8CharacterNode)] = typeMapping.TypeUtf8Text, [typeof(Utf16CharacterNode)] = typeMapping.TypeUtf16Text, [typeof(Utf32CharacterNode)] = typeMapping.TypeUtf32Text, @@ -154,76 +156,76 @@ public CppCodeGenerator(CppTypeMapping typeMapping) public string GenerateCode(IReadOnlyList classes, IReadOnlyList enums, ILogger logger) { - using (var sw = new StringWriter()) + using var sw = new StringWriter(); + using var iw = new IndentedTextWriter(sw, "\t"); + + iw.WriteLine($"// Created with {Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"); + iw.WriteLine(); + + using (var en = enums.GetEnumerator()) { - using (var iw = new IndentedTextWriter(sw, "\t")) + if (en.MoveNext()) { - iw.WriteLine($"// Created with {Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"); - iw.WriteLine(); + WriteEnum(iw, en.Current); - using (var en = enums.GetEnumerator()) + while (en.MoveNext()) { - if (en.MoveNext()) - { - WriteEnum(iw, en.Current); - - while (en.MoveNext()) - { - iw.WriteLine(); - - WriteEnum(iw, en.Current); - } + iw.WriteLine(); - iw.WriteLine(); - } + WriteEnum(iw, en.Current); } - var alreadySeen = new HashSet(); + iw.WriteLine(); + } + } - IEnumerable GetReversedClassHierarchy(ClassNode node) - { - Contract.Requires(node != null); - Contract.Ensures(Contract.Result>() != null); + var alreadySeen = new HashSet(); - if (!alreadySeen.Add(node)) - { - return Enumerable.Empty(); - } + IEnumerable GetReversedClassHierarchy(ClassNode node) + { + Contract.Requires(node != null); + Contract.Ensures(Contract.Result>() != null); - var classNodes = node.Nodes - .OfType() - .Where(w => !w.IsNodePresentInChain()) // Pointers are forward declared - .Select(w => w.ResolveMostInnerNode() as ClassNode) - .Where(n => n != null); + if (!alreadySeen.Add(node)) + { + return Enumerable.Empty(); + } - return classNodes - .SelectMany(GetReversedClassHierarchy) - .Append(node); - } + var classNodes = node.Nodes + .OfType() + .SelectMany(c => c.Nodes) + .Concat(node.Nodes) + .OfType() + .Where(w => !w.IsNodePresentInChain()) // Pointers are forward declared + .Select(w => w.ResolveMostInnerNode() as ClassNode) + .Where(n => n != null); + + return classNodes + .SelectMany(GetReversedClassHierarchy) + .Append(node); + } - var classesToWrite = classes - .Where(c => c.Nodes.None(n => n is FunctionNode)) // Skip class which contains FunctionNodes because these are not data classes. - .SelectMany(GetReversedClassHierarchy) // Order the classes by their use hierarchy. - .Distinct(); + var classesToWrite = classes + .Where(c => c.Nodes.None(n => n is FunctionNode)) // Skip class which contains FunctionNodes because these are not data classes. + .SelectMany(GetReversedClassHierarchy) // Order the classes by their use hierarchy. + .Distinct(); - using (var en = classesToWrite.GetEnumerator()) - { - if (en.MoveNext()) - { - WriteClass(iw, en.Current, classes, logger); + using (var en = classesToWrite.GetEnumerator()) + { + if (en.MoveNext()) + { + WriteClass(iw, en.Current, classes, logger); - while (en.MoveNext()) - { - iw.WriteLine(); + while (en.MoveNext()) + { + iw.WriteLine(); - WriteClass(iw, en.Current, classes, logger); - } - } + WriteClass(iw, en.Current, classes, logger); } } - - return sw.ToString(); } + + return sw.ToString(); } /// @@ -348,6 +350,8 @@ private void WriteClass(IndentedTextWriter writer, ClassNode @class, IEnumerable writer.Indent--; writer.Write("}; //Size: 0x"); writer.WriteLine($"{@class.MemorySize:X04}"); + + writer.WriteLine($"static_assert(sizeof({@class.Name}) == 0x{@class.MemorySize:X});"); } /// @@ -364,7 +368,7 @@ private void WriteNodes(IndentedTextWriter writer, IEnumerable nodes, var fill = 0; var fillStart = 0; - BaseNode CreatePaddingMember(int offset, int count) + static BaseNode CreatePaddingMember(int offset, int count) { var node = new ArrayNode { @@ -494,48 +498,48 @@ private static BaseNode TransformNode(BaseNode node) return custom.TransformNode(node); } - BaseNode GetCharacterNodeForEncoding(Encoding encoding) + static BaseNode GetCharacterNodeForEncoding(Encoding encoding) { - if (encoding.Equals(Encoding.Unicode)) + if (encoding.IsSameCodePage(Encoding.Unicode)) { return new Utf16CharacterNode(); } - if (encoding.Equals(Encoding.UTF32)) + if (encoding.IsSameCodePage(Encoding.UTF32)) { return new Utf32CharacterNode(); } return new Utf8CharacterNode(); } - if (node is BaseTextNode textNode) - { - var arrayNode = new ArrayNode { Count = textNode.Length }; - arrayNode.CopyFromNode(node); - arrayNode.ChangeInnerNode(GetCharacterNodeForEncoding(textNode.Encoding)); - return arrayNode; - } - - if (node is BaseTextPtrNode textPtrNode) - { - var pointerNode = new PointerNode(); - pointerNode.CopyFromNode(node); - pointerNode.ChangeInnerNode(GetCharacterNodeForEncoding(textPtrNode.Encoding)); - return pointerNode; - } - - if (node is BitFieldNode bitFieldNode) + switch (node) { - var underlayingNode = bitFieldNode.GetUnderlayingNode(); - underlayingNode.CopyFromNode(node); - return underlayingNode; - } - - if (node is BaseHexNode hexNode) - { - var arrayNode = new ArrayNode { Count = hexNode.MemorySize }; - arrayNode.CopyFromNode(node); - arrayNode.ChangeInnerNode(new Utf8CharacterNode()); - return arrayNode; + case BaseTextNode textNode: + { + var arrayNode = new ArrayNode { Count = textNode.Length }; + arrayNode.CopyFromNode(node); + arrayNode.ChangeInnerNode(GetCharacterNodeForEncoding(textNode.Encoding)); + return arrayNode; + } + case BaseTextPtrNode textPtrNode: + { + var pointerNode = new PointerNode(); + pointerNode.CopyFromNode(node); + pointerNode.ChangeInnerNode(GetCharacterNodeForEncoding(textPtrNode.Encoding)); + return pointerNode; + } + case BitFieldNode bitFieldNode: + { + var underlayingNode = bitFieldNode.GetUnderlayingNode(); + underlayingNode.CopyFromNode(node); + return underlayingNode; + } + case BaseHexNode hexNode: + { + var arrayNode = new ArrayNode { Count = hexNode.MemorySize }; + arrayNode.CopyFromNode(node); + arrayNode.ChangeInnerNode(new Utf8CharacterNode()); + return arrayNode; + } } return node; @@ -562,13 +566,12 @@ private string GetTypeDefinition(BaseNode node, ILogger logger) return type; } - if (node is ClassInstanceNode classInstanceNode) - { - return $"class {classInstanceNode.InnerNode.Name}"; - } - if (node is EnumNode enumNode) + switch (node) { - return enumNode.Enum.Name; + case ClassInstanceNode classInstanceNode: + return $"class {classInstanceNode.InnerNode.Name}"; + case EnumNode enumNode: + return enumNode.Enum.Name; } return null; diff --git a/ReClass.NET/UI/BannerBox.cs b/ReClass.NET/Controls/BannerBox.cs similarity index 93% rename from ReClass.NET/UI/BannerBox.cs rename to ReClass.NET/Controls/BannerBox.cs index c20c541e..b3cdab8c 100644 --- a/ReClass.NET/UI/BannerBox.cs +++ b/ReClass.NET/Controls/BannerBox.cs @@ -1,8 +1,9 @@ -using System.ComponentModel; +using System.ComponentModel; using System.Drawing; using System.Windows.Forms; +using ReClassNET.UI; -namespace ReClassNET.UI +namespace ReClassNET.Controls { public class BannerBox : Control, ISupportInitialize { @@ -79,7 +80,7 @@ private void UpdateBanner() } catch { - + // ignored } } } diff --git a/ReClass.NET/UI/ColorBox.Designer.cs b/ReClass.NET/Controls/ColorBox.Designer.cs similarity index 98% rename from ReClass.NET/UI/ColorBox.Designer.cs rename to ReClass.NET/Controls/ColorBox.Designer.cs index 2cdd1b19..0757df19 100644 --- a/ReClass.NET/UI/ColorBox.Designer.cs +++ b/ReClass.NET/Controls/ColorBox.Designer.cs @@ -1,4 +1,4 @@ -namespace ReClassNET.UI +namespace ReClassNET.Controls { partial class ColorBox { diff --git a/ReClass.NET/UI/ColorBox.cs b/ReClass.NET/Controls/ColorBox.cs similarity index 91% rename from ReClass.NET/UI/ColorBox.cs rename to ReClass.NET/Controls/ColorBox.cs index 97148fff..9325e645 100644 --- a/ReClass.NET/UI/ColorBox.cs +++ b/ReClass.NET/Controls/ColorBox.cs @@ -1,10 +1,10 @@ -using System; +using System; using System.ComponentModel; using System.Diagnostics.Contracts; using System.Drawing; using System.Windows.Forms; -namespace ReClassNET.UI +namespace ReClassNET.Controls { [DefaultEvent(nameof(ColorChanged))] [DefaultBindingProperty(nameof(Color))] @@ -77,22 +77,21 @@ private void OnTextChanged(object sender, EventArgs e) } catch { - + // ignored } } private void OnPanelClick(object sender, EventArgs e) { - using (var cd = new ColorDialog + using var cd = new ColorDialog { FullOpen = true, Color = Color - }) + }; + + if (cd.ShowDialog() == DialogResult.OK) { - if (cd.ShowDialog() == DialogResult.OK) - { - Color = cd.Color; - } + Color = cd.Color; } } diff --git a/ReClass.NET/UI/ColorBox.resx b/ReClass.NET/Controls/ColorBox.resx similarity index 100% rename from ReClass.NET/UI/ColorBox.resx rename to ReClass.NET/Controls/ColorBox.resx diff --git a/ReClass.NET/UI/CustomToolStripItems.cs b/ReClass.NET/Controls/CustomToolStripItems.cs similarity index 92% rename from ReClass.NET/UI/CustomToolStripItems.cs rename to ReClass.NET/Controls/CustomToolStripItems.cs index 779b24d0..ea186f17 100644 --- a/ReClass.NET/UI/CustomToolStripItems.cs +++ b/ReClass.NET/Controls/CustomToolStripItems.cs @@ -1,8 +1,8 @@ -using System; +using System; using System.Windows.Forms; using System.Windows.Forms.Design; -namespace ReClassNET.UI +namespace ReClassNET.Controls { [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)] public class IntegerToolStripMenuItem : ToolStripMenuItem diff --git a/ReClass.NET/UI/ViewInfo.cs b/ReClass.NET/Controls/DrawContext.cs similarity index 66% rename from ReClass.NET/UI/ViewInfo.cs rename to ReClass.NET/Controls/DrawContext.cs index 5ccfe64c..6d233780 100644 --- a/ReClass.NET/UI/ViewInfo.cs +++ b/ReClass.NET/Controls/DrawContext.cs @@ -1,17 +1,20 @@ -using System; +using System; using System.Collections.Generic; using System.Drawing; using ReClassNET.Memory; +using ReClassNET.UI; -namespace ReClassNET.UI +namespace ReClassNET.Controls { - public class ViewInfo + public class DrawContext { public Settings Settings { get; set; } - public Graphics Context { get; set; } + public Graphics Graphics { get; set; } public FontEx Font { get; set; } + public IconProvider IconProvider { get; set; } + public RemoteProcess Process { get; set; } public MemoryBuffer Memory { get; set; } public DateTime CurrentTime { get; set; } @@ -22,13 +25,15 @@ public class ViewInfo public int Level { get; set; } public bool MultipleNodesSelected { get; set; } - public ViewInfo Clone() + public DrawContext Clone() { - return new ViewInfo + return new DrawContext { Settings = Settings, - Context = Context, + Graphics = Graphics, Font = Font, + IconProvider = IconProvider, + Process = Process, Memory = Memory, CurrentTime = CurrentTime, ClientArea = ClientArea, diff --git a/ReClass.NET/Controls/DrawContextRequestEventArgs.cs b/ReClass.NET/Controls/DrawContextRequestEventArgs.cs new file mode 100644 index 00000000..13c04d03 --- /dev/null +++ b/ReClass.NET/Controls/DrawContextRequestEventArgs.cs @@ -0,0 +1,26 @@ +using System; +using ReClassNET.Memory; +using ReClassNET.Nodes; +using ReClassNET.UI; + +namespace ReClassNET.Controls +{ + public class DrawContextRequestEventArgs : EventArgs + { + public DateTime CurrentTime { get; set; } = DateTime.UtcNow; + + public Settings Settings { get; set; } + + public IconProvider IconProvider { get; set; } + + public RemoteProcess Process { get; set; } + + public MemoryBuffer Memory { get; set; } + + public BaseNode Node { get; set; } + + public IntPtr BaseAddress { get; set; } + } + + public delegate void DrawContextRequestEventHandler(object sender, DrawContextRequestEventArgs args); +} diff --git a/ReClass.NET/UI/DualValueBox.Designer.cs b/ReClass.NET/Controls/DualValueBox.Designer.cs similarity index 99% rename from ReClass.NET/UI/DualValueBox.Designer.cs rename to ReClass.NET/Controls/DualValueBox.Designer.cs index f94500f7..dd5a675b 100644 --- a/ReClass.NET/UI/DualValueBox.Designer.cs +++ b/ReClass.NET/Controls/DualValueBox.Designer.cs @@ -1,4 +1,4 @@ -namespace ReClassNET.UI +namespace ReClassNET.Controls { partial class DualValueBox { diff --git a/ReClass.NET/UI/DualValueBox.cs b/ReClass.NET/Controls/DualValueBox.cs similarity index 96% rename from ReClass.NET/UI/DualValueBox.cs rename to ReClass.NET/Controls/DualValueBox.cs index a3f473f9..d2b8d264 100644 --- a/ReClass.NET/UI/DualValueBox.cs +++ b/ReClass.NET/Controls/DualValueBox.cs @@ -1,8 +1,8 @@ -using System.ComponentModel; +using System.ComponentModel; using System.Windows.Forms; using System.Windows.Forms.Design; -namespace ReClassNET.UI +namespace ReClassNET.Controls { [Designer(typeof(DualValueControlDesigner))] public partial class DualValueBox : UserControl diff --git a/ReClass.NET/UI/DualValueBox.resx b/ReClass.NET/Controls/DualValueBox.resx similarity index 100% rename from ReClass.NET/UI/DualValueBox.resx rename to ReClass.NET/Controls/DualValueBox.resx diff --git a/ReClass.NET/UI/EnumComboBox.cs b/ReClass.NET/Controls/EnumComboBox.cs similarity index 94% rename from ReClass.NET/UI/EnumComboBox.cs rename to ReClass.NET/Controls/EnumComboBox.cs index c266a9fa..4875b85d 100644 --- a/ReClass.NET/UI/EnumComboBox.cs +++ b/ReClass.NET/Controls/EnumComboBox.cs @@ -1,12 +1,11 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.Contracts; using System.Linq; using System.Windows.Forms; using ReClassNET.Extensions; -using ReClassNET.Util; -namespace ReClassNET.UI +namespace ReClassNET.Controls { public class EnumComboBox : ComboBox where TEnum : struct { @@ -52,7 +51,7 @@ public class EnumComboBox : ComboBox where TEnum : struct [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public new TEnum SelectedValue { - get => ((EnumDescriptionDisplay)base.SelectedItem)?.Value ?? default(TEnum); + get => ((EnumDescriptionDisplay)base.SelectedItem)?.Value ?? default; set => base.SelectedItem = base.Items.Cast>().PredicateOrFirst(e => e.Value.Equals(value)); } @@ -93,7 +92,7 @@ public EnumComboBox() public void SetAvailableValues(TEnum item1, params TEnum[] items) { - SetAvailableValues(item1.Yield().Concat(items)); + SetAvailableValues(items.Prepend(item1)); } public void SetAvailableValues(IEnumerable values) @@ -105,7 +104,7 @@ public void SetAvailableValues(IEnumerable values) public void SetAvailableValuesExclude(TEnum item1, params TEnum[] items) { - SetAvailableValuesExclude(item1.Yield().Concat(items)); + SetAvailableValuesExclude(items.Prepend(item1)); } public void SetAvailableValuesExclude(IEnumerable values) diff --git a/ReClass.NET/UI/EnumDescriptionDisplay.cs b/ReClass.NET/Controls/EnumDescriptionDisplay.cs similarity index 73% rename from ReClass.NET/UI/EnumDescriptionDisplay.cs rename to ReClass.NET/Controls/EnumDescriptionDisplay.cs index 692b22ce..e2fa4c1b 100644 --- a/ReClass.NET/UI/EnumDescriptionDisplay.cs +++ b/ReClass.NET/Controls/EnumDescriptionDisplay.cs @@ -1,13 +1,11 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.Contracts; using System.Linq; using System.Reflection; -using ReClassNET.Extensions; -using ReClassNET.Util; -namespace ReClassNET.UI +namespace ReClassNET.Controls { public class EnumDescriptionDisplay where TEnum : struct { @@ -21,13 +19,6 @@ public static List> Create() return CreateExact(Enum.GetValues(typeof(TEnum)).Cast()); } - public static List> CreateExact(TEnum item1, params TEnum[] include) - { - Contract.Ensures(Contract.Result>>() != null); - - return CreateExact(item1.Yield().Concat(include)); - } - public static List> CreateExact(IEnumerable include) { Contract.Requires(include != null); @@ -43,13 +34,6 @@ public static List> CreateExact(IEnumerable .ToList(); } - public static List> CreateExclude(TEnum item1, params TEnum[] exclude) - { - Contract.Ensures(Contract.Result>>() != null); - - return CreateExclude(item1.Yield().Concat(exclude)); - } - public static List> CreateExclude(IEnumerable exclude) { Contract.Requires(exclude != null); diff --git a/ReClass.NET/Controls/HotSpotTextBox.cs b/ReClass.NET/Controls/HotSpotTextBox.cs new file mode 100644 index 00000000..218cdeb7 --- /dev/null +++ b/ReClass.NET/Controls/HotSpotTextBox.cs @@ -0,0 +1,130 @@ +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using ReClassNET.UI; + +namespace ReClassNET.Controls +{ + public class HotSpotTextBox : TextBox + { + private HotSpot currentHotSpot; + + private FontEx font; + private int minimumWidth; + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new FontEx Font + { + get => font; + set + { + if (font != value) + { + font = value; + + base.Font = font.Font; + } + } + } + + public event HotSpotTextBoxCommitEventHandler Committed; + + public HotSpotTextBox() + { + BorderStyle = BorderStyle.None; + } + + #region Events + + protected override void OnVisibleChanged(EventArgs e) + { + base.OnVisibleChanged(e); + + if (Visible) + { + BackColor = Program.Settings.BackgroundColor; + + if (currentHotSpot != null) + { + Focus(); + Select(0, TextLength); + } + } + } + + protected override void OnKeyDown(KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + OnCommit(); + + e.Handled = true; + e.SuppressKeyPress = true; + } + + base.OnKeyDown(e); + } + + protected override void OnTextChanged(EventArgs e) + { + base.OnTextChanged(e); + + var w = (TextLength + 1) * font.Width; + if (w > minimumWidth) + { + Width = w; + } + } + + private void OnCommit() + { + Visible = false; + + currentHotSpot.Text = Text.Trim(); + + Committed?.Invoke(this, new HotSpotTextBoxCommitEventArgs(currentHotSpot)); + } + + #endregion + + public void ShowOnHotSpot(HotSpot hotSpot) + { + currentHotSpot = hotSpot; + + if (hotSpot == null) + { + Visible = false; + + return; + } + + AlignToRect(hotSpot.Rect); + + Text = hotSpot.Text.Trim(); + ReadOnly = hotSpot.Id == HotSpot.ReadOnlyId; + + Visible = true; + } + + private void AlignToRect(Rectangle rect) + { + SetBounds(rect.Left + 2, rect.Top, rect.Width, rect.Height); + + minimumWidth = rect.Width; + } + } + + public delegate void HotSpotTextBoxCommitEventHandler(object sender, HotSpotTextBoxCommitEventArgs e); + + public class HotSpotTextBoxCommitEventArgs : EventArgs + { + public HotSpot HotSpot { get; set; } + + public HotSpotTextBoxCommitEventArgs(HotSpot hotSpot) + { + HotSpot = hotSpot; + } + } +} diff --git a/ReClass.NET/UI/HotkeyBox.Designer.cs b/ReClass.NET/Controls/HotkeyBox.Designer.cs similarity index 98% rename from ReClass.NET/UI/HotkeyBox.Designer.cs rename to ReClass.NET/Controls/HotkeyBox.Designer.cs index 5654a7d5..c65ead37 100644 --- a/ReClass.NET/UI/HotkeyBox.Designer.cs +++ b/ReClass.NET/Controls/HotkeyBox.Designer.cs @@ -1,4 +1,4 @@ -namespace ReClassNET.UI +namespace ReClassNET.Controls { partial class HotkeyBox { diff --git a/ReClass.NET/UI/HotkeyBox.cs b/ReClass.NET/Controls/HotkeyBox.cs similarity index 97% rename from ReClass.NET/UI/HotkeyBox.cs rename to ReClass.NET/Controls/HotkeyBox.cs index 8a5d1747..9a24e7b3 100644 --- a/ReClass.NET/UI/HotkeyBox.cs +++ b/ReClass.NET/Controls/HotkeyBox.cs @@ -1,11 +1,11 @@ -using System; +using System; using System.ComponentModel; using System.Linq; using System.Windows.Forms; using System.Windows.Forms.Design; using ReClassNET.Input; -namespace ReClassNET.UI +namespace ReClassNET.Controls { [Designer(typeof(HotkeyBoxDesigner))] public partial class HotkeyBox : UserControl diff --git a/ReClass.NET/UI/HotkeyBox.resx b/ReClass.NET/Controls/HotkeyBox.resx similarity index 100% rename from ReClass.NET/UI/HotkeyBox.resx rename to ReClass.NET/Controls/HotkeyBox.resx diff --git a/ReClass.NET/UI/IconButton.cs b/ReClass.NET/Controls/IconButton.cs similarity index 82% rename from ReClass.NET/UI/IconButton.cs rename to ReClass.NET/Controls/IconButton.cs index d3331c2c..5d45a198 100644 --- a/ReClass.NET/UI/IconButton.cs +++ b/ReClass.NET/Controls/IconButton.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Diagnostics.Contracts; using System.Drawing; @@ -6,7 +6,7 @@ using System.Windows.Forms; using System.Windows.Forms.Design; -namespace ReClassNET.UI +namespace ReClassNET.Controls { /// /// Based on . @@ -100,18 +100,16 @@ private void RenderButtonBackground(Graphics g) else { drawHotBorder = false; - using (var brush = new SolidBrush(BackColor)) - { - g.FillRectangle(brush, bounds); - } + using var brush = new SolidBrush(BackColor); + + g.FillRectangle(brush, bounds); } if (drawHotBorder) { - using (var pen = new Pen(colorTable.ButtonSelectedBorder)) - { - g.DrawRectangle(pen, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); - } + using var pen = new Pen(colorTable.ButtonSelectedBorder); + + g.DrawRectangle(pen, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); } } @@ -124,10 +122,9 @@ private void RenderPressedButtonFill(Graphics g, Rectangle bounds) return; } - using (var brush = new LinearGradientBrush(bounds, colorTable.ButtonPressedGradientBegin, colorTable.ButtonPressedGradientEnd, LinearGradientMode.Vertical)) - { - g.FillRectangle(brush, bounds); - } + using var brush = new LinearGradientBrush(bounds, colorTable.ButtonPressedGradientBegin, colorTable.ButtonPressedGradientEnd, LinearGradientMode.Vertical); + + g.FillRectangle(brush, bounds); } private void RenderSelectedButtonFill(Graphics g, Rectangle bounds) @@ -139,10 +136,9 @@ private void RenderSelectedButtonFill(Graphics g, Rectangle bounds) return; } - using (var brush = new LinearGradientBrush(bounds, colorTable.ButtonSelectedGradientBegin, colorTable.ButtonSelectedGradientEnd, LinearGradientMode.Vertical)) - { - g.FillRectangle(brush, bounds); - } + using var brush = new LinearGradientBrush(bounds, colorTable.ButtonSelectedGradientBegin, colorTable.ButtonSelectedGradientEnd, LinearGradientMode.Vertical); + + g.FillRectangle(brush, bounds); } private void RenderImage(Graphics g) diff --git a/ReClass.NET/UI/MemoryPreviewPopUp.cs b/ReClass.NET/Controls/MemoryPreviewPopUp.cs similarity index 80% rename from ReClass.NET/UI/MemoryPreviewPopUp.cs rename to ReClass.NET/Controls/MemoryPreviewPopUp.cs index 1d04834a..c407a40d 100644 --- a/ReClass.NET/UI/MemoryPreviewPopUp.cs +++ b/ReClass.NET/Controls/MemoryPreviewPopUp.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.Contracts; @@ -8,8 +8,9 @@ using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.Nodes; +using ReClassNET.UI; -namespace ReClassNET.UI +namespace ReClassNET.Controls { [ToolboxItem(false)] public class MemoryPreviewPopUp : ToolStripDropDown @@ -22,7 +23,7 @@ private class MemoryPreviewPanel : Panel { private const int MinNodeCount = 10; - public ViewInfo ViewInfo { get; } + public DrawContext DrawContext { get; } private readonly List nodes; @@ -34,9 +35,10 @@ public MemoryPreviewPanel(FontEx font) nodes = new List(); - ViewInfo = new ViewInfo + DrawContext = new DrawContext { Font = font, + IconProvider = new IconProvider(), // TODO use single instance Memory = new MemoryBuffer(), @@ -74,7 +76,7 @@ BaseHexNode CreateNode(int index) nodes.RemoveRange(count, nodes.Count - count); } - ViewInfo.Memory.Size = nodes.Select(n => n.MemorySize).Sum(); + DrawContext.Memory.Size = nodes.Select(n => n.MemorySize).Sum(); } /// Changes the number of nodes with the provided delta. @@ -99,29 +101,29 @@ private void CalculateSize() { var size = new Size( ToolTipWidth, - nodes.Sum(n => n.CalculateDrawnHeight(ViewInfo)) + ToolTipPadding + nodes.Sum(n => n.CalculateDrawnHeight(DrawContext)) + ToolTipPadding ); - ViewInfo.ClientArea = new Rectangle(ToolTipPadding / 2, ToolTipPadding / 2, size.Width - ToolTipPadding, size.Height - ToolTipPadding); + DrawContext.ClientArea = new Rectangle(ToolTipPadding / 2, ToolTipPadding / 2, size.Width - ToolTipPadding, size.Height - ToolTipPadding); Size = MinimumSize = MaximumSize = size; } protected override void OnPaint(PaintEventArgs e) { - ViewInfo.HotSpots.Clear(); + DrawContext.HotSpots.Clear(); // Some settings are not usefull for the preview. - ViewInfo.Settings = Program.Settings.Clone(); - ViewInfo.Settings.ShowNodeAddress = false; + DrawContext.Settings = Program.Settings.Clone(); + DrawContext.Settings.ShowNodeAddress = false; - ViewInfo.Context = e.Graphics; + DrawContext.Graphics = e.Graphics; - using (var brush = new SolidBrush(ViewInfo.Settings.BackgroundColor)) + using (var brush = new SolidBrush(DrawContext.Settings.BackgroundColor)) { e.Graphics.FillRectangle(brush, ClientRectangle); } - using (var pen = new Pen(ViewInfo.Settings.BackgroundColor.Invert(), 1)) + using (var pen = new Pen(DrawContext.Settings.BackgroundColor.Invert(), 1)) { e.Graphics.DrawRectangle(pen, new Rectangle(Bounds.X, Bounds.Y, Bounds.Width - 1, Bounds.Height - 1)); } @@ -130,7 +132,7 @@ protected override void OnPaint(PaintEventArgs e) int y = 2; foreach (var node in nodes) { - y += node.Draw(ViewInfo, x, y).Height; + y += node.Draw(DrawContext, x, y).Height; } } } @@ -212,15 +214,15 @@ public void InitializeMemory(RemoteProcess process, IntPtr address) memoryAddress = address; - var memory = panel.ViewInfo.Memory; - memory.Process = process; - memory.Update(address); + panel.DrawContext.Process = process; + + panel.DrawContext.Memory.UpdateFrom(process, address); } /// Updates the memory buffer to get current data. public void UpdateMemory() { - panel.ViewInfo.Memory.Update(memoryAddress); + panel.DrawContext.Memory.UpdateFrom(panel.DrawContext.Process, memoryAddress); panel.Invalidate(); } diff --git a/ReClass.NET/UI/MemoryRecordList.Designer.cs b/ReClass.NET/Controls/MemoryRecordList.Designer.cs similarity index 99% rename from ReClass.NET/UI/MemoryRecordList.Designer.cs rename to ReClass.NET/Controls/MemoryRecordList.Designer.cs index 34475868..8f3e0379 100644 --- a/ReClass.NET/UI/MemoryRecordList.Designer.cs +++ b/ReClass.NET/Controls/MemoryRecordList.Designer.cs @@ -1,4 +1,4 @@ -namespace ReClassNET.UI +namespace ReClassNET.Controls { partial class MemoryRecordList { diff --git a/ReClass.NET/UI/MemoryRecordList.cs b/ReClass.NET/Controls/MemoryRecordList.cs similarity index 98% rename from ReClass.NET/UI/MemoryRecordList.cs rename to ReClass.NET/Controls/MemoryRecordList.cs index f3d63b92..b3a06672 100644 --- a/ReClass.NET/UI/MemoryRecordList.cs +++ b/ReClass.NET/Controls/MemoryRecordList.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.Contracts; using System.Drawing; @@ -7,9 +7,9 @@ using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.MemoryScanner; -using ReClassNET.Util; +using ReClassNET.UI; -namespace ReClassNET.UI +namespace ReClassNET.Controls { public delegate void MemorySearchResultControlResultDoubleClickEventHandler(object sender, MemoryRecord record); diff --git a/ReClass.NET/UI/MemoryRecordList.resx b/ReClass.NET/Controls/MemoryRecordList.resx similarity index 100% rename from ReClass.NET/UI/MemoryRecordList.resx rename to ReClass.NET/Controls/MemoryRecordList.resx diff --git a/ReClass.NET/Controls/MemoryViewControl.Designer.cs b/ReClass.NET/Controls/MemoryViewControl.Designer.cs new file mode 100644 index 00000000..942c196d --- /dev/null +++ b/ReClass.NET/Controls/MemoryViewControl.Designer.cs @@ -0,0 +1,74 @@ +namespace ReClassNET.Controls +{ + partial class MemoryViewControl + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.repaintTimer = new System.Windows.Forms.Timer(this.components); + this.hotSpotEditBox = new HotSpotTextBox(); + this.nodeInfoToolTip = new System.Windows.Forms.ToolTip(this.components); + this.SuspendLayout(); + // + // repaintTimer + // + this.repaintTimer.Enabled = true; + this.repaintTimer.Interval = 250; + this.repaintTimer.Tick += new System.EventHandler(this.repaintTimer_Tick); + // + // hotSpotEditBox + // + this.hotSpotEditBox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.hotSpotEditBox.Location = new System.Drawing.Point(0, 0); + this.hotSpotEditBox.Name = "hotSpotEditBox"; + this.hotSpotEditBox.Size = new System.Drawing.Size(100, 13); + this.hotSpotEditBox.TabIndex = 1; + this.hotSpotEditBox.TabStop = false; + this.hotSpotEditBox.Visible = false; + this.hotSpotEditBox.Committed += new HotSpotTextBoxCommitEventHandler(this.editBox_Committed); + // + // nodeInfoToolTip + // + this.nodeInfoToolTip.ShowAlways = true; + // + // MemoryViewControl + // + this.Controls.Add(this.hotSpotEditBox); + this.DoubleBuffered = true; + this.Name = "MemoryViewControl"; + this.Size = new System.Drawing.Size(150, 162); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Timer repaintTimer; + private HotSpotTextBox hotSpotEditBox; + private System.Windows.Forms.ToolTip nodeInfoToolTip; + } +} diff --git a/ReClass.NET/UI/MemoryViewControl.cs b/ReClass.NET/Controls/MemoryViewControl.cs similarity index 74% rename from ReClass.NET/UI/MemoryViewControl.cs rename to ReClass.NET/Controls/MemoryViewControl.cs index ead9e1f1..64b8dfa4 100644 --- a/ReClass.NET/UI/MemoryViewControl.cs +++ b/ReClass.NET/Controls/MemoryViewControl.cs @@ -1,7 +1,5 @@ -using System; +using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; @@ -9,11 +7,12 @@ using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.Nodes; +using ReClassNET.UI; using ReClassNET.Util; -namespace ReClassNET.UI +namespace ReClassNET.Controls { - public partial class MemoryViewControl : ScrollableCustomControl + public partial class MemoryViewControl : UserControl { /// /// Contains informations about a selected node. @@ -24,7 +23,9 @@ public class SelectedNodeInfo /// The selected node. /// public BaseNode Node { get; } - + + public RemoteProcess Process { get; } + /// /// The memory this node uses. /// @@ -37,20 +38,20 @@ public class SelectedNodeInfo public int Level { get; } - public SelectedNodeInfo(BaseNode node, MemoryBuffer memory, IntPtr address, int level) + public SelectedNodeInfo(BaseNode node, RemoteProcess process, MemoryBuffer memory, IntPtr address, int level) { Contract.Requires(node != null); + Contract.Requires(process != null); Contract.Requires(memory != null); Node = node; + Process = process; Memory = memory; Address = address; Level = level; } } - private ClassNode classNode; - private readonly List hotSpots = new List(); private readonly List selectedNodes = new List(); @@ -59,37 +60,9 @@ public SelectedNodeInfo(BaseNode node, MemoryBuffer memory, IntPtr address, int private readonly FontEx font; - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public ClassNode ClassNode - { - get => classNode; - set - { - editBox.Visible = false; - - ClearSelection(); - - OnSelectionChanged(); - - classNode = value; - - VerticalScroll.Value = VerticalScroll.Minimum; - if (classNode != null && Memory?.Process != null) - { - classNode.UpdateAddress(Memory.Process); - } - - Invalidate(); - } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public MemoryBuffer Memory { get; set; } - public ContextMenuStrip NodeContextMenuStrip { get; set; } + public event DrawContextRequestEventHandler DrawContextRequested; public event EventHandler SelectionChanged; public event NodeClickEventHandler ChangeClassTypeClick; public event NodeClickEventHandler ChangeWrappedTypeClick; @@ -106,25 +79,15 @@ public MemoryViewControl() return; } + AutoScroll = true; + font = Program.MonoSpaceFont; - editBox.Font = font; + hotSpotEditBox.Font = font; memoryPreviewPopUp = new MemoryPreviewPopUp(font); } - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - VerticalScroll.Enabled = true; - VerticalScroll.Visible = true; - VerticalScroll.SmallChange = 10; - HorizontalScroll.Enabled = true; - HorizontalScroll.Visible = true; - HorizontalScroll.SmallChange = 100; - } - protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); @@ -136,6 +99,11 @@ protected override void OnPaint(PaintEventArgs e) return; } + var args = new DrawContextRequestEventArgs(); + + var requestHandler = DrawContextRequested; + requestHandler?.Invoke(this, args); + hotSpots.Clear(); using (var brush = new SolidBrush(Program.Settings.BackgroundColor)) @@ -143,86 +111,50 @@ protected override void OnPaint(PaintEventArgs e) e.Graphics.FillRectangle(brush, ClientRectangle); } - if (ClassNode == null) + if (args.Process == null || args.Memory == null || args.Node == null) { return; } - if (Memory.Process != null) - { - ClassNode.UpdateAddress(Memory.Process); - } - if (memoryPreviewPopUp.Visible) { memoryPreviewPopUp.UpdateMemory(); } - Memory.Size = ClassNode.MemorySize; - Memory.Update(ClassNode.Address); - - var view = new ViewInfo + var view = new DrawContext { - Settings = Program.Settings, - Context = e.Graphics, + Settings = args.Settings, + Graphics = e.Graphics, Font = font, - Memory = Memory, - CurrentTime = DateTime.UtcNow, + IconProvider = args.IconProvider, + Process = args.Process, + Memory = args.Memory, + CurrentTime = args.CurrentTime, ClientArea = ClientRectangle, HotSpots = hotSpots, - Address = classNode.Address, + Address = args.BaseAddress, Level = 0, MultipleNodesSelected = selectedNodes.Count > 1 }; - try - { - var drawnSize = ClassNode.Draw( - view, - -HorizontalScroll.Value, - -VerticalScroll.Value * font.Height - ); - drawnSize.Width += 50; - - /*foreach (var spot in hotSpots.Where(h => h.Type == HotSpotType.Select)) - { - e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(150, 255, 0, 0)), 1), spot.Rect); - }*/ - - if (drawnSize.Height > ClientSize.Height) - { - VerticalScroll.Enabled = true; + var scrollPosition = AutoScrollPosition; - VerticalScroll.LargeChange = ClientSize.Height / font.Height; - VerticalScroll.Maximum = (drawnSize.Height - ClientSize.Height) / font.Height + VerticalScroll.LargeChange; - } - else - { - VerticalScroll.Enabled = false; - - VerticalScroll.Value = VerticalScroll.Minimum; - } + var drawnSize = args.Node.Draw( + view, + scrollPosition.X, + scrollPosition.Y + ); + drawnSize.Width += 10; - if (drawnSize.Width > ClientSize.Width) - { - HorizontalScroll.Enabled = true; - - HorizontalScroll.LargeChange = ClientSize.Width; - HorizontalScroll.Maximum = drawnSize.Width - ClientSize.Width + HorizontalScroll.LargeChange; - } - else - { - HorizontalScroll.Enabled = false; - - HorizontalScroll.Value = HorizontalScroll.Minimum; - } - } - catch (Exception) + /*foreach (var spot in hotSpots.Where(h => h.Type == HotSpotType.Select)) { - Debug.Assert(false); + e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(150, 255, 0, 0)), 1), spot.Rect); + }*/ - throw; - } + AutoScrollMinSize = new Size(Math.Max(drawnSize.Width, ClientSize.Width), Math.Max(drawnSize.Height, ClientSize.Height)); + + // Sometimes setting AutoScrollMinSize resets AutoScrollPosition. This restores the original position. + AutoScrollPosition = new Point(-scrollPosition.X, -scrollPosition.Y); } private void OnSelectionChanged() @@ -236,6 +168,8 @@ protected override void OnMouseClick(MouseEventArgs e) { Contract.Requires(e != null); + hotSpotEditBox.Hide(); + var invalidate = false; foreach (var hotSpot in hotSpots) @@ -314,11 +248,12 @@ protected override void OnMouseClick(MouseEventArgs e) var containerNode = selectedNode.GetParentContainer(); foreach (var spot in containerNode.Nodes .SkipWhile(n => n != first.Node) - .TakeUntil(n => n == last.Node) + .TakeWhileInclusive(n => n != last.Node) .Select(n => new HotSpot { Address = (IntPtr)(containerNode.Offset + n.Offset), Node = n, + Process = first.Process, Memory = first.Memory, Level = first.Level })) @@ -371,9 +306,12 @@ protected override void OnMouseClick(MouseEventArgs e) } else if (hotSpot.Type == HotSpotType.ChangeClassType || hotSpot.Type == HotSpotType.ChangeWrappedType || hotSpot.Type == HotSpotType.ChangeEnumType) { - var handler = hotSpot.Type == HotSpotType.ChangeClassType - ? ChangeClassTypeClick : hotSpot.Type == HotSpotType.ChangeWrappedType - ? ChangeWrappedTypeClick : ChangeEnumTypeClick; + var handler = hotSpot.Type switch + { + HotSpotType.ChangeClassType => ChangeClassTypeClick, + HotSpotType.ChangeWrappedType => ChangeWrappedTypeClick, + HotSpotType.ChangeEnumType => ChangeEnumTypeClick + }; handler?.Invoke(this, new NodeClickEventArgs(hitObject, hotSpot.Address, hotSpot.Memory, e.Button, e.Location)); @@ -382,8 +320,6 @@ protected override void OnMouseClick(MouseEventArgs e) } } - editBox.Visible = false; - if (invalidate) { Invalidate(); @@ -396,7 +332,7 @@ protected override void OnMouseDoubleClick(MouseEventArgs e) { Contract.Requires(e != null); - editBox.Visible = false; + hotSpotEditBox.Hide(); var invalidate = false; @@ -420,11 +356,7 @@ protected override void OnMouseDoubleClick(MouseEventArgs e) } if (hotSpot.Type == HotSpotType.Edit) { - editBox.BackColor = Program.Settings.SelectedColor; - editBox.HotSpot = hotSpot; - editBox.Visible = true; - - editBox.ReadOnly = hotSpot.Id == HotSpot.ReadOnlyId; + hotSpotEditBox.ShowOnHotSpot(hotSpot); break; } @@ -457,7 +389,7 @@ protected override void OnMouseHover(EventArgs e) if (selectedNodes.Count > 1) { var memorySize = selectedNodes.Sum(h => h.Node.MemorySize); - nodeInfoToolTip.Show($"{selectedNodes.Count} Nodes selected, {memorySize} bytes", this, toolTipPosition.OffsetEx(16, 16)); + nodeInfoToolTip.Show($"{selectedNodes.Count} Nodes selected, {memorySize} bytes", this, toolTipPosition.Relocate(16, 16)); } else { @@ -465,18 +397,18 @@ protected override void OnMouseHover(EventArgs e) { if (spot.Rect.Contains(toolTipPosition)) { - if (spot.Node.UseMemoryPreviewToolTip(spot, spot.Memory, out var previewAddress)) + if (spot.Node.UseMemoryPreviewToolTip(spot, out var previewAddress)) { - memoryPreviewPopUp.InitializeMemory(spot.Memory.Process, previewAddress); + memoryPreviewPopUp.InitializeMemory(spot.Process, previewAddress); - memoryPreviewPopUp.Show(this, toolTipPosition.OffsetEx(16, 16)); + memoryPreviewPopUp.Show(this, toolTipPosition.Relocate(16, 16)); } else { - var text = spot.Node.GetToolTipText(spot, spot.Memory); + var text = spot.Node.GetToolTipText(spot); if (!string.IsNullOrEmpty(text)) { - nodeInfoToolTip.Show(text, this, toolTipPosition.OffsetEx(16, 16)); + nodeInfoToolTip.Show(text, this, toolTipPosition.Relocate(16, 16)); } } @@ -511,6 +443,8 @@ protected override void OnMouseMove(MouseEventArgs e) protected override void OnMouseWheel(MouseEventArgs e) { + hotSpotEditBox.Hide(); + if (memoryPreviewPopUp.Visible) { memoryPreviewPopUp.HandleMouseWheelEvent(e); @@ -521,18 +455,9 @@ protected override void OnMouseWheel(MouseEventArgs e) } } - protected override void OnScroll(ScrollEventArgs e) - { - Contract.Requires(e != null); - - base.OnScroll(e); - - editBox.Visible = false; - } - protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { - if (editBox.Visible == false) // Only process keys if the edit field is not visible. + if (hotSpotEditBox.Visible == false) // Only process keys if the edit field is not visible. { var key = keyData & Keys.KeyCode; var modifier = keyData & Keys.Modifiers; @@ -557,7 +482,8 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) if (key == Keys.Down) { var temp = query - .SkipUntil(h => h.Node == selectionCaret.Node) + .SkipWhile(h => h.Node != selectionCaret.Node) + .Skip(1) .ToList(); toSelect = temp.FirstOrDefault(); @@ -593,11 +519,12 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) var containerNode = toSelect.Node.GetParentContainer(); foreach (var spot in containerNode.Nodes .SkipWhile(n => n != first.Node) - .TakeUntil(n => n == last.Node) + .TakeWhileInclusive(n => n != last.Node) .Select(n => new HotSpot { Address = (IntPtr)(containerNode.Offset + n.Offset), Node = n, + Process = toSelect.Process, Memory = toSelect.Memory, Level = toSelect.Level })) @@ -610,7 +537,10 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) if (isAtEnd) { - DoScroll(ScrollOrientation.VerticalScroll, key == Keys.Down ? 1 : - 1); + const int ScrollAmount = 3; + + var position = AutoScrollPosition; + AutoScrollPosition = new Point(-position.X, -position.Y + (key == Keys.Down ? ScrollAmount : -ScrollAmount) * font.Height); } Invalidate(); @@ -674,11 +604,9 @@ private void repaintTimer_Tick(object sender, EventArgs e) Invalidate(false); } - private void editBox_Committed(object sender, EventArgs e) + private void editBox_Committed(object sender, HotSpotTextBoxCommitEventArgs e) { - var hotspotTextBox = sender as HotSpotTextBox; - - var hotSpot = hotspotTextBox?.HotSpot; + var hotSpot = e.HotSpot; if (hotSpot != null) { try @@ -692,6 +620,8 @@ private void editBox_Committed(object sender, EventArgs e) Invalidate(); } + + Focus(); } #endregion @@ -703,7 +633,7 @@ private void editBox_Committed(object sender, EventArgs e) public IReadOnlyList GetSelectedNodes() { return selectedNodes - .Select(h => new SelectedNodeInfo(h.Node, h.Memory, h.Address, h.Level)) + .Select(h => new SelectedNodeInfo(h.Node, h.Process, h.Memory, h.Address, h.Level)) .ToList(); } @@ -717,7 +647,7 @@ public void SetSelectedNodes(IEnumerable nodes) selectedNodes.Clear(); - selectedNodes.AddRange(nodes.Select(i => new HotSpot { Type = HotSpotType.Select, Node = i.Node, Memory = i.Memory, Address = i.Address, Level = i.Level })); + selectedNodes.AddRange(nodes.Select(i => new HotSpot { Type = HotSpotType.Select, Node = i.Node, Process = i.Process, Memory = i.Memory, Address = i.Address, Level = i.Level })); selectedNodes.ForEach(h => h.Node.IsSelected = true); OnSelectionChanged(); @@ -732,6 +662,21 @@ private void ShowNodeContextMenu(Point location) NodeContextMenuStrip?.Show(this, location); } + public void ShowNodeNameEditBox(BaseNode node) + { + if (node == null || node is BaseHexNode) + { + return; + } + + var hotSpot = hotSpots + .FirstOrDefault(s => s.Node == node && s.Type == HotSpotType.Edit && s.Id == HotSpot.NameId); + if (hotSpot != null) + { + hotSpotEditBox.ShowOnHotSpot(hotSpot); + } + } + /// /// Resets the selection state of all selected nodes. /// @@ -747,5 +692,17 @@ public void ClearSelection() //Invalidate(); } + + /// + /// Resets the control to the initial state. + /// + public void Reset() + { + ClearSelection(); + + hotSpotEditBox.Hide(); + + VerticalScroll.Value = VerticalScroll.Minimum; + } } } diff --git a/ReClass.NET/UI/MemoryViewControl.resx b/ReClass.NET/Controls/MemoryViewControl.resx similarity index 100% rename from ReClass.NET/UI/MemoryViewControl.resx rename to ReClass.NET/Controls/MemoryViewControl.resx diff --git a/ReClass.NET/UI/NodeClickEventArgs.cs b/ReClass.NET/Controls/NodeClickEventArgs.cs similarity index 94% rename from ReClass.NET/UI/NodeClickEventArgs.cs rename to ReClass.NET/Controls/NodeClickEventArgs.cs index 70f3948a..3d9dd82f 100644 --- a/ReClass.NET/UI/NodeClickEventArgs.cs +++ b/ReClass.NET/Controls/NodeClickEventArgs.cs @@ -1,11 +1,11 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Drawing; using System.Windows.Forms; using ReClassNET.Memory; using ReClassNET.Nodes; -namespace ReClassNET.UI +namespace ReClassNET.Controls { public class NodeClickEventArgs : EventArgs { diff --git a/ReClass.NET/UI/PlaceholderTextBox.cs b/ReClass.NET/Controls/PlaceholderTextBox.cs similarity index 87% rename from ReClass.NET/UI/PlaceholderTextBox.cs rename to ReClass.NET/Controls/PlaceholderTextBox.cs index d0ac5d25..59734c10 100644 --- a/ReClass.NET/UI/PlaceholderTextBox.cs +++ b/ReClass.NET/Controls/PlaceholderTextBox.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; -namespace ReClassNET.UI +namespace ReClassNET.Controls { public class PlaceholderTextBox : TextBox { @@ -66,10 +66,9 @@ protected override void OnPaint(PaintEventArgs e) if (string.IsNullOrEmpty(Text) && Focused == false) { - using (var brush = new SolidBrush(PlaceholderColor)) - { - e.Graphics.DrawString(PlaceholderText ?? string.Empty, Font, brush, new PointF(-1.0f, 1.0f)); - } + using var brush = new SolidBrush(PlaceholderColor); + + e.Graphics.DrawString(PlaceholderText ?? string.Empty, Font, brush, new PointF(-1.0f, 1.0f)); } } } diff --git a/ReClass.NET/UI/ProjectView.Designer.cs b/ReClass.NET/Controls/ProjectView.Designer.cs similarity index 98% rename from ReClass.NET/UI/ProjectView.Designer.cs rename to ReClass.NET/Controls/ProjectView.Designer.cs index 1658a477..25d6422e 100644 --- a/ReClass.NET/UI/ProjectView.Designer.cs +++ b/ReClass.NET/Controls/ProjectView.Designer.cs @@ -1,4 +1,4 @@ -namespace ReClassNET.UI +namespace ReClassNET.Controls { partial class ProjectView { diff --git a/ReClass.NET/UI/ProjectView.cs b/ReClass.NET/Controls/ProjectView.cs similarity index 98% rename from ReClass.NET/UI/ProjectView.cs rename to ReClass.NET/Controls/ProjectView.cs index b860c66f..f1b12261 100644 --- a/ReClass.NET/UI/ProjectView.cs +++ b/ReClass.NET/Controls/ProjectView.cs @@ -1,15 +1,14 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.Contracts; using System.Linq; -using System.Runtime.Remoting.Contexts; using System.Windows.Forms; using ReClassNET.Extensions; using ReClassNET.Nodes; using ReClassNET.Project; -namespace ReClassNET.UI +namespace ReClassNET.Controls { public partial class ProjectView : UserControl { @@ -72,7 +71,7 @@ private void RebuildClassHierarchy(HashSet seen) .Distinct() .ToList(); - if (distinctClasses.SequenceEqualsEx(Nodes.Cast().Select(t => t.ClassNode))) + if (distinctClasses.IsEquivalentTo(Nodes.Cast().Select(t => t.ClassNode))) { return; } diff --git a/ReClass.NET/UI/ProjectView.resx b/ReClass.NET/Controls/ProjectView.resx similarity index 100% rename from ReClass.NET/UI/ProjectView.resx rename to ReClass.NET/Controls/ProjectView.resx diff --git a/ReClass.NET/DataExchange/ReClass/Legacy/BaseClassArrayNode.cs b/ReClass.NET/DataExchange/ReClass/Legacy/BaseClassArrayNode.cs index 97f4561b..0871658d 100644 --- a/ReClass.NET/DataExchange/ReClass/Legacy/BaseClassArrayNode.cs +++ b/ReClass.NET/DataExchange/ReClass/Legacy/BaseClassArrayNode.cs @@ -1,7 +1,7 @@ -using System; +using System; using System.Drawing; +using ReClassNET.Controls; using ReClassNET.Nodes; -using ReClassNET.UI; namespace ReClassNET.DataExchange.ReClass.Legacy { @@ -14,12 +14,12 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) throw new NotImplementedException(); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { throw new NotImplementedException(); } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { throw new NotImplementedException(); } diff --git a/ReClass.NET/DataExchange/ReClass/Legacy/ClassPointerNode.cs b/ReClass.NET/DataExchange/ReClass/Legacy/ClassPointerNode.cs index 6511cb04..243707e8 100644 --- a/ReClass.NET/DataExchange/ReClass/Legacy/ClassPointerNode.cs +++ b/ReClass.NET/DataExchange/ReClass/Legacy/ClassPointerNode.cs @@ -1,7 +1,7 @@ -using System; +using System; using System.Drawing; +using ReClassNET.Controls; using ReClassNET.Nodes; -using ReClassNET.UI; namespace ReClassNET.DataExchange.ReClass.Legacy { @@ -14,12 +14,12 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) throw new NotImplementedException(); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { throw new NotImplementedException(); } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { throw new NotImplementedException(); } diff --git a/ReClass.NET/DataExchange/ReClass/Legacy/CustomNode.cs b/ReClass.NET/DataExchange/ReClass/Legacy/CustomNode.cs index 96238c84..0645f860 100644 --- a/ReClass.NET/DataExchange/ReClass/Legacy/CustomNode.cs +++ b/ReClass.NET/DataExchange/ReClass/Legacy/CustomNode.cs @@ -1,8 +1,8 @@ -using System; +using System; using System.Collections.Generic; using System.Drawing; +using ReClassNET.Controls; using ReClassNET.Nodes; -using ReClassNET.UI; namespace ReClassNET.DataExchange.ReClass.Legacy { @@ -15,12 +15,12 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) throw new NotImplementedException(); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { throw new NotImplementedException(); } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { throw new NotImplementedException(); } diff --git a/ReClass.NET/DataExchange/ReClass/ReClass2007File.cs b/ReClass.NET/DataExchange/ReClass/ReClass2007File.cs deleted file mode 100644 index c969b9a9..00000000 --- a/ReClass.NET/DataExchange/ReClass/ReClass2007File.cs +++ /dev/null @@ -1,212 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.SQLite; -using System.Diagnostics.Contracts; -using System.Linq; -using ReClassNET.DataExchange.ReClass.Legacy; -using ReClassNET.Extensions; -using ReClassNET.Logger; -using ReClassNET.Nodes; -using ReClassNET.Project; - -namespace ReClassNET.DataExchange.ReClass -{ - public class ReClass2007File : IReClassImport - { - public const string FormatName = "ReClass 2007 File"; - public const string FileExtension = ".rdc"; - - private static readonly Type[] typeMap = - { - null, - typeof(ClassInstanceNode), - typeof(ClassNode), - null, - typeof(Hex32Node), - typeof(Hex16Node), - typeof(Hex8Node), - typeof(ClassPointerNode), - typeof(Int32Node), - typeof(Int16Node), - typeof(Int8Node), - typeof(FloatNode), - typeof(UInt32Node), - typeof(UInt16Node), - typeof(UInt8Node), - typeof(Utf8TextNode), - typeof(FunctionPtrNode) - }; - - private readonly ReClassNetProject project; - - public ReClass2007File(ReClassNetProject project) - { - Contract.Requires(project != null); - - this.project = project; - } - - public void Load(string filePath, ILogger logger) - { - using (var connection = new SQLiteConnection($"Data Source={filePath}")) - { - connection.Open(); - - var classes = new Dictionary(); - var vtables = new Dictionary(); - - foreach (var row in Query(connection, "SELECT tbl_name FROM sqlite_master WHERE tbl_name LIKE 'class%'")) - { - var id = Convert.ToInt32(row["tbl_name"].ToString().Substring(5)); - - var classRow = Query(connection, $"SELECT variable, comment FROM class{id} WHERE type = 2 LIMIT 1").FirstOrDefault(); - if (classRow == null) - { - continue; - } - - // Skip the vtable classes. - if (classRow["variable"].ToString() == "VTABLE") - { - var vtableNode = new VirtualMethodTableNode(); - - Query(connection, $"SELECT variable, comment FROM class{id} WHERE type = 16") - .Select(e => new VirtualMethodNode - { - Name = Convert.ToString(e["variable"]), - Comment = Convert.ToString(e["comment"]) - }) - .ForEach(vtableNode.AddNode); - - foreach (var method in vtableNode.Nodes.Where(m => m.Name == "void function()")) - { - method.Name = string.Empty; - } - - vtables.Add(id, vtableNode); - - continue; - } - - var node = new ClassNode(false) - { - Name = classRow["variable"].ToString(), - Comment = classRow["comment"].ToString() - }; - - project.AddClass(node); - - classes.Add(id, node); - } - - foreach (var kv in classes) - { - ReadNodeRows( - Query(connection, $"SELECT variable, comment, type, length, ref FROM class{kv.Key} WHERE type != 2"), - kv.Value, - classes, - vtables, - logger - ).ForEach(kv.Value.AddNode); - } - } - } - - private static IEnumerable ReadNodeRows(IEnumerable rows, ClassNode parent, IReadOnlyDictionary classes, IReadOnlyDictionary vtables, ILogger logger) - { - Contract.Requires(rows != null); - Contract.Requires(parent != null); - Contract.Requires(logger != null); - - foreach (var row in rows) - { - Type nodeType = null; - - var typeVal = Convert.ToInt32(row["type"]); - if (typeVal >= 0 && typeVal < typeMap.Length) - { - nodeType = typeMap[typeVal]; - } - - if (nodeType == null) - { - logger.Log(LogLevel.Error, $"Skipping node with unknown type: {row["type"]}"); - logger.Log(LogLevel.Warning, string.Join(",", row.ItemArray)); - - continue; - } - - var node = BaseNode.CreateInstanceFromType(nodeType, false); - if (node == null) - { - logger.Log(LogLevel.Error, $"Could not create node of type: {nodeType}"); - - continue; - } - - node.Name = Convert.ToString(row["variable"]); - node.Comment = Convert.ToString(row["comment"]); - - // ClassInstanceNode, ClassPointerNode - if (node is BaseWrapperNode wrapperNode) - { - var reference = Convert.ToInt32(row["ref"]); - if (!classes.ContainsKey(reference)) - { - if (!vtables.TryGetValue(reference, out var vtableNode)) - { - logger.Log(LogLevel.Error, $"Skipping node with unknown reference: {row["ref"]}"); - logger.Log(LogLevel.Warning, string.Join(",", row.ItemArray)); - - continue; - } - - yield return vtableNode; - - continue; - } - - var innerClassNode = classes[reference]; - if (wrapperNode.ShouldPerformCycleCheckForInnerNode() && !ClassUtil.IsCyclicIfClassIsAccessibleFromParent(parent, innerClassNode, classes.Values)) - { - logger.Log(LogLevel.Error, $"Skipping node with cycle reference: {parent.Name}->{node.Name}"); - - continue; - } - - if (node is ClassPointerNode classPointerNode) - { - node = classPointerNode.GetEquivalentNode(innerClassNode); - } - else - { - wrapperNode.ChangeInnerNode(innerClassNode); - } - } - if (node is BaseTextNode textNode) - { - textNode.Length = Math.Max(IntPtr.Size, Convert.ToInt32(row["length"])); - } - - yield return node; - } - } - - private static IEnumerable Query(SQLiteConnection connection, string query) - { - Contract.Requires(connection != null); - Contract.Requires(query != null); - Contract.Ensures(Contract.Result>() != null); - - using (var adapter = new SQLiteDataAdapter(query, connection)) - { - var ds = new DataSet(); - - adapter.Fill(ds); - - return ds.Tables[0].AsEnumerable(); - } - } - } -} diff --git a/ReClass.NET/DataExchange/ReClass/ReClassClipboard.cs b/ReClass.NET/DataExchange/ReClass/ReClassClipboard.cs index 45b45c0c..908040c9 100644 --- a/ReClass.NET/DataExchange/ReClass/ReClassClipboard.cs +++ b/ReClass.NET/DataExchange/ReClass/ReClassClipboard.cs @@ -25,12 +25,11 @@ public static void Copy(IEnumerable nodes, ILogger logger) Contract.Requires(nodes != null); Contract.Requires(logger != null); - using (var ms = new MemoryStream()) - { - ReClassNetFile.SerializeNodesToStream(ms, nodes, logger); + using var ms = new MemoryStream(); - Clipboard.SetData(ClipboardFormat, ms.ToArray()); - } + ReClassNetFile.SerializeNodesToStream(ms, nodes, logger); + + Clipboard.SetData(ClipboardFormat, ms.ToArray()); } /// Pastes nodes from the clipboard. @@ -43,23 +42,14 @@ public static Tuple, List> Paste(ReClassNetProject tem Contract.Requires(logger != null); Contract.Ensures(Contract.Result, List>>() != null); - var classes = new List(); - var nodes = new List(); - - if (ContainsNodes) + if (ContainsNodes && Clipboard.GetData(ClipboardFormat) is byte[] data) { - if (Clipboard.GetData(ClipboardFormat) is byte[] data) - { - using (var ms = new MemoryStream(data)) - { - var result = ReClassNetFile.DeserializeNodesFromStream(ms, templateProject, logger); - classes.AddRange(result.Item1); - nodes.AddRange(result.Item2); - } - } + using var ms = new MemoryStream(data); + + return ReClassNetFile.DeserializeNodesFromStream(ms, templateProject, logger); } - return Tuple.Create(classes, nodes); + return Tuple.Create(new List(), new List()); } } } diff --git a/ReClass.NET/DataExchange/ReClass/ReClassFile.cs b/ReClass.NET/DataExchange/ReClass/ReClassFile.cs index f036b32b..9bb01985 100644 --- a/ReClass.NET/DataExchange/ReClass/ReClassFile.cs +++ b/ReClass.NET/DataExchange/ReClass/ReClassFile.cs @@ -74,15 +74,15 @@ public void Load(string filePath, ILogger logger) } var classMap = classes.ToDictionary(t => t.Item2.Name, t => t.Item2); - foreach (var t in classes) + foreach (var (classElement, classNode) in classes) { ReadNodeElements( - t.Item1.Elements("Node"), - t.Item2, + classElement.Elements("Node"), + classNode, classMap, typeMap, logger - ).ForEach(t.Item2.AddNode); + ).ForEach(classNode.AddNode); } } diff --git a/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Read.cs b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Read.cs index fa86084b..4a3cb65d 100644 --- a/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Read.cs +++ b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Read.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.IO; @@ -17,10 +17,9 @@ public partial class ReClassNetFile { public void Load(string filePath, ILogger logger) { - using (var fs = new FileStream(filePath, FileMode.Open)) - { - Load(fs, logger); - } + using var fs = new FileStream(filePath, FileMode.Open); + + Load(fs, logger); } public void Load(Stream input, ILogger logger) @@ -28,112 +27,108 @@ public void Load(Stream input, ILogger logger) Contract.Requires(input != null); Contract.Requires(logger != null); - using (var archive = new ZipArchive(input, ZipArchiveMode.Read)) + using var archive = new ZipArchive(input, ZipArchiveMode.Read); + var dataEntry = archive.GetEntry(DataFileName); + if (dataEntry == null) { - var dataEntry = archive.GetEntry(DataFileName); - if (dataEntry == null) - { - throw new FormatException(); - } - using (var entryStream = dataEntry.Open()) - { - var document = XDocument.Load(entryStream); - if (document.Root?.Element(XmlClassesElement) == null) - { - throw new FormatException("The data has not the correct format."); - } + throw new FormatException(); + } - uint.TryParse(document.Root.Attribute(XmlVersionAttribute)?.Value, out var fileVersion); - if ((fileVersion & FileVersionCriticalMask) > (FileVersion & FileVersionCriticalMask)) - { - throw new FormatException($"The file version is unsupported. A newer {Constants.ApplicationName} version is required to read it."); - } + using var entryStream = dataEntry.Open(); + var document = XDocument.Load(entryStream); + if (document.Root?.Element(XmlClassesElement) == null) + { + throw new FormatException("The data has not the correct format."); + } - var platform = document.Root.Attribute(XmlPlatformAttribute)?.Value; - if (platform != Constants.Platform) - { - logger.Log(LogLevel.Warning, $"The platform of the file ({platform}) doesn't match the program platform ({Constants.Platform})."); - } + uint.TryParse(document.Root.Attribute(XmlVersionAttribute)?.Value, out var fileVersion); + if ((fileVersion & FileVersionCriticalMask) > (FileVersion & FileVersionCriticalMask)) + { + throw new FormatException($"The file version is unsupported. A newer {Constants.ApplicationName} version is required to read it."); + } - var customDataElement = document.Root.Element(XmlCustomDataElement); - if (customDataElement != null) - { - project.CustomData.Deserialize(customDataElement); - } + var platform = document.Root.Attribute(XmlPlatformAttribute)?.Value; + if (platform != Constants.Platform) + { + logger.Log(LogLevel.Warning, $"The platform of the file ({platform}) doesn't match the program platform ({Constants.Platform})."); + } + + var customDataElement = document.Root.Element(XmlCustomDataElement); + if (customDataElement != null) + { + project.CustomData.Deserialize(customDataElement); + } + + var typeMappingElement = document.Root.Element(XmlTypeMappingElement); + if (typeMappingElement != null) + { + project.TypeMapping.Deserialize(typeMappingElement); + } + + var enumsElement = document.Root.Element(XmlEnumsElement); + if (enumsElement != null) + { + foreach (var enumElement in enumsElement.Elements(XmlEnumElement)) + { + var name = enumElement.Attribute(XmlNameAttribute)?.Value ?? string.Empty; + var useFlagsMode = (bool?)enumElement.Attribute(XmlFlagsAttribute) ?? false; + var size = enumElement.Attribute(XmlSizeAttribute).GetEnumValue(); - var typeMappingElement = document.Root.Element(XmlTypeMappingElement); - if (typeMappingElement != null) + var values = new Dictionary(); + foreach (var itemElement in enumElement.Elements(XmlItemElement)) { - project.TypeMapping.Deserialize(typeMappingElement); + var itemName = itemElement.Attribute(XmlNameAttribute)?.Value ?? string.Empty; + var itemValue = (long?)itemElement.Attribute(XmlValueAttribute) ?? 0L; + + values.Add(itemName, itemValue); } - var enumsElement = document.Root.Element(XmlEnumsElement); - if (enumsElement != null) + var @enum = new EnumDescription { - foreach (var enumElement in enumsElement.Elements(XmlEnumElement)) - { - var name = enumElement.Attribute(XmlNameAttribute)?.Value ?? string.Empty; - var useFlagsMode = (bool?)enumElement.Attribute(XmlFlagsAttribute) ?? false; - var size = enumElement.Attribute(XmlSizeAttribute).GetEnumValue(); - - var values = new Dictionary(); - foreach (var itemElement in enumElement.Elements(XmlItemElement)) - { - var itemName = itemElement.Attribute(XmlNameAttribute)?.Value ?? string.Empty; - var itemValue = (long?)itemElement.Attribute(XmlValueAttribute) ?? 0L; - - values.Add(itemName, itemValue); - } - - var @enum = new EnumDescription - { - Name = name - }; - @enum.SetData(useFlagsMode, size, values); - - project.AddEnum(@enum); - } - } + Name = name + }; + @enum.SetData(useFlagsMode, size, values); + + project.AddEnum(@enum); + } + } - var classes = new List>(); + var classes = new List<(XElement, ClassNode)>(); - var classesElement = document.Root.Element(XmlClassesElement); - if (classesElement != null) + var classesElement = document.Root.Element(XmlClassesElement); + if (classesElement != null) + { + foreach (var element in classesElement + .Elements(XmlClassElement) + .DistinctBy(e => e.Attribute(XmlUuidAttribute)?.Value)) + { + var node = new ClassNode(false) { - foreach (var element in classesElement - .Elements(XmlClassElement) - .DistinctBy(e => e.Attribute(XmlUuidAttribute)?.Value)) - { - var node = new ClassNode(false) - { - Uuid = NodeUuid.FromBase64String(element.Attribute(XmlUuidAttribute)?.Value, true), - Name = element.Attribute(XmlNameAttribute)?.Value ?? string.Empty, - Comment = element.Attribute(XmlCommentAttribute)?.Value ?? string.Empty, - AddressFormula = element.Attribute(XmlAddressAttribute)?.Value ?? string.Empty - }; - - if (!project.ContainsClass(node.Uuid)) - { - project.AddClass(node); - - classes.Add(Tuple.Create(element, node)); - } - } - } + Uuid = ParseUuid(element.Attribute(XmlUuidAttribute)?.Value), + Name = element.Attribute(XmlNameAttribute)?.Value ?? string.Empty, + Comment = element.Attribute(XmlCommentAttribute)?.Value ?? string.Empty, + AddressFormula = element.Attribute(XmlAddressAttribute)?.Value ?? string.Empty + }; - foreach (var t in classes) + if (!project.ContainsClass(node.Uuid)) { - var nodes = t.Item1.Elements(XmlNodeElement) - .Select(e => CreateNodeFromElement(e, t.Item2, logger)) - .Where(n => n != null); + project.AddClass(node); - foreach (var node in nodes) - { - t.Item2.AddNode(node); - } + classes.Add((element, node)); } } } + + foreach (var (element, classNode) in classes) + { + var nodes = element.Elements(XmlNodeElement) + .Select(e => CreateNodeFromElement(e, classNode, logger)) + .Where(n => n != null); + + classNode.BeginUpdate(); + classNode.AddNodes(nodes); + classNode.EndUpdate(); + } } private BaseNode CreateNodeFromElement(XElement element, BaseNode parent, ILogger logger) @@ -178,7 +173,7 @@ BaseNode CreateNode() { ClassNode GetClassNodeFromElementReference() { - var reference = NodeUuid.FromBase64String(element.Attribute(XmlReferenceAttribute)?.Value, false); + var reference = ParseUuid(element.Attribute(XmlReferenceAttribute)?.Value); if (!project.ContainsClass(reference)) { logger.Log(LogLevel.Error, $"Skipping node with unknown reference: {reference}"); @@ -199,15 +194,11 @@ ClassNode GetClassNodeFromElementReference() return null; } - switch (node) + node = node switch { - case BaseClassArrayNode classArrayNode: - node = classArrayNode.GetEquivalentNode(0, innerClass); - break; - case ClassPointerNode classPointerNode: - node = classPointerNode.GetEquivalentNode(innerClass); - break; - } + BaseClassArrayNode classArrayNode => classArrayNode.GetEquivalentNode(0, innerClass), + ClassPointerNode classPointerNode => classPointerNode.GetEquivalentNode(innerClass) + }; } else { @@ -295,7 +286,7 @@ ClassNode GetClassNodeFromElementReference() { functionNode.Signature = element.Attribute(XmlSignatureAttribute)?.Value ?? string.Empty; - var reference = NodeUuid.FromBase64String(element.Attribute(XmlReferenceAttribute)?.Value, false); + var reference = ParseUuid(element.Attribute(XmlReferenceAttribute)?.Value); if (project.ContainsClass(reference)) { functionNode.BelongsToClass = project.GetClassByUuid(reference); @@ -315,32 +306,36 @@ ClassNode GetClassNodeFromElementReference() return node; } + private static Guid ParseUuid(string raw) => raw == null + ? throw new ArgumentNullException() + : raw.Length == 24 + ? new Guid(Convert.FromBase64String(raw)) + : Guid.Parse(raw); + public static Tuple, List> DeserializeNodesFromStream(Stream input, ReClassNetProject templateProject, ILogger logger) { Contract.Requires(input != null); Contract.Requires(logger != null); Contract.Ensures(Contract.Result, List>>() != null); - using (var project = new ReClassNetProject()) - { - templateProject?.Classes.ForEach(project.AddClass); + using var project = new ReClassNetProject(); + templateProject?.Classes.ForEach(project.AddClass); - var file = new ReClassNetFile(project); - file.Load(input, logger); + var file = new ReClassNetFile(project); + file.Load(input, logger); - var classes = project.Classes - .Where(c => c.Name != SerializationClassName); - if (templateProject != null) - { - classes = classes.Where(c => !templateProject.ContainsClass(c.Uuid)); - } + var classes = project.Classes + .Where(c => c.Name != SerializationClassName); + if (templateProject != null) + { + classes = classes.Where(c => !templateProject.ContainsClass(c.Uuid)); + } - var nodes = project.Classes - .Where(c => c.Name == SerializationClassName) - .SelectMany(c => c.Nodes); + var nodes = project.Classes + .Where(c => c.Name == SerializationClassName) + .SelectMany(c => c.Nodes); - return Tuple.Create(classes.ToList(), nodes.ToList()); - } + return Tuple.Create(classes.ToList(), nodes.ToList()); } } } diff --git a/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Write.cs b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Write.cs index 1e0cc696..1d33ebc5 100644 --- a/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Write.cs +++ b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Write.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Diagnostics.Contracts; using System.IO; using System.IO.Compression; @@ -14,36 +15,33 @@ public partial class ReClassNetFile { public void Save(string filePath, ILogger logger) { - using (var fs = new FileStream(filePath, FileMode.Create)) - { - Save(fs, logger); - } + using var fs = new FileStream(filePath, FileMode.Create); + + Save(fs, logger); } public void Save(Stream output, ILogger logger) { - using (var archive = new ZipArchive(output, ZipArchiveMode.Create)) - { - var dataEntry = archive.CreateEntry(DataFileName); - using (var entryStream = dataEntry.Open()) - { - var document = new XDocument( - new XComment($"{Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"), - new XComment($"Website: {Constants.HomepageUrl}"), - new XElement( - XmlRootElement, - new XAttribute(XmlVersionAttribute, FileVersion), - new XAttribute(XmlPlatformAttribute, Constants.Platform), - project.CustomData.Serialize(XmlCustomDataElement), - project.TypeMapping.Serialize(XmlTypeMappingElement), - new XElement(XmlEnumsElement, CreateEnumElements(project.Enums)), - new XElement(XmlClassesElement, CreateClassElements(project.Classes, logger)) - ) - ); - - document.Save(entryStream); - } - } + using var archive = new ZipArchive(output, ZipArchiveMode.Create); + + var dataEntry = archive.CreateEntry(DataFileName); + using var entryStream = dataEntry.Open(); + + var document = new XDocument( + new XComment($"{Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"), + new XComment($"Website: {Constants.HomepageUrl}"), + new XElement( + XmlRootElement, + new XAttribute(XmlVersionAttribute, FileVersion), + new XAttribute(XmlPlatformAttribute, Constants.Platform), + project.CustomData.Serialize(XmlCustomDataElement), + project.TypeMapping.Serialize(XmlTypeMappingElement), + new XElement(XmlEnumsElement, CreateEnumElements(project.Enums)), + new XElement(XmlClassesElement, CreateClassElements(project.Classes, logger)) + ) + ); + + document.Save(entryStream); } private static IEnumerable CreateEnumElements(IEnumerable enums) @@ -70,7 +68,7 @@ private static IEnumerable CreateClassElements(IEnumerable return classes.Select(c => new XElement( XmlClassElement, - new XAttribute(XmlUuidAttribute, c.Uuid.ToBase64String()), + new XAttribute(XmlUuidAttribute, c.Uuid), new XAttribute(XmlNameAttribute, c.Name ?? string.Empty), new XAttribute(XmlCommentAttribute, c.Comment ?? string.Empty), new XAttribute(XmlAddressAttribute, c.AddressFormula ?? string.Empty), @@ -121,7 +119,7 @@ XElement CreateElement() { if (node is BaseClassWrapperNode classWrapperNode) { - element.SetAttributeValue(XmlReferenceAttribute, ((ClassNode)classWrapperNode.InnerNode).Uuid.ToBase64String()); + element.SetAttributeValue(XmlReferenceAttribute, ((ClassNode)classWrapperNode.InnerNode).Uuid); } else if (wrapperNode.InnerNode != null) { @@ -163,8 +161,8 @@ XElement CreateElement() } case FunctionNode functionNode: { - var uuid = functionNode.BelongsToClass == null ? NodeUuid.Zero : functionNode.BelongsToClass.Uuid; - element.SetAttributeValue(XmlReferenceAttribute, uuid.ToBase64String()); + var uuid = functionNode.BelongsToClass?.Uuid ?? Guid.Empty; + element.SetAttributeValue(XmlReferenceAttribute, uuid); element.SetAttributeValue(XmlSignatureAttribute, functionNode.Signature); break; } @@ -185,61 +183,60 @@ public static void SerializeNodesToStream(Stream output, IEnumerable n Contract.Requires(Contract.ForAll(nodes, n => n != null)); Contract.Requires(logger != null); - using (var project = new ReClassNetProject()) + using var project = new ReClassNetProject(); + + void RecursiveAddClasses(BaseNode node) { - void RecursiveAddClasses(BaseNode node) + ClassNode classNode = null; + switch (node) { - ClassNode classNode = null; - switch (node) - { - case ClassNode c1: - classNode = c1; - break; - case BaseWrapperNode wrapperNode when wrapperNode.ResolveMostInnerNode() is ClassNode c2: - classNode = c2; - break; - } + case ClassNode c1: + classNode = c1; + break; + case BaseWrapperNode wrapperNode when wrapperNode.ResolveMostInnerNode() is ClassNode c2: + classNode = c2; + break; + } - if (classNode == null || project.ContainsClass(classNode.Uuid)) - { - return; - } + if (classNode == null || project.ContainsClass(classNode.Uuid)) + { + return; + } - project.AddClass(classNode); + project.AddClass(classNode); - foreach (var wrapperNodeChild in classNode.Nodes.OfType()) - { - RecursiveAddClasses(wrapperNodeChild); - } + foreach (var wrapperNodeChild in classNode.Nodes.OfType()) + { + RecursiveAddClasses(wrapperNodeChild); } + } - var serialisationClass = new ClassNode(false) - { - Name = SerializationClassName - }; + var serialisationClass = new ClassNode(false) + { + Name = SerializationClassName + }; - var needsSerialisationClass = true; + var needsSerialisationClass = true; - foreach (var node in nodes) - { - RecursiveAddClasses(node); + foreach (var node in nodes) + { + RecursiveAddClasses(node); - if (!(node is ClassNode)) + if (!(node is ClassNode)) + { + if (needsSerialisationClass) { - if (needsSerialisationClass) - { - needsSerialisationClass = false; - - project.AddClass(serialisationClass); - } + needsSerialisationClass = false; - serialisationClass.AddNode(node); + project.AddClass(serialisationClass); } - } - var file = new ReClassNetFile(project); - file.Save(output, logger); + serialisationClass.AddNode(node); + } } + + var file = new ReClassNetFile(project); + file.Save(output, logger); } } } diff --git a/ReClass.NET/DataExchange/ReClass/ReClassNetFile.cs b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.cs index d648ec4e..af258a04 100644 --- a/ReClass.NET/DataExchange/ReClass/ReClassNetFile.cs +++ b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; @@ -21,7 +21,7 @@ public ReClassNetFile(ReClassNetProject project) static ReClassNetFile() { - // Obsolete: The name of the class was changed. Because of this older files can't load this nodes. + // Obsolete: The name of the class was changed. Because of this older versions can't load these nodes. buildInStringToTypeMap["UTF8TextNode"] = typeof(Utf8TextNode); buildInStringToTypeMap["UTF8TextPtrNode"] = typeof(Utf8TextPtrNode); buildInStringToTypeMap["UTF16TextNode"] = typeof(Utf16TextNode); @@ -54,6 +54,7 @@ static ReClassNetFile() typeof(Int16Node), typeof(Int32Node), typeof(Int64Node), + typeof(NIntNode), typeof(Matrix3x3Node), typeof(Matrix3x4Node), typeof(Matrix4x4Node), @@ -61,6 +62,7 @@ static ReClassNetFile() typeof(UInt16Node), typeof(UInt32Node), typeof(UInt64Node), + typeof(NUIntNode), typeof(Utf8TextNode), typeof(Utf8TextPtrNode), typeof(Utf16TextNode), diff --git a/ReClass.NET/DataExchange/ReClass/ReClassQtFile.cs b/ReClass.NET/DataExchange/ReClass/ReClassQtFile.cs index 43dfdcc2..275624c0 100644 --- a/ReClass.NET/DataExchange/ReClass/ReClassQtFile.cs +++ b/ReClass.NET/DataExchange/ReClass/ReClassQtFile.cs @@ -77,14 +77,14 @@ public void Load(string filePath, ILogger logger) } var classMap = classes.ToDictionary(c => c.Item1.Attribute("ClassId")?.Value, c => c.Item2); - foreach (var t in classes) + foreach (var (classElement, classNode) in classes) { ReadNodeElements( - t.Item1.Elements("Node"), - t.Item2, + classElement.Elements("Node"), + classNode, classMap, logger - ).ForEach(t.Item2.AddNode); + ).ForEach(classNode.AddNode); } } diff --git a/ReClass.NET/DataExchange/Scanner/CheatEngineFile.cs b/ReClass.NET/DataExchange/Scanner/CheatEngineFile.cs index 757846af..1c6b95d9 100644 --- a/ReClass.NET/DataExchange/Scanner/CheatEngineFile.cs +++ b/ReClass.NET/DataExchange/Scanner/CheatEngineFile.cs @@ -27,65 +27,64 @@ public class CheatEngineFile : IScannerImport public IEnumerable Load(string filePath, ILogger logger) { - using (var stream = File.OpenRead(filePath)) + using var stream = File.OpenRead(filePath); + + var document = XDocument.Load(stream); + if (document.Root != null) { - var document = XDocument.Load(stream); - if (document.Root != null) + var version = document.Root.Attribute(XmlVersionElement)?.Value; + if (string.Compare(version, Version26, StringComparison.Ordinal) >= 0) { - var version = document.Root.Attribute(XmlVersionElement)?.Value; - if (string.Compare(version, Version26, StringComparison.Ordinal) >= 0) + var entries = document.Root.Element(XmlEntriesElement); + if (entries != null) { - var entries = document.Root.Element(XmlEntriesElement); - if (entries != null) + foreach (var entry in entries.Elements(XmlEntryElement)) { - foreach (var entry in entries.Elements(XmlEntryElement)) + var description = entry.Element(XmlDescriptionElement)?.Value.Trim() ?? string.Empty; + if (description == "\"No description\"") { - var description = entry.Element(XmlDescriptionElement)?.Value.Trim() ?? string.Empty; - if (description == "\"No description\"") - { - description = string.Empty; - } - var variableTypeStr = entry.Element(XmlValueTypeElement)?.Value.Trim() ?? string.Empty; - var valueType = Parse(variableTypeStr, logger); + description = string.Empty; + } + var variableTypeStr = entry.Element(XmlValueTypeElement)?.Value.Trim() ?? string.Empty; + var valueType = Parse(variableTypeStr, logger); - var record = new MemoryRecord - { - Description = description, - ValueType = valueType - }; + var record = new MemoryRecord + { + Description = description, + ValueType = valueType + }; - var addressStr = entry.Element(XmlAddressElement)?.Value.Trim() ?? string.Empty; - var addressParts = addressStr.Split('+'); - if (addressParts.Length == 2) - { - long.TryParse(addressParts[1], NumberStyles.HexNumber, null, out var value); - record.AddressOrOffset = (IntPtr)value; + var addressStr = entry.Element(XmlAddressElement)?.Value.Trim() ?? string.Empty; + var addressParts = addressStr.Split('+'); + if (addressParts.Length == 2) + { + long.TryParse(addressParts[1], NumberStyles.HexNumber, null, out var value); + record.AddressOrOffset = (IntPtr)value; - record.ModuleName = addressParts[0].Trim(); - } - else - { - long.TryParse(addressStr, NumberStyles.HexNumber, null, out var value); - record.AddressOrOffset = (IntPtr)value; - } + record.ModuleName = addressParts[0].Trim(); + } + else + { + long.TryParse(addressStr, NumberStyles.HexNumber, null, out var value); + record.AddressOrOffset = (IntPtr)value; + } - if (valueType == ScanValueType.ArrayOfBytes || valueType == ScanValueType.String) - { - var lengthStr = entry.Element(XmlLengthElement)?.Value ?? string.Empty; - int.TryParse(lengthStr, NumberStyles.Integer, null, out var valueLength); + if (valueType == ScanValueType.ArrayOfBytes || valueType == ScanValueType.String) + { + var lengthStr = entry.Element(XmlLengthElement)?.Value ?? string.Empty; + int.TryParse(lengthStr, NumberStyles.Integer, null, out var valueLength); - record.ValueLength = Math.Max(1, valueLength); + record.ValueLength = Math.Max(1, valueLength); - if (valueType == ScanValueType.String) - { - var isUnicode = (entry.Element(XmlUnicodeElement)?.Value ?? string.Empty) == "1"; + if (valueType == ScanValueType.String) + { + var isUnicode = (entry.Element(XmlUnicodeElement)?.Value ?? string.Empty) == "1"; - record.Encoding = isUnicode ? Encoding.Unicode : Encoding.UTF8; - } + record.Encoding = isUnicode ? Encoding.Unicode : Encoding.UTF8; } - - yield return record; } + + yield return record; } } } diff --git a/ReClass.NET/DataExchange/Scanner/CrySearchFile.cs b/ReClass.NET/DataExchange/Scanner/CrySearchFile.cs index 42d77147..2aca38c7 100644 --- a/ReClass.NET/DataExchange/Scanner/CrySearchFile.cs +++ b/ReClass.NET/DataExchange/Scanner/CrySearchFile.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Text; @@ -72,7 +72,7 @@ public IEnumerable Load(string filePath, ILogger logger) switch (valueTypeStr) { default: - case "8": + // case "8": record.Encoding = Encoding.UTF8; break; case "9": diff --git a/ReClass.NET/DataExchange/Scanner/ReClassScanFile.cs b/ReClass.NET/DataExchange/Scanner/ReClassScanFile.cs index b86fa626..8af86952 100644 --- a/ReClass.NET/DataExchange/Scanner/ReClassScanFile.cs +++ b/ReClass.NET/DataExchange/Scanner/ReClassScanFile.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Text; using System.Xml.Linq; +using ReClassNET.Extensions; using ReClassNET.Logger; using ReClassNET.MemoryScanner; @@ -34,136 +35,128 @@ public class ReClassScanFile : IScannerImport, IScannerExport public IEnumerable Load(string filePath, ILogger logger) { - using (var fs = new FileStream(filePath, FileMode.Open)) + using var fs = new FileStream(filePath, FileMode.Open); + using var archive = new ZipArchive(fs, ZipArchiveMode.Read); + + var dataEntry = archive.GetEntry(DataFileName); + if (dataEntry == null) { - using (var archive = new ZipArchive(fs, ZipArchiveMode.Read)) - { - var dataEntry = archive.GetEntry(DataFileName); - if (dataEntry == null) - { - throw new FormatException(); - } - using (var entryStream = dataEntry.Open()) - { - var document = XDocument.Load(entryStream); - if (document.Root == null) - { - logger.Log(LogLevel.Error, "File has not the correct format."); - yield break; - } + throw new FormatException(); + } - //var version = document.Root.Attribute(XmlVersionAttribute)?.Value; - var platform = document.Root.Attribute(XmlPlatformAttribute)?.Value; - if (platform != Constants.Platform) - { - logger.Log(LogLevel.Warning, $"The platform of the file ({platform}) doesn't match the program platform ({Constants.Platform})."); - } + using var entryStream = dataEntry.Open(); + var document = XDocument.Load(entryStream); + if (document.Root == null) + { + logger.Log(LogLevel.Error, "File has not the correct format."); + yield break; + } - foreach (var element in document.Root.Elements(XmlRecordElement)) - { - var valueTypeStr = element.Attribute(XmlValueTypeAttribute)?.Value ?? string.Empty; + //var version = document.Root.Attribute(XmlVersionAttribute)?.Value; + var platform = document.Root.Attribute(XmlPlatformAttribute)?.Value; + if (platform != Constants.Platform) + { + logger.Log(LogLevel.Warning, $"The platform of the file ({platform}) doesn't match the program platform ({Constants.Platform})."); + } - if (!Enum.TryParse(valueTypeStr, out var valueType)) - { - logger?.Log(LogLevel.Warning, $"Unknown value type: {valueTypeStr}"); - continue; - } + foreach (var element in document.Root.Elements(XmlRecordElement)) + { + var valueTypeStr = element.Attribute(XmlValueTypeAttribute)?.Value ?? string.Empty; - var description = element.Attribute(XmlDescriptionAttribute)?.Value ?? string.Empty; + if (!Enum.TryParse(valueTypeStr, out var valueType)) + { + logger?.Log(LogLevel.Warning, $"Unknown value type: {valueTypeStr}"); + continue; + } - var addressStr = element.Attribute(XmlAddressAttribute)?.Value ?? string.Empty; - var moduleName = element.Attribute(XmlModuleAttribute)?.Value ?? string.Empty; + var description = element.Attribute(XmlDescriptionAttribute)?.Value ?? string.Empty; - long.TryParse(addressStr, NumberStyles.HexNumber, null, out var address); + var addressStr = element.Attribute(XmlAddressAttribute)?.Value ?? string.Empty; + var moduleName = element.Attribute(XmlModuleAttribute)?.Value ?? string.Empty; - var record = new MemoryRecord - { - Description = description, - AddressOrOffset = (IntPtr)address, - ValueType = valueType - }; + long.TryParse(addressStr, NumberStyles.HexNumber, null, out var address); - if (!string.IsNullOrEmpty(moduleName)) - { - record.ModuleName = moduleName; - } + var record = new MemoryRecord + { + Description = description, + AddressOrOffset = (IntPtr)address, + ValueType = valueType + }; - if (valueType == ScanValueType.ArrayOfBytes || valueType == ScanValueType.String) - { - var lengthStr = element.Attribute(XmlValueLengthAttribute)?.Value ?? string.Empty; - int.TryParse(lengthStr, NumberStyles.Integer, null, out var valueLength); - - record.ValueLength = Math.Max(1, valueLength); - - if (valueType == ScanValueType.String) - { - switch (element.Attribute(XmlEncodingAttribute)?.Value ?? string.Empty) - { - default: - record.Encoding = Encoding.UTF8; - break; - case "UTF16": - record.Encoding = Encoding.Unicode; - break; - case "UTF32": - record.Encoding = Encoding.UTF32; - break; - } - } - } + if (!string.IsNullOrEmpty(moduleName)) + { + record.ModuleName = moduleName; + } - yield return record; + if (valueType == ScanValueType.ArrayOfBytes || valueType == ScanValueType.String) + { + var lengthStr = element.Attribute(XmlValueLengthAttribute)?.Value ?? string.Empty; + int.TryParse(lengthStr, NumberStyles.Integer, null, out var valueLength); + + record.ValueLength = Math.Max(1, valueLength); + + if (valueType == ScanValueType.String) + { + switch (element.Attribute(XmlEncodingAttribute)?.Value ?? string.Empty) + { + default: + record.Encoding = Encoding.UTF8; + break; + case "UTF16": + record.Encoding = Encoding.Unicode; + break; + case "UTF32": + record.Encoding = Encoding.UTF32; + break; } } } + + yield return record; } } public void Save(IEnumerable records, string filePath, ILogger logger) { - using (var fs = new FileStream(filePath, FileMode.Create)) - { - using (var archive = new ZipArchive(fs, ZipArchiveMode.Create)) - { - var dataEntry = archive.CreateEntry(DataFileName); - using (var entryStream = dataEntry.Open()) + using var fs = new FileStream(filePath, FileMode.Create); + using var archive = new ZipArchive(fs, ZipArchiveMode.Create); + + var dataEntry = archive.CreateEntry(DataFileName); + using var entryStream = dataEntry.Open(); + + var document = new XDocument( + new XComment($"{Constants.ApplicationName} Scanner {Constants.ApplicationVersion} by {Constants.Author}"), + new XComment($"Website: {Constants.HomepageUrl}"), + new XElement( + XmlRootElement, + new XAttribute(XmlVersionAttribute, Version1), + new XAttribute(XmlPlatformAttribute, Constants.Platform), + records.Select(r => { - var document = new XDocument( - new XComment($"{Constants.ApplicationName} Scanner {Constants.ApplicationVersion} by {Constants.Author}"), - new XComment($"Website: {Constants.HomepageUrl}"), - new XElement( - XmlRootElement, - new XAttribute(XmlVersionAttribute, Version1), - new XAttribute(XmlPlatformAttribute, Constants.Platform), - records.Select(r => - { - var temp = new XElement( - XmlRecordElement, - new XAttribute(XmlValueTypeAttribute, r.ValueType.ToString()), - new XAttribute(XmlDescriptionAttribute, r.Description ?? string.Empty), - new XAttribute(XmlAddressAttribute, r.AddressOrOffset.ToString(Constants.AddressHexFormat)) - ); - if (r.IsRelativeAddress) - { - temp.SetAttributeValue(XmlModuleAttribute, r.ModuleName); - } - if (r.ValueType == ScanValueType.ArrayOfBytes || r.ValueType == ScanValueType.String) - { - temp.SetAttributeValue(XmlValueLengthAttribute, r.ValueLength); - if (r.ValueType == ScanValueType.String) - { - temp.SetAttributeValue(XmlEncodingAttribute, r.Encoding == Encoding.UTF8 ? "UTF8" : r.Encoding == Encoding.Unicode ? "UTF16" : "UTF32"); - } - } - return temp; - }) - ) + var temp = new XElement( + XmlRecordElement, + new XAttribute(XmlValueTypeAttribute, r.ValueType.ToString()), + new XAttribute(XmlDescriptionAttribute, r.Description ?? string.Empty), + new XAttribute(XmlAddressAttribute, r.AddressOrOffset.ToString(Constants.AddressHexFormat)) ); + if (r.IsRelativeAddress) + { + temp.SetAttributeValue(XmlModuleAttribute, r.ModuleName); + } + if (r.ValueType == ScanValueType.ArrayOfBytes || r.ValueType == ScanValueType.String) + { + temp.SetAttributeValue(XmlValueLengthAttribute, r.ValueLength); + if (r.ValueType == ScanValueType.String) + { + temp.SetAttributeValue(XmlEncodingAttribute, r.Encoding.IsSameCodePage(Encoding.UTF8) ? "UTF8" : r.Encoding.IsSameCodePage(Encoding.Unicode) ? "UTF16" : "UTF32"); + } + } + return temp; + }) + ) + ); - document.Save(entryStream); - } - } - } + document.Save(entryStream); } } } diff --git a/ReClass.NET/Debugger/RemoteDebugger.Handler.cs b/ReClass.NET/Debugger/RemoteDebugger.Handler.cs index 45009e14..60e07402 100644 --- a/ReClass.NET/Debugger/RemoteDebugger.Handler.cs +++ b/ReClass.NET/Debugger/RemoteDebugger.Handler.cs @@ -10,8 +10,7 @@ private void HandleExceptionEvent(ref DebugEvent evt) foreach (var bp in breakpoints) { - var hwbp = bp as HardwareBreakpoint; - if (hwbp?.Register == causedBy) + if (bp is HardwareBreakpoint hwbp && hwbp.Register == causedBy) { hwbp.Handler(ref evt); diff --git a/ReClass.NET/Debugger/RemoteDebugger.cs b/ReClass.NET/Debugger/RemoteDebugger.cs index bb468553..3224293a 100644 --- a/ReClass.NET/Debugger/RemoteDebugger.cs +++ b/ReClass.NET/Debugger/RemoteDebugger.cs @@ -1,11 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; using ReClassNET.Extensions; using ReClassNET.Forms; using ReClassNET.Memory; -using ReClassNET.Util; namespace ReClassNET.Debugger { @@ -169,13 +168,11 @@ private List SplitBreakpoint(IntPtr address, int size) continue; } } - if (size >= 1) - { - splits.Add(new BreakpointSplit { Address = address, Size = 1 }); - address += 1; - size -= 1; - } + splits.Add(new BreakpointSplit { Address = address, Size = 1 }); + + address += 1; + size -= 1; } return splits; diff --git a/ReClass.NET/Extensions/ByteExtension.cs b/ReClass.NET/Extensions/ByteExtension.cs new file mode 100644 index 00000000..1ed5035d --- /dev/null +++ b/ReClass.NET/Extensions/ByteExtension.cs @@ -0,0 +1,21 @@ +using System; +using System.Diagnostics; +using System.Diagnostics.Contracts; + +namespace ReClassNET.Extensions +{ + public static class ByteExtension + { + /// + /// Sets every element in the array to zero. + /// + /// + [DebuggerStepThrough] + public static void FillWithZero(this byte[] array) + { + Contract.Requires(array != null); + + Array.Clear(array, 0, array.Length); + } + } +} diff --git a/ReClass.NET/Extensions/ColorExtensions.cs b/ReClass.NET/Extensions/ColorExtensions.cs index c8d8edd1..c28c0937 100644 --- a/ReClass.NET/Extensions/ColorExtensions.cs +++ b/ReClass.NET/Extensions/ColorExtensions.cs @@ -1,9 +1,20 @@ -using System.Drawing; +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Drawing; namespace ReClassNET.Extensions { public static class ExtensionColor { + [Pure] + [DebuggerStepThrough] + public static int ToRgb(this Color color) + { + return 0xFFFFFF & color.ToArgb(); + } + + [Pure] + [DebuggerStepThrough] public static Color Invert(this Color color) { return Color.FromArgb(color.A, 255 - color.R, 255 - color.G, 255 - color.B); diff --git a/ReClass.NET/Extensions/EncodingExtensions.cs b/ReClass.NET/Extensions/EncodingExtensions.cs index 696295f4..4a3ed695 100644 --- a/ReClass.NET/Extensions/EncodingExtensions.cs +++ b/ReClass.NET/Extensions/EncodingExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; namespace ReClassNET.Extensions @@ -8,13 +8,33 @@ public static class EncodingExtension /// Gets the (perhaps wrong) byte count per character. Special characters may need more bytes. /// The encoding. /// The byte count per character. - public static int GetSimpleByteCountPerChar(this Encoding encoding) + public static int GuessByteCountPerChar(this Encoding encoding) { - if (encoding.Equals(Encoding.UTF8) || encoding.Equals(Encoding.ASCII)) return 1; - if (encoding.Equals(Encoding.Unicode)) return 2; - if (encoding.Equals(Encoding.UTF32)) return 4; + if (encoding.IsSameCodePage(Encoding.UTF8) || encoding.CodePage == 1252 /* Windows-1252 */ || encoding.IsSameCodePage(Encoding.ASCII)) + { + return 1; + } + if (encoding.IsSameCodePage(Encoding.Unicode) || encoding.IsSameCodePage(Encoding.BigEndianUnicode)) + { + return 2; + } + if (encoding.IsSameCodePage(Encoding.UTF32)) + { + return 4; + } throw new NotImplementedException(); } + + /// + /// Checks if the code page of both encodings is equal. + /// + /// + /// + /// + public static bool IsSameCodePage(this Encoding encoding, Encoding other) + { + return encoding.CodePage == other.CodePage; + } } } diff --git a/ReClass.NET/Extensions/EnumerableExtension.cs b/ReClass.NET/Extensions/EnumerableExtension.cs new file mode 100644 index 00000000..0619c87f --- /dev/null +++ b/ReClass.NET/Extensions/EnumerableExtension.cs @@ -0,0 +1,206 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Linq; + +namespace ReClassNET.Extensions +{ + public static class EnumerableExtension + { + [DebuggerStepThrough] + public static bool None(this IEnumerable source) + { + Contract.Requires(source != null); + + return !source.Any(); + } + + [DebuggerStepThrough] + public static bool None(this IEnumerable source, Func predicate) + { + Contract.Requires(source != null); + Contract.Requires(predicate != null); + + return !source.Any(predicate); + } + + [DebuggerStepThrough] + public static IEnumerable WhereNot(this IEnumerable source, Func predicate) + { + Contract.Requires(source != null); + Contract.Requires(predicate != null); + + return source.Where(item => predicate(item) == false); + } + + [DebuggerStepThrough] + public static int FindIndex(this IEnumerable source, Func predicate) + { + Contract.Requires(source != null); + Contract.Requires(predicate != null); + Contract.Ensures(Contract.Result() >= -1); + + var index = 0; + foreach (var item in source) + { + if (predicate(item)) + { + return index; + } + ++index; + } + return -1; + } + + [DebuggerStepThrough] + public static void ForEach(this IEnumerable source, Action func) + { + Contract.Requires(source != null); + Contract.Requires(func != null); + + foreach (var item in source) + { + func(item); + } + } + + [DebuggerStepThrough] + public static IEnumerable Traverse(this IEnumerable source, Func> childSelector) + { + Contract.Requires(source != null); + Contract.Requires(childSelector != null); + Contract.Ensures(Contract.Result>() != null); + + var queue = new Queue(source); + while (queue.Count > 0) + { + var next = queue.Dequeue(); + + yield return next; + + foreach (var child in childSelector(next)) + { + queue.Enqueue(child); + } + } + } + + [DebuggerStepThrough] + public static IEnumerable TakeWhileInclusive(this IEnumerable source, Func predicate) + { + Contract.Requires(source != null); + Contract.Requires(predicate != null); + Contract.Ensures(Contract.Result>() != null); + + foreach (var item in source) + { + yield return item; + + if (!predicate(item)) + { + yield break; + } + } + } + + [DebuggerStepThrough] + public static IEnumerable DistinctBy(this IEnumerable source, Func keySelector) + { + Contract.Requires(source != null); + Contract.Requires(keySelector != null); + Contract.Ensures(Contract.Result>() != null); + + var knownKeys = new HashSet(); + foreach (var element in source) + { + if (knownKeys.Add(keySelector(element))) + { + yield return element; + } + } + } + + [DebuggerStepThrough] + public static bool IsEquivalentTo(this IEnumerable source, IEnumerable other) + { + Contract.Requires(source != null); + Contract.Requires(other != null); + + var expected = new List(source); + + if (other.Any(item => !expected.Remove(item))) + { + return false; + } + + return expected.Count == 0; + } + + /// + /// Scans the source and returns the first element where the predicate matches. + /// If the predicate doesn't match the first element of the source is returned. + /// + /// + /// + /// + public static TSource PredicateOrFirst(this IEnumerable source, Func predicate) + { + Contract.Requires(source != null); + Contract.Requires(predicate != null); + + var result = default(TSource); + var first = true; + foreach (var element in source) + { + if (predicate(element)) + { + return element; + } + if (first) + { + result = element; + first = false; + } + } + + if (first) + { + throw new InvalidOperationException("Sequence contains no elements"); + } + + return result; + } + + public static IEnumerable> GroupWhile(this IEnumerable source, Func condition) + { + Contract.Requires(source != null); + Contract.Requires(condition != null); + + using var it = source.GetEnumerator(); + if (it.MoveNext()) + { + var previous = it.Current; + var list = new List { previous }; + + while (it.MoveNext()) + { + var item = it.Current; + + if (condition(previous, item) == false) + { + yield return list; + + list = new List(); + } + + list.Add(item); + + previous = item; + } + + yield return list; + } + } + } +} diff --git a/ReClass.NET/Extensions/Extensions.cs b/ReClass.NET/Extensions/Extensions.cs deleted file mode 100644 index ef0ded0b..00000000 --- a/ReClass.NET/Extensions/Extensions.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.Contracts; -using System.Drawing; -using System.Linq; -using ReClassNET.Nodes; - -namespace ReClassNET.Extensions -{ - public static class Extensions - { - [Pure] - [DebuggerStepThrough] - public static int ToRgb(this Color color) - { - return 0xFFFFFF & color.ToArgb(); - } - - [DebuggerStepThrough] - public static void FillWithZero(this byte[] b) - { - Contract.Requires(b != null); - - for (var i = 0; i < b.Length; ++i) - { - b[i] = 0; - } - } - - [Pure] - [DebuggerStepThrough] - public static Point OffsetEx(this Point p, int x, int y) - { - var temp = p; - temp.Offset(x, y); - return temp; - } - - public static IEnumerable Descendants(this BaseNode root) - { - Contract.Requires(root != null); - - var nodes = new Stack(); - nodes.Push(root); - while (nodes.Any()) - { - var node = nodes.Pop(); - yield return node; - - if (node is ClassNode classNode) - { - foreach (var child in classNode.Nodes) - { - nodes.Push(child); - } - } - } - } - - #region List - - [DebuggerStepThrough] - public static T BinaryFind(this IList source, Func comparer) - { - Contract.Requires(source != null); - Contract.Requires(comparer != null); - - var lo = 0; - var hi = source.Count - 1; - - while (lo <= hi) - { - var median = lo + (hi - lo >> 1); - var num = comparer(source[median]); - if (num == 0) - { - return source[median]; - } - if (num > 0) - { - lo = median + 1; - } - else - { - hi = median - 1; - } - } - - return default(T); - } - - #endregion - } -} diff --git a/ReClass.NET/Extensions/FloatingPointExtensions.cs b/ReClass.NET/Extensions/FloatingPointExtensions.cs index b905165c..410c56e8 100644 --- a/ReClass.NET/Extensions/FloatingPointExtensions.cs +++ b/ReClass.NET/Extensions/FloatingPointExtensions.cs @@ -6,13 +6,6 @@ namespace ReClassNET.Extensions { public static class FloatingPointExtension { - [Pure] - [DebuggerStepThrough] - public static bool IsNearlyEqual(this float val, float other) - { - return IsNearlyEqual(val, other, float.Epsilon); - } - [Pure] [DebuggerStepThrough] public static bool IsNearlyEqual(this float val, float other, float epsilon) @@ -22,20 +15,7 @@ public static bool IsNearlyEqual(this float val, float other, float epsilon) return true; } - var diff = Math.Abs(val - other); - if (val == 0.0f || other == 0.0f || diff < float.Epsilon) - { - return diff < epsilon; - } - - return diff / (Math.Abs(val) + Math.Abs(other)) < epsilon; - } - - [Pure] - [DebuggerStepThrough] - public static bool IsNearlyEqual(this double val, double other) - { - return IsNearlyEqual(val, other, double.Epsilon); + return Math.Abs(val - other) <= epsilon; } [Pure] @@ -47,13 +27,7 @@ public static bool IsNearlyEqual(this double val, double other, double epsilon) return true; } - var diff = Math.Abs(val - other); - if (val == 0.0 || other == 0.0 || diff < double.Epsilon) - { - return diff < epsilon; - } - - return diff / (Math.Abs(val) + Math.Abs(other)) < epsilon; + return Math.Abs(val - other) <= epsilon; } } } diff --git a/ReClass.NET/Extensions/IRemoteMemoryReaderExtension.cs b/ReClass.NET/Extensions/IRemoteMemoryReaderExtension.cs new file mode 100644 index 00000000..b8f36bab --- /dev/null +++ b/ReClass.NET/Extensions/IRemoteMemoryReaderExtension.cs @@ -0,0 +1,146 @@ +using System; +using System.Diagnostics.Contracts; +using System.Text; +using ReClassNET.Memory; +using ReClassNET.MemoryScanner; + +namespace ReClassNET.Extensions +{ + public static class IRemoteMemoryReaderExtension + { + public static sbyte ReadRemoteInt8(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(sbyte)); + + return (sbyte)data[0]; + } + + public static byte ReadRemoteUInt8(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(byte)); + + return data[0]; + } + + public static short ReadRemoteInt16(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(short)); + + return reader.BitConverter.ToInt16(data, 0); + } + + public static ushort ReadRemoteUInt16(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(ushort)); + + return reader.BitConverter.ToUInt16(data, 0); + } + + public static int ReadRemoteInt32(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(int)); + + return reader.BitConverter.ToInt32(data, 0); + } + + public static uint ReadRemoteUInt32(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(uint)); + + return reader.BitConverter.ToUInt32(data, 0); + } + + public static long ReadRemoteInt64(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(long)); + + return reader.BitConverter.ToInt64(data, 0); + } + + public static ulong ReadRemoteUInt64(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(ulong)); + + return reader.BitConverter.ToUInt64(data, 0); + } + + public static float ReadRemoteFloat(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(float)); + + return reader.BitConverter.ToSingle(data, 0); + } + + public static double ReadRemoteDouble(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(double)); + + return reader.BitConverter.ToDouble(data, 0); + } + + public static IntPtr ReadRemoteIntPtr(this IRemoteMemoryReader reader, IntPtr address) + { +#if RECLASSNET64 + return (IntPtr)reader.ReadRemoteInt64(address); +#else + return (IntPtr)reader.ReadRemoteInt32(address); +#endif + } + + public static string ReadRemoteString(this IRemoteMemoryReader reader, IntPtr address, Encoding encoding, int length) + { + Contract.Requires(encoding != null); + Contract.Requires(length >= 0); + Contract.Ensures(Contract.Result() != null); + + var data = reader.ReadRemoteMemory(address, length * encoding.GuessByteCountPerChar()); + + try + { + var sb = new StringBuilder(encoding.GetString(data)); + for (var i = 0; i < sb.Length; ++i) + { + if (sb[i] == '\0') + { + sb.Length = i; + break; + } + if (!sb[i].IsPrintable()) + { + sb[i] = '.'; + } + } + return sb.ToString(); + } + catch + { + return string.Empty; + } + } + + public static string ReadRemoteStringUntilFirstNullCharacter(this IRemoteMemoryReader reader, IntPtr address, Encoding encoding, int length) + { + Contract.Requires(encoding != null); + Contract.Requires(length >= 0); + Contract.Ensures(Contract.Result() != null); + + var data = reader.ReadRemoteMemory(address, length * encoding.GuessByteCountPerChar()); + + // TODO We should cache the pattern per encoding. + var index = PatternScanner.FindPattern(BytePattern.From(new byte[encoding.GuessByteCountPerChar()]), data); + if (index == -1) + { + index = data.Length; + } + + try + { + return encoding.GetString(data, 0, Math.Min(index, data.Length)); + } + catch + { + return string.Empty; + } + } + } +} diff --git a/ReClass.NET/Extensions/IRemoteMemoryWriterExtension.cs b/ReClass.NET/Extensions/IRemoteMemoryWriterExtension.cs new file mode 100644 index 00000000..d39dace9 --- /dev/null +++ b/ReClass.NET/Extensions/IRemoteMemoryWriterExtension.cs @@ -0,0 +1,40 @@ +using System; +using System.Text; +using ReClassNET.Memory; + +namespace ReClassNET.Extensions +{ + public static class IRemoteMemoryWriterExtension + { + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, sbyte value) => writer.WriteRemoteMemory(address, new[] { (byte)value }); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, byte value) => writer.WriteRemoteMemory(address, new[] { value }); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, short value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, ushort value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, int value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, uint value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, long value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, ulong value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, float value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, double value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, IntPtr value) + { +#if RECLASSNET64 + writer.WriteRemoteMemory(address, value.ToInt64()); +#else + writer.WriteRemoteMemory(address, value.ToInt32()); +#endif + } + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, string value, Encoding encoding) => writer.WriteRemoteMemory(address, encoding.GetBytes(value)); + } +} diff --git a/ReClass.NET/Extensions/IntPtrExtensions.cs b/ReClass.NET/Extensions/IntPtrExtensions.cs index 504f4927..7f2ff58a 100644 --- a/ReClass.NET/Extensions/IntPtrExtensions.cs +++ b/ReClass.NET/Extensions/IntPtrExtensions.cs @@ -18,9 +18,9 @@ public static bool IsNull(this IntPtr ptr) public static bool MayBeValid(this IntPtr ptr) { #if RECLASSNET64 - return ptr.InRange((IntPtr)0x10000, (IntPtr)long.MaxValue); + return ptr.IsInRange((IntPtr)0x10000, (IntPtr)long.MaxValue); #else - return ptr.InRange((IntPtr)0x10000, (IntPtr)int.MaxValue); + return ptr.IsInRange((IntPtr)0x10000, (IntPtr)int.MaxValue); #endif } @@ -83,7 +83,18 @@ public static int Mod(this IntPtr lhs, int mod) [Pure] [DebuggerStepThrough] - public static bool InRange(this IntPtr address, IntPtr start, IntPtr end) + public static IntPtr Negate(this IntPtr ptr) + { +#if RECLASSNET64 + return new IntPtr(-ptr.ToInt64()); +#else + return new IntPtr(-ptr.ToInt32()); +#endif + } + + [Pure] + [DebuggerStepThrough] + public static bool IsInRange(this IntPtr address, IntPtr start, IntPtr end) { #if RECLASSNET64 var val = (ulong)address.ToInt64(); @@ -109,7 +120,7 @@ public static int CompareTo(this IntPtr lhs, IntPtr rhs) [DebuggerStepThrough] public static int CompareToRange(this IntPtr address, IntPtr start, IntPtr end) { - if (InRange(address, start, end)) + if (IsInRange(address, start, end)) { return 0; } @@ -145,11 +156,15 @@ public static long ToInt64Bits(this IntPtr ptr) #endif } + [Pure] + [DebuggerStepThrough] public static IntPtr From(int value) { return (IntPtr)value; } + [Pure] + [DebuggerStepThrough] public static IntPtr From(long value) { #if RECLASSNET64 diff --git a/ReClass.NET/Extensions/LinqExtensions.cs b/ReClass.NET/Extensions/LinqExtensions.cs deleted file mode 100644 index 7d169528..00000000 --- a/ReClass.NET/Extensions/LinqExtensions.cs +++ /dev/null @@ -1,326 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.Contracts; -using System.Linq; - -namespace ReClassNET.Extensions -{ - public static class LinqExtension - { - public static string Join(this IEnumerable source) - { - return Join(source, string.Empty); - } - - public static string Join(this IEnumerable source, string separator) - { - return string.Join(separator, source); - } - - public static TResult Max(this IEnumerable source, Func selector, IComparer comparer) - { - comparer = comparer ?? Comparer.Default; - - using (var it = source.GetEnumerator()) - { - if (!it.MoveNext()) - { - throw new InvalidOperationException(); - } - - var max = selector(it.Current); - while (it.MoveNext()) - { - var current = selector(it.Current); - if (comparer.Compare(current, max) > 0) - { - max = current; - } - } - return max; - } - } - - public static TResult Min(this IEnumerable source, Func selector, IComparer comparer) - { - comparer = comparer ?? Comparer.Default; - - using (var it = source.GetEnumerator()) - { - if (!it.MoveNext()) - { - throw new InvalidOperationException(); - } - - var min = selector(it.Current); - while (it.MoveNext()) - { - var current = selector(it.Current); - if (comparer.Compare(current, min) < 0) - { - min = current; - } - } - return min; - } - } - - [DebuggerStepThrough] - public static bool None(this IEnumerable source) - { - Contract.Requires(source != null); - - return !source.Any(); - } - - [DebuggerStepThrough] - public static bool None(this IEnumerable source, Func predicate) - { - Contract.Requires(source != null); - Contract.Requires(predicate != null); - - return !source.Any(predicate); - } - - [DebuggerStepThrough] - public static IEnumerable WhereNot(this IEnumerable source, Func predicate) - { - Contract.Requires(source != null); - Contract.Requires(predicate != null); - - return source.Where(item => predicate(item) == false); - } - - [DebuggerStepThrough] - public static int FindIndex(this IEnumerable source, Func predicate) - { - Contract.Requires(source != null); - Contract.Requires(predicate != null); - Contract.Ensures(Contract.Result() >= -1); - - var index = 0; - foreach (var item in source) - { - if (predicate(item)) - { - return index; - } - ++index; - } - return -1; - } - - [DebuggerStepThrough] - public static void ForEach(this IEnumerable source, Action func) - { - Contract.Requires(source != null); - Contract.Requires(func != null); - - foreach (var item in source) - { - func(item); - } - } - - [DebuggerStepThrough] - public static IEnumerable Yield(this TSource item) - { - Contract.Ensures(Contract.Result>() != null); - - yield return item; - } - - [DebuggerStepThrough] - public static IEnumerable Append(this IEnumerable source, TSource item) - { - Contract.Ensures(Contract.Result>() != null); - Contract.Requires(source != null); - - return source.Concat(Yield(item)); - } - - [DebuggerStepThrough] - public static IEnumerable Traverse(this IEnumerable source, Func> childSelector) - { - Contract.Requires(source != null); - Contract.Requires(childSelector != null); - Contract.Ensures(Contract.Result>() != null); - - var stack = new Stack(source); - while (stack.Any()) - { - var next = stack.Pop(); - - yield return next; - - foreach (var child in childSelector(next)) - { - stack.Push(child); - } - } - } - - [DebuggerStepThrough] - public static IEnumerable SkipUntil(this IEnumerable source, Func predicate) - { - Contract.Requires(source != null); - Contract.Requires(predicate != null); - Contract.Ensures(Contract.Result>() != null); - - using (var iterator = source.GetEnumerator()) - { - while (iterator.MoveNext()) - { - if (predicate(iterator.Current)) - { - break; - } - } - while (iterator.MoveNext()) - { - yield return iterator.Current; - } - } - } - - [DebuggerStepThrough] - public static IEnumerable TakeUntil(this IEnumerable source, Func predicate) - { - Contract.Requires(source != null); - Contract.Requires(predicate != null); - Contract.Ensures(Contract.Result>() != null); - - foreach (var item in source) - { - yield return item; - - if (predicate(item)) - { - yield break; - } - } - } - - [DebuggerStepThrough] - public static IEnumerable DistinctBy(this IEnumerable source, Func keySelector) - { - Contract.Requires(source != null); - Contract.Requires(keySelector != null); - Contract.Ensures(Contract.Result>() != null); - - var knownKeys = new HashSet(); - foreach (var element in source) - { - if (knownKeys.Add(keySelector(element))) - { - yield return element; - } - } - } - - [DebuggerStepThrough] - public static bool SequenceEqualsEx(this IEnumerable first, IEnumerable second) - { - Contract.Requires(first != null); - Contract.Requires(second != null); - - return SequenceEqualsEx(first, second, EqualityComparer.Default); - } - - [DebuggerStepThrough] - public static bool SequenceEqualsEx(this IEnumerable first, IEnumerable second, IEqualityComparer comparer) - { - Contract.Requires(first != null); - Contract.Requires(second != null); - Contract.Requires(comparer != null); - - var counter = new Dictionary(comparer); - foreach (var element in first) - { - if (counter.ContainsKey(element)) - { - counter[element]++; - } - else - { - counter.Add(element, 1); - } - } - foreach (var element in second) - { - if (counter.ContainsKey(element)) - { - counter[element]--; - } - else - { - return false; - } - } - return counter.Values.All(c => c == 0); - } - - /// - /// Scans the source and returns the first element where the predicate matches. - /// If the predicate doesn't match the first element of the source is returned. - /// - /// - /// - /// - public static TSource PredicateOrFirst(this IEnumerable source, Func predicate) - { - Contract.Requires(source != null); - Contract.Requires(predicate != null); - - var result = default(TSource); - var first = true; - foreach (var element in source) - { - if (predicate(element)) - { - return element; - } - if (first) - { - result = element; - first = false; - } - } - return result; - } - - public static IEnumerable> GroupWhile(this IEnumerable source, Func condition) - { - Contract.Requires(source != null); - Contract.Requires(condition != null); - - using (var it = source.GetEnumerator()) - { - if (it.MoveNext()) - { - var previous = it.Current; - var list = new List { previous }; - - while (it.MoveNext()) - { - var item = it.Current; - - if (condition(previous, item) == false) - { - yield return list; - - list = new List(); - } - - list.Add(item); - - previous = item; - } - - yield return list; - } - } - } - } -} diff --git a/ReClass.NET/Extensions/ListExtension.cs b/ReClass.NET/Extensions/ListExtension.cs new file mode 100644 index 00000000..cad4b572 --- /dev/null +++ b/ReClass.NET/Extensions/ListExtension.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Contracts; + +namespace ReClassNET.Extensions +{ + public static class ListExtension + { + /// + /// Searches a range of elements in the sorted list for an element using the specified comparer and returns the zero-based index of the element. + /// + /// + /// + /// The comparer to use + /// The zero-based index in the sorted list, if an item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger or, if there is no larger element, the bitwise complement of . + [Pure] + [DebuggerStepThrough] + public static int BinarySearch(this IList source, Func comparer) + { + Contract.Requires(source != null); + Contract.Requires(comparer != null); + + var lo = 0; + var hi = source.Count - 1; + + while (lo <= hi) + { + var i = lo + (hi - lo >> 1); + + var order = comparer(source[i]); + if (order == 0) + { + return i; + } + if (order > 0) + { + lo = i + 1; + } + else + { + hi = i - 1; + } + } + + return ~lo; + } + } +} diff --git a/ReClass.NET/Extensions/PointExtension.cs b/ReClass.NET/Extensions/PointExtension.cs new file mode 100644 index 00000000..a43fa48f --- /dev/null +++ b/ReClass.NET/Extensions/PointExtension.cs @@ -0,0 +1,23 @@ +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Drawing; + +namespace ReClassNET.Extensions +{ + public static class PointExtension + { + /// + /// Creates a new point which is relocated with the given offsets. + /// + /// + /// The offset in x direction. + /// The offset in y direction. + /// The relocated point. + [Pure] + [DebuggerStepThrough] + public static Point Relocate(this Point point, int offsetX, int offsetY) + { + return new Point(point.X + offsetX, point.Y + offsetY); + } + } +} diff --git a/ReClass.NET/Extensions/RichTextBoxExtensions.cs b/ReClass.NET/Extensions/RichTextBoxExtensions.cs index 19f8fe20..4c1b49a3 100644 --- a/ReClass.NET/Extensions/RichTextBoxExtensions.cs +++ b/ReClass.NET/Extensions/RichTextBoxExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -7,7 +7,7 @@ namespace ReClassNET.Extensions { public static class RichTextBoxExtension { - public static void SetInnerPadding(this TextBoxBase textBox, int left, int top, int right, int bottom) + public static void SetInnerMargin(this TextBoxBase textBox, int left, int top, int right, int bottom) { var rect = textBox.GetFormattingRect(); @@ -16,7 +16,7 @@ public static void SetInnerPadding(this TextBoxBase textBox, int left, int top, } [StructLayout(LayoutKind.Sequential)] - private struct RECT + private readonly struct RECT { public readonly int Left; public readonly int Top; @@ -37,7 +37,7 @@ public RECT(Rectangle r) } } - [DllImport("User32.dll", CharSet = CharSet.Auto)] + [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern int SendMessage(IntPtr hWnd, uint msg, int wParam, ref RECT rect); [DllImport("user32.dll", CharSet = CharSet.Auto)] diff --git a/ReClass.NET/Extensions/SizeExtensions.cs b/ReClass.NET/Extensions/SizeExtensions.cs deleted file mode 100644 index cc62726e..00000000 --- a/ReClass.NET/Extensions/SizeExtensions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Drawing; - -namespace ReClassNET.Extensions -{ - public static class SizeExtension - { - public static Size Extend(this Size size, int width, int height) - { - return new Size(size.Width + width, size.Height + height); - } - } -} diff --git a/ReClass.NET/Extensions/StringExtensions.cs b/ReClass.NET/Extensions/StringExtensions.cs index b0c8c50e..51ae20d2 100644 --- a/ReClass.NET/Extensions/StringExtensions.cs +++ b/ReClass.NET/Extensions/StringExtensions.cs @@ -13,11 +13,11 @@ public static class StringExtension [DebuggerStepThrough] public static bool IsPrintable(this char c) { - return ' ' <= c && c <= '~'; + return (' ' <= c && c <= '~' || '\xA1' <= c && c <= '\xFF') && c != '\xFFFD' /* Unicode REPLACEMENT CHARACTER � */; } [DebuggerStepThrough] - public static IEnumerable InterpretAsUtf8(this IEnumerable source) + public static IEnumerable InterpretAsSingleByteCharacter(this IEnumerable source) { Contract.Requires(source != null); @@ -25,7 +25,7 @@ public static IEnumerable InterpretAsUtf8(this IEnumerable source) } [DebuggerStepThrough] - public static IEnumerable InterpretAsUtf16(this IEnumerable source) + public static IEnumerable InterpretAsDoubleByteCharacter(this IEnumerable source) { Contract.Requires(source != null); @@ -40,17 +40,23 @@ public static bool IsPrintableData(this IEnumerable source) { Contract.Requires(source != null); - return IsLikelyPrintableData(source) >= 1.0f; + return CalculatePrintableDataThreshold(source) >= 1.0f; } [DebuggerStepThrough] - public static float IsLikelyPrintableData(this IEnumerable source) + public static bool IsLikelyPrintableData(this IEnumerable source) { Contract.Requires(source != null); - bool doCountValid = true; - int countValid = 0; - int countAll = 0; + return CalculatePrintableDataThreshold(source) >= 0.75f; + } + + [DebuggerStepThrough] + public static float CalculatePrintableDataThreshold(this IEnumerable source) + { + var doCountValid = true; + var countValid = 0; + var countAll = 0; foreach (var c in source) { @@ -69,6 +75,11 @@ public static float IsLikelyPrintableData(this IEnumerable source) } } + if (countAll == 0) + { + return 0.0f; + } + return countValid / (float)countAll; } @@ -86,10 +97,12 @@ public static string LimitLength(this string s, int length) return s.Substring(0, length); } - private static readonly Regex HexRegex = new Regex("(0x|h)?([0-9A-F]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex hexadecimalValueRegex = new Regex("^(0x|h)?([0-9A-F]+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase); public static bool TryGetHexString(this string s, out string value) { - var match = HexRegex.Match(s); + Contract.Requires(s != null); + + var match = hexadecimalValueRegex.Match(s); value = match.Success ? match.Groups[2].Value : null; return match.Success; diff --git a/ReClass.NET/Extensions/XAttributeExtensions.cs b/ReClass.NET/Extensions/XAttributeExtensions.cs index 9a5f8c5d..d559e50d 100644 --- a/ReClass.NET/Extensions/XAttributeExtensions.cs +++ b/ReClass.NET/Extensions/XAttributeExtensions.cs @@ -7,7 +7,7 @@ public static class XAttributeExtensions { public static TEnum GetEnumValue(this XAttribute attribute) where TEnum : struct { - TEnum @enum = default(TEnum); + TEnum @enum = default; if (attribute != null) { Enum.TryParse(attribute.Value, out @enum); diff --git a/ReClass.NET/Forms/AboutForm.Designer.cs b/ReClass.NET/Forms/AboutForm.Designer.cs index 25e94816..97793e12 100644 --- a/ReClass.NET/Forms/AboutForm.Designer.cs +++ b/ReClass.NET/Forms/AboutForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class AboutForm { @@ -29,7 +31,7 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutForm)); - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new BannerBox(); this.infoLabel = new System.Windows.Forms.Label(); this.platformLabel = new System.Windows.Forms.Label(); this.buildTimeLabel = new System.Windows.Forms.Label(); @@ -191,7 +193,7 @@ private void InitializeComponent() #endregion - private UI.BannerBox bannerBox; + private BannerBox bannerBox; private System.Windows.Forms.Label infoLabel; private System.Windows.Forms.Label platformLabel; private System.Windows.Forms.Label buildTimeLabel; diff --git a/ReClass.NET/Forms/ClassSelectionForm.Designer.cs b/ReClass.NET/Forms/ClassSelectionForm.Designer.cs index 7a2aa18f..cc441d54 100644 --- a/ReClass.NET/Forms/ClassSelectionForm.Designer.cs +++ b/ReClass.NET/Forms/ClassSelectionForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class ClassSelectionForm { @@ -28,9 +30,9 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new BannerBox(); this.classesListBox = new System.Windows.Forms.ListBox(); - this.filterNameTextBox = new ReClassNET.UI.PlaceholderTextBox(); + this.filterNameTextBox = new PlaceholderTextBox(); this.cancelButton = new System.Windows.Forms.Button(); this.selectButton = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); @@ -118,9 +120,9 @@ private void InitializeComponent() #endregion - private UI.BannerBox bannerBox; + private BannerBox bannerBox; private System.Windows.Forms.ListBox classesListBox; - private UI.PlaceholderTextBox filterNameTextBox; + private PlaceholderTextBox filterNameTextBox; private System.Windows.Forms.Button cancelButton; private System.Windows.Forms.Button selectButton; } diff --git a/ReClass.NET/Forms/ClassSelectionForm.cs b/ReClass.NET/Forms/ClassSelectionForm.cs index ee55f0e8..e8ed984d 100644 --- a/ReClass.NET/Forms/ClassSelectionForm.cs +++ b/ReClass.NET/Forms/ClassSelectionForm.cs @@ -1,6 +1,5 @@ -using System; +using System; using System.Collections.Generic; -using System.Data; using System.Diagnostics.Contracts; using System.Linq; using System.Windows.Forms; diff --git a/ReClass.NET/Forms/CodeForm.Designer.cs b/ReClass.NET/Forms/CodeForm.Designer.cs index fee807e4..4c419b03 100644 --- a/ReClass.NET/Forms/CodeForm.Designer.cs +++ b/ReClass.NET/Forms/CodeForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class CodeForm { @@ -28,7 +30,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new BannerBox(); this.codeRichTextBox = new System.Windows.Forms.RichTextBox(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); this.SuspendLayout(); @@ -71,7 +73,7 @@ private void InitializeComponent() } #endregion - private UI.BannerBox bannerBox; + private BannerBox bannerBox; private System.Windows.Forms.RichTextBox codeRichTextBox; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/CodeForm.cs b/ReClass.NET/Forms/CodeForm.cs index 8e94a4e3..f84d3f0e 100644 --- a/ReClass.NET/Forms/CodeForm.cs +++ b/ReClass.NET/Forms/CodeForm.cs @@ -27,7 +27,7 @@ public CodeForm(ICodeGenerator generator, IReadOnlyList classes, IRea InitializeComponent(); - codeRichTextBox.SetInnerPadding(5, 5, 5, 5); + codeRichTextBox.SetInnerMargin(5, 5, 5, 5); var code = generator.GenerateCode(classes, enums, logger); diff --git a/ReClass.NET/Forms/EnumEditorForm.Designer.cs b/ReClass.NET/Forms/EnumEditorForm.Designer.cs index 998c6184..c06e2978 100644 --- a/ReClass.NET/Forms/EnumEditorForm.Designer.cs +++ b/ReClass.NET/Forms/EnumEditorForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class EnumEditorForm { @@ -28,7 +30,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new BannerBox(); this.saveButton = new System.Windows.Forms.Button(); this.enumNameLabel = new System.Windows.Forms.Label(); this.cancelButton = new System.Windows.Forms.Button(); @@ -179,7 +181,7 @@ private void InitializeComponent() #endregion - private UI.BannerBox bannerBox; + private BannerBox bannerBox; private System.Windows.Forms.Button saveButton; private System.Windows.Forms.Label enumNameLabel; private System.Windows.Forms.Button cancelButton; diff --git a/ReClass.NET/Forms/EnumEditorForm.cs b/ReClass.NET/Forms/EnumEditorForm.cs index e4b07bcd..cfdc5302 100644 --- a/ReClass.NET/Forms/EnumEditorForm.cs +++ b/ReClass.NET/Forms/EnumEditorForm.cs @@ -1,8 +1,9 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; using System.Windows.Forms; +using ReClassNET.Controls; using ReClassNET.Project; using ReClassNET.UI; @@ -26,7 +27,7 @@ public EnumEditorForm(EnumDescription @enum) foreach (var kv in @enum.Values) { - enumDataGridView.Rows.Add(kv.Key, kv.Value); + enumDataGridView.Rows.Add(kv.Value, kv.Key); } } diff --git a/ReClass.NET/Forms/EnumListForm.Designer.cs b/ReClass.NET/Forms/EnumListForm.Designer.cs index b03c4e31..44d1f381 100644 --- a/ReClass.NET/Forms/EnumListForm.Designer.cs +++ b/ReClass.NET/Forms/EnumListForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class EnumListForm { @@ -28,12 +30,12 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.filterNameTextBox = new ReClassNET.UI.PlaceholderTextBox(); + this.filterNameTextBox = new PlaceholderTextBox(); this.itemListBox = new System.Windows.Forms.ListBox(); - this.bannerBox = new ReClassNET.UI.BannerBox(); - this.addEnumIconButton = new ReClassNET.UI.IconButton(); - this.removeEnumIconButton = new ReClassNET.UI.IconButton(); - this.editEnumIconButton = new ReClassNET.UI.IconButton(); + this.bannerBox = new BannerBox(); + this.addEnumIconButton = new IconButton(); + this.removeEnumIconButton = new IconButton(); + this.editEnumIconButton = new IconButton(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); this.SuspendLayout(); // @@ -130,11 +132,11 @@ private void InitializeComponent() } #endregion - private UI.PlaceholderTextBox filterNameTextBox; + private PlaceholderTextBox filterNameTextBox; private System.Windows.Forms.ListBox itemListBox; - private UI.BannerBox bannerBox; - private UI.IconButton addEnumIconButton; - private UI.IconButton removeEnumIconButton; - private UI.IconButton editEnumIconButton; + private BannerBox bannerBox; + private IconButton addEnumIconButton; + private IconButton removeEnumIconButton; + private IconButton editEnumIconButton; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/EnumListForm.cs b/ReClass.NET/Forms/EnumListForm.cs index a2e109c6..f8cafe56 100644 --- a/ReClass.NET/Forms/EnumListForm.cs +++ b/ReClass.NET/Forms/EnumListForm.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; @@ -57,10 +57,9 @@ private void editEnumIconButton_Click(object sender, EventArgs e) return; } - using (var eef = new EnumEditorForm(@enum)) - { - eef.ShowDialog(); - } + using var eef = new EnumEditorForm(@enum); + + eef.ShowDialog(); } private void addEnumIconButton_Click(object sender, EventArgs e) @@ -70,14 +69,13 @@ private void addEnumIconButton_Click(object sender, EventArgs e) Name = "Enum" }; - using (var eef = new EnumEditorForm(@enum)) + using var eef = new EnumEditorForm(@enum); + + if (eef.ShowDialog() == DialogResult.OK) { - if (eef.ShowDialog() == DialogResult.OK) - { - project.AddEnum(@enum); + project.AddEnum(@enum); - ShowFilteredEnums(); - } + ShowFilteredEnums(); } } diff --git a/ReClass.NET/Forms/EnumSelectionForm.Designer.cs b/ReClass.NET/Forms/EnumSelectionForm.Designer.cs index 3e96b886..6334244a 100644 --- a/ReClass.NET/Forms/EnumSelectionForm.Designer.cs +++ b/ReClass.NET/Forms/EnumSelectionForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class EnumSelectionForm { @@ -30,12 +32,12 @@ private void InitializeComponent() { this.selectButton = new System.Windows.Forms.Button(); this.cancelButton = new System.Windows.Forms.Button(); - this.filterNameTextBox = new ReClassNET.UI.PlaceholderTextBox(); + this.filterNameTextBox = new PlaceholderTextBox(); this.itemListBox = new System.Windows.Forms.ListBox(); - this.bannerBox = new ReClassNET.UI.BannerBox(); - this.addEnumIconButton = new ReClassNET.UI.IconButton(); - this.removeEnumIconButton = new ReClassNET.UI.IconButton(); - this.editEnumIconButton = new ReClassNET.UI.IconButton(); + this.bannerBox = new BannerBox(); + this.addEnumIconButton = new IconButton(); + this.removeEnumIconButton = new IconButton(); + this.editEnumIconButton = new IconButton(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); this.SuspendLayout(); // @@ -163,11 +165,11 @@ private void InitializeComponent() private System.Windows.Forms.Button selectButton; private System.Windows.Forms.Button cancelButton; - private UI.PlaceholderTextBox filterNameTextBox; + private PlaceholderTextBox filterNameTextBox; private System.Windows.Forms.ListBox itemListBox; - private UI.BannerBox bannerBox; - private UI.IconButton addEnumIconButton; - private UI.IconButton removeEnumIconButton; - private UI.IconButton editEnumIconButton; + private BannerBox bannerBox; + private IconButton addEnumIconButton; + private IconButton removeEnumIconButton; + private IconButton editEnumIconButton; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/EnumSelectionForm.cs b/ReClass.NET/Forms/EnumSelectionForm.cs index 03d11d69..6ef69d17 100644 --- a/ReClass.NET/Forms/EnumSelectionForm.cs +++ b/ReClass.NET/Forms/EnumSelectionForm.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; @@ -57,10 +57,9 @@ private void editEnumIconButton_Click(object sender, EventArgs e) return; } - using (var eef = new EnumEditorForm(@enum)) - { - eef.ShowDialog(); - } + using var eef = new EnumEditorForm(@enum); + + eef.ShowDialog(); } private void addEnumIconButton_Click(object sender, EventArgs e) @@ -70,14 +69,13 @@ private void addEnumIconButton_Click(object sender, EventArgs e) Name = "Enum" }; - using (var eef = new EnumEditorForm(@enum)) + using var eef = new EnumEditorForm(@enum); + + if (eef.ShowDialog() == DialogResult.OK) { - if (eef.ShowDialog() == DialogResult.OK) - { - project.AddEnum(@enum); + project.AddEnum(@enum); - ShowFilteredEnums(); - } + ShowFilteredEnums(); } } diff --git a/ReClass.NET/Forms/FoundCodeForm.Designer.cs b/ReClass.NET/Forms/FoundCodeForm.Designer.cs index 1e1d5dcf..75df742e 100644 --- a/ReClass.NET/Forms/FoundCodeForm.Designer.cs +++ b/ReClass.NET/Forms/FoundCodeForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class FoundCodeForm { @@ -36,7 +38,7 @@ private void InitializeComponent() this.stopButton = new System.Windows.Forms.Button(); this.closeButton = new System.Windows.Forms.Button(); this.createFunctionButton = new System.Windows.Forms.Button(); - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new BannerBox(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -194,6 +196,6 @@ private void InitializeComponent() private System.Windows.Forms.Button closeButton; private System.Windows.Forms.TextBox infoTextBox; private System.Windows.Forms.Button createFunctionButton; - private UI.BannerBox bannerBox; + private BannerBox bannerBox; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/FoundCodeForm.cs b/ReClass.NET/Forms/FoundCodeForm.cs index 68ccd141..3169db2a 100644 --- a/ReClass.NET/Forms/FoundCodeForm.cs +++ b/ReClass.NET/Forms/FoundCodeForm.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Data; using System.Diagnostics.Contracts; using System.Drawing; @@ -10,7 +10,6 @@ using ReClassNET.Memory; using ReClassNET.Nodes; using ReClassNET.UI; -using ReClassNET.Util; namespace ReClassNET.Forms { diff --git a/ReClass.NET/Forms/InputCorrelatorForm.Designer.cs b/ReClass.NET/Forms/InputCorrelatorForm.Designer.cs index 6b75bc36..27a18a9f 100644 --- a/ReClass.NET/Forms/InputCorrelatorForm.Designer.cs +++ b/ReClass.NET/Forms/InputCorrelatorForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class InputCorrelatorForm { @@ -30,14 +32,14 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.refineTimer = new System.Windows.Forms.Timer(this.components); - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new BannerBox(); this.settingsGroupBox = new System.Windows.Forms.GroupBox(); this.removeButton = new System.Windows.Forms.Button(); this.addButton = new System.Windows.Forms.Button(); this.valueTypeComboBox = new ReClassNET.Forms.ScannerForm.ScanValueTypeComboBox(); this.label1 = new System.Windows.Forms.Label(); this.hotkeyListBox = new System.Windows.Forms.ListBox(); - this.hotkeyBox = new ReClassNET.UI.HotkeyBox(); + this.hotkeyBox = new HotkeyBox(); this.startStopButton = new System.Windows.Forms.Button(); this.infoLabel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); @@ -181,9 +183,9 @@ private void InitializeComponent() #endregion private System.Windows.Forms.Timer refineTimer; - private UI.BannerBox bannerBox; + private BannerBox bannerBox; private System.Windows.Forms.GroupBox settingsGroupBox; - private UI.HotkeyBox hotkeyBox; + private HotkeyBox hotkeyBox; private System.Windows.Forms.ListBox hotkeyListBox; private System.Windows.Forms.Button removeButton; private System.Windows.Forms.Button addButton; diff --git a/ReClass.NET/Forms/LogForm.Designer.cs b/ReClass.NET/Forms/LogForm.Designer.cs index 5bd2d132..384b0974 100644 --- a/ReClass.NET/Forms/LogForm.Designer.cs +++ b/ReClass.NET/Forms/LogForm.Designer.cs @@ -86,7 +86,7 @@ private void InitializeComponent() this.entriesDataGridView.Name = "entriesDataGridView"; this.entriesDataGridView.ReadOnly = true; this.entriesDataGridView.RowHeadersVisible = false; - this.entriesDataGridView.RowTemplate.ContextMenuStrip = this.contextMenuStrip; + this.entriesDataGridView.ContextMenuStrip = this.contextMenuStrip; this.entriesDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.entriesDataGridView.Size = new System.Drawing.Size(563, 188); this.entriesDataGridView.TabIndex = 1; diff --git a/ReClass.NET/Forms/MainForm.Designer.cs b/ReClass.NET/Forms/MainForm.Designer.cs index 3d5cd7c2..e2b2a199 100644 --- a/ReClass.NET/Forms/MainForm.Designer.cs +++ b/ReClass.NET/Forms/MainForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class MainForm { @@ -32,7 +34,7 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.processUpdateTimer = new System.Windows.Forms.Timer(this.components); this.splitContainer = new System.Windows.Forms.SplitContainer(); - this.projectView = new ReClassNET.UI.ProjectView(); + this.projectView = new ReClassNET.Controls.ProjectView(); this.projectClassContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.deleteClassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator19 = new System.Windows.Forms.ToolStripSeparator(); @@ -51,26 +53,26 @@ private void InitializeComponent() this.editEnumToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.projectEnumsContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.editEnumsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.memoryViewControl = new ReClassNET.UI.MemoryViewControl(); + this.memoryViewControl = new ReClassNET.Controls.MemoryViewControl(); this.selectedNodeContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.changeTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.integerToolStripMenuItem1 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem2 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem3 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem4 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem5 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem6 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem7 = new ReClassNET.UI.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem1 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem2 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem3 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem4 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem5 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem6 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem7 = new ReClassNET.Controls.IntegerToolStripMenuItem(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.insertBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.integerToolStripMenuItem8 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem9 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem10 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem11 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem12 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem13 = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.integerToolStripMenuItem14 = new ReClassNET.UI.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem8 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem9 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem10 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem11 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem12 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem13 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem14 = new ReClassNET.Controls.IntegerToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.createClassFromNodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -105,22 +107,22 @@ private void InitializeComponent() this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); this.newClassToolStripButton = new System.Windows.Forms.ToolStripButton(); this.addBytesToolStripDropDownButton = new System.Windows.Forms.ToolStripDropDownButton(); - this.add4BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add8BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add64BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add256BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add1024BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add2048BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add4096BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); + this.add4BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add8BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add64BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add256BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add1024BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add2048BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add4096BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); this.addXBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.insertBytesToolStripDropDownButton = new System.Windows.Forms.ToolStripDropDownButton(); - this.insert4BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert8BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert64BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert256BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert1024BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert2048BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert4096BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); + this.insert4BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert8BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert64BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert256BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert1024BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert2048BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert4096BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); this.insertXBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.nodeTypesToolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); this.statusStrip = new System.Windows.Forms.StatusStrip(); @@ -147,6 +149,8 @@ private void InitializeComponent() this.processInformationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.memorySearcherToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.namedAddressesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator23 = new System.Windows.Forms.ToolStripSeparator(); + this.isLittleEndianToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator(); this.loadSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loadSymbolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -157,12 +161,12 @@ private void InitializeComponent() this.projectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.goToClassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.cleanUnusedClassesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.showEnumsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator(); this.generateCppCodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.generateCSharpCodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.showEnumsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -213,7 +217,7 @@ private void InitializeComponent() this.projectView.Name = "projectView"; this.projectView.Size = new System.Drawing.Size(201, 524); this.projectView.TabIndex = 0; - this.projectView.SelectionChanged += new ReClassNET.UI.ProjectView.SelectionChangedEvent(this.classesView_ClassSelected); + this.projectView.SelectionChanged += new ReClassNET.Controls.ProjectView.SelectionChangedEvent(this.classesView_ClassSelected); // // projectClassContextMenuStrip // @@ -271,33 +275,33 @@ private void InitializeComponent() this.toolStripSeparator22, this.addNewClassToolStripMenuItem}); this.projectClassesContextMenuStrip.Name = "rootContextMenuStrip"; - this.projectClassesContextMenuStrip.Size = new System.Drawing.Size(221, 126); + this.projectClassesContextMenuStrip.Size = new System.Drawing.Size(222, 126); // // enableHierarchyViewToolStripMenuItem // this.enableHierarchyViewToolStripMenuItem.Name = "enableHierarchyViewToolStripMenuItem"; - this.enableHierarchyViewToolStripMenuItem.Size = new System.Drawing.Size(220, 22); + this.enableHierarchyViewToolStripMenuItem.Size = new System.Drawing.Size(221, 22); this.enableHierarchyViewToolStripMenuItem.Text = "Enable hierarchy view"; this.enableHierarchyViewToolStripMenuItem.Click += new System.EventHandler(this.enableHierarchyViewToolStripMenuItem_Click); // // autoExpandHierarchyViewToolStripMenuItem // this.autoExpandHierarchyViewToolStripMenuItem.Name = "autoExpandHierarchyViewToolStripMenuItem"; - this.autoExpandHierarchyViewToolStripMenuItem.Size = new System.Drawing.Size(220, 22); + this.autoExpandHierarchyViewToolStripMenuItem.Size = new System.Drawing.Size(221, 22); this.autoExpandHierarchyViewToolStripMenuItem.Text = "Auto expand hierarchy view"; this.autoExpandHierarchyViewToolStripMenuItem.Click += new System.EventHandler(this.autoExpandHierarchyViewToolStripMenuItem_Click); // // toolStripSeparator21 // this.toolStripSeparator21.Name = "toolStripSeparator21"; - this.toolStripSeparator21.Size = new System.Drawing.Size(217, 6); + this.toolStripSeparator21.Size = new System.Drawing.Size(218, 6); // // expandAllClassesToolStripMenuItem // this.expandAllClassesToolStripMenuItem.Enabled = false; this.expandAllClassesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Tree_Expand; this.expandAllClassesToolStripMenuItem.Name = "expandAllClassesToolStripMenuItem"; - this.expandAllClassesToolStripMenuItem.Size = new System.Drawing.Size(220, 22); + this.expandAllClassesToolStripMenuItem.Size = new System.Drawing.Size(221, 22); this.expandAllClassesToolStripMenuItem.Text = "Expand all classes"; this.expandAllClassesToolStripMenuItem.Click += new System.EventHandler(this.expandAllClassesToolStripMenuItem_Click); // @@ -306,20 +310,20 @@ private void InitializeComponent() this.collapseAllClassesToolStripMenuItem.Enabled = false; this.collapseAllClassesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Tree_Collapse; this.collapseAllClassesToolStripMenuItem.Name = "collapseAllClassesToolStripMenuItem"; - this.collapseAllClassesToolStripMenuItem.Size = new System.Drawing.Size(220, 22); + this.collapseAllClassesToolStripMenuItem.Size = new System.Drawing.Size(221, 22); this.collapseAllClassesToolStripMenuItem.Text = "Collapse all classes"; this.collapseAllClassesToolStripMenuItem.Click += new System.EventHandler(this.collapseAllClassesToolStripMenuItem_Click); // // toolStripSeparator22 // this.toolStripSeparator22.Name = "toolStripSeparator22"; - this.toolStripSeparator22.Size = new System.Drawing.Size(217, 6); + this.toolStripSeparator22.Size = new System.Drawing.Size(218, 6); // // addNewClassToolStripMenuItem // this.addNewClassToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Class_Add; this.addNewClassToolStripMenuItem.Name = "addNewClassToolStripMenuItem"; - this.addNewClassToolStripMenuItem.Size = new System.Drawing.Size(220, 22); + this.addNewClassToolStripMenuItem.Size = new System.Drawing.Size(221, 22); this.addNewClassToolStripMenuItem.Text = "Add new class"; this.addNewClassToolStripMenuItem.Click += new System.EventHandler(this.newClassToolStripButton_Click); // @@ -349,7 +353,7 @@ private void InitializeComponent() // this.editEnumsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Category; this.editEnumsToolStripMenuItem.Name = "editEnumsToolStripMenuItem"; - this.editEnumsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.editEnumsToolStripMenuItem.Size = new System.Drawing.Size(142, 22); this.editEnumsToolStripMenuItem.Text = "Edit enums..."; this.editEnumsToolStripMenuItem.Click += new System.EventHandler(this.editEnumsToolStripMenuItem_Click); // @@ -362,10 +366,11 @@ private void InitializeComponent() this.memoryViewControl.NodeContextMenuStrip = this.selectedNodeContextMenuStrip; this.memoryViewControl.Size = new System.Drawing.Size(936, 524); this.memoryViewControl.TabIndex = 0; + this.memoryViewControl.DrawContextRequested += new ReClassNET.Controls.DrawContextRequestEventHandler(this.memoryViewControl_DrawContextRequested); this.memoryViewControl.SelectionChanged += new System.EventHandler(this.memoryViewControl_SelectionChanged); - this.memoryViewControl.ChangeClassTypeClick += new ReClassNET.UI.NodeClickEventHandler(this.memoryViewControl_ChangeClassTypeClick); - this.memoryViewControl.ChangeWrappedTypeClick += new ReClassNET.UI.NodeClickEventHandler(this.memoryViewControl_ChangeWrappedTypeClick); - this.memoryViewControl.ChangeEnumTypeClick += new ReClassNET.UI.NodeClickEventHandler(this.memoryViewControl_ChangeEnumTypeClick); + this.memoryViewControl.ChangeClassTypeClick += new ReClassNET.Controls.NodeClickEventHandler(this.memoryViewControl_ChangeClassTypeClick); + this.memoryViewControl.ChangeWrappedTypeClick += new ReClassNET.Controls.NodeClickEventHandler(this.memoryViewControl_ChangeWrappedTypeClick); + this.memoryViewControl.ChangeEnumTypeClick += new ReClassNET.Controls.NodeClickEventHandler(this.memoryViewControl_ChangeEnumTypeClick); this.memoryViewControl.KeyDown += new System.Windows.Forms.KeyEventHandler(this.memoryViewControl_KeyDown); // // selectedNodeContextMenuStrip @@ -1187,6 +1192,8 @@ private void InitializeComponent() this.processInformationsToolStripMenuItem, this.memorySearcherToolStripMenuItem, this.namedAddressesToolStripMenuItem, + this.toolStripSeparator23, + this.isLittleEndianToolStripMenuItem, this.toolStripSeparator17, this.loadSymbolToolStripMenuItem, this.loadSymbolsToolStripMenuItem, @@ -1222,6 +1229,19 @@ private void InitializeComponent() this.namedAddressesToolStripMenuItem.Text = "Named Addresses..."; this.namedAddressesToolStripMenuItem.Click += new System.EventHandler(this.namedAddressesToolStripMenuItem_Click); // + // toolStripSeparator23 + // + this.toolStripSeparator23.Name = "toolStripSeparator23"; + this.toolStripSeparator23.Size = new System.Drawing.Size(191, 6); + // + // isLittleEndianToolStripMenuItem + // + this.isLittleEndianToolStripMenuItem.CheckOnClick = true; + this.isLittleEndianToolStripMenuItem.Name = "isLittleEndianToolStripMenuItem"; + this.isLittleEndianToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.isLittleEndianToolStripMenuItem.Text = "Is Little Endian"; + this.isLittleEndianToolStripMenuItem.Click += new System.EventHandler(this.isLittleEndianToolStripMenuItem_Click); + // // toolStripSeparator17 // this.toolStripSeparator17.Name = "toolStripSeparator17"; @@ -1289,6 +1309,7 @@ private void InitializeComponent() // this.goToClassToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Class_Type; this.goToClassToolStripMenuItem.Name = "goToClassToolStripMenuItem"; + this.goToClassToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); this.goToClassToolStripMenuItem.Size = new System.Drawing.Size(198, 22); this.goToClassToolStripMenuItem.Text = "Go to class..."; this.goToClassToolStripMenuItem.Click += new System.EventHandler(this.goToClassToolStripMenuItem_Click); @@ -1301,6 +1322,14 @@ private void InitializeComponent() this.cleanUnusedClassesToolStripMenuItem.Text = "Remove unused classes"; this.cleanUnusedClassesToolStripMenuItem.Click += new System.EventHandler(this.cleanUnusedClassesToolStripMenuItem_Click); // + // showEnumsToolStripMenuItem + // + this.showEnumsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Category; + this.showEnumsToolStripMenuItem.Name = "showEnumsToolStripMenuItem"; + this.showEnumsToolStripMenuItem.Size = new System.Drawing.Size(198, 22); + this.showEnumsToolStripMenuItem.Text = "Show Enums..."; + this.showEnumsToolStripMenuItem.Click += new System.EventHandler(this.showEnumsToolStripMenuItem_Click); + // // toolStripSeparator16 // this.toolStripSeparator16.Name = "toolStripSeparator16"; @@ -1338,14 +1367,6 @@ private void InitializeComponent() this.aboutToolStripMenuItem.Text = "About..."; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // - // showEnumsToolStripMenuItem - // - this.showEnumsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Category; - this.showEnumsToolStripMenuItem.Name = "showEnumsToolStripMenuItem"; - this.showEnumsToolStripMenuItem.Size = new System.Drawing.Size(198, 22); - this.showEnumsToolStripMenuItem.Text = "Show Enums..."; - this.showEnumsToolStripMenuItem.Click += new System.EventHandler(this.showEnumsToolStripMenuItem_Click); - // // MainForm // this.AllowDrop = true; @@ -1386,7 +1407,7 @@ private void InitializeComponent() #endregion - private UI.MemoryViewControl memoryViewControl; + private MemoryViewControl memoryViewControl; private System.Windows.Forms.StatusStrip statusStrip; private System.Windows.Forms.MenuStrip mainMenuStrip; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; @@ -1419,25 +1440,25 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; private System.Windows.Forms.ToolStripButton newClassToolStripButton; private System.Windows.Forms.ToolStripDropDownButton addBytesToolStripDropDownButton; - private UI.IntegerToolStripMenuItem add4BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add8BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add64BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add256BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add1024BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add2048BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add4096BytesToolStripMenuItem; + private IntegerToolStripMenuItem add4BytesToolStripMenuItem; + private IntegerToolStripMenuItem add8BytesToolStripMenuItem; + private IntegerToolStripMenuItem add64BytesToolStripMenuItem; + private IntegerToolStripMenuItem add256BytesToolStripMenuItem; + private IntegerToolStripMenuItem add1024BytesToolStripMenuItem; + private IntegerToolStripMenuItem add2048BytesToolStripMenuItem; + private IntegerToolStripMenuItem add4096BytesToolStripMenuItem; private System.Windows.Forms.ToolStripDropDownButton insertBytesToolStripDropDownButton; - private UI.IntegerToolStripMenuItem insert4BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert8BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert64BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert256BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert1024BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert2048BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert4096BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert4BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert8BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert64BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert256BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert1024BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert2048BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert4096BytesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem addXBytesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem insertXBytesToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator nodeTypesToolStripSeparator; - private UI.ProjectView projectView; + private ProjectView projectView; private System.Windows.Forms.ToolStripMenuItem projectToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem cleanUnusedClassesToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator16; @@ -1457,21 +1478,21 @@ private void InitializeComponent() private System.Windows.Forms.ContextMenuStrip selectedNodeContextMenuStrip; private System.Windows.Forms.ToolStripMenuItem changeTypeToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem addBytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem1; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem2; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem3; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem4; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem5; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem6; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem7; + private IntegerToolStripMenuItem integerToolStripMenuItem1; + private IntegerToolStripMenuItem integerToolStripMenuItem2; + private IntegerToolStripMenuItem integerToolStripMenuItem3; + private IntegerToolStripMenuItem integerToolStripMenuItem4; + private IntegerToolStripMenuItem integerToolStripMenuItem5; + private IntegerToolStripMenuItem integerToolStripMenuItem6; + private IntegerToolStripMenuItem integerToolStripMenuItem7; private System.Windows.Forms.ToolStripMenuItem insertBytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem8; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem9; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem10; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem11; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem12; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem13; - private UI.IntegerToolStripMenuItem integerToolStripMenuItem14; + private IntegerToolStripMenuItem integerToolStripMenuItem8; + private IntegerToolStripMenuItem integerToolStripMenuItem9; + private IntegerToolStripMenuItem integerToolStripMenuItem10; + private IntegerToolStripMenuItem integerToolStripMenuItem11; + private IntegerToolStripMenuItem integerToolStripMenuItem12; + private IntegerToolStripMenuItem integerToolStripMenuItem13; + private IntegerToolStripMenuItem integerToolStripMenuItem14; private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; private System.Windows.Forms.ToolStripMenuItem createClassFromNodesToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator13; @@ -1519,6 +1540,8 @@ private void InitializeComponent() private System.Windows.Forms.ContextMenuStrip projectEnumsContextMenuStrip; private System.Windows.Forms.ToolStripMenuItem editEnumsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem showEnumsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator23; + private System.Windows.Forms.ToolStripMenuItem isLittleEndianToolStripMenuItem; } } diff --git a/ReClass.NET/Forms/MainForm.Functions.cs b/ReClass.NET/Forms/MainForm.Functions.cs index 5bf0d1c0..84f1b53a 100644 --- a/ReClass.NET/Forms/MainForm.Functions.cs +++ b/ReClass.NET/Forms/MainForm.Functions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.Contracts; @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using ReClassNET.CodeGenerator; +using ReClassNET.Controls; using ReClassNET.DataExchange.ReClass; using ReClassNET.Extensions; using ReClassNET.Logger; @@ -15,7 +16,6 @@ using ReClassNET.Nodes; using ReClassNET.Project; using ReClassNET.UI; -using ReClassNET.Util; namespace ReClassNET.Forms { @@ -112,7 +112,7 @@ void UpdateClassNodes(BaseNode node) projectView.Clear(); projectView.AddEnums(currentProject.Enums); projectView.AddClasses(currentProject.Classes); - memoryViewControl.ClassNode = currentProject.Classes.FirstOrDefault(); + CurrentClassNode = currentProject.Classes.FirstOrDefault(); } /// Opens the and calls with the result. @@ -123,19 +123,20 @@ private void AskAddOrInsertBytes(string title, Action callback) Contract.Requires(title != null); Contract.Requires(callback != null); - if (memoryViewControl.ClassNode == null) + var classNode = CurrentClassNode; + if (classNode == null) { return; } - using (var ib = new InputBytesForm(memoryViewControl.ClassNode.MemorySize)) + using var ib = new InputBytesForm(classNode.MemorySize) { - ib.Text = title; + Text = title + }; - if (ib.ShowDialog() == DialogResult.OK) - { - callback(ib.Bytes); - } + if (ib.ShowDialog() == DialogResult.OK) + { + callback(ib.Bytes); } } @@ -189,19 +190,18 @@ public void ClearSelection() /// The path to the selected file or null if no file was selected. public static string ShowOpenProjectFileDialog() { - using (var ofd = new OpenFileDialog()) + using var ofd = new OpenFileDialog { - ofd.CheckFileExists = true; - ofd.Filter = $"All ReClass Types |*{ReClassNetFile.FileExtension};*{ReClassFile.FileExtension};*{ReClassQtFile.FileExtension};*{ReClass2007File.FileExtension}" - + $"|{ReClassNetFile.FormatName} (*{ReClassNetFile.FileExtension})|*{ReClassNetFile.FileExtension}" - + $"|{ReClassFile.FormatName} (*{ReClassFile.FileExtension})|*{ReClassFile.FileExtension}" - + $"|{ReClassQtFile.FormatName} (*{ReClassQtFile.FileExtension})|*{ReClassQtFile.FileExtension}" - + $"|{ReClass2007File.FormatName} (*{ReClass2007File.FileExtension})|*{ReClass2007File.FileExtension}"; + CheckFileExists = true, + Filter = $"All ReClass Types |*{ReClassNetFile.FileExtension};*{ReClassFile.FileExtension};*{ReClassQtFile.FileExtension}" + + $"|{ReClassNetFile.FormatName} (*{ReClassNetFile.FileExtension})|*{ReClassNetFile.FileExtension}" + + $"|{ReClassFile.FormatName} (*{ReClassFile.FileExtension})|*{ReClassFile.FileExtension}" + + $"|{ReClassQtFile.FormatName} (*{ReClassQtFile.FileExtension})|*{ReClassQtFile.FileExtension}" + }; - if (ofd.ShowDialog() == DialogResult.OK) - { - return ofd.FileName; - } + if (ofd.ShowDialog() == DialogResult.OK) + { + return ofd.FileName; } return null; @@ -247,9 +247,6 @@ private static void LoadProjectFromPath(string path, ref ReClassNetProject proje case ReClassFile.FileExtension: import = new ReClassFile(project); break; - case ReClass2007File.FileExtension: - import = new ReClass2007File(project); - break; default: Program.Logger.Log(LogLevel.Error, $"The file '{path}' has an unknown type."); return; @@ -267,7 +264,7 @@ private void LoadAllSymbolsForCurrentProcess() infoToolStripStatusLabel.Visible = true; - int index = 0; + var index = 0; var progress = new Progress>>( report => @@ -295,38 +292,47 @@ public void ReplaceSelectedNodesWithType(Type type) var hotSpotPartitions = selectedNodes .WhereNot(s => s.Node is ClassNode) .GroupBy(s => s.Node.GetParentContainer()) - .SelectMany(g => g - .OrderBy(s => s.Node.Offset) - .GroupWhile((h1, h2) => h1.Node.Offset + h1.Node.MemorySize == h2.Node.Offset) - ); + .Select(g => new + { + Container = g.Key, + Partitions = g.OrderBy(s => s.Node.Offset) + .GroupWhile((s1, s2) => s1.Node.Offset + s1.Node.MemorySize == s2.Node.Offset) + }); - foreach (var selectedPartition in hotSpotPartitions) + foreach (var containerPartitions in hotSpotPartitions) { - var hotSpotsToReplace = new Queue(selectedPartition); - while (hotSpotsToReplace.Count > 0) + containerPartitions.Container.BeginUpdate(); + + foreach (var partition in containerPartitions.Partitions) { - var selected = hotSpotsToReplace.Dequeue(); + var hotSpotsToReplace = new Queue(partition); + while (hotSpotsToReplace.Count > 0) + { + var selected = hotSpotsToReplace.Dequeue(); - var node = BaseNode.CreateInstanceFromType(type); + var node = BaseNode.CreateInstanceFromType(type); - var createdNodes = new List(); - selected.Node.GetParentContainer().ReplaceChildNode(selected.Node, node, ref createdNodes); + var createdNodes = new List(); + containerPartitions.Container.ReplaceChildNode(selected.Node, node, ref createdNodes); - node.IsSelected = true; + node.IsSelected = true; - var info = new MemoryViewControl.SelectedNodeInfo(node, selected.Memory, selected.Address, selected.Level); + var info = new MemoryViewControl.SelectedNodeInfo(node, selected.Process, selected.Memory, selected.Address, selected.Level); - newSelected.Add(info); + newSelected.Add(info); - // If more than one node is selected I assume the user wants to replace the complete range with the desired node type. - if (selectedNodes.Count > 1) - { - foreach (var createdNode in createdNodes) + // If more than one node is selected I assume the user wants to replace the complete range with the desired node type. + if (selectedNodes.Count > 1) { - hotSpotsToReplace.Enqueue(new MemoryViewControl.SelectedNodeInfo(createdNode, selected.Memory, selected.Address + createdNode.Offset - node.Offset, selected.Level)); + foreach (var createdNode in createdNodes) + { + hotSpotsToReplace.Enqueue(new MemoryViewControl.SelectedNodeInfo(createdNode, selected.Process, selected.Memory, selected.Address + createdNode.Offset - node.Offset, selected.Level)); + } } } } + + containerPartitions.Container.EndUpdate(); } memoryViewControl.ClearSelection(); @@ -359,8 +365,8 @@ private void CopySelectedNodesToClipboard() private void PasteNodeFromClipboardToSelection() { - var result = ReClassClipboard.Paste(CurrentProject, Program.Logger); - foreach (var pastedClassNode in result.Item1) + var (classNodes, nodes) = ReClassClipboard.Paste(CurrentProject, Program.Logger); + foreach (var pastedClassNode in classNodes) { if (!CurrentProject.ContainsClass(pastedClassNode.Uuid)) { @@ -376,7 +382,9 @@ private void PasteNodeFromClipboardToSelection() var classNode = selectedNode.GetParentClass(); if (containerNode != null && classNode != null) { - foreach (var node in result.Item2) + containerNode.BeginUpdate(); + + foreach (var node in nodes) { if (node is BaseWrapperNode) { @@ -397,10 +405,21 @@ private void PasteNodeFromClipboardToSelection() containerNode.InsertNode(selectedNode, node); } + + containerNode.EndUpdate(); } } } + private void EditSelectedNodeName() + { + var selectedNodes = memoryViewControl.GetSelectedNodes(); + if (selectedNodes.Count == 1) + { + memoryViewControl.ShowNodeNameEditBox(selectedNodes[0].Node); + } + } + private void RemoveSelectedNodes() { memoryViewControl.GetSelectedNodes() diff --git a/ReClass.NET/Forms/MainForm.cs b/ReClass.NET/Forms/MainForm.cs index e69875b2..e771a10d 100644 --- a/ReClass.NET/Forms/MainForm.cs +++ b/ReClass.NET/Forms/MainForm.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Diagnostics.Contracts; using System.IO; @@ -7,7 +7,9 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using ReClassNET.AddressParser; using ReClassNET.CodeGenerator; +using ReClassNET.Controls; using ReClassNET.Core; using ReClassNET.DataExchange.ReClass; using ReClassNET.Extensions; @@ -19,16 +21,22 @@ using ReClassNET.Project; using ReClassNET.UI; using ReClassNET.Util; +using ReClassNET.Util.Conversion; namespace ReClassNET.Forms { public partial class MainForm : IconForm { private readonly PluginManager pluginManager; + private readonly IconProvider iconProvider = new IconProvider(); private ReClassNetProject currentProject; public ReClassNetProject CurrentProject => currentProject; + private ClassNode currentClassNode; + + private readonly MemoryBuffer memoryViewBuffer = new MemoryBuffer(); + private Task updateProcessInformationsTask; private Task loadSymbolsTask; private CancellationTokenSource loadSymbolsTaskToken; @@ -37,36 +45,55 @@ public partial class MainForm : IconForm public MenuStrip MainMenu => mainMenuStrip; + public ClassNode CurrentClassNode + { + get => currentClassNode; + set + { + currentClassNode = value; + + projectView.SelectedClass = value; + + memoryViewControl.Reset(); + memoryViewControl.Invalidate(); + } + } + + private void UpdateWindowTitle(string extra = null) + { + var title = $"{(Program.Settings.RandomizeWindowTitle ? Utils.RandomString(Program.GlobalRandom.Next(15, 20)) : Constants.ApplicationName)} ({Constants.Platform})"; + if (!string.IsNullOrEmpty(extra)) + { + title += $" - {extra}"; + } + Text = title; + } + public MainForm() { Contract.Ensures(pluginManager != null); Contract.Ensures(currentProject != null); InitializeComponent(); - - Text = $"{Constants.ApplicationName} ({Constants.Platform})"; + UpdateWindowTitle(); mainMenuStrip.Renderer = new CustomToolStripProfessionalRenderer(true, true); toolStrip.Renderer = new CustomToolStripProfessionalRenderer(true, false); + isLittleEndianToolStripMenuItem.Checked = BitConverter.IsLittleEndian; Program.RemoteProcess.ProcessAttached += sender => { var text = $"{sender.UnderlayingProcess.Name} (ID: {sender.UnderlayingProcess.Id.ToString()})"; - - Text = $"{Constants.ApplicationName} ({Constants.Platform}) - {text}"; processInfoToolStripStatusLabel.Text = text; + UpdateWindowTitle(text); + }; Program.RemoteProcess.ProcessClosed += sender => { - Text = $"{Constants.ApplicationName} ({Constants.Platform})"; + UpdateWindowTitle(); processInfoToolStripStatusLabel.Text = "No process selected"; }; - memoryViewControl.Memory = new MemoryBuffer - { - Process = Program.RemoteProcess - }; - pluginManager = new PluginManager(new DefaultPluginHost(this, Program.RemoteProcess, Program.Logger)); } @@ -141,7 +168,7 @@ private async void MainForm_FormClosing(object sender, FormClosingEventArgs e) } catch { - + // ignored } loadSymbolsTask = null; @@ -155,7 +182,7 @@ private async void MainForm_FormClosing(object sender, FormClosingEventArgs e) } catch { - + // ignored } updateProcessInformationsTask = null; @@ -236,15 +263,14 @@ private void mergeWithProjectToolStripMenuItem_Click(object sender, EventArgs e) private void goToClassToolStripMenuItem_Click(object sender, EventArgs e) { - using (var csf = new ClassSelectionForm(currentProject.Classes.OrderBy(c => c.Name))) + using var csf = new ClassSelectionForm(currentProject.Classes.OrderBy(c => c.Name)); + + if (csf.ShowDialog() == DialogResult.OK) { - if (csf.ShowDialog() == DialogResult.OK) + var selectedClassNode = csf.SelectedClass; + if (selectedClassNode != null) { - var selectedClassNode = csf.SelectedClass; - if (selectedClassNode != null) - { - projectView.SelectedClass = selectedClassNode; - } + projectView.SelectedClass = selectedClassNode; } } } @@ -252,8 +278,6 @@ private void goToClassToolStripMenuItem_Click(object sender, EventArgs e) private void clearProjectToolStripMenuItem_Click(object sender, EventArgs e) { SetProject(new ReClassNetProject()); - - memoryViewControl.ClassNode = null; } private void saveToolStripMenuItem_Click(object sender, EventArgs e) @@ -281,34 +305,32 @@ private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) return; } - using (var sfd = new SaveFileDialog()) + using var sfd = new SaveFileDialog { - sfd.DefaultExt = ReClassNetFile.FileExtension; - sfd.Filter = $"{ReClassNetFile.FormatName} (*{ReClassNetFile.FileExtension})|*{ReClassNetFile.FileExtension}"; + DefaultExt = ReClassNetFile.FileExtension, + Filter = $"{ReClassNetFile.FormatName} (*{ReClassNetFile.FileExtension})|*{ReClassNetFile.FileExtension}" + }; - if (sfd.ShowDialog() == DialogResult.OK) - { - currentProject.Path = sfd.FileName; + if (sfd.ShowDialog() == DialogResult.OK) + { + currentProject.Path = sfd.FileName; - saveToolStripMenuItem_Click(sender, e); - } + saveToolStripMenuItem_Click(sender, e); } } private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { - using (var sd = new SettingsForm(Program.Settings, CurrentProject.TypeMapping)) - { - sd.ShowDialog(); - } + using var sd = new SettingsForm(Program.Settings, CurrentProject.TypeMapping); + + sd.ShowDialog(); } private void pluginsToolStripButton_Click(object sender, EventArgs e) { - using (var pf = new PluginForm(pluginManager)) - { - pf.ShowDialog(); - } + using var pf = new PluginForm(pluginManager); + + pf.ShowDialog(); } private void quitToolStripMenuItem_Click(object sender, EventArgs e) @@ -331,22 +353,28 @@ private void namedAddressesToolStripMenuItem_Click(object sender, EventArgs e) new NamedAddressesForm(Program.RemoteProcess).Show(); } + private void isLittleEndianToolStripMenuItem_Click(object sender, EventArgs e) + { + Program.RemoteProcess.BitConverter = isLittleEndianToolStripMenuItem.Checked ? (EndianBitConverter)EndianBitConverter.Little : EndianBitConverter.Big; + } + private void loadSymbolToolStripMenuItem_Click(object sender, EventArgs e) { - using (var ofd = new OpenFileDialog()) + using var ofd = new OpenFileDialog { - ofd.Filter = "Program Debug Database (*.pdb)|*.pdb|All Files (*.*)|*.*"; + Filter = "Program Debug Database (*.pdb)|*.pdb|All Files (*.*)|*.*" + }; + - if (ofd.ShowDialog() == DialogResult.OK) + if (ofd.ShowDialog() == DialogResult.OK) + { + try { - try - { - Program.RemoteProcess.Symbols.LoadSymbolsFromPDB(ofd.FileName); - } - catch (Exception ex) - { - Program.Logger.Log(ex); - } + Program.RemoteProcess.Symbols.LoadSymbolsFromPDB(ofd.FileName); + } + catch (Exception ex) + { + Program.Logger.Log(ex); } } } @@ -393,10 +421,9 @@ private void generateCSharpCodeToolStripMenuItem_Click(object sender, EventArgs private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { - using (var af = new AboutForm()) - { - af.ShowDialog(); - } + using var af = new AboutForm(); + + af.ShowDialog(); } #endregion @@ -405,18 +432,17 @@ private void aboutToolStripMenuItem_Click(object sender, EventArgs e) private void attachToProcessToolStripSplitButton_ButtonClick(object sender, EventArgs e) { - using (var pb = new ProcessBrowserForm(Program.Settings.LastProcess)) + using var pb = new ProcessBrowserForm(Program.Settings.LastProcess); + + if (pb.ShowDialog() == DialogResult.OK) { - if (pb.ShowDialog() == DialogResult.OK) + if (pb.SelectedProcess != null) { - if (pb.SelectedProcess != null) - { - AttachToProcess(pb.SelectedProcess); + AttachToProcess(pb.SelectedProcess); - if (pb.LoadSymbols) - { - LoadAllSymbolsForCurrentProcess(); - } + if (pb.LoadSymbols) + { + LoadAllSymbolsForCurrentProcess(); } } } @@ -447,29 +473,30 @@ private void selectedNodeContextMenuStrip_Opening(object sender, CancelEventArgs var parentNode = node?.GetParentContainer(); var nodeIsClass = node is ClassNode; - var nodeIsSearchableValueNode = false; - switch (node) - { - case BaseHexNode _: - case FloatNode _: - case DoubleNode _: - case Int8Node _: - case UInt8Node _: - case Int16Node _: - case UInt16Node _: - case Int32Node _: - case UInt32Node _: - case Int64Node _: - case UInt64Node _: - case Utf8TextNode _: - case Utf16TextNode _: - case Utf32TextNode _: - nodeIsSearchableValueNode = true; - break; - } + var nodeIsContainer = node is BaseContainerNode; + var nodeIsSearchableValueNode = node switch + { + BaseHexNode _ => true, + FloatNode _ => true, + DoubleNode _ => true, + Int8Node _ => true, + UInt8Node _ => true, + Int16Node _ => true, + UInt16Node _ => true, + Int32Node _ => true, + UInt32Node _ => true, + Int64Node _ => true, + UInt64Node _ => true, + NIntNode _ => true, + NUIntNode _ => true, + Utf8TextNode _ => true, + Utf16TextNode _ => true, + Utf32TextNode _ => true, + _ => false + }; - addBytesToolStripMenuItem.Enabled = parentNode != null || nodeIsClass; - insertBytesToolStripMenuItem.Enabled = count == 1 && parentNode != null; + addBytesToolStripMenuItem.Enabled = parentNode != null || nodeIsContainer; + insertBytesToolStripMenuItem.Enabled = count == 1 && parentNode != null && !nodeIsContainer; changeTypeToolStripMenuItem.Enabled = count > 0 && !nodeIsClass; @@ -555,7 +582,7 @@ private void dissectNodesToolStripMenuItem_Click(object sender, EventArgs e) foreach (var g in hexNodes.GroupBy(n => n.Node.GetParentContainer())) { - NodeDissector.DissectNodes(g.Select(h => (BaseHexNode)h.Node), g.First().Memory); + NodeDissector.DissectNodes(g.Select(h => (BaseHexNode)h.Node), Program.RemoteProcess, g.First().Memory); } ClearSelection(); @@ -569,6 +596,8 @@ private void searchForEqualValuesToolStripMenuItem_Click(object sender, EventArg return; } + var bitConverter = Program.RemoteProcess.BitConverter; + IScanComparer comparer; switch (selectedNode.Node) { @@ -576,10 +605,10 @@ private void searchForEqualValuesToolStripMenuItem_Click(object sender, EventArg comparer = new ArrayOfBytesMemoryComparer(node.ReadValueFromMemory(selectedNode.Memory)); break; case FloatNode node: - comparer = new FloatMemoryComparer(ScanCompareType.Equal, ScanRoundMode.Normal, 2, node.ReadValueFromMemory(selectedNode.Memory), 0); + comparer = new FloatMemoryComparer(ScanCompareType.Equal, ScanRoundMode.Normal, 2, node.ReadValueFromMemory(selectedNode.Memory), 0.0f, bitConverter); break; case DoubleNode node: - comparer = new DoubleMemoryComparer(ScanCompareType.Equal, ScanRoundMode.Normal, 2, node.ReadValueFromMemory(selectedNode.Memory), 0); + comparer = new DoubleMemoryComparer(ScanCompareType.Equal, ScanRoundMode.Normal, 2, node.ReadValueFromMemory(selectedNode.Memory), 0.0, bitConverter); break; case Int8Node node: comparer = new ByteMemoryComparer(ScanCompareType.Equal, (byte)node.ReadValueFromMemory(selectedNode.Memory), 0); @@ -588,23 +617,43 @@ private void searchForEqualValuesToolStripMenuItem_Click(object sender, EventArg comparer = new ByteMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0); break; case Int16Node node: - comparer = new ShortMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0); + comparer = new ShortMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0, bitConverter); break; case UInt16Node node: - comparer = new ShortMemoryComparer(ScanCompareType.Equal, (short)node.ReadValueFromMemory(selectedNode.Memory), 0); + comparer = new ShortMemoryComparer(ScanCompareType.Equal, (short)node.ReadValueFromMemory(selectedNode.Memory), 0, bitConverter); break; case Int32Node node: - comparer = new IntegerMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0); + comparer = new IntegerMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0, bitConverter); break; case UInt32Node node: - comparer = new IntegerMemoryComparer(ScanCompareType.Equal, (int)node.ReadValueFromMemory(selectedNode.Memory), 0); + comparer = new IntegerMemoryComparer(ScanCompareType.Equal, (int)node.ReadValueFromMemory(selectedNode.Memory), 0, bitConverter); break; case Int64Node node: - comparer = new LongMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0); + comparer = new LongMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0L, bitConverter); break; case UInt64Node node: - comparer = new LongMemoryComparer(ScanCompareType.Equal, (long)node.ReadValueFromMemory(selectedNode.Memory), 0); + comparer = new LongMemoryComparer(ScanCompareType.Equal, (long)node.ReadValueFromMemory(selectedNode.Memory), 0L, bitConverter); + break; + case NIntNode node: + { + var value = node.ReadValueFromMemory(selectedNode.Memory); +#if RECLASSNET64 + comparer = new LongMemoryComparer(ScanCompareType.Equal, value.ToInt64(), 0L, bitConverter); +#else + comparer = new IntegerMemoryComparer(ScanCompareType.Equal, value.ToInt32(), 0, bitConverter); +#endif + break; + } + case NUIntNode node: + { + var value = node.ReadValueFromMemory(selectedNode.Memory); +#if RECLASSNET64 + comparer = new LongMemoryComparer(ScanCompareType.Equal, (long)value.ToUInt64(), 0L, bitConverter); +#else + comparer = new IntegerMemoryComparer(ScanCompareType.Equal, (int)value.ToUInt32(), 0, bitConverter); +#endif break; + } case Utf8TextNode node: comparer = new StringMemoryComparer(node.ReadValueFromMemory(selectedNode.Memory), Encoding.UTF8, true); break; @@ -697,7 +746,7 @@ private void shrinkClassToolStripMenuItem_Click(object sender, EventArgs e) } } - #endregion +#endregion private void MainForm_DragEnter(object sender, DragEventArgs e) { @@ -710,7 +759,6 @@ private void MainForm_DragEnter(object sender, DragEventArgs e) case ReClassNetFile.FileExtension: case ReClassQtFile.FileExtension: case ReClassFile.FileExtension: - case ReClass2007File.FileExtension: e.Effect = DragDropEffects.Copy; break; } @@ -747,27 +795,27 @@ private void processUpdateTimer_Tick(object sender, EventArgs e) private void classesView_ClassSelected(object sender, ClassNode node) { - memoryViewControl.ClassNode = node; - - memoryViewControl.Invalidate(); + CurrentClassNode = node; } - private void memoryViewControl_KeyDown(object sender, KeyEventArgs e) + private void memoryViewControl_KeyDown(object sender, KeyEventArgs args) { - if (e.Control) + switch (args.KeyCode) { - if (e.KeyCode == Keys.C) - { + case Keys.C when args.Control: CopySelectedNodesToClipboard(); - } - else if (e.KeyCode == Keys.V) - { + break; + case Keys.V when args.Control: PasteNodeFromClipboardToSelection(); - } - } - else if (e.KeyCode == Keys.Delete) - { - RemoveSelectedNodes(); + break; + + case Keys.Delete: + RemoveSelectedNodes(); + break; + + case Keys.F2: + EditSelectedNodeName(); + break; } } @@ -782,11 +830,13 @@ private void memoryViewControl_SelectionChanged(object sender, EventArgs e) var node = selectedNodes.FirstOrDefault()?.Node; var parentContainer = node?.GetParentContainer(); + var nodeIsClass = node is ClassNode; + var isContainerNode = node is BaseContainerNode; - addBytesToolStripDropDownButton.Enabled = parentContainer != null || node is ClassNode; - insertBytesToolStripDropDownButton.Enabled = selectedNodes.Count == 1 && parentContainer != null; + addBytesToolStripDropDownButton.Enabled = parentContainer != null || isContainerNode; + insertBytesToolStripDropDownButton.Enabled = selectedNodes.Count == 1 && parentContainer != null && !isContainerNode; - var enabled = selectedNodes.Count > 0 && !(node is ClassNode); + var enabled = selectedNodes.Count > 0 && !nodeIsClass; toolStrip.Items.OfType().ForEach(b => b.Enabled = enabled); } @@ -801,36 +851,34 @@ private void memoryViewControl_ChangeClassTypeClick(object sender, NodeClickEven Name = "None" }; - using (var csf = new ClassSelectionForm(noneClass.Yield().Concat(classes))) + using var csf = new ClassSelectionForm(classes.Prepend(noneClass)); + + if (csf.ShowDialog() == DialogResult.OK) { - if (csf.ShowDialog() == DialogResult.OK) + var selectedClassNode = csf.SelectedClass; + if (selectedClassNode != null) { - var selectedClassNode = csf.SelectedClass; - if (selectedClassNode != null) + if (selectedClassNode == noneClass) { - if (selectedClassNode == noneClass) - { - selectedClassNode = null; - } - - functionNode.BelongsToClass = selectedClassNode; + selectedClassNode = null; } + + functionNode.BelongsToClass = selectedClassNode; } } } else if (e.Node is BaseWrapperNode refNode) { - using (var csf = new ClassSelectionForm(classes)) + using var csf = new ClassSelectionForm(classes); + + if (csf.ShowDialog() == DialogResult.OK) { - if (csf.ShowDialog() == DialogResult.OK) + var selectedClassNode = csf.SelectedClass; + if (refNode.CanChangeInnerNodeTo(selectedClassNode)) { - var selectedClassNode = csf.SelectedClass; - if (refNode.CanChangeInnerNodeTo(selectedClassNode)) + if (!refNode.GetRootWrapperNode().ShouldPerformCycleCheckForInnerNode() || IsCycleFree(e.Node.GetParentClass(), selectedClassNode)) { - if (!refNode.GetRootWrapperNode().ShouldPerformCycleCheckForInnerNode() || IsCycleFree(e.Node.GetParentClass(), selectedClassNode)) - { - refNode.ChangeInnerNode(selectedClassNode); - } + refNode.ChangeInnerNode(selectedClassNode); } } } @@ -860,26 +908,25 @@ private void memoryViewControl_ChangeEnumTypeClick(object sender, NodeClickEvent { if (e.Node is EnumNode enumNode) { - using (var csf = new EnumSelectionForm(CurrentProject)) - { - var size = enumNode.Enum.Size; + using var csf = new EnumSelectionForm(CurrentProject); - if (csf.ShowDialog() == DialogResult.OK) - { - var @enum = csf.SelectedItem; - if (@enum != null) - { - enumNode.ChangeEnum(@enum); - } - } + var size = enumNode.Enum.Size; - if (size != enumNode.Enum.Size) + if (csf.ShowDialog() == DialogResult.OK) + { + var @enum = csf.SelectedItem; + if (@enum != null) { - // Update the parent container because the enum size has changed. - enumNode.GetParentContainer()?.ChildHasChanged(enumNode); + enumNode.ChangeEnum(@enum); } } + if (size != enumNode.Enum.Size) + { + // Update the parent container because the enum size has changed. + enumNode.GetParentContainer()?.ChildHasChanged(enumNode); + } + foreach (var @enum in CurrentProject.Enums) { projectView.UpdateEnumNode(@enum); @@ -953,10 +1000,9 @@ private void deleteClassToolStripMenuItem_Click(object sender, EventArgs e) private void editEnumsToolStripMenuItem_Click(object sender, EventArgs e) { - using (var elf = new EnumListForm(currentProject)) - { - elf.ShowDialog(); - } + using var elf = new EnumListForm(currentProject); + + elf.ShowDialog(); } private void editEnumToolStripMenuItem_Click(object sender, EventArgs e) @@ -964,18 +1010,45 @@ private void editEnumToolStripMenuItem_Click(object sender, EventArgs e) var @enum = projectView.SelectedEnum; if (@enum != null) { - using (var eef = new EnumEditorForm(@enum)) - { - eef.ShowDialog(); - } + using var eef = new EnumEditorForm(@enum); + + eef.ShowDialog(); } } private void showEnumsToolStripMenuItem_Click(object sender, EventArgs e) { - using (var elf = new EnumListForm(currentProject)) + using var elf = new EnumListForm(currentProject); + + elf.ShowDialog(); + } + + private void memoryViewControl_DrawContextRequested(object sender, DrawContextRequestEventArgs args) + { + var process = Program.RemoteProcess; + + var classNode = CurrentClassNode; + if (classNode != null) { - elf.ShowDialog(); + memoryViewBuffer.Size = classNode.MemorySize; + + IntPtr address; + try + { + address = process.ParseAddress(classNode.AddressFormula); + } + catch (ParseException) + { + address = IntPtr.Zero; + } + memoryViewBuffer.UpdateFrom(process, address); + + args.Settings = Program.Settings; + args.IconProvider = iconProvider; + args.Process = process; + args.Memory = memoryViewBuffer; + args.Node = classNode; + args.BaseAddress = address; } } } diff --git a/ReClass.NET/Forms/NamedAddressesForm.Designer.cs b/ReClass.NET/Forms/NamedAddressesForm.Designer.cs index ed7e807c..a6a8a6e3 100644 --- a/ReClass.NET/Forms/NamedAddressesForm.Designer.cs +++ b/ReClass.NET/Forms/NamedAddressesForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class NamedAddressesForm { @@ -28,12 +30,12 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.bannerBox = new ReClassNET.UI.BannerBox(); - this.addressTextBox = new ReClassNET.UI.PlaceholderTextBox(); - this.nameTextBox = new ReClassNET.UI.PlaceholderTextBox(); + this.bannerBox = new BannerBox(); + this.addressTextBox = new PlaceholderTextBox(); + this.nameTextBox = new PlaceholderTextBox(); this.namedAddressesListBox = new System.Windows.Forms.ListBox(); - this.removeAddressIconButton = new ReClassNET.UI.IconButton(); - this.addAddressIconButton = new ReClassNET.UI.IconButton(); + this.removeAddressIconButton = new IconButton(); + this.addAddressIconButton = new IconButton(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); this.SuspendLayout(); // @@ -128,11 +130,11 @@ private void InitializeComponent() #endregion - private UI.BannerBox bannerBox; - private UI.PlaceholderTextBox addressTextBox; - private UI.PlaceholderTextBox nameTextBox; + private BannerBox bannerBox; + private PlaceholderTextBox addressTextBox; + private PlaceholderTextBox nameTextBox; private System.Windows.Forms.ListBox namedAddressesListBox; - private UI.IconButton removeAddressIconButton; - private UI.IconButton addAddressIconButton; + private IconButton removeAddressIconButton; + private IconButton addAddressIconButton; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/PluginForm.Designer.cs b/ReClass.NET/Forms/PluginForm.Designer.cs index 0caecd06..c1df5042 100644 --- a/ReClass.NET/Forms/PluginForm.Designer.cs +++ b/ReClass.NET/Forms/PluginForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class PluginForm { @@ -33,17 +35,17 @@ private void InitializeComponent() this.descriptionGroupBox = new System.Windows.Forms.GroupBox(); this.descriptionLabel = new System.Windows.Forms.Label(); this.pluginsDataGridView = new System.Windows.Forms.DataGridView(); - this.iconColumn = new System.Windows.Forms.DataGridViewImageColumn(); - this.nameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.versionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.authorColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.nativesTabPage = new System.Windows.Forms.TabPage(); this.label2 = new System.Windows.Forms.Label(); this.functionsProvidersComboBox = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.getMoreLinkLabel = new System.Windows.Forms.LinkLabel(); this.closeButton = new System.Windows.Forms.Button(); - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new ReClassNET.Controls.BannerBox(); + this.iconColumn = new System.Windows.Forms.DataGridViewImageColumn(); + this.nameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.versionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.authorColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabControl.SuspendLayout(); this.pluginsTabPage.SuspendLayout(); this.descriptionGroupBox.SuspendLayout(); @@ -117,43 +119,6 @@ private void InitializeComponent() this.pluginsDataGridView.TabIndex = 0; this.pluginsDataGridView.SelectionChanged += new System.EventHandler(this.pluginsDataGridView_SelectionChanged); // - // iconColumn - // - this.iconColumn.DataPropertyName = "Icon"; - this.iconColumn.HeaderText = ""; - this.iconColumn.MinimumWidth = 18; - this.iconColumn.Name = "iconColumn"; - this.iconColumn.ReadOnly = true; - this.iconColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.iconColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.iconColumn.Width = 18; - // - // nameColumn - // - this.nameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.nameColumn.DataPropertyName = "Name"; - this.nameColumn.HeaderText = "Name"; - this.nameColumn.Name = "nameColumn"; - this.nameColumn.ReadOnly = true; - // - // versionColumn - // - this.versionColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.versionColumn.DataPropertyName = "Version"; - this.versionColumn.HeaderText = "Version"; - this.versionColumn.Name = "versionColumn"; - this.versionColumn.ReadOnly = true; - this.versionColumn.Width = 67; - // - // authorColumn - // - this.authorColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.authorColumn.DataPropertyName = "Author"; - this.authorColumn.HeaderText = "Author"; - this.authorColumn.Name = "authorColumn"; - this.authorColumn.ReadOnly = true; - this.authorColumn.Width = 63; - // // nativesTabPage // this.nativesTabPage.Controls.Add(this.label2); @@ -231,6 +196,44 @@ private void InitializeComponent() this.bannerBox.Text = "Here you can configure all loaded ReClass.NET plugins."; this.bannerBox.Title = "Plugins"; // + // iconColumn + // + this.iconColumn.DataPropertyName = "Icon"; + this.iconColumn.HeaderText = ""; + this.iconColumn.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; + this.iconColumn.MinimumWidth = 18; + this.iconColumn.Name = "iconColumn"; + this.iconColumn.ReadOnly = true; + this.iconColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.iconColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.iconColumn.Width = 18; + // + // nameColumn + // + this.nameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.nameColumn.DataPropertyName = "Name"; + this.nameColumn.HeaderText = "Name"; + this.nameColumn.Name = "nameColumn"; + this.nameColumn.ReadOnly = true; + // + // versionColumn + // + this.versionColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.versionColumn.DataPropertyName = "Version"; + this.versionColumn.HeaderText = "Version"; + this.versionColumn.Name = "versionColumn"; + this.versionColumn.ReadOnly = true; + this.versionColumn.Width = 67; + // + // authorColumn + // + this.authorColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.authorColumn.DataPropertyName = "Author"; + this.authorColumn.HeaderText = "Author"; + this.authorColumn.Name = "authorColumn"; + this.authorColumn.ReadOnly = true; + this.authorColumn.Width = 63; + // // PluginForm // this.AcceptButton = this.closeButton; @@ -271,12 +274,12 @@ private void InitializeComponent() private System.Windows.Forms.Button closeButton; private System.Windows.Forms.Label descriptionLabel; private System.Windows.Forms.Label label1; + private BannerBox bannerBox; + private System.Windows.Forms.ComboBox functionsProvidersComboBox; + private System.Windows.Forms.Label label2; private System.Windows.Forms.DataGridViewImageColumn iconColumn; private System.Windows.Forms.DataGridViewTextBoxColumn nameColumn; private System.Windows.Forms.DataGridViewTextBoxColumn versionColumn; private System.Windows.Forms.DataGridViewTextBoxColumn authorColumn; - private UI.BannerBox bannerBox; - private System.Windows.Forms.ComboBox functionsProvidersComboBox; - private System.Windows.Forms.Label label2; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/PluginForm.cs b/ReClass.NET/Forms/PluginForm.cs index c8493df2..81577f7f 100644 --- a/ReClass.NET/Forms/PluginForm.cs +++ b/ReClass.NET/Forms/PluginForm.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Diagnostics.Contracts; using System.Drawing; diff --git a/ReClass.NET/Forms/ProcessBrowserForm.Designer.cs b/ReClass.NET/Forms/ProcessBrowserForm.Designer.cs index d8677633..d4e111d5 100644 --- a/ReClass.NET/Forms/ProcessBrowserForm.Designer.cs +++ b/ReClass.NET/Forms/ProcessBrowserForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class ProcessBrowserForm { @@ -42,7 +44,7 @@ private void InitializeComponent() this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.filterTextBox = new System.Windows.Forms.TextBox(); - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new BannerBox(); ((System.ComponentModel.ISupportInitialize)(this.processDataGridView)).BeginInit(); this.filterGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); @@ -271,6 +273,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox filterTextBox; - private UI.BannerBox bannerBox; + private BannerBox bannerBox; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/ProcessBrowserForm.cs b/ReClass.NET/Forms/ProcessBrowserForm.cs index 9478a06f..d4ed7cb3 100644 --- a/ReClass.NET/Forms/ProcessBrowserForm.cs +++ b/ReClass.NET/Forms/ProcessBrowserForm.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Data; using System.Drawing; using System.Linq; @@ -131,7 +131,7 @@ private void ApplyFilter() var filter = filterTextBox.Text; if (!string.IsNullOrEmpty(filter)) { - filter = $"name like '%{filter}%' or path like '%{filter}%'"; + filter = $"name like '%{filter}%' or path like '%{filter}%' or CONVERT(id, System.String) like '%{filter}%'"; } ((DataTable)processDataGridView.DataSource).DefaultView.RowFilter = filter; } diff --git a/ReClass.NET/Forms/ProcessInfoForm.Designer.cs b/ReClass.NET/Forms/ProcessInfoForm.Designer.cs index c4d9e46b..90fa7959 100644 --- a/ReClass.NET/Forms/ProcessInfoForm.Designer.cs +++ b/ReClass.NET/Forms/ProcessInfoForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class ProcessInfoForm { @@ -41,7 +43,7 @@ private void InitializeComponent() this.protectionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.typeColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.moduleColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.bannerBox1 = new ReClassNET.UI.BannerBox(); + this.bannerBox1 = new ReClassNET.Controls.BannerBox(); this.tabControl = new System.Windows.Forms.TabControl(); this.modulesTabPage = new System.Windows.Forms.TabPage(); this.modulesDataGridView = new System.Windows.Forms.DataGridView(); @@ -69,6 +71,7 @@ private void InitializeComponent() this.dumpToolStripMenuItem}); this.contextMenuStrip.Name = "contextMenuStrip"; this.contextMenuStrip.Size = new System.Drawing.Size(203, 98); + this.contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_Opening); // // setCurrentClassAddressToolStripMenuItem // @@ -113,13 +116,13 @@ private void InitializeComponent() this.protectionColumn, this.typeColumn, this.moduleColumn}); + this.sectionsDataGridView.ContextMenuStrip = this.contextMenuStrip; this.sectionsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; this.sectionsDataGridView.Location = new System.Drawing.Point(3, 3); this.sectionsDataGridView.MultiSelect = false; this.sectionsDataGridView.Name = "sectionsDataGridView"; this.sectionsDataGridView.ReadOnly = true; this.sectionsDataGridView.RowHeadersVisible = false; - this.sectionsDataGridView.RowTemplate.ContextMenuStrip = this.contextMenuStrip; this.sectionsDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.sectionsDataGridView.Size = new System.Drawing.Size(796, 386); this.sectionsDataGridView.TabIndex = 0; @@ -227,13 +230,13 @@ private void InitializeComponent() this.moduleAddressDataGridViewTextBoxColumn, this.moduleSizeDataGridViewTextBoxColumn, this.modulePathDataGridViewTextBoxColumn}); + this.modulesDataGridView.ContextMenuStrip = this.contextMenuStrip; this.modulesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; this.modulesDataGridView.Location = new System.Drawing.Point(3, 3); this.modulesDataGridView.MultiSelect = false; this.modulesDataGridView.Name = "modulesDataGridView"; this.modulesDataGridView.ReadOnly = true; this.modulesDataGridView.RowHeadersVisible = false; - this.modulesDataGridView.RowTemplate.ContextMenuStrip = this.contextMenuStrip; this.modulesDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.modulesDataGridView.Size = new System.Drawing.Size(796, 386); this.modulesDataGridView.TabIndex = 1; @@ -325,7 +328,7 @@ private void InitializeComponent() private System.Windows.Forms.ContextMenuStrip contextMenuStrip; private System.Windows.Forms.ToolStripMenuItem setCurrentClassAddressToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem createClassAtAddressToolStripMenuItem; - private UI.BannerBox bannerBox1; + private BannerBox bannerBox1; private System.Windows.Forms.TabControl tabControl; private System.Windows.Forms.TabPage modulesTabPage; private System.Windows.Forms.DataGridView modulesDataGridView; diff --git a/ReClass.NET/Forms/ProcessInfoForm.cs b/ReClass.NET/Forms/ProcessInfoForm.cs index 5c1e5fe0..fc56d3eb 100644 --- a/ReClass.NET/Forms/ProcessInfoForm.cs +++ b/ReClass.NET/Forms/ProcessInfoForm.cs @@ -1,4 +1,5 @@ -using System; +using System; +using System.ComponentModel; using System.Data; using System.Diagnostics.Contracts; using System.Drawing; @@ -14,12 +15,12 @@ namespace ReClassNET.Forms { public partial class ProcessInfoForm : IconForm { - private readonly RemoteProcess process; + private readonly IProcessReader process; /// The context menu of the sections grid view. public ContextMenuStrip GridContextMenu => contextMenuStrip; - public ProcessInfoForm(RemoteProcess process) + public ProcessInfoForm(IProcessReader process) { Contract.Requires(process != null); @@ -61,34 +62,30 @@ protected override void OnFormClosed(FormClosedEventArgs e) private async void ProcessInfoForm_Load(object sender, EventArgs e) { - if (!process.IsValid) - { - return; - } - - var sections = new DataTable(); - sections.Columns.Add("address", typeof(string)); - sections.Columns.Add("size", typeof(string)); - sections.Columns.Add("name", typeof(string)); - sections.Columns.Add("protection", typeof(string)); - sections.Columns.Add("type", typeof(string)); - sections.Columns.Add("module", typeof(string)); - sections.Columns.Add("section", typeof(Section)); - - var modules = new DataTable(); - modules.Columns.Add("icon", typeof(Icon)); - modules.Columns.Add("name", typeof(string)); - modules.Columns.Add("address", typeof(string)); - modules.Columns.Add("size", typeof(string)); - modules.Columns.Add("path", typeof(string)); - modules.Columns.Add("module", typeof(Module)); + var sectionsTable = new DataTable(); + sectionsTable.Columns.Add("address", typeof(string)); + sectionsTable.Columns.Add("size", typeof(string)); + sectionsTable.Columns.Add("name", typeof(string)); + sectionsTable.Columns.Add("protection", typeof(string)); + sectionsTable.Columns.Add("type", typeof(string)); + sectionsTable.Columns.Add("module", typeof(string)); + sectionsTable.Columns.Add("section", typeof(Section)); + + var modulesTable = new DataTable(); + modulesTable.Columns.Add("icon", typeof(Icon)); + modulesTable.Columns.Add("name", typeof(string)); + modulesTable.Columns.Add("address", typeof(string)); + modulesTable.Columns.Add("size", typeof(string)); + modulesTable.Columns.Add("path", typeof(string)); + modulesTable.Columns.Add("module", typeof(Module)); await Task.Run(() => { - process.EnumerateRemoteSectionsAndModules( - delegate (Section section) + if (process.EnumerateRemoteSectionsAndModules(out var sections, out var modules)) + { + foreach (var section in sections) { - var row = sections.NewRow(); + var row = sectionsTable.NewRow(); row["address"] = section.Start.ToString(Constants.AddressHexFormat); row["size"] = section.Size.ToString(Constants.AddressHexFormat); row["name"] = section.Name; @@ -96,24 +93,24 @@ await Task.Run(() => row["type"] = section.Type.ToString(); row["module"] = section.ModuleName; row["section"] = section; - sections.Rows.Add(row); - }, - delegate (Module module) + sectionsTable.Rows.Add(row); + } + foreach (var module in modules) { - var row = modules.NewRow(); + var row = modulesTable.NewRow(); row["icon"] = NativeMethods.GetIconForFile(module.Path); row["name"] = module.Name; row["address"] = module.Start.ToString(Constants.AddressHexFormat); row["size"] = module.Size.ToString(Constants.AddressHexFormat); row["path"] = module.Path; row["module"] = module; - modules.Rows.Add(row); + modulesTable.Rows.Add(row); } - ); + } }); - sectionsDataGridView.DataSource = sections; - modulesDataGridView.DataSource = modules; + sectionsDataGridView.DataSource = sectionsTable; + modulesDataGridView.DataSource = modulesTable; } private void SelectRow_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) @@ -133,6 +130,13 @@ private void SelectRow_CellMouseDown(object sender, DataGridViewCellMouseEventAr } } + private void contextMenuStrip_Opening(object sender, CancelEventArgs e) + { + var sourceControl = (sender as ContextMenuStrip)?.SourceControl; + + e.Cancel = sourceControl == null || (sourceControl == modulesDataGridView && GetSelectedModule() == null) || (sourceControl == sectionsDataGridView && GetSelectedSection() == null); + } + private void setCurrentClassAddressToolStripMenuItem_Click(object sender, EventArgs e) { LinkedWindowFeatures.SetCurrentClassAddress(GetSelectedAddress(sender)); @@ -145,11 +149,8 @@ private void createClassAtAddressToolStripMenuItem_Click(object sender, EventArg private void dumpToolStripMenuItem_Click(object sender, EventArgs e) { - bool isModule; - string fileName; - var initialDirectory = string.Empty; - IntPtr address; - int size; + Func createDialogFn; + Action dumpFn; if (GetToolStripSourceControl(sender) == modulesDataGridView) { @@ -159,11 +160,18 @@ private void dumpToolStripMenuItem_Click(object sender, EventArgs e) return; } - isModule = true; - fileName = $"{Path.GetFileNameWithoutExtension(module.Name)}_Dumped{Path.GetExtension(module.Name)}"; - initialDirectory = Path.GetDirectoryName(module.Path); - address = module.Start; - size = module.Size.ToInt32(); + createDialogFn = () => new SaveFileDialog + { + FileName = $"{Path.GetFileNameWithoutExtension(module.Name)}_Dumped{Path.GetExtension(module.Name)}", + InitialDirectory = Path.GetDirectoryName(module.Path) + }; + + dumpFn = (reader, stream) => + { + Dumper.DumpModule(reader, module, stream); + + MessageBox.Show("Module successfully dumped.", Constants.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); + }; } else { @@ -173,43 +181,36 @@ private void dumpToolStripMenuItem_Click(object sender, EventArgs e) return; } - isModule = false; - fileName = $"Section_{section.Start.ToString("X")}_{section.End.ToString("X")}.dat"; - address = section.Start; - size = section.Size.ToInt32(); + createDialogFn = () => new SaveFileDialog + { + FileName = $"Section_{section.Start.ToString("X")}_{section.End.ToString("X")}.dat" + }; + + dumpFn = (reader, stream) => + { + Dumper.DumpSection(reader, section, stream); + + MessageBox.Show("Section successfully dumped.", Constants.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); + }; } - using (var sfd = new SaveFileDialog()) + using var sfd = createDialogFn(); + sfd.Filter = "All|*.*"; + + if (sfd.ShowDialog() != DialogResult.OK) { - sfd.FileName = fileName; - sfd.Filter = "All|*.*"; - sfd.InitialDirectory = initialDirectory; + return; + } - if (sfd.ShowDialog() == DialogResult.OK) - { - var dumper = new Dumper(process); + try + { + using var stream = sfd.OpenFile(); - try - { - using (var stream = sfd.OpenFile()) - { - if (isModule) - { - dumper.DumpModule(address, size, stream); - } - else - { - dumper.DumpSection(address, size, stream); - } - - MessageBox.Show("Module successfully dumped.", Constants.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - catch (Exception ex) - { - Program.ShowException(ex); - } - } + dumpFn(process, stream); + } + catch (Exception ex) + { + Program.ShowException(ex); } } @@ -228,13 +229,10 @@ private IntPtr GetSelectedAddress(object sender) { return GetSelectedModule()?.Start ?? IntPtr.Zero; } - else - { - return GetSelectedSection()?.Start ?? IntPtr.Zero; - } + return GetSelectedSection()?.Start ?? IntPtr.Zero; } - private Control GetToolStripSourceControl(object sender) + private static Control GetToolStripSourceControl(object sender) { return ((sender as ToolStripMenuItem)?.GetCurrentParent() as ContextMenuStrip)?.SourceControl; } diff --git a/ReClass.NET/Forms/ScannerForm.Designer.cs b/ReClass.NET/Forms/ScannerForm.Designer.cs index bbd88cb9..d6fd02ac 100644 --- a/ReClass.NET/Forms/ScannerForm.Designer.cs +++ b/ReClass.NET/Forms/ScannerForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class ScannerForm { @@ -29,20 +31,23 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new ReClassNET.Controls.BannerBox(); this.filterGroupBox = new System.Windows.Forms.GroupBox(); this.valueTypeComboBox = new ReClassNET.Forms.ScannerForm.ScanValueTypeComboBox(); this.label3 = new System.Windows.Forms.Label(); this.compareTypeComboBox = new ReClassNET.Forms.ScannerForm.ScanCompareTypeComboBox(); this.label1 = new System.Windows.Forms.Label(); this.isHexCheckBox = new System.Windows.Forms.CheckBox(); - this.dualValueBox = new ReClassNET.UI.DualValueBox(); + this.dualValueBox = new ReClassNET.Controls.DualValueBox(); this.scanOptionsGroupBox = new System.Windows.Forms.GroupBox(); this.fastScanAlignmentTextBox = new System.Windows.Forms.TextBox(); this.fastScanCheckBox = new System.Windows.Forms.CheckBox(); this.scanCopyOnWriteCheckBox = new System.Windows.Forms.CheckBox(); this.scanExecutableCheckBox = new System.Windows.Forms.CheckBox(); this.scanWritableCheckBox = new System.Windows.Forms.CheckBox(); + this.scanMappedCheckBox = new System.Windows.Forms.CheckBox(); + this.scanImageCheckBox = new System.Windows.Forms.CheckBox(); + this.scanPrivateCheckBox = new System.Windows.Forms.CheckBox(); this.stopAddressTextBox = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.startAddressTextBox = new System.Windows.Forms.TextBox(); @@ -62,7 +67,7 @@ private void InitializeComponent() this.scanProgressBar = new System.Windows.Forms.ProgressBar(); this.resultCountLabel = new System.Windows.Forms.Label(); this.updateValuesTimer = new System.Windows.Forms.Timer(this.components); - this.resultMemoryRecordList = new ReClassNET.UI.MemoryRecordList(); + this.resultMemoryRecordList = new ReClassNET.Controls.MemoryRecordList(); this.resultListContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.addSelectedResultsToAddressListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeSelectedRecordsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -79,7 +84,7 @@ private void InitializeComponent() this.findOutWhatWritesToThisAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.copyAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.addressListMemoryRecordList = new ReClassNET.UI.MemoryRecordList(); + this.addressListMemoryRecordList = new ReClassNET.Controls.MemoryRecordList(); this.toolStripPanel = new System.Windows.Forms.ToolStripPanel(); this.menuToolStrip = new System.Windows.Forms.ToolStrip(); this.openAddressFileToolStripButton = new System.Windows.Forms.ToolStripButton(); @@ -88,9 +93,9 @@ private void InitializeComponent() this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.clearAddressListToolStripButton = new System.Windows.Forms.ToolStripButton(); this.infoToolTip = new System.Windows.Forms.ToolTip(this.components); - this.undoIconButton = new ReClassNET.UI.IconButton(); - this.showInputCorrelatorIconButton = new ReClassNET.UI.IconButton(); - this.cancelScanIconButton = new ReClassNET.UI.IconButton(); + this.undoIconButton = new ReClassNET.Controls.IconButton(); + this.showInputCorrelatorIconButton = new ReClassNET.Controls.IconButton(); + this.cancelScanIconButton = new ReClassNET.Controls.IconButton(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); this.filterGroupBox.SuspendLayout(); this.scanOptionsGroupBox.SuspendLayout(); @@ -191,6 +196,9 @@ private void InitializeComponent() this.scanOptionsGroupBox.Controls.Add(this.scanCopyOnWriteCheckBox); this.scanOptionsGroupBox.Controls.Add(this.scanExecutableCheckBox); this.scanOptionsGroupBox.Controls.Add(this.scanWritableCheckBox); + this.scanOptionsGroupBox.Controls.Add(this.scanMappedCheckBox); + this.scanOptionsGroupBox.Controls.Add(this.scanImageCheckBox); + this.scanOptionsGroupBox.Controls.Add(this.scanPrivateCheckBox); this.scanOptionsGroupBox.Controls.Add(this.stopAddressTextBox); this.scanOptionsGroupBox.Controls.Add(this.label4); this.scanOptionsGroupBox.Controls.Add(this.startAddressTextBox); @@ -198,37 +206,37 @@ private void InitializeComponent() this.scanOptionsGroupBox.Location = new System.Drawing.Point(3, 239); this.scanOptionsGroupBox.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); this.scanOptionsGroupBox.Name = "scanOptionsGroupBox"; - this.scanOptionsGroupBox.Size = new System.Drawing.Size(308, 120); + this.scanOptionsGroupBox.Size = new System.Drawing.Size(308, 141); this.scanOptionsGroupBox.TabIndex = 9; this.scanOptionsGroupBox.TabStop = false; this.scanOptionsGroupBox.Text = "Scan Options"; // // fastScanAlignmentTextBox // - this.fastScanAlignmentTextBox.Location = new System.Drawing.Point(133, 91); + this.fastScanAlignmentTextBox.Location = new System.Drawing.Point(144, 112); this.fastScanAlignmentTextBox.Name = "fastScanAlignmentTextBox"; this.fastScanAlignmentTextBox.Size = new System.Drawing.Size(26, 20); - this.fastScanAlignmentTextBox.TabIndex = 9; + this.fastScanAlignmentTextBox.TabIndex = 11; // // fastScanCheckBox // this.fastScanCheckBox.AutoSize = true; this.fastScanCheckBox.Checked = true; this.fastScanCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.fastScanCheckBox.Location = new System.Drawing.Point(9, 93); + this.fastScanCheckBox.Location = new System.Drawing.Point(9, 114); this.fastScanCheckBox.Name = "fastScanCheckBox"; this.fastScanCheckBox.Size = new System.Drawing.Size(129, 17); - this.fastScanCheckBox.TabIndex = 8; + this.fastScanCheckBox.TabIndex = 10; this.fastScanCheckBox.Text = "Fast Scan, Alignment:"; this.fastScanCheckBox.UseVisualStyleBackColor = true; // // scanCopyOnWriteCheckBox // this.scanCopyOnWriteCheckBox.AutoSize = true; - this.scanCopyOnWriteCheckBox.Location = new System.Drawing.Point(189, 68); + this.scanCopyOnWriteCheckBox.Location = new System.Drawing.Point(189, 91); this.scanCopyOnWriteCheckBox.Name = "scanCopyOnWriteCheckBox"; this.scanCopyOnWriteCheckBox.Size = new System.Drawing.Size(95, 17); - this.scanCopyOnWriteCheckBox.TabIndex = 7; + this.scanCopyOnWriteCheckBox.TabIndex = 9; this.scanCopyOnWriteCheckBox.Text = "Copy On Write"; this.scanCopyOnWriteCheckBox.ThreeState = true; this.scanCopyOnWriteCheckBox.UseVisualStyleBackColor = true; @@ -238,10 +246,10 @@ private void InitializeComponent() this.scanExecutableCheckBox.AutoSize = true; this.scanExecutableCheckBox.Checked = true; this.scanExecutableCheckBox.CheckState = System.Windows.Forms.CheckState.Indeterminate; - this.scanExecutableCheckBox.Location = new System.Drawing.Point(91, 68); + this.scanExecutableCheckBox.Location = new System.Drawing.Point(91, 91); this.scanExecutableCheckBox.Name = "scanExecutableCheckBox"; this.scanExecutableCheckBox.Size = new System.Drawing.Size(79, 17); - this.scanExecutableCheckBox.TabIndex = 6; + this.scanExecutableCheckBox.TabIndex = 8; this.scanExecutableCheckBox.Text = "Executable"; this.scanExecutableCheckBox.ThreeState = true; this.scanExecutableCheckBox.UseVisualStyleBackColor = true; @@ -251,14 +259,48 @@ private void InitializeComponent() this.scanWritableCheckBox.AutoSize = true; this.scanWritableCheckBox.Checked = true; this.scanWritableCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.scanWritableCheckBox.Location = new System.Drawing.Point(9, 68); + this.scanWritableCheckBox.Location = new System.Drawing.Point(9, 91); this.scanWritableCheckBox.Name = "scanWritableCheckBox"; this.scanWritableCheckBox.Size = new System.Drawing.Size(65, 17); - this.scanWritableCheckBox.TabIndex = 5; + this.scanWritableCheckBox.TabIndex = 7; this.scanWritableCheckBox.Text = "Writable"; this.scanWritableCheckBox.ThreeState = true; this.scanWritableCheckBox.UseVisualStyleBackColor = true; // + // scanMappedCheckBox + // + this.scanMappedCheckBox.AutoSize = true; + this.scanMappedCheckBox.Location = new System.Drawing.Point(189, 68); + this.scanMappedCheckBox.Name = "scanMappedCheckBox"; + this.scanMappedCheckBox.Size = new System.Drawing.Size(65, 17); + this.scanMappedCheckBox.TabIndex = 6; + this.scanMappedCheckBox.Text = "Mapped"; + this.scanMappedCheckBox.UseVisualStyleBackColor = true; + // + // scanImageCheckBox + // + this.scanImageCheckBox.AutoSize = true; + this.scanImageCheckBox.Checked = true; + this.scanImageCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.scanImageCheckBox.Location = new System.Drawing.Point(91, 68); + this.scanImageCheckBox.Name = "scanImageCheckBox"; + this.scanImageCheckBox.Size = new System.Drawing.Size(55, 17); + this.scanImageCheckBox.TabIndex = 5; + this.scanImageCheckBox.Text = "Image"; + this.scanImageCheckBox.UseVisualStyleBackColor = true; + // + // scanPrivateCheckBox + // + this.scanPrivateCheckBox.AutoSize = true; + this.scanPrivateCheckBox.Checked = true; + this.scanPrivateCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.scanPrivateCheckBox.Location = new System.Drawing.Point(9, 68); + this.scanPrivateCheckBox.Name = "scanPrivateCheckBox"; + this.scanPrivateCheckBox.Size = new System.Drawing.Size(59, 17); + this.scanPrivateCheckBox.TabIndex = 4; + this.scanPrivateCheckBox.Text = "Private"; + this.scanPrivateCheckBox.UseVisualStyleBackColor = true; + // // stopAddressTextBox // this.stopAddressTextBox.Location = new System.Drawing.Point(66, 42); @@ -302,7 +344,7 @@ private void InitializeComponent() this.flowLayoutPanel.Location = new System.Drawing.Point(292, 80); this.flowLayoutPanel.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel.Name = "flowLayoutPanel"; - this.flowLayoutPanel.Size = new System.Drawing.Size(317, 294); + this.flowLayoutPanel.Size = new System.Drawing.Size(317, 314); this.flowLayoutPanel.TabIndex = 9; this.flowLayoutPanel.WrapContents = false; // @@ -471,9 +513,9 @@ private void InitializeComponent() this.resultMemoryRecordList.ShowPreviousValueColumn = true; this.resultMemoryRecordList.ShowValueColumn = true; this.resultMemoryRecordList.ShowValueTypeColumn = false; - this.resultMemoryRecordList.Size = new System.Drawing.Size(268, 292); + this.resultMemoryRecordList.Size = new System.Drawing.Size(268, 314); this.resultMemoryRecordList.TabIndex = 16; - this.resultMemoryRecordList.RecordDoubleClick += new ReClassNET.UI.MemorySearchResultControlResultDoubleClickEventHandler(this.memorySearchResultControl_ResultDoubleClick); + this.resultMemoryRecordList.RecordDoubleClick += new ReClassNET.Controls.MemorySearchResultControlResultDoubleClickEventHandler(this.memorySearchResultControl_ResultDoubleClick); // // resultListContextMenuStrip // @@ -607,7 +649,7 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.addressListMemoryRecordList.ContextMenuStrip = this.resultListContextMenuStrip; - this.addressListMemoryRecordList.Location = new System.Drawing.Point(11, 402); + this.addressListMemoryRecordList.Location = new System.Drawing.Point(11, 425); this.addressListMemoryRecordList.Name = "addressListMemoryRecordList"; this.addressListMemoryRecordList.ShowAddressColumn = true; this.addressListMemoryRecordList.ShowDescriptionColumn = true; @@ -620,7 +662,7 @@ private void InitializeComponent() // toolStripPanel // this.toolStripPanel.Controls.Add(this.menuToolStrip); - this.toolStripPanel.Location = new System.Drawing.Point(11, 375); + this.toolStripPanel.Location = new System.Drawing.Point(11, 397); this.toolStripPanel.Name = "toolStripPanel"; this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; this.toolStripPanel.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; @@ -707,7 +749,7 @@ private void InitializeComponent() // this.showInputCorrelatorIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.showInputCorrelatorIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Canvas_Size; - this.showInputCorrelatorIconButton.Location = new System.Drawing.Point(580, 378); + this.showInputCorrelatorIconButton.Location = new System.Drawing.Point(580, 398); this.showInputCorrelatorIconButton.Name = "showInputCorrelatorIconButton"; this.showInputCorrelatorIconButton.Pressed = false; this.showInputCorrelatorIconButton.Selected = false; @@ -717,6 +759,7 @@ private void InitializeComponent() // // cancelScanIconButton // + this.cancelScanIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.cancelScanIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Delete; this.cancelScanIconButton.Location = new System.Drawing.Point(517, 54); this.cancelScanIconButton.Name = "cancelScanIconButton"; @@ -731,7 +774,7 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(612, 584); + this.ClientSize = new System.Drawing.Size(612, 607); this.Controls.Add(this.cancelScanIconButton); this.Controls.Add(this.showInputCorrelatorIconButton); this.Controls.Add(this.undoIconButton); @@ -771,9 +814,9 @@ private void InitializeComponent() #endregion - private UI.BannerBox bannerBox; + private BannerBox bannerBox; private System.Windows.Forms.GroupBox filterGroupBox; - private UI.DualValueBox dualValueBox; + private DualValueBox dualValueBox; private System.Windows.Forms.CheckBox isHexCheckBox; private ScanCompareTypeComboBox compareTypeComboBox; private System.Windows.Forms.Label label1; @@ -785,6 +828,9 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox scanCopyOnWriteCheckBox; private System.Windows.Forms.CheckBox scanExecutableCheckBox; private System.Windows.Forms.CheckBox scanWritableCheckBox; + private System.Windows.Forms.CheckBox scanMappedCheckBox; + private System.Windows.Forms.CheckBox scanImageCheckBox; + private System.Windows.Forms.CheckBox scanPrivateCheckBox; private System.Windows.Forms.TextBox stopAddressTextBox; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox startAddressTextBox; @@ -804,8 +850,8 @@ private void InitializeComponent() private System.Windows.Forms.ProgressBar scanProgressBar; private System.Windows.Forms.Label resultCountLabel; private System.Windows.Forms.Timer updateValuesTimer; - private UI.MemoryRecordList resultMemoryRecordList; - private UI.MemoryRecordList addressListMemoryRecordList; + private MemoryRecordList resultMemoryRecordList; + private MemoryRecordList addressListMemoryRecordList; private System.Windows.Forms.ToolStripPanel toolStripPanel; private System.Windows.Forms.ToolStrip menuToolStrip; private System.Windows.Forms.ToolStripButton openAddressFileToolStripButton; @@ -830,8 +876,8 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem valueToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; private System.Windows.Forms.ToolStripMenuItem copyAddressToolStripMenuItem; - private UI.IconButton undoIconButton; - private UI.IconButton showInputCorrelatorIconButton; - private UI.IconButton cancelScanIconButton; + private IconButton undoIconButton; + private IconButton showInputCorrelatorIconButton; + private IconButton cancelScanIconButton; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/ScannerForm.cs b/ReClass.NET/Forms/ScannerForm.cs index cfbefa55..0fb4d430 100644 --- a/ReClass.NET/Forms/ScannerForm.cs +++ b/ReClass.NET/Forms/ScannerForm.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Diagnostics.Contracts; using System.Globalization; @@ -8,6 +8,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using ReClassNET.Controls; using ReClassNET.DataExchange.Scanner; using ReClassNET.Extensions; using ReClassNET.Logger; @@ -206,58 +207,60 @@ private void memorySearchResultControl_ResultDoubleClick(object sender, MemoryRe private void openAddressFileToolStripButton_Click(object sender, EventArgs e) { - using (var ofd = new OpenFileDialog()) + using var ofd = new OpenFileDialog { - ofd.CheckFileExists = true; - ofd.Filter = $"All Scanner Types |*{ReClassScanFile.FileExtension};*{CheatEngineFile.FileExtension};*{CrySearchFile.FileExtension}" - + $"|{ReClassScanFile.FormatName} (*{ReClassScanFile.FileExtension})|*{ReClassScanFile.FileExtension}" - + $"|{CheatEngineFile.FormatName} (*{CheatEngineFile.FileExtension})|*{CheatEngineFile.FileExtension}" - + $"|{CrySearchFile.FormatName} (*{CrySearchFile.FileExtension})|*{CrySearchFile.FileExtension}"; + CheckFileExists = true, + Filter = $"All Scanner Types |*{ReClassScanFile.FileExtension};*{CheatEngineFile.FileExtension};*{CrySearchFile.FileExtension}" + + $"|{ReClassScanFile.FormatName} (*{ReClassScanFile.FileExtension})|*{ReClassScanFile.FileExtension}" + + $"|{CheatEngineFile.FormatName} (*{CheatEngineFile.FileExtension})|*{CheatEngineFile.FileExtension}" + + $"|{CrySearchFile.FormatName} (*{CrySearchFile.FileExtension})|*{CrySearchFile.FileExtension}" + }; + + if (ofd.ShowDialog() == DialogResult.OK) + { + IScannerImport import = null; + switch (Path.GetExtension(ofd.FileName)?.ToLower()) + { + case ReClassScanFile.FileExtension: + import = new ReClassScanFile(); + break; + case CheatEngineFile.FileExtension: + import = new CheatEngineFile(); + break; + case CrySearchFile.FileExtension: + import = new CrySearchFile(); + break; + default: + Program.Logger.Log(LogLevel.Error, $"The file '{ofd.FileName}' has an unknown type."); + break; + } + if (import == null) + { + return; + } - if (ofd.ShowDialog() == DialogResult.OK) + if (addressListMemoryRecordList.Records.Any()) { - IScannerImport import = null; - switch (Path.GetExtension(ofd.FileName)?.ToLower()) + if (MessageBox.Show("The address list contains addresses. Do you really want to open the file?", $"{Constants.ApplicationName} Scanner", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { - case ReClassScanFile.FileExtension: - import = new ReClassScanFile(); - break; - case CheatEngineFile.FileExtension: - import = new CheatEngineFile(); - break; - case CrySearchFile.FileExtension: - import = new CrySearchFile(); - break; - default: - Program.Logger.Log(LogLevel.Error, $"The file '{ofd.FileName}' has an unknown type."); - break; + return; } - if (import != null) - { - if (addressListMemoryRecordList.Records.Any()) - { - if (MessageBox.Show("The address list contains addresses. Do you really want to open the file?", $"{Constants.ApplicationName} Scanner", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) - { - return; - } - } + } - if (import is ReClassScanFile) - { - addressFilePath = ofd.FileName; - } - - addressListMemoryRecordList.SetRecords( - import.Load(ofd.FileName, Program.Logger) - .Select(r => - { - r.ResolveAddress(process); - r.RefreshValue(process); - return r; - }) - ); - } + if (import is ReClassScanFile) + { + addressFilePath = ofd.FileName; } + + addressListMemoryRecordList.SetRecords( + import.Load(ofd.FileName, Program.Logger) + .Select(r => + { + r.ResolveAddress(process); + r.RefreshValue(process); + return r; + }) + ); } } @@ -286,17 +289,17 @@ private void saveAsToolStripButton_Click(object sender, EventArgs e) return; } - using (var sfd = new SaveFileDialog()) + using var sfd = new SaveFileDialog { - sfd.DefaultExt = ReClassScanFile.FileExtension; - sfd.Filter = $"{ReClassScanFile.FormatName} (*{ReClassScanFile.FileExtension})|*{ReClassScanFile.FileExtension}"; + DefaultExt = ReClassScanFile.FileExtension, + Filter = $"{ReClassScanFile.FormatName} (*{ReClassScanFile.FileExtension})|*{ReClassScanFile.FileExtension}" + }; - if (sfd.ShowDialog() == DialogResult.OK) - { - addressFilePath = sfd.FileName; + if (sfd.ShowDialog() == DialogResult.OK) + { + addressFilePath = sfd.FileName; - saveAddressFileToolStripButton_Click(sender, e); - } + saveAddressFileToolStripButton_Click(sender, e); } } @@ -454,6 +457,7 @@ private void OnCompareTypeChanged() case ScanValueType.Double: case ScanValueType.ArrayOfBytes: case ScanValueType.String: + case ScanValueType.Regex: isHexCheckBox.Checked = false; enableHexCheckBox = false; break; @@ -485,6 +489,7 @@ private void OnValueTypeChanged() case ScanValueType.Double: case ScanValueType.ArrayOfBytes: case ScanValueType.String: + case ScanValueType.Regex: isHexCheckBox.Checked = false; isHexCheckBox.Enabled = false; break; @@ -506,7 +511,7 @@ private void OnValueTypeChanged() fastScanAlignmentTextBox.Text = alignment.ToString(); floatingOptionsGroupBox.Visible = valueType == ScanValueType.Float || valueType == ScanValueType.Double; - stringOptionsGroupBox.Visible = valueType == ScanValueType.String; + stringOptionsGroupBox.Visible = valueType == ScanValueType.String || valueType == ScanValueType.Regex; } /// @@ -516,7 +521,7 @@ private void SetValidCompareTypes() { var compareType = compareTypeComboBox.SelectedValue; var valueType = valueTypeComboBox.SelectedValue; - if (valueType == ScanValueType.ArrayOfBytes || valueType == ScanValueType.String) + if (valueType == ScanValueType.ArrayOfBytes || valueType == ScanValueType.String || valueType == ScanValueType.Regex) { compareTypeComboBox.SetAvailableValues(ScanCompareType.Equal); } @@ -652,8 +657,8 @@ private ScanSettings CreateSearchSettings() long.TryParse(startAddressTextBox.Text, NumberStyles.HexNumber, null, out var startAddressVar); long.TryParse(stopAddressTextBox.Text, NumberStyles.HexNumber, null, out var endAddressVar); #if RECLASSNET64 - settings.StartAddress = unchecked((IntPtr)startAddressVar); - settings.StopAddress = unchecked((IntPtr)endAddressVar); + settings.StartAddress = (IntPtr)startAddressVar; + settings.StopAddress = (IntPtr)endAddressVar; #else settings.StartAddress = unchecked((IntPtr)(int)startAddressVar); settings.StopAddress = unchecked((IntPtr)(int)endAddressVar); @@ -662,7 +667,7 @@ private ScanSettings CreateSearchSettings() int.TryParse(fastScanAlignmentTextBox.Text, out var alignment); settings.FastScanAlignment = Math.Max(1, alignment); - SettingState CheckStateToSettingState(CheckState state) + static SettingState CheckStateToSettingState(CheckState state) { switch (state) { @@ -675,6 +680,9 @@ SettingState CheckStateToSettingState(CheckState state) } } + settings.ScanPrivateMemory = scanPrivateCheckBox.Checked; + settings.ScanImageMemory = scanImageCheckBox.Checked; + settings.ScanMappedMemory = scanMappedCheckBox.Checked; settings.ScanWritableMemory = CheckStateToSettingState(scanWritableCheckBox.CheckState); settings.ScanExecutableMemory = CheckStateToSettingState(scanExecutableCheckBox.CheckState); settings.ScanCopyOnWriteMemory = CheckStateToSettingState(scanCopyOnWriteCheckBox.CheckState); @@ -697,8 +705,8 @@ private void SetGuiFromSettings(ScanSettings settings) fastScanCheckBox.Checked = settings.EnableFastScan; fastScanAlignmentTextBox.Text = Math.Max(1, settings.FastScanAlignment).ToString(); - - CheckState SettingStateToCheckState(SettingState state) + + static CheckState SettingStateToCheckState(SettingState state) { switch (state) { @@ -711,6 +719,9 @@ CheckState SettingStateToCheckState(SettingState state) } } + scanPrivateCheckBox.Checked = settings.ScanPrivateMemory; + scanImageCheckBox.Checked = settings.ScanImageMemory; + scanMappedCheckBox.Checked = settings.ScanMappedMemory; scanWritableCheckBox.CheckState = SettingStateToCheckState(settings.ScanWritableMemory); scanExecutableCheckBox.CheckState = SettingStateToCheckState(settings.ScanExecutableMemory); scanCopyOnWriteCheckBox.CheckState = SettingStateToCheckState(settings.ScanCopyOnWriteMemory); @@ -734,16 +745,24 @@ private IScanComparer CreateComparer(ScanSettings settings) if (!long.TryParse(dualValueBox.Value1, numberStyle, null, out var value1)) throw new InvalidInputException(dualValueBox.Value1); if (!long.TryParse(dualValueBox.Value2, numberStyle, null, out var value2) && checkBothInputFields) throw new InvalidInputException(dualValueBox.Value2); + if (compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual) + { + if (value1 > value2) + { + Utils.Swap(ref value1, ref value2); + } + } + switch (settings.ValueType) { case ScanValueType.Byte: return new ByteMemoryComparer(compareType, (byte)value1, (byte)value2); case ScanValueType.Short: - return new ShortMemoryComparer(compareType, (short)value1, (short)value2); + return new ShortMemoryComparer(compareType, (short)value1, (short)value2, process.BitConverter); case ScanValueType.Integer: - return new IntegerMemoryComparer(compareType, (int)value1, (int)value2); + return new IntegerMemoryComparer(compareType, (int)value1, (int)value2, process.BitConverter); case ScanValueType.Long: - return new LongMemoryComparer(compareType, value1, value2); + return new LongMemoryComparer(compareType, value1, value2, process.BitConverter); } } else if (settings.ValueType == ScanValueType.Float || settings.ValueType == ScanValueType.Double) @@ -764,11 +783,19 @@ int CalculateSignificantDigits(string input, NumberFormatInfo numberFormat) return digits; } - var nf1 = Utils.GuessNumberFormat(dualValueBox.Value1); + var nf1 = NumberFormat.GuessNumberFormat(dualValueBox.Value1); if (!double.TryParse(dualValueBox.Value1, NumberStyles.Float, nf1, out var value1)) throw new InvalidInputException(dualValueBox.Value1); - var nf2 = Utils.GuessNumberFormat(dualValueBox.Value2); + var nf2 = NumberFormat.GuessNumberFormat(dualValueBox.Value2); if (!double.TryParse(dualValueBox.Value2, NumberStyles.Float, nf2, out var value2) && checkBothInputFields) throw new InvalidInputException(dualValueBox.Value2); + if (compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual) + { + if (value1 > value2) + { + Utils.Swap(ref value1, ref value2); + } + } + var significantDigits = Math.Max( CalculateSignificantDigits(dualValueBox.Value1, nf1), CalculateSignificantDigits(dualValueBox.Value2, nf2) @@ -779,9 +806,9 @@ int CalculateSignificantDigits(string input, NumberFormatInfo numberFormat) switch (settings.ValueType) { case ScanValueType.Float: - return new FloatMemoryComparer(compareType, roundMode, significantDigits, (float)value1, (float)value2); + return new FloatMemoryComparer(compareType, roundMode, significantDigits, (float)value1, (float)value2, process.BitConverter); case ScanValueType.Double: - return new DoubleMemoryComparer(compareType, roundMode, significantDigits, value1, value2); + return new DoubleMemoryComparer(compareType, roundMode, significantDigits, value1, value2, process.BitConverter); } } else if (settings.ValueType == ScanValueType.ArrayOfBytes) @@ -790,7 +817,7 @@ int CalculateSignificantDigits(string input, NumberFormatInfo numberFormat) return new ArrayOfBytesMemoryComparer(pattern); } - else if (settings.ValueType == ScanValueType.String) + else if (settings.ValueType == ScanValueType.String || settings.ValueType == ScanValueType.Regex) { if (string.IsNullOrEmpty(dualValueBox.Value1)) { @@ -798,8 +825,14 @@ int CalculateSignificantDigits(string input, NumberFormatInfo numberFormat) } var encoding = encodingUtf8RadioButton.Checked ? Encoding.UTF8 : encodingUtf16RadioButton.Checked ? Encoding.Unicode : Encoding.UTF32; - - return new StringMemoryComparer(dualValueBox.Value1, encoding, caseSensitiveCheckBox.Checked); + if (settings.ValueType == ScanValueType.String) + { + return new StringMemoryComparer(dualValueBox.Value1, encoding, caseSensitiveCheckBox.Checked); + } + else + { + return new RegexStringMemoryComparer(dualValueBox.Value1, encoding, caseSensitiveCheckBox.Checked); + } } throw new InvalidOperationException(); @@ -834,6 +867,7 @@ private static void FindWhatInteractsWithSelectedRecord(MemoryRecord record, boo size = record.ValueLength; break; case ScanValueType.String: + case ScanValueType.Regex: size = record.ValueLength; break; default: @@ -849,7 +883,7 @@ internal class InvalidInputException : Exception public InvalidInputException(string input) : base($"'{input}' is not a valid input.") { - + } } } diff --git a/ReClass.NET/Forms/SettingsForm.Designer.cs b/ReClass.NET/Forms/SettingsForm.Designer.cs index cc5764b1..82e4efd9 100644 --- a/ReClass.NET/Forms/SettingsForm.Designer.cs +++ b/ReClass.NET/Forms/SettingsForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class SettingsForm { @@ -28,1034 +30,1118 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.settingsTabControl = new System.Windows.Forms.TabControl(); - this.generalSettingsTabPage = new System.Windows.Forms.TabPage(); - this.fileAssociationGroupBox = new System.Windows.Forms.GroupBox(); - this.removeAssociationButton = new System.Windows.Forms.Button(); - this.createAssociationButton = new System.Windows.Forms.Button(); - this.associationInfoLabel = new System.Windows.Forms.Label(); - this.commentsGroupBox = new System.Windows.Forms.GroupBox(); - this.showPluginInfoCheckBox = new System.Windows.Forms.CheckBox(); - this.showStringCheckBox = new System.Windows.Forms.CheckBox(); - this.showSymbolsCheckBox = new System.Windows.Forms.CheckBox(); - this.showRttiCheckBox = new System.Windows.Forms.CheckBox(); - this.showPointerCheckBox = new System.Windows.Forms.CheckBox(); - this.showIntegerCheckBox = new System.Windows.Forms.CheckBox(); - this.showFloatCheckBox = new System.Windows.Forms.CheckBox(); - this.displayGroupBox = new System.Windows.Forms.GroupBox(); - this.highlightChangedValuesCheckBox = new System.Windows.Forms.CheckBox(); - this.showTextCheckBox = new System.Windows.Forms.CheckBox(); - this.showNodeOffsetCheckBox = new System.Windows.Forms.CheckBox(); - this.showNodeAddressCheckBox = new System.Windows.Forms.CheckBox(); - this.stayOnTopCheckBox = new System.Windows.Forms.CheckBox(); - this.colorsSettingTabPage = new System.Windows.Forms.TabPage(); - this.nodeColorGroupBox = new System.Windows.Forms.GroupBox(); - this.nodeValueLabel = new System.Windows.Forms.Label(); - this.nodePluginLabel = new System.Windows.Forms.Label(); - this.nodeHexValueColorBox = new ReClassNET.UI.ColorBox(); - this.nodePluginColorBox = new ReClassNET.UI.ColorBox(); - this.nodeHexValueLabel = new System.Windows.Forms.Label(); - this.nodeVTableLabel = new System.Windows.Forms.Label(); - this.nodeOffsetColorBox = new ReClassNET.UI.ColorBox(); - this.nodeVTableColorBox = new ReClassNET.UI.ColorBox(); - this.nodeOffsetLabel = new System.Windows.Forms.Label(); - this.nodeTextLabel = new System.Windows.Forms.Label(); - this.nodeAddressColorBox = new ReClassNET.UI.ColorBox(); - this.nodeTextColorBox = new ReClassNET.UI.ColorBox(); - this.nodeAddressLabel = new System.Windows.Forms.Label(); - this.nodeCommentLabel = new System.Windows.Forms.Label(); - this.nodeHiddenColorBox = new ReClassNET.UI.ColorBox(); - this.nodeCommentColorBox = new ReClassNET.UI.ColorBox(); - this.nodeHiddenLabel = new System.Windows.Forms.Label(); - this.nodeIndexLabel = new System.Windows.Forms.Label(); - this.nodeSelectedColorBox = new ReClassNET.UI.ColorBox(); - this.nodeIndexColorBox = new ReClassNET.UI.ColorBox(); - this.nodeSelectedLabel = new System.Windows.Forms.Label(); - this.nodeTypeColorBox = new ReClassNET.UI.ColorBox(); - this.nodeValueColorBox = new ReClassNET.UI.ColorBox(); - this.nodeTypeLabel = new System.Windows.Forms.Label(); - this.nodeNameLabel = new System.Windows.Forms.Label(); - this.nodeNameColorBox = new ReClassNET.UI.ColorBox(); - this.backgroundLabel = new System.Windows.Forms.Label(); - this.backgroundColorBox = new ReClassNET.UI.ColorBox(); - this.typeDefinitionsSettingsTabPage = new System.Windows.Forms.TabPage(); - this.boolSettingsLabel = new System.Windows.Forms.Label(); - this.boolTypeTextBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.functionPtrSettingsLabel = new System.Windows.Forms.Label(); - this.functionPtrTypeTextBox = new System.Windows.Forms.TextBox(); - this.utf16TextSettingsLabel = new System.Windows.Forms.Label(); - this.utf16TextTypeTextBox = new System.Windows.Forms.TextBox(); - this.utf8TextSettingsLabel = new System.Windows.Forms.Label(); - this.utf8TextTypeTextBox = new System.Windows.Forms.TextBox(); - this.matrix3x3SettingsLabel = new System.Windows.Forms.Label(); - this.matrix3x3TypeTextBox = new System.Windows.Forms.TextBox(); - this.matrix3x4SettingsLabel = new System.Windows.Forms.Label(); - this.matrix3x4TypeTextBox = new System.Windows.Forms.TextBox(); - this.matrix4x4SettingsLabel = new System.Windows.Forms.Label(); - this.matrix4x4TypeTextBox = new System.Windows.Forms.TextBox(); - this.vector2SettingsLabel = new System.Windows.Forms.Label(); - this.vector2TypeTextBox = new System.Windows.Forms.TextBox(); - this.vector3SettingsLabel = new System.Windows.Forms.Label(); - this.vector3TypeTextBox = new System.Windows.Forms.TextBox(); - this.vector4SettingsLabel = new System.Windows.Forms.Label(); - this.vector4TypeTextBox = new System.Windows.Forms.TextBox(); - this.doubleSettingsLabel = new System.Windows.Forms.Label(); - this.doubleTypeTextBox = new System.Windows.Forms.TextBox(); - this.floatSettingsLabel = new System.Windows.Forms.Label(); - this.floatTypeTextBox = new System.Windows.Forms.TextBox(); - this.uint64SettingsLabel = new System.Windows.Forms.Label(); - this.uint64TypeTextBox = new System.Windows.Forms.TextBox(); - this.uint32SettingsLabel = new System.Windows.Forms.Label(); - this.uint32TypeTextBox = new System.Windows.Forms.TextBox(); - this.uint16SettingsLabel = new System.Windows.Forms.Label(); - this.uint16TypeTextBox = new System.Windows.Forms.TextBox(); - this.uint8SettingsLabel = new System.Windows.Forms.Label(); - this.uint8TypeTextBox = new System.Windows.Forms.TextBox(); - this.int64SettingsLabel = new System.Windows.Forms.Label(); - this.int64TypeTextBox = new System.Windows.Forms.TextBox(); - this.int32SettingsLabel = new System.Windows.Forms.Label(); - this.int32TypeTextBox = new System.Windows.Forms.TextBox(); - this.int16SettingsLabel = new System.Windows.Forms.Label(); - this.int16TypeTextBox = new System.Windows.Forms.TextBox(); - this.int8SettingsLabel = new System.Windows.Forms.Label(); - this.int8TypeTextBox = new System.Windows.Forms.TextBox(); - this.bannerBox = new ReClassNET.UI.BannerBox(); - this.settingsTabControl.SuspendLayout(); - this.generalSettingsTabPage.SuspendLayout(); - this.fileAssociationGroupBox.SuspendLayout(); - this.commentsGroupBox.SuspendLayout(); - this.displayGroupBox.SuspendLayout(); - this.colorsSettingTabPage.SuspendLayout(); - this.nodeColorGroupBox.SuspendLayout(); - this.typeDefinitionsSettingsTabPage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); - this.SuspendLayout(); - // - // settingsTabControl - // - this.settingsTabControl.Controls.Add(this.generalSettingsTabPage); - this.settingsTabControl.Controls.Add(this.colorsSettingTabPage); - this.settingsTabControl.Controls.Add(this.typeDefinitionsSettingsTabPage); - this.settingsTabControl.Location = new System.Drawing.Point(12, 60); - this.settingsTabControl.Name = "settingsTabControl"; - this.settingsTabControl.SelectedIndex = 0; - this.settingsTabControl.Size = new System.Drawing.Size(562, 355); - this.settingsTabControl.TabIndex = 1; - // - // generalSettingsTabPage - // - this.generalSettingsTabPage.Controls.Add(this.fileAssociationGroupBox); - this.generalSettingsTabPage.Controls.Add(this.commentsGroupBox); - this.generalSettingsTabPage.Controls.Add(this.displayGroupBox); - this.generalSettingsTabPage.Controls.Add(this.stayOnTopCheckBox); - this.generalSettingsTabPage.Location = new System.Drawing.Point(4, 22); - this.generalSettingsTabPage.Name = "generalSettingsTabPage"; - this.generalSettingsTabPage.Padding = new System.Windows.Forms.Padding(3); - this.generalSettingsTabPage.Size = new System.Drawing.Size(554, 329); - this.generalSettingsTabPage.TabIndex = 0; - this.generalSettingsTabPage.Text = "General"; - this.generalSettingsTabPage.UseVisualStyleBackColor = true; - // - // fileAssociationGroupBox - // - this.fileAssociationGroupBox.Controls.Add(this.removeAssociationButton); - this.fileAssociationGroupBox.Controls.Add(this.createAssociationButton); - this.fileAssociationGroupBox.Controls.Add(this.associationInfoLabel); - this.fileAssociationGroupBox.Location = new System.Drawing.Point(6, 231); - this.fileAssociationGroupBox.Name = "fileAssociationGroupBox"; - this.fileAssociationGroupBox.Size = new System.Drawing.Size(542, 85); - this.fileAssociationGroupBox.TabIndex = 4; - this.fileAssociationGroupBox.TabStop = false; - this.fileAssociationGroupBox.Text = "RCNET File Association"; - // - // removeAssociationButton - // - this.removeAssociationButton.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.removeAssociationButton.Location = new System.Drawing.Point(146, 52); - this.removeAssociationButton.Name = "removeAssociationButton"; - this.removeAssociationButton.Size = new System.Drawing.Size(135, 23); - this.removeAssociationButton.TabIndex = 2; - this.removeAssociationButton.Text = "&Remove Association"; - this.removeAssociationButton.UseVisualStyleBackColor = true; - this.removeAssociationButton.Click += new System.EventHandler(this.removeAssociationButton_Click); - // - // createAssociationButton - // - this.createAssociationButton.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.createAssociationButton.Location = new System.Drawing.Point(9, 52); - this.createAssociationButton.Name = "createAssociationButton"; - this.createAssociationButton.Size = new System.Drawing.Size(131, 23); - this.createAssociationButton.TabIndex = 1; - this.createAssociationButton.Text = "Create &Association"; - this.createAssociationButton.UseVisualStyleBackColor = true; - this.createAssociationButton.Click += new System.EventHandler(this.createAssociationButton_Click); - // - // associationInfoLabel - // - this.associationInfoLabel.Location = new System.Drawing.Point(6, 21); - this.associationInfoLabel.Name = "associationInfoLabel"; - this.associationInfoLabel.Size = new System.Drawing.Size(525, 28); - this.associationInfoLabel.TabIndex = 0; - this.associationInfoLabel.Text = "RCNET files can be associated with ReClass.NET. When you double-click a RCNET fil" + + this.settingsTabControl = new System.Windows.Forms.TabControl(); + this.generalSettingsTabPage = new System.Windows.Forms.TabPage(); + this.fileAssociationGroupBox = new System.Windows.Forms.GroupBox(); + this.removeAssociationButton = new System.Windows.Forms.Button(); + this.createAssociationButton = new System.Windows.Forms.Button(); + this.associationInfoLabel = new System.Windows.Forms.Label(); + this.commentsGroupBox = new System.Windows.Forms.GroupBox(); + this.showPluginInfoCheckBox = new System.Windows.Forms.CheckBox(); + this.showStringCheckBox = new System.Windows.Forms.CheckBox(); + this.showSymbolsCheckBox = new System.Windows.Forms.CheckBox(); + this.showRttiCheckBox = new System.Windows.Forms.CheckBox(); + this.showPointerCheckBox = new System.Windows.Forms.CheckBox(); + this.showIntegerCheckBox = new System.Windows.Forms.CheckBox(); + this.showFloatCheckBox = new System.Windows.Forms.CheckBox(); + this.displayGroupBox = new System.Windows.Forms.GroupBox(); + this.randomizeWindowTitleCheckBox = new System.Windows.Forms.CheckBox(); + this.runAsAdminCheckBox = new System.Windows.Forms.CheckBox(); + this.highlightChangedValuesCheckBox = new System.Windows.Forms.CheckBox(); + this.showTextCheckBox = new System.Windows.Forms.CheckBox(); + this.showNodeOffsetCheckBox = new System.Windows.Forms.CheckBox(); + this.showNodeAddressCheckBox = new System.Windows.Forms.CheckBox(); + this.stayOnTopCheckBox = new System.Windows.Forms.CheckBox(); + this.colorsSettingTabPage = new System.Windows.Forms.TabPage(); + this.nodeColorGroupBox = new System.Windows.Forms.GroupBox(); + this.nodeValueLabel = new System.Windows.Forms.Label(); + this.nodePluginLabel = new System.Windows.Forms.Label(); + this.nodeHexValueColorBox = new ReClassNET.Controls.ColorBox(); + this.nodePluginColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeHexValueLabel = new System.Windows.Forms.Label(); + this.nodeVTableLabel = new System.Windows.Forms.Label(); + this.nodeOffsetColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeVTableColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeOffsetLabel = new System.Windows.Forms.Label(); + this.nodeTextLabel = new System.Windows.Forms.Label(); + this.nodeAddressColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeTextColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeAddressLabel = new System.Windows.Forms.Label(); + this.nodeCommentLabel = new System.Windows.Forms.Label(); + this.nodeHiddenColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeCommentColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeHiddenLabel = new System.Windows.Forms.Label(); + this.nodeIndexLabel = new System.Windows.Forms.Label(); + this.nodeSelectedColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeIndexColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeSelectedLabel = new System.Windows.Forms.Label(); + this.nodeTypeColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeValueColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeTypeLabel = new System.Windows.Forms.Label(); + this.nodeNameLabel = new System.Windows.Forms.Label(); + this.nodeNameColorBox = new ReClassNET.Controls.ColorBox(); + this.backgroundLabel = new System.Windows.Forms.Label(); + this.backgroundColorBox = new ReClassNET.Controls.ColorBox(); + this.typeDefinitionsSettingsTabPage = new System.Windows.Forms.TabPage(); + this.nuintSettingsLabel = new System.Windows.Forms.Label(); + this.nuintTypeTextBox = new System.Windows.Forms.TextBox(); + this.nintSettingsLabel = new System.Windows.Forms.Label(); + this.nintTypeTextBox = new System.Windows.Forms.TextBox(); + this.boolSettingsLabel = new System.Windows.Forms.Label(); + this.boolTypeTextBox = new System.Windows.Forms.TextBox(); + this.generatorInfoLabel = new System.Windows.Forms.Label(); + this.functionPtrSettingsLabel = new System.Windows.Forms.Label(); + this.functionPtrTypeTextBox = new System.Windows.Forms.TextBox(); + this.utf16TextSettingsLabel = new System.Windows.Forms.Label(); + this.utf16TextTypeTextBox = new System.Windows.Forms.TextBox(); + this.utf8TextSettingsLabel = new System.Windows.Forms.Label(); + this.utf8TextTypeTextBox = new System.Windows.Forms.TextBox(); + this.matrix3x3SettingsLabel = new System.Windows.Forms.Label(); + this.matrix3x3TypeTextBox = new System.Windows.Forms.TextBox(); + this.matrix3x4SettingsLabel = new System.Windows.Forms.Label(); + this.matrix3x4TypeTextBox = new System.Windows.Forms.TextBox(); + this.matrix4x4SettingsLabel = new System.Windows.Forms.Label(); + this.matrix4x4TypeTextBox = new System.Windows.Forms.TextBox(); + this.vector2SettingsLabel = new System.Windows.Forms.Label(); + this.vector2TypeTextBox = new System.Windows.Forms.TextBox(); + this.vector3SettingsLabel = new System.Windows.Forms.Label(); + this.vector3TypeTextBox = new System.Windows.Forms.TextBox(); + this.vector4SettingsLabel = new System.Windows.Forms.Label(); + this.vector4TypeTextBox = new System.Windows.Forms.TextBox(); + this.doubleSettingsLabel = new System.Windows.Forms.Label(); + this.doubleTypeTextBox = new System.Windows.Forms.TextBox(); + this.floatSettingsLabel = new System.Windows.Forms.Label(); + this.floatTypeTextBox = new System.Windows.Forms.TextBox(); + this.uint64SettingsLabel = new System.Windows.Forms.Label(); + this.uint64TypeTextBox = new System.Windows.Forms.TextBox(); + this.uint32SettingsLabel = new System.Windows.Forms.Label(); + this.uint32TypeTextBox = new System.Windows.Forms.TextBox(); + this.uint16SettingsLabel = new System.Windows.Forms.Label(); + this.uint16TypeTextBox = new System.Windows.Forms.TextBox(); + this.uint8SettingsLabel = new System.Windows.Forms.Label(); + this.uint8TypeTextBox = new System.Windows.Forms.TextBox(); + this.int64SettingsLabel = new System.Windows.Forms.Label(); + this.int64TypeTextBox = new System.Windows.Forms.TextBox(); + this.int32SettingsLabel = new System.Windows.Forms.Label(); + this.int32TypeTextBox = new System.Windows.Forms.TextBox(); + this.int16SettingsLabel = new System.Windows.Forms.Label(); + this.int16TypeTextBox = new System.Windows.Forms.TextBox(); + this.int8SettingsLabel = new System.Windows.Forms.Label(); + this.int8TypeTextBox = new System.Windows.Forms.TextBox(); + this.bannerBox = new ReClassNET.Controls.BannerBox(); + this.utf32TextSettingsLabel = new System.Windows.Forms.Label(); + this.utf32TextTypeTextBox = new System.Windows.Forms.TextBox(); + this.settingsTabControl.SuspendLayout(); + this.generalSettingsTabPage.SuspendLayout(); + this.fileAssociationGroupBox.SuspendLayout(); + this.commentsGroupBox.SuspendLayout(); + this.displayGroupBox.SuspendLayout(); + this.colorsSettingTabPage.SuspendLayout(); + this.nodeColorGroupBox.SuspendLayout(); + this.typeDefinitionsSettingsTabPage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + this.SuspendLayout(); + // + // settingsTabControl + // + this.settingsTabControl.Controls.Add(this.generalSettingsTabPage); + this.settingsTabControl.Controls.Add(this.colorsSettingTabPage); + this.settingsTabControl.Controls.Add(this.typeDefinitionsSettingsTabPage); + this.settingsTabControl.Location = new System.Drawing.Point(12, 60); + this.settingsTabControl.Name = "settingsTabControl"; + this.settingsTabControl.SelectedIndex = 0; + this.settingsTabControl.Size = new System.Drawing.Size(562, 355); + this.settingsTabControl.TabIndex = 1; + // + // generalSettingsTabPage + // + this.generalSettingsTabPage.Controls.Add(this.fileAssociationGroupBox); + this.generalSettingsTabPage.Controls.Add(this.commentsGroupBox); + this.generalSettingsTabPage.Controls.Add(this.displayGroupBox); + this.generalSettingsTabPage.Controls.Add(this.stayOnTopCheckBox); + this.generalSettingsTabPage.Location = new System.Drawing.Point(4, 22); + this.generalSettingsTabPage.Name = "generalSettingsTabPage"; + this.generalSettingsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.generalSettingsTabPage.Size = new System.Drawing.Size(554, 329); + this.generalSettingsTabPage.TabIndex = 0; + this.generalSettingsTabPage.Text = "General"; + this.generalSettingsTabPage.UseVisualStyleBackColor = true; + // + // fileAssociationGroupBox + // + this.fileAssociationGroupBox.Controls.Add(this.removeAssociationButton); + this.fileAssociationGroupBox.Controls.Add(this.createAssociationButton); + this.fileAssociationGroupBox.Controls.Add(this.associationInfoLabel); + this.fileAssociationGroupBox.Location = new System.Drawing.Point(6, 231); + this.fileAssociationGroupBox.Name = "fileAssociationGroupBox"; + this.fileAssociationGroupBox.Size = new System.Drawing.Size(542, 85); + this.fileAssociationGroupBox.TabIndex = 4; + this.fileAssociationGroupBox.TabStop = false; + this.fileAssociationGroupBox.Text = "RCNET File Association"; + // + // removeAssociationButton + // + this.removeAssociationButton.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.removeAssociationButton.Location = new System.Drawing.Point(146, 52); + this.removeAssociationButton.Name = "removeAssociationButton"; + this.removeAssociationButton.Size = new System.Drawing.Size(135, 23); + this.removeAssociationButton.TabIndex = 2; + this.removeAssociationButton.Text = "&Remove Association"; + this.removeAssociationButton.UseVisualStyleBackColor = true; + this.removeAssociationButton.Click += new System.EventHandler(this.removeAssociationButton_Click); + // + // createAssociationButton + // + this.createAssociationButton.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.createAssociationButton.Location = new System.Drawing.Point(9, 52); + this.createAssociationButton.Name = "createAssociationButton"; + this.createAssociationButton.Size = new System.Drawing.Size(131, 23); + this.createAssociationButton.TabIndex = 1; + this.createAssociationButton.Text = "Create &Association"; + this.createAssociationButton.UseVisualStyleBackColor = true; + this.createAssociationButton.Click += new System.EventHandler(this.createAssociationButton_Click); + // + // associationInfoLabel + // + this.associationInfoLabel.Location = new System.Drawing.Point(6, 21); + this.associationInfoLabel.Name = "associationInfoLabel"; + this.associationInfoLabel.Size = new System.Drawing.Size(525, 28); + this.associationInfoLabel.TabIndex = 0; + this.associationInfoLabel.Text = "RCNET files can be associated with ReClass.NET. When you double-click a RCNET fil" + "e, they will automatically be opened by ReClass.NET."; - // - // commentsGroupBox - // - this.commentsGroupBox.Controls.Add(this.showPluginInfoCheckBox); - this.commentsGroupBox.Controls.Add(this.showStringCheckBox); - this.commentsGroupBox.Controls.Add(this.showSymbolsCheckBox); - this.commentsGroupBox.Controls.Add(this.showRttiCheckBox); - this.commentsGroupBox.Controls.Add(this.showPointerCheckBox); - this.commentsGroupBox.Controls.Add(this.showIntegerCheckBox); - this.commentsGroupBox.Controls.Add(this.showFloatCheckBox); - this.commentsGroupBox.Location = new System.Drawing.Point(6, 39); - this.commentsGroupBox.Name = "commentsGroupBox"; - this.commentsGroupBox.Size = new System.Drawing.Size(265, 186); - this.commentsGroupBox.TabIndex = 3; - this.commentsGroupBox.TabStop = false; - this.commentsGroupBox.Text = "Node Comments"; - // - // showPluginInfoCheckBox - // - this.showPluginInfoCheckBox.AutoSize = true; - this.showPluginInfoCheckBox.Location = new System.Drawing.Point(6, 157); - this.showPluginInfoCheckBox.Name = "showPluginInfoCheckBox"; - this.showPluginInfoCheckBox.Size = new System.Drawing.Size(111, 17); - this.showPluginInfoCheckBox.TabIndex = 6; - this.showPluginInfoCheckBox.Text = "Show Plugin Infos"; - this.showPluginInfoCheckBox.UseVisualStyleBackColor = true; - // - // showStringCheckBox - // - this.showStringCheckBox.AutoSize = true; - this.showStringCheckBox.Location = new System.Drawing.Point(6, 134); - this.showStringCheckBox.Name = "showStringCheckBox"; - this.showStringCheckBox.Size = new System.Drawing.Size(88, 17); - this.showStringCheckBox.TabIndex = 5; - this.showStringCheckBox.Text = "Show Strings"; - this.showStringCheckBox.UseVisualStyleBackColor = true; - // - // showSymbolsCheckBox - // - this.showSymbolsCheckBox.AutoSize = true; - this.showSymbolsCheckBox.Location = new System.Drawing.Point(6, 111); - this.showSymbolsCheckBox.Name = "showSymbolsCheckBox"; - this.showSymbolsCheckBox.Size = new System.Drawing.Size(130, 17); - this.showSymbolsCheckBox.TabIndex = 4; - this.showSymbolsCheckBox.Text = "Show Debug Symbols"; - this.showSymbolsCheckBox.UseVisualStyleBackColor = true; - // - // showRttiCheckBox - // - this.showRttiCheckBox.AutoSize = true; - this.showRttiCheckBox.Location = new System.Drawing.Point(6, 88); - this.showRttiCheckBox.Name = "showRttiCheckBox"; - this.showRttiCheckBox.Size = new System.Drawing.Size(81, 17); - this.showRttiCheckBox.TabIndex = 3; - this.showRttiCheckBox.Text = "Show RTTI"; - this.showRttiCheckBox.UseVisualStyleBackColor = true; - // - // showPointerCheckBox - // - this.showPointerCheckBox.AutoSize = true; - this.showPointerCheckBox.Location = new System.Drawing.Point(6, 65); - this.showPointerCheckBox.Name = "showPointerCheckBox"; - this.showPointerCheckBox.Size = new System.Drawing.Size(94, 17); - this.showPointerCheckBox.TabIndex = 2; - this.showPointerCheckBox.Text = "Show Pointers"; - this.showPointerCheckBox.UseVisualStyleBackColor = true; - // - // showIntegerCheckBox - // - this.showIntegerCheckBox.AutoSize = true; - this.showIntegerCheckBox.Location = new System.Drawing.Point(6, 42); - this.showIntegerCheckBox.Name = "showIntegerCheckBox"; - this.showIntegerCheckBox.Size = new System.Drawing.Size(124, 17); - this.showIntegerCheckBox.TabIndex = 1; - this.showIntegerCheckBox.Text = "Show Integer Values"; - this.showIntegerCheckBox.UseVisualStyleBackColor = true; - // - // showFloatCheckBox - // - this.showFloatCheckBox.AutoSize = true; - this.showFloatCheckBox.Location = new System.Drawing.Point(6, 19); - this.showFloatCheckBox.Name = "showFloatCheckBox"; - this.showFloatCheckBox.Size = new System.Drawing.Size(114, 17); - this.showFloatCheckBox.TabIndex = 0; - this.showFloatCheckBox.Text = "Show Float Values"; - this.showFloatCheckBox.UseVisualStyleBackColor = true; - // - // displayGroupBox - // - this.displayGroupBox.Controls.Add(this.highlightChangedValuesCheckBox); - this.displayGroupBox.Controls.Add(this.showTextCheckBox); - this.displayGroupBox.Controls.Add(this.showNodeOffsetCheckBox); - this.displayGroupBox.Controls.Add(this.showNodeAddressCheckBox); - this.displayGroupBox.Location = new System.Drawing.Point(283, 39); - this.displayGroupBox.Name = "displayGroupBox"; - this.displayGroupBox.Size = new System.Drawing.Size(265, 113); - this.displayGroupBox.TabIndex = 2; - this.displayGroupBox.TabStop = false; - this.displayGroupBox.Text = "Display"; - // - // highlightChangedValuesCheckBox - // - this.highlightChangedValuesCheckBox.AutoSize = true; - this.highlightChangedValuesCheckBox.Location = new System.Drawing.Point(6, 88); - this.highlightChangedValuesCheckBox.Name = "highlightChangedValuesCheckBox"; - this.highlightChangedValuesCheckBox.Size = new System.Drawing.Size(148, 17); - this.highlightChangedValuesCheckBox.TabIndex = 3; - this.highlightChangedValuesCheckBox.Text = "Highlight Changed Values"; - this.highlightChangedValuesCheckBox.UseVisualStyleBackColor = true; - // - // showTextCheckBox - // - this.showTextCheckBox.AutoSize = true; - this.showTextCheckBox.Location = new System.Drawing.Point(6, 65); - this.showTextCheckBox.Name = "showTextCheckBox"; - this.showTextCheckBox.Size = new System.Drawing.Size(166, 17); - this.showTextCheckBox.TabIndex = 2; - this.showTextCheckBox.Text = "Show Textual Representation"; - this.showTextCheckBox.UseVisualStyleBackColor = true; - // - // showNodeOffsetCheckBox - // - this.showNodeOffsetCheckBox.AutoSize = true; - this.showNodeOffsetCheckBox.Location = new System.Drawing.Point(6, 42); - this.showNodeOffsetCheckBox.Name = "showNodeOffsetCheckBox"; - this.showNodeOffsetCheckBox.Size = new System.Drawing.Size(113, 17); - this.showNodeOffsetCheckBox.TabIndex = 1; - this.showNodeOffsetCheckBox.Text = "Show Node Offset"; - this.showNodeOffsetCheckBox.UseVisualStyleBackColor = true; - // - // showNodeAddressCheckBox - // - this.showNodeAddressCheckBox.AutoSize = true; - this.showNodeAddressCheckBox.Location = new System.Drawing.Point(6, 19); - this.showNodeAddressCheckBox.Name = "showNodeAddressCheckBox"; - this.showNodeAddressCheckBox.Size = new System.Drawing.Size(123, 17); - this.showNodeAddressCheckBox.TabIndex = 0; - this.showNodeAddressCheckBox.Text = "Show Node Address"; - this.showNodeAddressCheckBox.UseVisualStyleBackColor = true; - // - // stayOnTopCheckBox - // - this.stayOnTopCheckBox.AutoSize = true; - this.stayOnTopCheckBox.Location = new System.Drawing.Point(6, 6); - this.stayOnTopCheckBox.Name = "stayOnTopCheckBox"; - this.stayOnTopCheckBox.Size = new System.Drawing.Size(187, 17); - this.stayOnTopCheckBox.TabIndex = 1; - this.stayOnTopCheckBox.Text = "Force ReClass.NET to stay on top"; - this.stayOnTopCheckBox.UseVisualStyleBackColor = true; - // - // colorsSettingTabPage - // - this.colorsSettingTabPage.Controls.Add(this.nodeColorGroupBox); - this.colorsSettingTabPage.Controls.Add(this.backgroundLabel); - this.colorsSettingTabPage.Controls.Add(this.backgroundColorBox); - this.colorsSettingTabPage.Location = new System.Drawing.Point(4, 22); - this.colorsSettingTabPage.Name = "colorsSettingTabPage"; - this.colorsSettingTabPage.Padding = new System.Windows.Forms.Padding(3); - this.colorsSettingTabPage.Size = new System.Drawing.Size(554, 329); - this.colorsSettingTabPage.TabIndex = 1; - this.colorsSettingTabPage.Text = "Colors"; - this.colorsSettingTabPage.UseVisualStyleBackColor = true; - // - // nodeColorGroupBox - // - this.nodeColorGroupBox.Controls.Add(this.nodeValueLabel); - this.nodeColorGroupBox.Controls.Add(this.nodePluginLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeHexValueColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodePluginColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeHexValueLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeVTableLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeOffsetColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeVTableColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeOffsetLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeTextLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeAddressColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeTextColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeAddressLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeCommentLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeHiddenColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeCommentColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeHiddenLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeIndexLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeSelectedColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeIndexColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeSelectedLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeTypeColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeValueColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeTypeLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeNameLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeNameColorBox); - this.nodeColorGroupBox.Location = new System.Drawing.Point(9, 43); - this.nodeColorGroupBox.Name = "nodeColorGroupBox"; - this.nodeColorGroupBox.Size = new System.Drawing.Size(539, 225); - this.nodeColorGroupBox.TabIndex = 28; - this.nodeColorGroupBox.TabStop = false; - this.nodeColorGroupBox.Text = "Node Colors"; - // - // nodeValueLabel - // - this.nodeValueLabel.AutoSize = true; - this.nodeValueLabel.Location = new System.Drawing.Point(9, 198); - this.nodeValueLabel.Name = "nodeValueLabel"; - this.nodeValueLabel.Size = new System.Drawing.Size(64, 13); - this.nodeValueLabel.TabIndex = 17; - this.nodeValueLabel.Text = "Value Color:"; - // - // nodePluginLabel - // - this.nodePluginLabel.AutoSize = true; - this.nodePluginLabel.Location = new System.Drawing.Point(286, 172); - this.nodePluginLabel.Name = "nodePluginLabel"; - this.nodePluginLabel.Size = new System.Drawing.Size(87, 13); - this.nodePluginLabel.TabIndex = 27; - this.nodePluginLabel.Text = "Plugin Info Color:"; - // - // nodeHexValueColorBox - // - this.nodeHexValueColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeHexValueColorBox.Location = new System.Drawing.Point(133, 117); - this.nodeHexValueColorBox.Name = "nodeHexValueColorBox"; - this.nodeHexValueColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeHexValueColorBox.TabIndex = 2; - // - // nodePluginColorBox - // - this.nodePluginColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodePluginColorBox.Location = new System.Drawing.Point(410, 169); - this.nodePluginColorBox.Name = "nodePluginColorBox"; - this.nodePluginColorBox.Size = new System.Drawing.Size(123, 20); - this.nodePluginColorBox.TabIndex = 26; - // - // nodeHexValueLabel - // - this.nodeHexValueLabel.AutoSize = true; - this.nodeHexValueLabel.Location = new System.Drawing.Point(9, 120); - this.nodeHexValueLabel.Name = "nodeHexValueLabel"; - this.nodeHexValueLabel.Size = new System.Drawing.Size(86, 13); - this.nodeHexValueLabel.TabIndex = 3; - this.nodeHexValueLabel.Text = "Hex Value Color:"; - // - // nodeVTableLabel - // - this.nodeVTableLabel.AutoSize = true; - this.nodeVTableLabel.Location = new System.Drawing.Point(286, 94); - this.nodeVTableLabel.Name = "nodeVTableLabel"; - this.nodeVTableLabel.Size = new System.Drawing.Size(71, 13); - this.nodeVTableLabel.TabIndex = 25; - this.nodeVTableLabel.Text = "VTable Color:"; - // - // nodeOffsetColorBox - // - this.nodeOffsetColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeOffsetColorBox.Location = new System.Drawing.Point(133, 91); - this.nodeOffsetColorBox.Name = "nodeOffsetColorBox"; - this.nodeOffsetColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeOffsetColorBox.TabIndex = 4; - // - // nodeVTableColorBox - // - this.nodeVTableColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeVTableColorBox.Location = new System.Drawing.Point(410, 91); - this.nodeVTableColorBox.Name = "nodeVTableColorBox"; - this.nodeVTableColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeVTableColorBox.TabIndex = 24; - // - // nodeOffsetLabel - // - this.nodeOffsetLabel.AutoSize = true; - this.nodeOffsetLabel.Location = new System.Drawing.Point(9, 94); - this.nodeOffsetLabel.Name = "nodeOffsetLabel"; - this.nodeOffsetLabel.Size = new System.Drawing.Size(65, 13); - this.nodeOffsetLabel.TabIndex = 5; - this.nodeOffsetLabel.Text = "Offset Color:"; - // - // nodeTextLabel - // - this.nodeTextLabel.AutoSize = true; - this.nodeTextLabel.Location = new System.Drawing.Point(286, 146); - this.nodeTextLabel.Name = "nodeTextLabel"; - this.nodeTextLabel.Size = new System.Drawing.Size(58, 13); - this.nodeTextLabel.TabIndex = 23; - this.nodeTextLabel.Text = "Text Color:"; - // - // nodeAddressColorBox - // - this.nodeAddressColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeAddressColorBox.Location = new System.Drawing.Point(133, 65); - this.nodeAddressColorBox.Name = "nodeAddressColorBox"; - this.nodeAddressColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeAddressColorBox.TabIndex = 6; - // - // nodeTextColorBox - // - this.nodeTextColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeTextColorBox.Location = new System.Drawing.Point(410, 143); - this.nodeTextColorBox.Name = "nodeTextColorBox"; - this.nodeTextColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeTextColorBox.TabIndex = 22; - // - // nodeAddressLabel - // - this.nodeAddressLabel.AutoSize = true; - this.nodeAddressLabel.Location = new System.Drawing.Point(9, 68); - this.nodeAddressLabel.Name = "nodeAddressLabel"; - this.nodeAddressLabel.Size = new System.Drawing.Size(75, 13); - this.nodeAddressLabel.TabIndex = 7; - this.nodeAddressLabel.Text = "Address Color:"; - // - // nodeCommentLabel - // - this.nodeCommentLabel.AutoSize = true; - this.nodeCommentLabel.Location = new System.Drawing.Point(286, 120); - this.nodeCommentLabel.Name = "nodeCommentLabel"; - this.nodeCommentLabel.Size = new System.Drawing.Size(81, 13); - this.nodeCommentLabel.TabIndex = 21; - this.nodeCommentLabel.Text = "Comment Color:"; - // - // nodeHiddenColorBox - // - this.nodeHiddenColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeHiddenColorBox.Location = new System.Drawing.Point(410, 18); - this.nodeHiddenColorBox.Name = "nodeHiddenColorBox"; - this.nodeHiddenColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeHiddenColorBox.TabIndex = 8; - // - // nodeCommentColorBox - // - this.nodeCommentColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeCommentColorBox.Location = new System.Drawing.Point(410, 117); - this.nodeCommentColorBox.Name = "nodeCommentColorBox"; - this.nodeCommentColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeCommentColorBox.TabIndex = 20; - // - // nodeHiddenLabel - // - this.nodeHiddenLabel.AutoSize = true; - this.nodeHiddenLabel.Location = new System.Drawing.Point(286, 21); - this.nodeHiddenLabel.Name = "nodeHiddenLabel"; - this.nodeHiddenLabel.Size = new System.Drawing.Size(71, 13); - this.nodeHiddenLabel.TabIndex = 9; - this.nodeHiddenLabel.Text = "Hidden Color:"; - // - // nodeIndexLabel - // - this.nodeIndexLabel.AutoSize = true; - this.nodeIndexLabel.Location = new System.Drawing.Point(286, 68); - this.nodeIndexLabel.Name = "nodeIndexLabel"; - this.nodeIndexLabel.Size = new System.Drawing.Size(63, 13); - this.nodeIndexLabel.TabIndex = 19; - this.nodeIndexLabel.Text = "Index Color:"; - // - // nodeSelectedColorBox - // - this.nodeSelectedColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeSelectedColorBox.Location = new System.Drawing.Point(133, 18); - this.nodeSelectedColorBox.Name = "nodeSelectedColorBox"; - this.nodeSelectedColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeSelectedColorBox.TabIndex = 10; - // - // nodeIndexColorBox - // - this.nodeIndexColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeIndexColorBox.Location = new System.Drawing.Point(410, 65); - this.nodeIndexColorBox.Name = "nodeIndexColorBox"; - this.nodeIndexColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeIndexColorBox.TabIndex = 18; - // - // nodeSelectedLabel - // - this.nodeSelectedLabel.AutoSize = true; - this.nodeSelectedLabel.Location = new System.Drawing.Point(9, 21); - this.nodeSelectedLabel.Name = "nodeSelectedLabel"; - this.nodeSelectedLabel.Size = new System.Drawing.Size(79, 13); - this.nodeSelectedLabel.TabIndex = 11; - this.nodeSelectedLabel.Text = "Selected Color:"; - // - // nodeTypeColorBox - // - this.nodeTypeColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeTypeColorBox.Location = new System.Drawing.Point(133, 143); - this.nodeTypeColorBox.Name = "nodeTypeColorBox"; - this.nodeTypeColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeTypeColorBox.TabIndex = 12; - // - // nodeValueColorBox - // - this.nodeValueColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeValueColorBox.Location = new System.Drawing.Point(133, 195); - this.nodeValueColorBox.Name = "nodeValueColorBox"; - this.nodeValueColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeValueColorBox.TabIndex = 16; - // - // nodeTypeLabel - // - this.nodeTypeLabel.AutoSize = true; - this.nodeTypeLabel.Location = new System.Drawing.Point(9, 146); - this.nodeTypeLabel.Name = "nodeTypeLabel"; - this.nodeTypeLabel.Size = new System.Drawing.Size(61, 13); - this.nodeTypeLabel.TabIndex = 13; - this.nodeTypeLabel.Text = "Type Color:"; - // - // nodeNameLabel - // - this.nodeNameLabel.AutoSize = true; - this.nodeNameLabel.Location = new System.Drawing.Point(9, 172); - this.nodeNameLabel.Name = "nodeNameLabel"; - this.nodeNameLabel.Size = new System.Drawing.Size(65, 13); - this.nodeNameLabel.TabIndex = 15; - this.nodeNameLabel.Text = "Name Color:"; - // - // nodeNameColorBox - // - this.nodeNameColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeNameColorBox.Location = new System.Drawing.Point(133, 169); - this.nodeNameColorBox.Name = "nodeNameColorBox"; - this.nodeNameColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeNameColorBox.TabIndex = 14; - // - // backgroundLabel - // - this.backgroundLabel.AutoSize = true; - this.backgroundLabel.Location = new System.Drawing.Point(6, 14); - this.backgroundLabel.Name = "backgroundLabel"; - this.backgroundLabel.Size = new System.Drawing.Size(161, 13); - this.backgroundLabel.TabIndex = 1; - this.backgroundLabel.Text = "Memory View Background Color:"; - // - // backgroundColorBox - // - this.backgroundColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.backgroundColorBox.Location = new System.Drawing.Point(175, 11); - this.backgroundColorBox.Name = "backgroundColorBox"; - this.backgroundColorBox.Size = new System.Drawing.Size(123, 20); - this.backgroundColorBox.TabIndex = 0; - // - // typeDefinitionsSettingsTabPage - // - this.typeDefinitionsSettingsTabPage.Controls.Add(this.boolSettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.boolTypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.label1); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.functionPtrSettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.functionPtrTypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf16TextSettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf16TextTypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf8TextSettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf8TextTypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x3SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x3TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x4SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x4TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix4x4SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix4x4TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector2SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector2TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector3SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector3TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector4SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector4TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.doubleSettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.doubleTypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.floatSettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.floatTypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint64SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint64TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint32SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint32TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint16SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint16TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint8SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint8TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int64SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int64TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int32SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int32TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int16SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int16TypeTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int8SettingsLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int8TypeTextBox); - this.typeDefinitionsSettingsTabPage.Location = new System.Drawing.Point(4, 22); - this.typeDefinitionsSettingsTabPage.Name = "typeDefinitionsSettingsTabPage"; - this.typeDefinitionsSettingsTabPage.Padding = new System.Windows.Forms.Padding(3); - this.typeDefinitionsSettingsTabPage.Size = new System.Drawing.Size(554, 329); - this.typeDefinitionsSettingsTabPage.TabIndex = 2; - this.typeDefinitionsSettingsTabPage.Text = "Type Definitions"; - this.typeDefinitionsSettingsTabPage.UseVisualStyleBackColor = true; - // - // boolSettingsLabel - // - this.boolSettingsLabel.AutoSize = true; - this.boolSettingsLabel.Location = new System.Drawing.Point(254, 35); - this.boolSettingsLabel.Name = "boolSettingsLabel"; - this.boolSettingsLabel.Size = new System.Drawing.Size(31, 13); - this.boolSettingsLabel.TabIndex = 46; - this.boolSettingsLabel.Text = "Bool:"; - // - // boolSettingsTextBox - // - this.boolTypeTextBox.Location = new System.Drawing.Point(346, 32); - this.boolTypeTextBox.Name = "boolTypeTextBox"; - this.boolTypeTextBox.Size = new System.Drawing.Size(120, 20); - this.boolTypeTextBox.TabIndex = 45; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 6); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(214, 13); - this.label1.TabIndex = 44; - this.label1.Text = "These types are used to generate the code:"; - // - // functionPtrSettingsLabel - // - this.functionPtrSettingsLabel.AutoSize = true; - this.functionPtrSettingsLabel.Location = new System.Drawing.Point(254, 233); - this.functionPtrSettingsLabel.Name = "functionPtrSettingsLabel"; - this.functionPtrSettingsLabel.Size = new System.Drawing.Size(87, 13); - this.functionPtrSettingsLabel.TabIndex = 43; - this.functionPtrSettingsLabel.Text = "Function Pointer:"; - // - // functionPtrSettingsTextBox - // - this.functionPtrTypeTextBox.Location = new System.Drawing.Point(346, 230); - this.functionPtrTypeTextBox.Name = "functionPtrTypeTextBox"; - this.functionPtrTypeTextBox.Size = new System.Drawing.Size(120, 20); - this.functionPtrTypeTextBox.TabIndex = 42; - // - // utf16TextSettingsLabel - // - this.utf16TextSettingsLabel.AutoSize = true; - this.utf16TextSettingsLabel.Location = new System.Drawing.Point(254, 211); - this.utf16TextSettingsLabel.Name = "utf16TextSettingsLabel"; - this.utf16TextSettingsLabel.Size = new System.Drawing.Size(43, 13); - this.utf16TextSettingsLabel.TabIndex = 39; - this.utf16TextSettingsLabel.Text = "UTF16:"; - // - // utf16TextSettingsTextBox - // - this.utf16TextTypeTextBox.Location = new System.Drawing.Point(346, 208); - this.utf16TextTypeTextBox.Name = "utf16TextTypeTextBox"; - this.utf16TextTypeTextBox.Size = new System.Drawing.Size(120, 20); - this.utf16TextTypeTextBox.TabIndex = 38; - // - // utf8TextSettingsLabel - // - this.utf8TextSettingsLabel.AutoSize = true; - this.utf8TextSettingsLabel.Location = new System.Drawing.Point(254, 189); - this.utf8TextSettingsLabel.Name = "utf8TextSettingsLabel"; - this.utf8TextSettingsLabel.Size = new System.Drawing.Size(37, 13); - this.utf8TextSettingsLabel.TabIndex = 35; - this.utf8TextSettingsLabel.Text = "UTF8:"; - // - // utf8TextSettingsTextBox - // - this.utf8TextTypeTextBox.Location = new System.Drawing.Point(346, 186); - this.utf8TextTypeTextBox.Name = "utf8TextTypeTextBox"; - this.utf8TextTypeTextBox.Size = new System.Drawing.Size(120, 20); - this.utf8TextTypeTextBox.TabIndex = 34; - // - // matrix3x3SettingsLabel - // - this.matrix3x3SettingsLabel.AutoSize = true; - this.matrix3x3SettingsLabel.Location = new System.Drawing.Point(254, 123); - this.matrix3x3SettingsLabel.Name = "matrix3x3SettingsLabel"; - this.matrix3x3SettingsLabel.Size = new System.Drawing.Size(64, 13); - this.matrix3x3SettingsLabel.TabIndex = 33; - this.matrix3x3SettingsLabel.Text = "Matrix (3x3):"; - // - // matrix3x3SettingsTextBox - // - this.matrix3x3TypeTextBox.Location = new System.Drawing.Point(346, 120); - this.matrix3x3TypeTextBox.Name = "matrix3x3TypeTextBox"; - this.matrix3x3TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.matrix3x3TypeTextBox.TabIndex = 32; - // - // matrix3x4SettingsLabel - // - this.matrix3x4SettingsLabel.AutoSize = true; - this.matrix3x4SettingsLabel.Location = new System.Drawing.Point(254, 145); - this.matrix3x4SettingsLabel.Name = "matrix3x4SettingsLabel"; - this.matrix3x4SettingsLabel.Size = new System.Drawing.Size(64, 13); - this.matrix3x4SettingsLabel.TabIndex = 31; - this.matrix3x4SettingsLabel.Text = "Matrix (3x4):"; - // - // matrix3x4SettingsTextBox - // - this.matrix3x4TypeTextBox.Location = new System.Drawing.Point(346, 142); - this.matrix3x4TypeTextBox.Name = "matrix3x4TypeTextBox"; - this.matrix3x4TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.matrix3x4TypeTextBox.TabIndex = 30; - // - // matrix4x4SettingsLabel - // - this.matrix4x4SettingsLabel.AutoSize = true; - this.matrix4x4SettingsLabel.Location = new System.Drawing.Point(254, 167); - this.matrix4x4SettingsLabel.Name = "matrix4x4SettingsLabel"; - this.matrix4x4SettingsLabel.Size = new System.Drawing.Size(64, 13); - this.matrix4x4SettingsLabel.TabIndex = 29; - this.matrix4x4SettingsLabel.Text = "Matrix (4x4):"; - // - // matrix4x4SettingsTextBox - // - this.matrix4x4TypeTextBox.Location = new System.Drawing.Point(346, 164); - this.matrix4x4TypeTextBox.Name = "matrix4x4TypeTextBox"; - this.matrix4x4TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.matrix4x4TypeTextBox.TabIndex = 28; - // - // vector2SettingsLabel - // - this.vector2SettingsLabel.AutoSize = true; - this.vector2SettingsLabel.Location = new System.Drawing.Point(254, 57); - this.vector2SettingsLabel.Name = "vector2SettingsLabel"; - this.vector2SettingsLabel.Size = new System.Drawing.Size(47, 13); - this.vector2SettingsLabel.TabIndex = 27; - this.vector2SettingsLabel.Text = "Vector2:"; - // - // vector2SettingsTextBox - // - this.vector2TypeTextBox.Location = new System.Drawing.Point(346, 54); - this.vector2TypeTextBox.Name = "vector2TypeTextBox"; - this.vector2TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.vector2TypeTextBox.TabIndex = 26; - // - // vector3SettingsLabel - // - this.vector3SettingsLabel.AutoSize = true; - this.vector3SettingsLabel.Location = new System.Drawing.Point(254, 79); - this.vector3SettingsLabel.Name = "vector3SettingsLabel"; - this.vector3SettingsLabel.Size = new System.Drawing.Size(47, 13); - this.vector3SettingsLabel.TabIndex = 25; - this.vector3SettingsLabel.Text = "Vector3:"; - // - // vector3SettingsTextBox - // - this.vector3TypeTextBox.Location = new System.Drawing.Point(346, 76); - this.vector3TypeTextBox.Name = "vector3TypeTextBox"; - this.vector3TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.vector3TypeTextBox.TabIndex = 24; - // - // vector4SettingsLabel - // - this.vector4SettingsLabel.AutoSize = true; - this.vector4SettingsLabel.Location = new System.Drawing.Point(254, 101); - this.vector4SettingsLabel.Name = "vector4SettingsLabel"; - this.vector4SettingsLabel.Size = new System.Drawing.Size(47, 13); - this.vector4SettingsLabel.TabIndex = 23; - this.vector4SettingsLabel.Text = "Vector4:"; - // - // vector4SettingsTextBox - // - this.vector4TypeTextBox.Location = new System.Drawing.Point(346, 98); - this.vector4TypeTextBox.Name = "vector4TypeTextBox"; - this.vector4TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.vector4TypeTextBox.TabIndex = 22; - // - // doubleSettingsLabel - // - this.doubleSettingsLabel.AutoSize = true; - this.doubleSettingsLabel.Location = new System.Drawing.Point(6, 233); - this.doubleSettingsLabel.Name = "doubleSettingsLabel"; - this.doubleSettingsLabel.Size = new System.Drawing.Size(44, 13); - this.doubleSettingsLabel.TabIndex = 21; - this.doubleSettingsLabel.Text = "Double:"; - // - // doubleSettingsTextBox - // - this.doubleTypeTextBox.Location = new System.Drawing.Point(98, 230); - this.doubleTypeTextBox.Name = "doubleTypeTextBox"; - this.doubleTypeTextBox.Size = new System.Drawing.Size(120, 20); - this.doubleTypeTextBox.TabIndex = 20; - // - // floatSettingsLabel - // - this.floatSettingsLabel.AutoSize = true; - this.floatSettingsLabel.Location = new System.Drawing.Point(6, 211); - this.floatSettingsLabel.Name = "floatSettingsLabel"; - this.floatSettingsLabel.Size = new System.Drawing.Size(33, 13); - this.floatSettingsLabel.TabIndex = 19; - this.floatSettingsLabel.Text = "Float:"; - // - // floatSettingsTextBox - // - this.floatTypeTextBox.Location = new System.Drawing.Point(98, 208); - this.floatTypeTextBox.Name = "floatTypeTextBox"; - this.floatTypeTextBox.Size = new System.Drawing.Size(120, 20); - this.floatTypeTextBox.TabIndex = 18; - // - // uint64SettingsLabel - // - this.uint64SettingsLabel.AutoSize = true; - this.uint64SettingsLabel.Location = new System.Drawing.Point(6, 189); - this.uint64SettingsLabel.Name = "uint64SettingsLabel"; - this.uint64SettingsLabel.Size = new System.Drawing.Size(42, 13); - this.uint64SettingsLabel.TabIndex = 17; - this.uint64SettingsLabel.Text = "UInt64:"; - // - // uint64SettingsTextBox - // - this.uint64TypeTextBox.Location = new System.Drawing.Point(98, 186); - this.uint64TypeTextBox.Name = "uint64TypeTextBox"; - this.uint64TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.uint64TypeTextBox.TabIndex = 16; - // - // uint32SettingsLabel - // - this.uint32SettingsLabel.AutoSize = true; - this.uint32SettingsLabel.Location = new System.Drawing.Point(6, 167); - this.uint32SettingsLabel.Name = "uint32SettingsLabel"; - this.uint32SettingsLabel.Size = new System.Drawing.Size(42, 13); - this.uint32SettingsLabel.TabIndex = 15; - this.uint32SettingsLabel.Text = "UInt32:"; - // - // uint32SettingsTextBox - // - this.uint32TypeTextBox.Location = new System.Drawing.Point(98, 164); - this.uint32TypeTextBox.Name = "uint32TypeTextBox"; - this.uint32TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.uint32TypeTextBox.TabIndex = 14; - // - // uint16SettingsLabel - // - this.uint16SettingsLabel.AutoSize = true; - this.uint16SettingsLabel.Location = new System.Drawing.Point(6, 145); - this.uint16SettingsLabel.Name = "uint16SettingsLabel"; - this.uint16SettingsLabel.Size = new System.Drawing.Size(42, 13); - this.uint16SettingsLabel.TabIndex = 13; - this.uint16SettingsLabel.Text = "UInt16:"; - // - // uint16SettingsTextBox - // - this.uint16TypeTextBox.Location = new System.Drawing.Point(98, 142); - this.uint16TypeTextBox.Name = "uint16TypeTextBox"; - this.uint16TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.uint16TypeTextBox.TabIndex = 12; - // - // uint8SettingsLabel - // - this.uint8SettingsLabel.AutoSize = true; - this.uint8SettingsLabel.Location = new System.Drawing.Point(6, 123); - this.uint8SettingsLabel.Name = "uint8SettingsLabel"; - this.uint8SettingsLabel.Size = new System.Drawing.Size(36, 13); - this.uint8SettingsLabel.TabIndex = 11; - this.uint8SettingsLabel.Text = "UInt8:"; - // - // uint8SettingsTextBox - // - this.uint8TypeTextBox.Location = new System.Drawing.Point(98, 120); - this.uint8TypeTextBox.Name = "uint8TypeTextBox"; - this.uint8TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.uint8TypeTextBox.TabIndex = 10; - // - // int64SettingsLabel - // - this.int64SettingsLabel.AutoSize = true; - this.int64SettingsLabel.Location = new System.Drawing.Point(6, 101); - this.int64SettingsLabel.Name = "int64SettingsLabel"; - this.int64SettingsLabel.Size = new System.Drawing.Size(34, 13); - this.int64SettingsLabel.TabIndex = 9; - this.int64SettingsLabel.Text = "Int64:"; - // - // int64SettingsTextBox - // - this.int64TypeTextBox.Location = new System.Drawing.Point(98, 98); - this.int64TypeTextBox.Name = "int64TypeTextBox"; - this.int64TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.int64TypeTextBox.TabIndex = 8; - // - // int32SettingsLabel - // - this.int32SettingsLabel.AutoSize = true; - this.int32SettingsLabel.Location = new System.Drawing.Point(6, 79); - this.int32SettingsLabel.Name = "int32SettingsLabel"; - this.int32SettingsLabel.Size = new System.Drawing.Size(34, 13); - this.int32SettingsLabel.TabIndex = 7; - this.int32SettingsLabel.Text = "Int32:"; - // - // int32SettingsTextBox - // - this.int32TypeTextBox.Location = new System.Drawing.Point(98, 76); - this.int32TypeTextBox.Name = "int32TypeTextBox"; - this.int32TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.int32TypeTextBox.TabIndex = 6; - // - // int16SettingsLabel - // - this.int16SettingsLabel.AutoSize = true; - this.int16SettingsLabel.Location = new System.Drawing.Point(6, 57); - this.int16SettingsLabel.Name = "int16SettingsLabel"; - this.int16SettingsLabel.Size = new System.Drawing.Size(34, 13); - this.int16SettingsLabel.TabIndex = 5; - this.int16SettingsLabel.Text = "Int16:"; - // - // int16SettingsTextBox - // - this.int16TypeTextBox.Location = new System.Drawing.Point(98, 54); - this.int16TypeTextBox.Name = "int16TypeTextBox"; - this.int16TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.int16TypeTextBox.TabIndex = 4; - // - // int8SettingsLabel - // - this.int8SettingsLabel.AutoSize = true; - this.int8SettingsLabel.Location = new System.Drawing.Point(6, 35); - this.int8SettingsLabel.Name = "int8SettingsLabel"; - this.int8SettingsLabel.Size = new System.Drawing.Size(28, 13); - this.int8SettingsLabel.TabIndex = 3; - this.int8SettingsLabel.Text = "Int8:"; - // - // int8SettingsTextBox - // - this.int8TypeTextBox.Location = new System.Drawing.Point(98, 32); - this.int8TypeTextBox.Name = "int8TypeTextBox"; - this.int8TypeTextBox.Size = new System.Drawing.Size(120, 20); - this.int8TypeTextBox.TabIndex = 2; - // - // bannerBox - // - this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; - this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B32x32_Cogs; - this.bannerBox.Location = new System.Drawing.Point(0, 0); - this.bannerBox.Name = "bannerBox"; - this.bannerBox.Size = new System.Drawing.Size(586, 48); - this.bannerBox.TabIndex = 2; - this.bannerBox.Text = "Configure the global settings."; - this.bannerBox.Title = "Settings"; - // - // SettingsForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(586, 427); - this.Controls.Add(this.bannerBox); - this.Controls.Add(this.settingsTabControl); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SettingsForm"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "ReClass.NET - Settings"; - this.settingsTabControl.ResumeLayout(false); - this.generalSettingsTabPage.ResumeLayout(false); - this.generalSettingsTabPage.PerformLayout(); - this.fileAssociationGroupBox.ResumeLayout(false); - this.commentsGroupBox.ResumeLayout(false); - this.commentsGroupBox.PerformLayout(); - this.displayGroupBox.ResumeLayout(false); - this.displayGroupBox.PerformLayout(); - this.colorsSettingTabPage.ResumeLayout(false); - this.colorsSettingTabPage.PerformLayout(); - this.nodeColorGroupBox.ResumeLayout(false); - this.nodeColorGroupBox.PerformLayout(); - this.typeDefinitionsSettingsTabPage.ResumeLayout(false); - this.typeDefinitionsSettingsTabPage.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); - this.ResumeLayout(false); + // + // commentsGroupBox + // + this.commentsGroupBox.Controls.Add(this.showPluginInfoCheckBox); + this.commentsGroupBox.Controls.Add(this.showStringCheckBox); + this.commentsGroupBox.Controls.Add(this.showSymbolsCheckBox); + this.commentsGroupBox.Controls.Add(this.showRttiCheckBox); + this.commentsGroupBox.Controls.Add(this.showPointerCheckBox); + this.commentsGroupBox.Controls.Add(this.showIntegerCheckBox); + this.commentsGroupBox.Controls.Add(this.showFloatCheckBox); + this.commentsGroupBox.Location = new System.Drawing.Point(6, 39); + this.commentsGroupBox.Name = "commentsGroupBox"; + this.commentsGroupBox.Size = new System.Drawing.Size(265, 186); + this.commentsGroupBox.TabIndex = 3; + this.commentsGroupBox.TabStop = false; + this.commentsGroupBox.Text = "Node Comments"; + // + // showPluginInfoCheckBox + // + this.showPluginInfoCheckBox.AutoSize = true; + this.showPluginInfoCheckBox.Location = new System.Drawing.Point(6, 157); + this.showPluginInfoCheckBox.Name = "showPluginInfoCheckBox"; + this.showPluginInfoCheckBox.Size = new System.Drawing.Size(111, 17); + this.showPluginInfoCheckBox.TabIndex = 6; + this.showPluginInfoCheckBox.Text = "Show Plugin Infos"; + this.showPluginInfoCheckBox.UseVisualStyleBackColor = true; + // + // showStringCheckBox + // + this.showStringCheckBox.AutoSize = true; + this.showStringCheckBox.Location = new System.Drawing.Point(6, 134); + this.showStringCheckBox.Name = "showStringCheckBox"; + this.showStringCheckBox.Size = new System.Drawing.Size(88, 17); + this.showStringCheckBox.TabIndex = 5; + this.showStringCheckBox.Text = "Show Strings"; + this.showStringCheckBox.UseVisualStyleBackColor = true; + // + // showSymbolsCheckBox + // + this.showSymbolsCheckBox.AutoSize = true; + this.showSymbolsCheckBox.Location = new System.Drawing.Point(6, 111); + this.showSymbolsCheckBox.Name = "showSymbolsCheckBox"; + this.showSymbolsCheckBox.Size = new System.Drawing.Size(130, 17); + this.showSymbolsCheckBox.TabIndex = 4; + this.showSymbolsCheckBox.Text = "Show Debug Symbols"; + this.showSymbolsCheckBox.UseVisualStyleBackColor = true; + // + // showRttiCheckBox + // + this.showRttiCheckBox.AutoSize = true; + this.showRttiCheckBox.Location = new System.Drawing.Point(6, 88); + this.showRttiCheckBox.Name = "showRttiCheckBox"; + this.showRttiCheckBox.Size = new System.Drawing.Size(81, 17); + this.showRttiCheckBox.TabIndex = 3; + this.showRttiCheckBox.Text = "Show RTTI"; + this.showRttiCheckBox.UseVisualStyleBackColor = true; + // + // showPointerCheckBox + // + this.showPointerCheckBox.AutoSize = true; + this.showPointerCheckBox.Location = new System.Drawing.Point(6, 65); + this.showPointerCheckBox.Name = "showPointerCheckBox"; + this.showPointerCheckBox.Size = new System.Drawing.Size(94, 17); + this.showPointerCheckBox.TabIndex = 2; + this.showPointerCheckBox.Text = "Show Pointers"; + this.showPointerCheckBox.UseVisualStyleBackColor = true; + // + // showIntegerCheckBox + // + this.showIntegerCheckBox.AutoSize = true; + this.showIntegerCheckBox.Location = new System.Drawing.Point(6, 42); + this.showIntegerCheckBox.Name = "showIntegerCheckBox"; + this.showIntegerCheckBox.Size = new System.Drawing.Size(124, 17); + this.showIntegerCheckBox.TabIndex = 1; + this.showIntegerCheckBox.Text = "Show Integer Values"; + this.showIntegerCheckBox.UseVisualStyleBackColor = true; + // + // showFloatCheckBox + // + this.showFloatCheckBox.AutoSize = true; + this.showFloatCheckBox.Location = new System.Drawing.Point(6, 19); + this.showFloatCheckBox.Name = "showFloatCheckBox"; + this.showFloatCheckBox.Size = new System.Drawing.Size(114, 17); + this.showFloatCheckBox.TabIndex = 0; + this.showFloatCheckBox.Text = "Show Float Values"; + this.showFloatCheckBox.UseVisualStyleBackColor = true; + // + // displayGroupBox + // + this.displayGroupBox.Controls.Add(this.randomizeWindowTitleCheckBox); + this.displayGroupBox.Controls.Add(this.runAsAdminCheckBox); + this.displayGroupBox.Controls.Add(this.highlightChangedValuesCheckBox); + this.displayGroupBox.Controls.Add(this.showTextCheckBox); + this.displayGroupBox.Controls.Add(this.showNodeOffsetCheckBox); + this.displayGroupBox.Controls.Add(this.showNodeAddressCheckBox); + this.displayGroupBox.Location = new System.Drawing.Point(283, 39); + this.displayGroupBox.Name = "displayGroupBox"; + this.displayGroupBox.Size = new System.Drawing.Size(265, 160); + this.displayGroupBox.TabIndex = 2; + this.displayGroupBox.TabStop = false; + this.displayGroupBox.Text = "Display"; + // + // randomizeWindowTitleCheckBox + // + this.randomizeWindowTitleCheckBox.AutoSize = true; + this.randomizeWindowTitleCheckBox.Location = new System.Drawing.Point(6, 134); + this.randomizeWindowTitleCheckBox.Name = "randomizeWindowTitleCheckBox"; + this.randomizeWindowTitleCheckBox.Size = new System.Drawing.Size(137, 17); + this.randomizeWindowTitleCheckBox.TabIndex = 5; + this.randomizeWindowTitleCheckBox.Text = "Randomize window title"; + this.randomizeWindowTitleCheckBox.UseVisualStyleBackColor = true; + // + // runAsAdminCheckBox + // + this.runAsAdminCheckBox.AutoSize = true; + this.runAsAdminCheckBox.Location = new System.Drawing.Point(6, 111); + this.runAsAdminCheckBox.Name = "runAsAdminCheckBox"; + this.runAsAdminCheckBox.Size = new System.Drawing.Size(200, 17); + this.runAsAdminCheckBox.TabIndex = 4; + this.runAsAdminCheckBox.Text = "Run as administrator (requires restart)"; + this.runAsAdminCheckBox.UseVisualStyleBackColor = true; + // + // highlightChangedValuesCheckBox + // + this.highlightChangedValuesCheckBox.AutoSize = true; + this.highlightChangedValuesCheckBox.Location = new System.Drawing.Point(6, 88); + this.highlightChangedValuesCheckBox.Name = "highlightChangedValuesCheckBox"; + this.highlightChangedValuesCheckBox.Size = new System.Drawing.Size(148, 17); + this.highlightChangedValuesCheckBox.TabIndex = 3; + this.highlightChangedValuesCheckBox.Text = "Highlight Changed Values"; + this.highlightChangedValuesCheckBox.UseVisualStyleBackColor = true; + // + // showTextCheckBox + // + this.showTextCheckBox.AutoSize = true; + this.showTextCheckBox.Location = new System.Drawing.Point(6, 65); + this.showTextCheckBox.Name = "showTextCheckBox"; + this.showTextCheckBox.Size = new System.Drawing.Size(166, 17); + this.showTextCheckBox.TabIndex = 2; + this.showTextCheckBox.Text = "Show Textual Representation"; + this.showTextCheckBox.UseVisualStyleBackColor = true; + // + // showNodeOffsetCheckBox + // + this.showNodeOffsetCheckBox.AutoSize = true; + this.showNodeOffsetCheckBox.Location = new System.Drawing.Point(6, 42); + this.showNodeOffsetCheckBox.Name = "showNodeOffsetCheckBox"; + this.showNodeOffsetCheckBox.Size = new System.Drawing.Size(113, 17); + this.showNodeOffsetCheckBox.TabIndex = 1; + this.showNodeOffsetCheckBox.Text = "Show Node Offset"; + this.showNodeOffsetCheckBox.UseVisualStyleBackColor = true; + // + // showNodeAddressCheckBox + // + this.showNodeAddressCheckBox.AutoSize = true; + this.showNodeAddressCheckBox.Location = new System.Drawing.Point(6, 19); + this.showNodeAddressCheckBox.Name = "showNodeAddressCheckBox"; + this.showNodeAddressCheckBox.Size = new System.Drawing.Size(123, 17); + this.showNodeAddressCheckBox.TabIndex = 0; + this.showNodeAddressCheckBox.Text = "Show Node Address"; + this.showNodeAddressCheckBox.UseVisualStyleBackColor = true; + // + // stayOnTopCheckBox + // + this.stayOnTopCheckBox.AutoSize = true; + this.stayOnTopCheckBox.Location = new System.Drawing.Point(6, 6); + this.stayOnTopCheckBox.Name = "stayOnTopCheckBox"; + this.stayOnTopCheckBox.Size = new System.Drawing.Size(187, 17); + this.stayOnTopCheckBox.TabIndex = 1; + this.stayOnTopCheckBox.Text = "Force ReClass.NET to stay on top"; + this.stayOnTopCheckBox.UseVisualStyleBackColor = true; + // + // colorsSettingTabPage + // + this.colorsSettingTabPage.Controls.Add(this.nodeColorGroupBox); + this.colorsSettingTabPage.Controls.Add(this.backgroundLabel); + this.colorsSettingTabPage.Controls.Add(this.backgroundColorBox); + this.colorsSettingTabPage.Location = new System.Drawing.Point(4, 22); + this.colorsSettingTabPage.Name = "colorsSettingTabPage"; + this.colorsSettingTabPage.Padding = new System.Windows.Forms.Padding(3); + this.colorsSettingTabPage.Size = new System.Drawing.Size(554, 329); + this.colorsSettingTabPage.TabIndex = 1; + this.colorsSettingTabPage.Text = "Colors"; + this.colorsSettingTabPage.UseVisualStyleBackColor = true; + // + // nodeColorGroupBox + // + this.nodeColorGroupBox.Controls.Add(this.nodeValueLabel); + this.nodeColorGroupBox.Controls.Add(this.nodePluginLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeHexValueColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodePluginColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeHexValueLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeVTableLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeOffsetColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeVTableColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeOffsetLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeTextLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeAddressColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeTextColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeAddressLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeCommentLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeHiddenColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeCommentColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeHiddenLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeIndexLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeSelectedColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeIndexColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeSelectedLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeTypeColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeValueColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeTypeLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeNameLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeNameColorBox); + this.nodeColorGroupBox.Location = new System.Drawing.Point(9, 43); + this.nodeColorGroupBox.Name = "nodeColorGroupBox"; + this.nodeColorGroupBox.Size = new System.Drawing.Size(539, 225); + this.nodeColorGroupBox.TabIndex = 28; + this.nodeColorGroupBox.TabStop = false; + this.nodeColorGroupBox.Text = "Node Colors"; + // + // nodeValueLabel + // + this.nodeValueLabel.AutoSize = true; + this.nodeValueLabel.Location = new System.Drawing.Point(9, 198); + this.nodeValueLabel.Name = "nodeValueLabel"; + this.nodeValueLabel.Size = new System.Drawing.Size(64, 13); + this.nodeValueLabel.TabIndex = 17; + this.nodeValueLabel.Text = "Value Color:"; + // + // nodePluginLabel + // + this.nodePluginLabel.AutoSize = true; + this.nodePluginLabel.Location = new System.Drawing.Point(286, 172); + this.nodePluginLabel.Name = "nodePluginLabel"; + this.nodePluginLabel.Size = new System.Drawing.Size(87, 13); + this.nodePluginLabel.TabIndex = 27; + this.nodePluginLabel.Text = "Plugin Info Color:"; + // + // nodeHexValueColorBox + // + this.nodeHexValueColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeHexValueColorBox.Location = new System.Drawing.Point(133, 117); + this.nodeHexValueColorBox.Name = "nodeHexValueColorBox"; + this.nodeHexValueColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeHexValueColorBox.TabIndex = 2; + // + // nodePluginColorBox + // + this.nodePluginColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodePluginColorBox.Location = new System.Drawing.Point(410, 169); + this.nodePluginColorBox.Name = "nodePluginColorBox"; + this.nodePluginColorBox.Size = new System.Drawing.Size(123, 20); + this.nodePluginColorBox.TabIndex = 26; + // + // nodeHexValueLabel + // + this.nodeHexValueLabel.AutoSize = true; + this.nodeHexValueLabel.Location = new System.Drawing.Point(9, 120); + this.nodeHexValueLabel.Name = "nodeHexValueLabel"; + this.nodeHexValueLabel.Size = new System.Drawing.Size(86, 13); + this.nodeHexValueLabel.TabIndex = 3; + this.nodeHexValueLabel.Text = "Hex Value Color:"; + // + // nodeVTableLabel + // + this.nodeVTableLabel.AutoSize = true; + this.nodeVTableLabel.Location = new System.Drawing.Point(286, 94); + this.nodeVTableLabel.Name = "nodeVTableLabel"; + this.nodeVTableLabel.Size = new System.Drawing.Size(71, 13); + this.nodeVTableLabel.TabIndex = 25; + this.nodeVTableLabel.Text = "VTable Color:"; + // + // nodeOffsetColorBox + // + this.nodeOffsetColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeOffsetColorBox.Location = new System.Drawing.Point(133, 91); + this.nodeOffsetColorBox.Name = "nodeOffsetColorBox"; + this.nodeOffsetColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeOffsetColorBox.TabIndex = 4; + // + // nodeVTableColorBox + // + this.nodeVTableColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeVTableColorBox.Location = new System.Drawing.Point(410, 91); + this.nodeVTableColorBox.Name = "nodeVTableColorBox"; + this.nodeVTableColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeVTableColorBox.TabIndex = 24; + // + // nodeOffsetLabel + // + this.nodeOffsetLabel.AutoSize = true; + this.nodeOffsetLabel.Location = new System.Drawing.Point(9, 94); + this.nodeOffsetLabel.Name = "nodeOffsetLabel"; + this.nodeOffsetLabel.Size = new System.Drawing.Size(65, 13); + this.nodeOffsetLabel.TabIndex = 5; + this.nodeOffsetLabel.Text = "Offset Color:"; + // + // nodeTextLabel + // + this.nodeTextLabel.AutoSize = true; + this.nodeTextLabel.Location = new System.Drawing.Point(286, 146); + this.nodeTextLabel.Name = "nodeTextLabel"; + this.nodeTextLabel.Size = new System.Drawing.Size(58, 13); + this.nodeTextLabel.TabIndex = 23; + this.nodeTextLabel.Text = "Text Color:"; + // + // nodeAddressColorBox + // + this.nodeAddressColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeAddressColorBox.Location = new System.Drawing.Point(133, 65); + this.nodeAddressColorBox.Name = "nodeAddressColorBox"; + this.nodeAddressColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeAddressColorBox.TabIndex = 6; + // + // nodeTextColorBox + // + this.nodeTextColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeTextColorBox.Location = new System.Drawing.Point(410, 143); + this.nodeTextColorBox.Name = "nodeTextColorBox"; + this.nodeTextColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeTextColorBox.TabIndex = 22; + // + // nodeAddressLabel + // + this.nodeAddressLabel.AutoSize = true; + this.nodeAddressLabel.Location = new System.Drawing.Point(9, 68); + this.nodeAddressLabel.Name = "nodeAddressLabel"; + this.nodeAddressLabel.Size = new System.Drawing.Size(75, 13); + this.nodeAddressLabel.TabIndex = 7; + this.nodeAddressLabel.Text = "Address Color:"; + // + // nodeCommentLabel + // + this.nodeCommentLabel.AutoSize = true; + this.nodeCommentLabel.Location = new System.Drawing.Point(286, 120); + this.nodeCommentLabel.Name = "nodeCommentLabel"; + this.nodeCommentLabel.Size = new System.Drawing.Size(81, 13); + this.nodeCommentLabel.TabIndex = 21; + this.nodeCommentLabel.Text = "Comment Color:"; + // + // nodeHiddenColorBox + // + this.nodeHiddenColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeHiddenColorBox.Location = new System.Drawing.Point(410, 18); + this.nodeHiddenColorBox.Name = "nodeHiddenColorBox"; + this.nodeHiddenColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeHiddenColorBox.TabIndex = 8; + // + // nodeCommentColorBox + // + this.nodeCommentColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeCommentColorBox.Location = new System.Drawing.Point(410, 117); + this.nodeCommentColorBox.Name = "nodeCommentColorBox"; + this.nodeCommentColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeCommentColorBox.TabIndex = 20; + // + // nodeHiddenLabel + // + this.nodeHiddenLabel.AutoSize = true; + this.nodeHiddenLabel.Location = new System.Drawing.Point(286, 21); + this.nodeHiddenLabel.Name = "nodeHiddenLabel"; + this.nodeHiddenLabel.Size = new System.Drawing.Size(71, 13); + this.nodeHiddenLabel.TabIndex = 9; + this.nodeHiddenLabel.Text = "Hidden Color:"; + // + // nodeIndexLabel + // + this.nodeIndexLabel.AutoSize = true; + this.nodeIndexLabel.Location = new System.Drawing.Point(286, 68); + this.nodeIndexLabel.Name = "nodeIndexLabel"; + this.nodeIndexLabel.Size = new System.Drawing.Size(63, 13); + this.nodeIndexLabel.TabIndex = 19; + this.nodeIndexLabel.Text = "Index Color:"; + // + // nodeSelectedColorBox + // + this.nodeSelectedColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeSelectedColorBox.Location = new System.Drawing.Point(133, 18); + this.nodeSelectedColorBox.Name = "nodeSelectedColorBox"; + this.nodeSelectedColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeSelectedColorBox.TabIndex = 10; + // + // nodeIndexColorBox + // + this.nodeIndexColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeIndexColorBox.Location = new System.Drawing.Point(410, 65); + this.nodeIndexColorBox.Name = "nodeIndexColorBox"; + this.nodeIndexColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeIndexColorBox.TabIndex = 18; + // + // nodeSelectedLabel + // + this.nodeSelectedLabel.AutoSize = true; + this.nodeSelectedLabel.Location = new System.Drawing.Point(9, 21); + this.nodeSelectedLabel.Name = "nodeSelectedLabel"; + this.nodeSelectedLabel.Size = new System.Drawing.Size(79, 13); + this.nodeSelectedLabel.TabIndex = 11; + this.nodeSelectedLabel.Text = "Selected Color:"; + // + // nodeTypeColorBox + // + this.nodeTypeColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeTypeColorBox.Location = new System.Drawing.Point(133, 143); + this.nodeTypeColorBox.Name = "nodeTypeColorBox"; + this.nodeTypeColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeTypeColorBox.TabIndex = 12; + // + // nodeValueColorBox + // + this.nodeValueColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeValueColorBox.Location = new System.Drawing.Point(133, 195); + this.nodeValueColorBox.Name = "nodeValueColorBox"; + this.nodeValueColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeValueColorBox.TabIndex = 16; + // + // nodeTypeLabel + // + this.nodeTypeLabel.AutoSize = true; + this.nodeTypeLabel.Location = new System.Drawing.Point(9, 146); + this.nodeTypeLabel.Name = "nodeTypeLabel"; + this.nodeTypeLabel.Size = new System.Drawing.Size(61, 13); + this.nodeTypeLabel.TabIndex = 13; + this.nodeTypeLabel.Text = "Type Color:"; + // + // nodeNameLabel + // + this.nodeNameLabel.AutoSize = true; + this.nodeNameLabel.Location = new System.Drawing.Point(9, 172); + this.nodeNameLabel.Name = "nodeNameLabel"; + this.nodeNameLabel.Size = new System.Drawing.Size(65, 13); + this.nodeNameLabel.TabIndex = 15; + this.nodeNameLabel.Text = "Name Color:"; + // + // nodeNameColorBox + // + this.nodeNameColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeNameColorBox.Location = new System.Drawing.Point(133, 169); + this.nodeNameColorBox.Name = "nodeNameColorBox"; + this.nodeNameColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeNameColorBox.TabIndex = 14; + // + // backgroundLabel + // + this.backgroundLabel.AutoSize = true; + this.backgroundLabel.Location = new System.Drawing.Point(6, 14); + this.backgroundLabel.Name = "backgroundLabel"; + this.backgroundLabel.Size = new System.Drawing.Size(161, 13); + this.backgroundLabel.TabIndex = 1; + this.backgroundLabel.Text = "Memory View Background Color:"; + // + // backgroundColorBox + // + this.backgroundColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.backgroundColorBox.Location = new System.Drawing.Point(175, 11); + this.backgroundColorBox.Name = "backgroundColorBox"; + this.backgroundColorBox.Size = new System.Drawing.Size(123, 20); + this.backgroundColorBox.TabIndex = 0; + // + // typeDefinitionsSettingsTabPage + // + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf32TextSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf32TextTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.nuintSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.nuintTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.nintSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.nintTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.boolSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.boolTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.generatorInfoLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.functionPtrSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.functionPtrTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf16TextSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf16TextTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf8TextSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf8TextTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x3SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x3TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x4SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x4TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix4x4SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix4x4TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector2SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector2TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector3SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector3TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector4SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector4TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.doubleSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.doubleTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.floatSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.floatTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint64SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint64TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint32SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint32TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint16SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint16TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint8SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint8TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int64SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int64TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int32SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int32TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int16SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int16TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int8SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int8TypeTextBox); + this.typeDefinitionsSettingsTabPage.Location = new System.Drawing.Point(4, 22); + this.typeDefinitionsSettingsTabPage.Name = "typeDefinitionsSettingsTabPage"; + this.typeDefinitionsSettingsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.typeDefinitionsSettingsTabPage.Size = new System.Drawing.Size(554, 329); + this.typeDefinitionsSettingsTabPage.TabIndex = 2; + this.typeDefinitionsSettingsTabPage.Text = "Type Definitions"; + this.typeDefinitionsSettingsTabPage.UseVisualStyleBackColor = true; + // + // nuintSettingsLabel + // + this.nuintSettingsLabel.AutoSize = true; + this.nuintSettingsLabel.Location = new System.Drawing.Point(6, 233); + this.nuintSettingsLabel.Name = "nuintSettingsLabel"; + this.nuintSettingsLabel.Size = new System.Drawing.Size(38, 13); + this.nuintSettingsLabel.TabIndex = 50; + this.nuintSettingsLabel.Text = "NUInt:"; + // + // nuintTypeTextBox + // + this.nuintTypeTextBox.Location = new System.Drawing.Point(98, 230); + this.nuintTypeTextBox.Name = "nuintTypeTextBox"; + this.nuintTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.nuintTypeTextBox.TabIndex = 49; + // + // nintSettingsLabel + // + this.nintSettingsLabel.AutoSize = true; + this.nintSettingsLabel.Location = new System.Drawing.Point(6, 123); + this.nintSettingsLabel.Name = "nintSettingsLabel"; + this.nintSettingsLabel.Size = new System.Drawing.Size(30, 13); + this.nintSettingsLabel.TabIndex = 48; + this.nintSettingsLabel.Text = "NInt:"; + // + // nintTypeTextBox + // + this.nintTypeTextBox.Location = new System.Drawing.Point(98, 120); + this.nintTypeTextBox.Name = "nintTypeTextBox"; + this.nintTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.nintTypeTextBox.TabIndex = 47; + // + // boolSettingsLabel + // + this.boolSettingsLabel.AutoSize = true; + this.boolSettingsLabel.Location = new System.Drawing.Point(254, 35); + this.boolSettingsLabel.Name = "boolSettingsLabel"; + this.boolSettingsLabel.Size = new System.Drawing.Size(31, 13); + this.boolSettingsLabel.TabIndex = 46; + this.boolSettingsLabel.Text = "Bool:"; + // + // boolTypeTextBox + // + this.boolTypeTextBox.Location = new System.Drawing.Point(346, 32); + this.boolTypeTextBox.Name = "boolTypeTextBox"; + this.boolTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.boolTypeTextBox.TabIndex = 45; + // + // generatorInfoLabel + // + this.generatorInfoLabel.AutoSize = true; + this.generatorInfoLabel.Location = new System.Drawing.Point(6, 6); + this.generatorInfoLabel.Name = "generatorInfoLabel"; + this.generatorInfoLabel.Size = new System.Drawing.Size(236, 13); + this.generatorInfoLabel.TabIndex = 44; + this.generatorInfoLabel.Text = "These types are used to generate the C++ code:"; + // + // functionPtrSettingsLabel + // + this.functionPtrSettingsLabel.AutoSize = true; + this.functionPtrSettingsLabel.Location = new System.Drawing.Point(254, 255); + this.functionPtrSettingsLabel.Name = "functionPtrSettingsLabel"; + this.functionPtrSettingsLabel.Size = new System.Drawing.Size(87, 13); + this.functionPtrSettingsLabel.TabIndex = 43; + this.functionPtrSettingsLabel.Text = "Function Pointer:"; + // + // functionPtrTypeTextBox + // + this.functionPtrTypeTextBox.Location = new System.Drawing.Point(346, 252); + this.functionPtrTypeTextBox.Name = "functionPtrTypeTextBox"; + this.functionPtrTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.functionPtrTypeTextBox.TabIndex = 42; + // + // utf16TextSettingsLabel + // + this.utf16TextSettingsLabel.AutoSize = true; + this.utf16TextSettingsLabel.Location = new System.Drawing.Point(254, 211); + this.utf16TextSettingsLabel.Name = "utf16TextSettingsLabel"; + this.utf16TextSettingsLabel.Size = new System.Drawing.Size(43, 13); + this.utf16TextSettingsLabel.TabIndex = 39; + this.utf16TextSettingsLabel.Text = "UTF16:"; + // + // utf16TextTypeTextBox + // + this.utf16TextTypeTextBox.Location = new System.Drawing.Point(346, 208); + this.utf16TextTypeTextBox.Name = "utf16TextTypeTextBox"; + this.utf16TextTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.utf16TextTypeTextBox.TabIndex = 38; + // + // utf8TextSettingsLabel + // + this.utf8TextSettingsLabel.AutoSize = true; + this.utf8TextSettingsLabel.Location = new System.Drawing.Point(254, 189); + this.utf8TextSettingsLabel.Name = "utf8TextSettingsLabel"; + this.utf8TextSettingsLabel.Size = new System.Drawing.Size(37, 13); + this.utf8TextSettingsLabel.TabIndex = 35; + this.utf8TextSettingsLabel.Text = "UTF8:"; + // + // utf8TextTypeTextBox + // + this.utf8TextTypeTextBox.Location = new System.Drawing.Point(346, 186); + this.utf8TextTypeTextBox.Name = "utf8TextTypeTextBox"; + this.utf8TextTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.utf8TextTypeTextBox.TabIndex = 34; + // + // matrix3x3SettingsLabel + // + this.matrix3x3SettingsLabel.AutoSize = true; + this.matrix3x3SettingsLabel.Location = new System.Drawing.Point(254, 123); + this.matrix3x3SettingsLabel.Name = "matrix3x3SettingsLabel"; + this.matrix3x3SettingsLabel.Size = new System.Drawing.Size(64, 13); + this.matrix3x3SettingsLabel.TabIndex = 33; + this.matrix3x3SettingsLabel.Text = "Matrix (3x3):"; + // + // matrix3x3TypeTextBox + // + this.matrix3x3TypeTextBox.Location = new System.Drawing.Point(346, 120); + this.matrix3x3TypeTextBox.Name = "matrix3x3TypeTextBox"; + this.matrix3x3TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.matrix3x3TypeTextBox.TabIndex = 32; + // + // matrix3x4SettingsLabel + // + this.matrix3x4SettingsLabel.AutoSize = true; + this.matrix3x4SettingsLabel.Location = new System.Drawing.Point(254, 145); + this.matrix3x4SettingsLabel.Name = "matrix3x4SettingsLabel"; + this.matrix3x4SettingsLabel.Size = new System.Drawing.Size(64, 13); + this.matrix3x4SettingsLabel.TabIndex = 31; + this.matrix3x4SettingsLabel.Text = "Matrix (3x4):"; + // + // matrix3x4TypeTextBox + // + this.matrix3x4TypeTextBox.Location = new System.Drawing.Point(346, 142); + this.matrix3x4TypeTextBox.Name = "matrix3x4TypeTextBox"; + this.matrix3x4TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.matrix3x4TypeTextBox.TabIndex = 30; + // + // matrix4x4SettingsLabel + // + this.matrix4x4SettingsLabel.AutoSize = true; + this.matrix4x4SettingsLabel.Location = new System.Drawing.Point(254, 167); + this.matrix4x4SettingsLabel.Name = "matrix4x4SettingsLabel"; + this.matrix4x4SettingsLabel.Size = new System.Drawing.Size(64, 13); + this.matrix4x4SettingsLabel.TabIndex = 29; + this.matrix4x4SettingsLabel.Text = "Matrix (4x4):"; + // + // matrix4x4TypeTextBox + // + this.matrix4x4TypeTextBox.Location = new System.Drawing.Point(346, 164); + this.matrix4x4TypeTextBox.Name = "matrix4x4TypeTextBox"; + this.matrix4x4TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.matrix4x4TypeTextBox.TabIndex = 28; + // + // vector2SettingsLabel + // + this.vector2SettingsLabel.AutoSize = true; + this.vector2SettingsLabel.Location = new System.Drawing.Point(254, 57); + this.vector2SettingsLabel.Name = "vector2SettingsLabel"; + this.vector2SettingsLabel.Size = new System.Drawing.Size(47, 13); + this.vector2SettingsLabel.TabIndex = 27; + this.vector2SettingsLabel.Text = "Vector2:"; + // + // vector2TypeTextBox + // + this.vector2TypeTextBox.Location = new System.Drawing.Point(346, 54); + this.vector2TypeTextBox.Name = "vector2TypeTextBox"; + this.vector2TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.vector2TypeTextBox.TabIndex = 26; + // + // vector3SettingsLabel + // + this.vector3SettingsLabel.AutoSize = true; + this.vector3SettingsLabel.Location = new System.Drawing.Point(254, 79); + this.vector3SettingsLabel.Name = "vector3SettingsLabel"; + this.vector3SettingsLabel.Size = new System.Drawing.Size(47, 13); + this.vector3SettingsLabel.TabIndex = 25; + this.vector3SettingsLabel.Text = "Vector3:"; + // + // vector3TypeTextBox + // + this.vector3TypeTextBox.Location = new System.Drawing.Point(346, 76); + this.vector3TypeTextBox.Name = "vector3TypeTextBox"; + this.vector3TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.vector3TypeTextBox.TabIndex = 24; + // + // vector4SettingsLabel + // + this.vector4SettingsLabel.AutoSize = true; + this.vector4SettingsLabel.Location = new System.Drawing.Point(254, 101); + this.vector4SettingsLabel.Name = "vector4SettingsLabel"; + this.vector4SettingsLabel.Size = new System.Drawing.Size(47, 13); + this.vector4SettingsLabel.TabIndex = 23; + this.vector4SettingsLabel.Text = "Vector4:"; + // + // vector4TypeTextBox + // + this.vector4TypeTextBox.Location = new System.Drawing.Point(346, 98); + this.vector4TypeTextBox.Name = "vector4TypeTextBox"; + this.vector4TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.vector4TypeTextBox.TabIndex = 22; + // + // doubleSettingsLabel + // + this.doubleSettingsLabel.AutoSize = true; + this.doubleSettingsLabel.Location = new System.Drawing.Point(6, 277); + this.doubleSettingsLabel.Name = "doubleSettingsLabel"; + this.doubleSettingsLabel.Size = new System.Drawing.Size(44, 13); + this.doubleSettingsLabel.TabIndex = 21; + this.doubleSettingsLabel.Text = "Double:"; + // + // doubleTypeTextBox + // + this.doubleTypeTextBox.Location = new System.Drawing.Point(98, 274); + this.doubleTypeTextBox.Name = "doubleTypeTextBox"; + this.doubleTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.doubleTypeTextBox.TabIndex = 20; + // + // floatSettingsLabel + // + this.floatSettingsLabel.AutoSize = true; + this.floatSettingsLabel.Location = new System.Drawing.Point(6, 255); + this.floatSettingsLabel.Name = "floatSettingsLabel"; + this.floatSettingsLabel.Size = new System.Drawing.Size(33, 13); + this.floatSettingsLabel.TabIndex = 19; + this.floatSettingsLabel.Text = "Float:"; + // + // floatTypeTextBox + // + this.floatTypeTextBox.Location = new System.Drawing.Point(98, 252); + this.floatTypeTextBox.Name = "floatTypeTextBox"; + this.floatTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.floatTypeTextBox.TabIndex = 18; + // + // uint64SettingsLabel + // + this.uint64SettingsLabel.AutoSize = true; + this.uint64SettingsLabel.Location = new System.Drawing.Point(6, 211); + this.uint64SettingsLabel.Name = "uint64SettingsLabel"; + this.uint64SettingsLabel.Size = new System.Drawing.Size(42, 13); + this.uint64SettingsLabel.TabIndex = 17; + this.uint64SettingsLabel.Text = "UInt64:"; + // + // uint64TypeTextBox + // + this.uint64TypeTextBox.Location = new System.Drawing.Point(98, 208); + this.uint64TypeTextBox.Name = "uint64TypeTextBox"; + this.uint64TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.uint64TypeTextBox.TabIndex = 16; + // + // uint32SettingsLabel + // + this.uint32SettingsLabel.AutoSize = true; + this.uint32SettingsLabel.Location = new System.Drawing.Point(6, 189); + this.uint32SettingsLabel.Name = "uint32SettingsLabel"; + this.uint32SettingsLabel.Size = new System.Drawing.Size(42, 13); + this.uint32SettingsLabel.TabIndex = 15; + this.uint32SettingsLabel.Text = "UInt32:"; + // + // uint32TypeTextBox + // + this.uint32TypeTextBox.Location = new System.Drawing.Point(98, 186); + this.uint32TypeTextBox.Name = "uint32TypeTextBox"; + this.uint32TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.uint32TypeTextBox.TabIndex = 14; + // + // uint16SettingsLabel + // + this.uint16SettingsLabel.AutoSize = true; + this.uint16SettingsLabel.Location = new System.Drawing.Point(6, 167); + this.uint16SettingsLabel.Name = "uint16SettingsLabel"; + this.uint16SettingsLabel.Size = new System.Drawing.Size(42, 13); + this.uint16SettingsLabel.TabIndex = 13; + this.uint16SettingsLabel.Text = "UInt16:"; + // + // uint16TypeTextBox + // + this.uint16TypeTextBox.Location = new System.Drawing.Point(98, 164); + this.uint16TypeTextBox.Name = "uint16TypeTextBox"; + this.uint16TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.uint16TypeTextBox.TabIndex = 12; + // + // uint8SettingsLabel + // + this.uint8SettingsLabel.AutoSize = true; + this.uint8SettingsLabel.Location = new System.Drawing.Point(6, 145); + this.uint8SettingsLabel.Name = "uint8SettingsLabel"; + this.uint8SettingsLabel.Size = new System.Drawing.Size(36, 13); + this.uint8SettingsLabel.TabIndex = 11; + this.uint8SettingsLabel.Text = "UInt8:"; + // + // uint8TypeTextBox + // + this.uint8TypeTextBox.Location = new System.Drawing.Point(98, 142); + this.uint8TypeTextBox.Name = "uint8TypeTextBox"; + this.uint8TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.uint8TypeTextBox.TabIndex = 10; + // + // int64SettingsLabel + // + this.int64SettingsLabel.AutoSize = true; + this.int64SettingsLabel.Location = new System.Drawing.Point(6, 101); + this.int64SettingsLabel.Name = "int64SettingsLabel"; + this.int64SettingsLabel.Size = new System.Drawing.Size(34, 13); + this.int64SettingsLabel.TabIndex = 9; + this.int64SettingsLabel.Text = "Int64:"; + // + // int64TypeTextBox + // + this.int64TypeTextBox.Location = new System.Drawing.Point(98, 98); + this.int64TypeTextBox.Name = "int64TypeTextBox"; + this.int64TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.int64TypeTextBox.TabIndex = 8; + // + // int32SettingsLabel + // + this.int32SettingsLabel.AutoSize = true; + this.int32SettingsLabel.Location = new System.Drawing.Point(6, 79); + this.int32SettingsLabel.Name = "int32SettingsLabel"; + this.int32SettingsLabel.Size = new System.Drawing.Size(34, 13); + this.int32SettingsLabel.TabIndex = 7; + this.int32SettingsLabel.Text = "Int32:"; + // + // int32TypeTextBox + // + this.int32TypeTextBox.Location = new System.Drawing.Point(98, 76); + this.int32TypeTextBox.Name = "int32TypeTextBox"; + this.int32TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.int32TypeTextBox.TabIndex = 6; + // + // int16SettingsLabel + // + this.int16SettingsLabel.AutoSize = true; + this.int16SettingsLabel.Location = new System.Drawing.Point(6, 57); + this.int16SettingsLabel.Name = "int16SettingsLabel"; + this.int16SettingsLabel.Size = new System.Drawing.Size(34, 13); + this.int16SettingsLabel.TabIndex = 5; + this.int16SettingsLabel.Text = "Int16:"; + // + // int16TypeTextBox + // + this.int16TypeTextBox.Location = new System.Drawing.Point(98, 54); + this.int16TypeTextBox.Name = "int16TypeTextBox"; + this.int16TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.int16TypeTextBox.TabIndex = 4; + // + // int8SettingsLabel + // + this.int8SettingsLabel.AutoSize = true; + this.int8SettingsLabel.Location = new System.Drawing.Point(6, 35); + this.int8SettingsLabel.Name = "int8SettingsLabel"; + this.int8SettingsLabel.Size = new System.Drawing.Size(28, 13); + this.int8SettingsLabel.TabIndex = 3; + this.int8SettingsLabel.Text = "Int8:"; + // + // int8TypeTextBox + // + this.int8TypeTextBox.Location = new System.Drawing.Point(98, 32); + this.int8TypeTextBox.Name = "int8TypeTextBox"; + this.int8TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.int8TypeTextBox.TabIndex = 2; + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B32x32_Cogs; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(586, 48); + this.bannerBox.TabIndex = 2; + this.bannerBox.Text = "Configure the global settings."; + this.bannerBox.Title = "Settings"; + // + // utf32TextSettingsLabel + // + this.utf32TextSettingsLabel.AutoSize = true; + this.utf32TextSettingsLabel.Location = new System.Drawing.Point(254, 233); + this.utf32TextSettingsLabel.Name = "utf32TextSettingsLabel"; + this.utf32TextSettingsLabel.Size = new System.Drawing.Size(43, 13); + this.utf32TextSettingsLabel.TabIndex = 52; + this.utf32TextSettingsLabel.Text = "UTF32:"; + // + // utf32TextTypeTextBox + // + this.utf32TextTypeTextBox.Location = new System.Drawing.Point(346, 230); + this.utf32TextTypeTextBox.Name = "utf32TextTypeTextBox"; + this.utf32TextTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.utf32TextTypeTextBox.TabIndex = 51; + // + // SettingsForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(586, 427); + this.Controls.Add(this.bannerBox); + this.Controls.Add(this.settingsTabControl); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SettingsForm"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ReClass.NET - Settings"; + this.settingsTabControl.ResumeLayout(false); + this.generalSettingsTabPage.ResumeLayout(false); + this.generalSettingsTabPage.PerformLayout(); + this.fileAssociationGroupBox.ResumeLayout(false); + this.commentsGroupBox.ResumeLayout(false); + this.commentsGroupBox.PerformLayout(); + this.displayGroupBox.ResumeLayout(false); + this.displayGroupBox.PerformLayout(); + this.colorsSettingTabPage.ResumeLayout(false); + this.colorsSettingTabPage.PerformLayout(); + this.nodeColorGroupBox.ResumeLayout(false); + this.nodeColorGroupBox.PerformLayout(); + this.typeDefinitionsSettingsTabPage.ResumeLayout(false); + this.typeDefinitionsSettingsTabPage.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + this.ResumeLayout(false); } @@ -1078,34 +1164,34 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox showPluginInfoCheckBox; private System.Windows.Forms.CheckBox showStringCheckBox; private System.Windows.Forms.CheckBox showSymbolsCheckBox; - private UI.ColorBox backgroundColorBox; + private ColorBox backgroundColorBox; private System.Windows.Forms.Label nodeSelectedLabel; - private UI.ColorBox nodeSelectedColorBox; + private ColorBox nodeSelectedColorBox; private System.Windows.Forms.Label nodeHiddenLabel; - private UI.ColorBox nodeHiddenColorBox; + private ColorBox nodeHiddenColorBox; private System.Windows.Forms.Label nodeAddressLabel; - private UI.ColorBox nodeAddressColorBox; + private ColorBox nodeAddressColorBox; private System.Windows.Forms.Label nodeOffsetLabel; - private UI.ColorBox nodeOffsetColorBox; + private ColorBox nodeOffsetColorBox; private System.Windows.Forms.Label nodeHexValueLabel; - private UI.ColorBox nodeHexValueColorBox; + private ColorBox nodeHexValueColorBox; private System.Windows.Forms.Label backgroundLabel; private System.Windows.Forms.Label nodeValueLabel; - private UI.ColorBox nodeValueColorBox; + private ColorBox nodeValueColorBox; private System.Windows.Forms.Label nodeNameLabel; - private UI.ColorBox nodeNameColorBox; + private ColorBox nodeNameColorBox; private System.Windows.Forms.Label nodeTypeLabel; - private UI.ColorBox nodeTypeColorBox; + private ColorBox nodeTypeColorBox; private System.Windows.Forms.Label nodeVTableLabel; - private UI.ColorBox nodeVTableColorBox; + private ColorBox nodeVTableColorBox; private System.Windows.Forms.Label nodeTextLabel; - private UI.ColorBox nodeTextColorBox; + private ColorBox nodeTextColorBox; private System.Windows.Forms.Label nodeCommentLabel; - private UI.ColorBox nodeCommentColorBox; + private ColorBox nodeCommentColorBox; private System.Windows.Forms.Label nodeIndexLabel; - private UI.ColorBox nodeIndexColorBox; + private ColorBox nodeIndexColorBox; private System.Windows.Forms.Label nodePluginLabel; - private UI.ColorBox nodePluginColorBox; + private ColorBox nodePluginColorBox; private System.Windows.Forms.Label floatSettingsLabel; private System.Windows.Forms.TextBox floatTypeTextBox; private System.Windows.Forms.Label uint64SettingsLabel; @@ -1145,13 +1231,21 @@ private void InitializeComponent() private System.Windows.Forms.Label doubleSettingsLabel; private System.Windows.Forms.TextBox doubleTypeTextBox; private System.Windows.Forms.GroupBox nodeColorGroupBox; - private System.Windows.Forms.Label label1; - private UI.BannerBox bannerBox; + private System.Windows.Forms.Label generatorInfoLabel; + private BannerBox bannerBox; private System.Windows.Forms.Label boolSettingsLabel; private System.Windows.Forms.TextBox boolTypeTextBox; private System.Windows.Forms.GroupBox fileAssociationGroupBox; private System.Windows.Forms.Button removeAssociationButton; private System.Windows.Forms.Button createAssociationButton; private System.Windows.Forms.Label associationInfoLabel; + private System.Windows.Forms.CheckBox randomizeWindowTitleCheckBox; + private System.Windows.Forms.CheckBox runAsAdminCheckBox; + private System.Windows.Forms.Label nuintSettingsLabel; + private System.Windows.Forms.TextBox nuintTypeTextBox; + private System.Windows.Forms.Label nintSettingsLabel; + private System.Windows.Forms.TextBox nintTypeTextBox; + private System.Windows.Forms.Label utf32TextSettingsLabel; + private System.Windows.Forms.TextBox utf32TextTypeTextBox; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/SettingsForm.cs b/ReClass.NET/Forms/SettingsForm.cs index f065b959..fcc4121e 100644 --- a/ReClass.NET/Forms/SettingsForm.cs +++ b/ReClass.NET/Forms/SettingsForm.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Windows.Forms; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Native; using ReClassNET.Project; @@ -38,11 +39,12 @@ public SettingsForm(Settings settings, CppTypeMapping typeMapping) SetGeneralBindings(); SetColorBindings(); - SetTypedefinitionBindings(); + SetTypeDefinitionBindings(); if (NativeMethods.IsUnix()) { fileAssociationGroupBox.Enabled = false; + runAsAdminCheckBox.Enabled = false; } else { @@ -88,10 +90,7 @@ private static void SetBinding(IBindableComponent control, string propertyName, private void SetGeneralBindings() { SetBinding(stayOnTopCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.StayOnTop)); - stayOnTopCheckBox.CheckedChanged += (sender, e) => - { - GlobalWindowManager.Windows.ForEach(w => w.TopMost = stayOnTopCheckBox.Checked); - }; + stayOnTopCheckBox.CheckedChanged += (_, _2) => GlobalWindowManager.Windows.ForEach(w => w.TopMost = stayOnTopCheckBox.Checked); SetBinding(showNodeAddressCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowNodeAddress)); SetBinding(showNodeOffsetCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowNodeOffset)); @@ -105,6 +104,8 @@ private void SetGeneralBindings() SetBinding(showSymbolsCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentSymbol)); SetBinding(showStringCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentString)); SetBinding(showPluginInfoCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentPluginInfo)); + SetBinding(runAsAdminCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.RunAsAdmin)); + SetBinding(randomizeWindowTitleCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.RandomizeWindowTitle)); } private void SetColorBindings() @@ -126,17 +127,19 @@ private void SetColorBindings() SetBinding(nodePluginColorBox, nameof(ColorBox.Color), settings, nameof(Settings.PluginColor)); } - private void SetTypedefinitionBindings() + private void SetTypeDefinitionBindings() { SetBinding(boolTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeBool)); SetBinding(int8TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeInt8)); SetBinding(int16TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeInt16)); SetBinding(int32TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeInt32)); SetBinding(int64TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeInt64)); + SetBinding(nintTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeNInt)); SetBinding(uint8TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUInt8)); SetBinding(uint16TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUInt16)); SetBinding(uint32TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUInt32)); SetBinding(uint64TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUInt64)); + SetBinding(nuintTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeNUInt)); SetBinding(floatTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeFloat)); SetBinding(doubleTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeDouble)); SetBinding(vector2TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeVector2)); @@ -147,6 +150,7 @@ private void SetTypedefinitionBindings() SetBinding(matrix4x4TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeMatrix4x4)); SetBinding(utf8TextTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUtf8Text)); SetBinding(utf16TextTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUtf16Text)); + SetBinding(utf32TextTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUtf32Text)); SetBinding(functionPtrTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeFunctionPtr)); } } diff --git a/ReClass.NET/Logger/BaseLogger.cs b/ReClass.NET/Logger/BaseLogger.cs index 5c5f9bc4..7b1f58b4 100644 --- a/ReClass.NET/Logger/BaseLogger.cs +++ b/ReClass.NET/Logger/BaseLogger.cs @@ -4,7 +4,7 @@ namespace ReClassNET.Logger { - class BaseLogger : ILogger + public abstract class BaseLogger : ILogger { private readonly object sync = new object(); diff --git a/ReClass.NET/Logger/GuiLogger.cs b/ReClass.NET/Logger/GuiLogger.cs index 924dc6a8..7371afc2 100644 --- a/ReClass.NET/Logger/GuiLogger.cs +++ b/ReClass.NET/Logger/GuiLogger.cs @@ -6,7 +6,7 @@ namespace ReClassNET.Logger { /// A logger which displays messages in a form. - class GuiLogger : BaseLogger + public class GuiLogger : BaseLogger { private readonly LogForm form; diff --git a/ReClass.NET/Makefile b/ReClass.NET/Makefile index 52bcae5b..d66fd569 100644 --- a/ReClass.NET/Makefile +++ b/ReClass.NET/Makefile @@ -1,3 +1,5 @@ +.PHONY: all clean debug clean_debug release clean_release update docker_debug docker_release podman_debug podman_release + all: debug release clean: clean_debug clean_release @@ -18,3 +20,19 @@ clean_release: update: mono --runtime=v4.0 ../Dependencies/nuget.exe restore ReClass.NET.csproj -SolutionDirectory ../ + +docker_debug: + docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x86 ReClass.NET.csproj" + docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x64 ReClass.NET.csproj" + +docker_release: + docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x86 ReClass.NET.csproj" + docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x64 ReClass.NET.csproj" + +podman_debug: + podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x86 ReClass.NET.csproj" + podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x64 ReClass.NET.csproj" + +podman_release: + podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x86 ReClass.NET.csproj" + podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x64 ReClass.NET.csproj" diff --git a/ReClass.NET/Memory/Disassembler.cs b/ReClass.NET/Memory/Disassembler.cs index f62ea7ea..d83dfc97 100644 --- a/ReClass.NET/Memory/Disassembler.cs +++ b/ReClass.NET/Memory/Disassembler.cs @@ -27,7 +27,7 @@ public Disassembler(CoreFunctionsManager coreFunctions) /// The address of the code. /// The length of the code in bytes. /// A list of . - public IReadOnlyList RemoteDisassembleCode(RemoteProcess process, IntPtr address, int length) + public IReadOnlyList RemoteDisassembleCode(IRemoteMemoryReader process, IntPtr address, int length) { Contract.Requires(process != null); Contract.Ensures(Contract.Result>() != null); @@ -41,7 +41,7 @@ public IReadOnlyList RemoteDisassembleCode(RemoteProces /// The length of the code in bytes. /// The maximum number of instructions to disassemble. If is -1, all available instructions get returned. /// A list of . - public IReadOnlyList RemoteDisassembleCode(RemoteProcess process, IntPtr address, int length, int maxInstructions) + public IReadOnlyList RemoteDisassembleCode(IRemoteMemoryReader process, IntPtr address, int length, int maxInstructions) { Contract.Requires(process != null); Contract.Ensures(Contract.Result>() != null); @@ -89,7 +89,7 @@ public IReadOnlyList DisassembleCode(byte[] data, IntPt /// The address of the code. /// The maximum maxLength of the code. /// A list of which belong to the function. - public IReadOnlyList RemoteDisassembleFunction(RemoteProcess process, IntPtr address, int maxLength) + public IReadOnlyList RemoteDisassembleFunction(IRemoteMemoryReader process, IntPtr address, int maxLength) { Contract.Requires(process != null); Contract.Ensures(Contract.Result>() != null); @@ -141,7 +141,7 @@ public IReadOnlyList DisassembleFunction(byte[] data, I /// The process to read from. /// The address of the code. /// The prior instruction. - public DisassembledInstruction RemoteGetPreviousInstruction(RemoteProcess process, IntPtr address) + public DisassembledInstruction RemoteGetPreviousInstruction(IRemoteMemoryReader process, IntPtr address) { const int TotalBufferSize = 7 * MaximumInstructionLength; const int BufferShiftSize = 6 * MaximumInstructionLength; @@ -203,7 +203,7 @@ public DisassembledInstruction RemoteGetPreviousInstruction(RemoteProcess proces /// The process to read from. /// The address inside the function. /// The start address of the function (maybe) or if no start address could be found. - public IntPtr RemoteGetFunctionStartAddress(RemoteProcess process, IntPtr address) + public IntPtr RemoteGetFunctionStartAddress(IRemoteMemoryReader process, IntPtr address) { const int BufferLength = 512; diff --git a/ReClass.NET/Memory/Dumper.cs b/ReClass.NET/Memory/Dumper.cs index a5cc926a..ba434ae0 100644 --- a/ReClass.NET/Memory/Dumper.cs +++ b/ReClass.NET/Memory/Dumper.cs @@ -4,80 +4,49 @@ namespace ReClassNET.Memory { - public class Dumper + public static class Dumper { - private readonly RemoteProcess process; - - public Dumper(RemoteProcess process) - { - Contract.Requires(process != null); - Contract.Ensures(this.process != null); - - this.process = process; - } - - /// Dumps a section to the given stream. - /// The begin of the section. - /// The size of the section. + /// Dumps a chunk of memory to the given stream. + /// The memory reader to use. + /// The begin of the chunk. + /// The size of the chunk. /// The stream to dump to. - public void DumpSection(IntPtr address, int size, Stream stream) + public static void DumpRaw(IRemoteMemoryReader reader, IntPtr address, int size, Stream stream) { Contract.Requires(size >= 0); Contract.Requires(stream != null); - var data = process.ReadRemoteMemory(address, size); + var data = reader.ReadRemoteMemory(address, size); stream.Write(data, 0, data.Length); } - /// Dumps a module to the given stream. The section headers of the pe header get fixed to make a valid pe file. - /// The begin of the module. - /// The size of the module. + /// Dumps a section to the given stream. + /// The memory reader to use. + /// The section to dump. /// The stream to dump to. - public void DumpModule(IntPtr address, int size, Stream stream) + public static void DumpSection(IRemoteMemoryReader reader, Section section, Stream stream) { - Contract.Requires(size >= 0); + Contract.Requires(section != null); Contract.Requires(stream != null); - var data = process.ReadRemoteMemory(address, size); - - var pe = new SimplePeHeader(data); - - // Fix the section headers. - using (var bw = new BinaryWriter(new MemoryStream(data))) - { - for (var i = 0; i < pe.NumberOfSections; ++i) - { - var offset = pe.SectionOffset(i); - bw.Seek(offset + 16, SeekOrigin.Begin); - bw.Write(BitConverter.ToUInt32(data, offset + 8)); // SizeOfRawData = VirtualSize - bw.Write(BitConverter.ToUInt32(data, offset + 12)); // PointerToRawData = VirtualAddress - } - } - - stream.Write(data, 0, data.Length); + DumpRaw(reader, section.Start, section.Size.ToInt32(), stream); } - private class SimplePeHeader + /// Dumps a module to the given stream. The section headers of the pe header get fixed to build a valid pe file. + /// The memory reader to use. + /// The module to dump. + /// The stream to dump to. + public static void DumpModule(IRemoteMemoryReader reader, Module module, Stream stream) { - private readonly byte[] data; - - private int e_lfanew => BitConverter.ToInt32(data, 60); - - private int FileHeader => e_lfanew + 4; - - public int NumberOfSections => BitConverter.ToInt16(data, FileHeader + 2); - - private int SizeOfOptionalHeader => BitConverter.ToInt16(data, FileHeader + 16); + Contract.Requires(module != null); + Contract.Requires(stream != null); - private int FirstSectionOffset => e_lfanew + 24 + SizeOfOptionalHeader; + var data = reader.ReadRemoteMemory(module.Start, module.Size.ToInt32()); - public int SectionOffset(int index) => FirstSectionOffset + index * 40; + SimplePeHeader.FixSectionHeaders(data); - public SimplePeHeader(byte[] data) - { - this.data = data; - } + stream.Write(data, 0, data.Length); } } } diff --git a/ReClass.NET/Memory/IProcessReader.cs b/ReClass.NET/Memory/IProcessReader.cs new file mode 100644 index 00000000..048bbea7 --- /dev/null +++ b/ReClass.NET/Memory/IProcessReader.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; + +namespace ReClassNET.Memory +{ + public interface IProcessReader : IRemoteMemoryReader + { + Section GetSectionToPointer(IntPtr address); + + Module GetModuleToPointer(IntPtr address); + + Module GetModuleByName(string name); + + bool EnumerateRemoteSectionsAndModules(out List
sections, out List modules); + } +} diff --git a/ReClass.NET/Memory/IRemoteMemoryReader.cs b/ReClass.NET/Memory/IRemoteMemoryReader.cs new file mode 100644 index 00000000..f60a4aaf --- /dev/null +++ b/ReClass.NET/Memory/IRemoteMemoryReader.cs @@ -0,0 +1,33 @@ +using System; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.Memory +{ + public interface IRemoteMemoryReader + { + EndianBitConverter BitConverter { get; set; } + + /// Reads remote memory from the address into the buffer. + /// The address to read from. + /// [out] The data buffer to fill. If the remote process is not valid, the buffer will get filled with zeros. + bool ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] buffer); + + /// Reads remote memory from the address into the buffer. + /// The address to read from. + /// [out] The data buffer to fill. If the remote process is not valid, the buffer will get filled with zeros. + /// The offset in the data. + /// The number of bytes to read. + bool ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] buffer, int offset, int length); + + /// Reads bytes from the address in the remote process. + /// The address to read from. + /// The size in bytes to read. + /// An array of bytes. + byte[] ReadRemoteMemory(IntPtr address, int size); + + /// Reads remote runtime type information for the given address from the remote process. + /// The address. + /// A string containing the runtime type information or null if no information could get found. + string ReadRemoteRuntimeTypeInformation(IntPtr address); + } +} diff --git a/ReClass.NET/Memory/IRemoteMemoryWriter.cs b/ReClass.NET/Memory/IRemoteMemoryWriter.cs new file mode 100644 index 00000000..fc895b3a --- /dev/null +++ b/ReClass.NET/Memory/IRemoteMemoryWriter.cs @@ -0,0 +1,17 @@ +using System; +using System.Text; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.Memory +{ + public interface IRemoteMemoryWriter + { + EndianBitConverter BitConverter { get; set; } + + /// Writes the given to the in the remote process. + /// The address to write to. + /// The data to write. + /// True if it succeeds, false if it fails. + bool WriteRemoteMemory(IntPtr address, byte[] data); + } +} diff --git a/ReClass.NET/Memory/MemoryBuffer.cs b/ReClass.NET/Memory/MemoryBuffer.cs index df4f0176..e1b515a4 100644 --- a/ReClass.NET/Memory/MemoryBuffer.cs +++ b/ReClass.NET/Memory/MemoryBuffer.cs @@ -1,8 +1,8 @@ -using System; +using System; using System.Diagnostics.Contracts; -using System.Runtime.InteropServices; using System.Text; using ReClassNET.Extensions; +using ReClassNET.Util.Conversion; namespace ReClassNET.Memory { @@ -13,16 +13,16 @@ public class MemoryBuffer private bool hasHistory; - public RemoteProcess Process { get; set; } - public byte[] RawData => data; + public EndianBitConverter BitConverter { get; set; } = EndianBitConverter.System; + public int Size { get => data.Length; set { - if (value != data.Length) + if (value >= 0 && value != data.Length) { data = new byte[value]; historyData = new byte[value]; @@ -46,54 +46,33 @@ private void ObjectInvariants() } public MemoryBuffer() - : this(0) - { - Contract.Ensures(data != null); - Contract.Ensures(historyData != null); - } - - public MemoryBuffer(int size) { - Contract.Requires(size >= 0); Contract.Ensures(data != null); Contract.Ensures(historyData != null); - data = new byte[size]; - historyData = new byte[size]; - } - - public MemoryBuffer(MemoryBuffer other) - { - Contract.Requires(other != null); - Contract.Ensures(data != null); - Contract.Ensures(historyData != null); - - data = other.data; - historyData = other.historyData; - hasHistory = other.hasHistory; - - ContainsValidData = other.ContainsValidData; + data = Array.Empty(); + historyData = Array.Empty(); } public MemoryBuffer Clone() { Contract.Ensures(Contract.Result() != null); - return new MemoryBuffer(this) + return new MemoryBuffer { - Offset = Offset, - Process = Process - }; - } + data = data, + historyData = historyData, + hasHistory = hasHistory, - public void Update(IntPtr address) - { - Update(address, true); + BitConverter = BitConverter, + ContainsValidData = ContainsValidData, + Offset = Offset + }; } - public void Update(IntPtr address, bool setHistory) + public void UpdateFrom(IRemoteMemoryReader reader, IntPtr address) { - if (Process == null) + if (reader == null) { data.FillWithZero(); @@ -102,14 +81,13 @@ public void Update(IntPtr address, bool setHistory) return; } - if (setHistory) - { - Array.Copy(data, historyData, data.Length); + Array.Copy(data, historyData, data.Length); - hasHistory = ContainsValidData; - } + hasHistory = ContainsValidData; + + BitConverter = reader.BitConverter; - ContainsValidData = Process.ReadRemoteMemoryIntoBuffer(address, ref data); + ContainsValidData = reader.ReadRemoteMemoryIntoBuffer(address, ref data); if (!ContainsValidData) { data.FillWithZero(); @@ -144,23 +122,6 @@ public void ReadBytes(int offset, byte[] buffer) Array.Copy(data, offset, buffer, 0, buffer.Length); } - public T ReadObject(int offset) where T : struct - { - Contract.Requires(offset >= 0); - - offset = Offset + offset; - if (offset + Marshal.SizeOf(typeof(T)) > data.Length) - { - return default(T); - } - - var handle = GCHandle.Alloc(data, GCHandleType.Pinned); - var obj = Marshal.PtrToStructure(handle.AddrOfPinnedObject() + offset); - handle.Free(); - - return obj; - } - #region Read Primitive Types /// Reads a from the specific offset. @@ -173,7 +134,7 @@ public sbyte ReadInt8(int offset) offset = Offset + offset; if (offset + sizeof(sbyte) > data.Length) { - return default(sbyte); + return default; } return (sbyte)data[offset]; @@ -189,7 +150,7 @@ public byte ReadUInt8(int offset) offset = Offset + offset; if (offset + sizeof(byte) > data.Length) { - return default(byte); + return default; } return data[offset]; @@ -205,7 +166,7 @@ public short ReadInt16(int offset) offset = Offset + offset; if (offset + sizeof(short) > data.Length) { - return default(short); + return default; } return BitConverter.ToInt16(data, offset); @@ -221,7 +182,7 @@ public ushort ReadUInt16(int offset) offset = Offset + offset; if (offset + sizeof(ushort) > data.Length) { - return default(ushort); + return default; } return BitConverter.ToUInt16(data, offset); @@ -237,7 +198,7 @@ public int ReadInt32(int offset) offset = Offset + offset; if (offset + sizeof(int) > data.Length) { - return default(int); + return default; } return BitConverter.ToInt32(data, offset); @@ -253,7 +214,7 @@ public uint ReadUInt32(int offset) offset = Offset + offset; if (offset + sizeof(uint) > data.Length) { - return default(uint); + return default; } return BitConverter.ToUInt32(data, offset); @@ -269,7 +230,7 @@ public long ReadInt64(int offset) offset = Offset + offset; if (offset + sizeof(long) > data.Length) { - return default(long); + return default; } return BitConverter.ToInt64(data, offset); @@ -285,7 +246,7 @@ public ulong ReadUInt64(int offset) offset = Offset + offset; if (offset + sizeof(ulong) > data.Length) { - return default(ulong); + return default; } return BitConverter.ToUInt64(data, offset); @@ -301,7 +262,7 @@ public float ReadFloat(int offset) offset = Offset + offset; if (offset + sizeof(float) > data.Length) { - return default(float); + return default; } return BitConverter.ToSingle(data, offset); @@ -317,7 +278,7 @@ public double ReadDouble(int offset) offset = Offset + offset; if (offset + sizeof(double) > data.Length) { - return default(double); + return default; } return BitConverter.ToDouble(data, offset); @@ -337,10 +298,25 @@ public IntPtr ReadIntPtr(int offset) #endif } + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public UIntPtr ReadUIntPtr(int offset) + { + Contract.Requires(offset >= 0); + +#if RECLASSNET64 + return (UIntPtr)ReadUInt64(offset); +#else + return (UIntPtr)ReadUInt32(offset); +#endif + } + #endregion - public string ReadPrintableAsciiString(int offset, int length) + public string ReadString(Encoding encoding, int offset, int length) { + Contract.Requires(encoding != null); Contract.Requires(offset >= 0); Contract.Requires(length >= 0); Contract.Ensures(Contract.Result() != null); @@ -355,27 +331,6 @@ public string ReadPrintableAsciiString(int offset, int length) return string.Empty; } - var sb = new StringBuilder(length); - for (var i = 0; i < length; ++i) - { - var c = (char)data[Offset + offset + i]; - sb.Append(c.IsPrintable() ? c : '.'); - } - return sb.ToString(); - } - - public string ReadString(Encoding encoding, int offset, int length) - { - Contract.Requires(encoding != null); - Contract.Requires(offset >= 0); - Contract.Requires(length >= 0); - Contract.Ensures(Contract.Result() != null); - - if (Offset + offset + length > data.Length) - { - length = data.Length - Offset - offset; - } - var sb = new StringBuilder(encoding.GetString(data, Offset + offset, length)); for (var i = 0; i < sb.Length; ++i) { diff --git a/ReClass.NET/Memory/NodeDissector.cs b/ReClass.NET/Memory/NodeDissector.cs index 8046efe1..e03b92e9 100644 --- a/ReClass.NET/Memory/NodeDissector.cs +++ b/ReClass.NET/Memory/NodeDissector.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; @@ -9,7 +9,7 @@ namespace ReClassNET.Memory { public class NodeDissector { - public static void DissectNodes(IEnumerable nodes, MemoryBuffer memory) + public static void DissectNodes(IEnumerable nodes, IProcessReader reader, MemoryBuffer memory) { Contract.Requires(nodes != null); Contract.Requires(Contract.ForAll(nodes, n => n != null)); @@ -17,19 +17,20 @@ public static void DissectNodes(IEnumerable nodes, MemoryBuffer mem foreach (var node in nodes) { - var type = GuessExplicitNode(node, memory); - if (type != null) + if (GuessNode(node, reader, memory, out var guessedNode)) { - node.GetParentContainer()?.ReplaceChildNode(node, type); + node.GetParentContainer()?.ReplaceChildNode(node, guessedNode); } } } - public static BaseNode GuessExplicitNode(BaseHexNode node, MemoryBuffer memory) + public static bool GuessNode(BaseHexNode node, IProcessReader reader, MemoryBuffer memory, out BaseNode guessedNode) { Contract.Requires(node != null); Contract.Requires(memory != null); + guessedNode = null; + var offset = node.Offset; var is4ByteAligned = offset % 4 == 0; var is8ByteAligned = offset % 8 == 0; @@ -37,55 +38,64 @@ public static BaseNode GuessExplicitNode(BaseHexNode node, MemoryBuffer memory) // The node is not aligned, skip it. if (!is4ByteAligned) { - return null; + return false; } - var data64 = memory.ReadObject(offset); - var data32 = memory.ReadObject(offset); + var data64 = new UInt64FloatDoubleData + { + Raw1 = memory.ReadInt32(offset), + Raw2 = memory.ReadInt32(offset + sizeof(int)) + }; ; + var data32 = new UInt32FloatData + { + Raw = memory.ReadInt32(offset) + }; var raw = memory.ReadBytes(offset, node.MemorySize); - if (raw.InterpretAsUtf8().IsLikelyPrintableData() >= 0.75f) + if (raw.InterpretAsSingleByteCharacter().IsLikelyPrintableData()) { - return new Utf8TextNode(); + guessedNode = new Utf8TextNode(); + + return true; } - if (raw.InterpretAsUtf16().IsLikelyPrintableData() >= 0.75f) + if (raw.InterpretAsDoubleByteCharacter().IsLikelyPrintableData()) { - return new Utf16TextNode(); + guessedNode = new Utf16TextNode(); + + return true; } +#if RECLASSNET64 if (is8ByteAligned) { -#if RECLASSNET64 - var pointerType = GuessPointerNode(data64.IntPtr, memory); - if (pointerType != null) + if (GuessPointerNode(data64.IntPtr, reader, out guessedNode)) { - return pointerType; + return true; } -#endif } +#else + if (GuessPointerNode(data32.IntPtr, reader, out guessedNode)) + { + return true; + } +#endif + // 0 could be anything. + if (data32.IntValue != 0) { -#if RECLASSNET32 - var pointerNode = GuessPointerNode(data32.IntPtr, memory); - if (pointerNode != null) + // If the data represents a reasonable range, it could be a float. + if (-999999.0f <= data32.FloatValue && data32.FloatValue <= 999999.0f && !data32.FloatValue.IsNearlyEqual(0.0f, 0.001f)) { - return pointerNode; + guessedNode = new FloatNode(); + + return true; } -#endif - // 0 could be anything. - if (data32.IntValue != 0) + if (-999999 <= data32.IntValue && data32.IntValue <= 999999) { - // If the data represents a reasonable range, it could be a float. - if (-999999.0f <= data32.FloatValue && data32.FloatValue <= 999999.0f && !data32.FloatValue.IsNearlyEqual(0.0f, 0.001f)) - { - return new FloatNode(); - } + guessedNode = new Int32Node(); - if (-999999 <= data32.IntValue && data32.IntValue <= 999999) - { - return new Int32Node(); - } + return true; } } @@ -96,60 +106,73 @@ public static BaseNode GuessExplicitNode(BaseHexNode node, MemoryBuffer memory) // If the data represents a reasonable range, it could be a double. if (-999999.0 <= data64.DoubleValue && data64.DoubleValue <= 999999.0 && !data64.DoubleValue.IsNearlyEqual(0.0, 0.001)) { - return new DoubleNode(); + guessedNode = new DoubleNode(); + + return true; } } } - return null; + return false; } - private static BaseNode GuessPointerNode(IntPtr address, MemoryBuffer memory) + private static bool GuessPointerNode(IntPtr address, IProcessReader process, out BaseNode node) { - Contract.Requires(memory != null); + Contract.Requires(process != null); + + node = null; if (address.IsNull()) { - return null; + return false; } - var section = memory.Process.GetSectionToPointer(address); + var section = process.GetSectionToPointer(address); if (section == null) { - return null; + return false; } if (section.Category == SectionCategory.CODE) // If the section contains code, it should be a function pointer. { - return new FunctionPtrNode(); + node = new FunctionPtrNode(); + + return true; } if (section.Category == SectionCategory.DATA || section.Category == SectionCategory.HEAP) // If the section contains data, it is at least a pointer to a class or something. { // Check if it is a vtable. Check if the first 3 values are pointers to a code section. - var possibleVmt = memory.Process.ReadRemoteObject(address); - if (memory.Process.GetSectionToPointer(possibleVmt.Pointer1)?.Category == SectionCategory.CODE - && memory.Process.GetSectionToPointer(possibleVmt.Pointer2)?.Category == SectionCategory.CODE - && memory.Process.GetSectionToPointer(possibleVmt.Pointer3)?.Category == SectionCategory.CODE) + if (process.GetSectionToPointer(process.ReadRemoteIntPtr(address))?.Category == SectionCategory.CODE + && process.GetSectionToPointer(process.ReadRemoteIntPtr(address + IntPtr.Size))?.Category == SectionCategory.CODE + && process.GetSectionToPointer(process.ReadRemoteIntPtr(address + 2 * IntPtr.Size))?.Category == SectionCategory.CODE) { - return new VirtualMethodTableNode(); + node = new VirtualMethodTableNode(); + + return true; } // Check if it is a string. - var data = memory.Process.ReadRemoteMemory(address, IntPtr.Size * 2); - if (data.Take(IntPtr.Size).InterpretAsUtf8().IsLikelyPrintableData() >= 07.5f) + var data = process.ReadRemoteMemory(address, IntPtr.Size * 2); + if (data.Take(IntPtr.Size).InterpretAsSingleByteCharacter().IsLikelyPrintableData()) { - return new Utf8TextPtrNode(); + node = new Utf8TextPtrNode(); + + return true; } - if (data.InterpretAsUtf16().IsLikelyPrintableData() >= 0.75f) + if (data.InterpretAsDoubleByteCharacter().IsLikelyPrintableData()) { - return new Utf16TextPtrNode(); + node = new Utf16TextPtrNode(); + + return true; } // Now it could be a pointer to something else but we can't tell. :( - return new PointerNode(); + node = new PointerNode(); + + return true; } - return null; + return false; } } } diff --git a/ReClass.NET/Memory/ProcessInfo.cs b/ReClass.NET/Memory/ProcessInfo.cs index fe60ae2f..b2f8c67e 100644 --- a/ReClass.NET/Memory/ProcessInfo.cs +++ b/ReClass.NET/Memory/ProcessInfo.cs @@ -24,10 +24,8 @@ public ProcessInfo(IntPtr id, string name, string path) Path = path; icon = new Lazy(() => { - using (var i = NativeMethods.GetIconForFile(Path)) - { - return i?.ToBitmap(); - } + using var i = NativeMethods.GetIconForFile(Path); + return i?.ToBitmap(); }); } } diff --git a/ReClass.NET/Memory/RemoteProcess.cs b/ReClass.NET/Memory/RemoteProcess.cs index a154632f..0f994e20 100644 --- a/ReClass.NET/Memory/RemoteProcess.cs +++ b/ReClass.NET/Memory/RemoteProcess.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; @@ -10,16 +10,15 @@ using ReClassNET.Core; using ReClassNET.Debugger; using ReClassNET.Extensions; -using ReClassNET.MemoryScanner; using ReClassNET.Native; using ReClassNET.Symbols; -using ReClassNET.Util; +using ReClassNET.Util.Conversion; namespace ReClassNET.Memory { public delegate void RemoteProcessEvent(RemoteProcess sender); - public class RemoteProcess : IDisposable + public class RemoteProcess : IDisposable, IRemoteMemoryReader, IRemoteMemoryWriter, IProcessReader { private readonly object processSync = new object(); @@ -57,17 +56,17 @@ public class RemoteProcess : IDisposable public SymbolStore Symbols => symbols; + public EndianBitConverter BitConverter { get; set; } = EndianBitConverter.System; + /// Gets a copy of the current modules list. This list may change if the remote process (un)loads a module. public IEnumerable Modules { get { - List cpy; lock (modules) { - cpy = modules.ToList(); + return new List(modules); } - return cpy; } } @@ -76,12 +75,10 @@ public IEnumerable
Sections { get { - List
cpy; lock (sections) { - cpy = sections.ToList(); + return new List
(sections); } - return cpy; } } @@ -151,9 +148,6 @@ public void Close() #region ReadMemory - /// Reads remote memory from the address into the buffer. - /// The address to read from. - /// [out] The data buffer to fill. If the remote process is not valid, the buffer will get filled with zeros. public bool ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] buffer) { Contract.Requires(buffer != null); @@ -162,11 +156,6 @@ public bool ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] buffer) return ReadRemoteMemoryIntoBuffer(address, ref buffer, 0, buffer.Length); } - /// Reads remote memory from the address into the buffer. - /// The address to read from. - /// [out] The data buffer to fill. If the remote process is not valid, the buffer will get filled with zeros. - /// The offset in the data. - /// The number of bytes to read. public bool ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] buffer, int offset, int length) { Contract.Requires(buffer != null); @@ -188,10 +177,6 @@ public bool ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] buffer, int of return coreFunctions.ReadRemoteMemory(handle, address, ref buffer, offset, length); } - /// Reads bytes from the address in the remote process. - /// The address to read from. - /// The size in bytes to read. - /// An array of bytes. public byte[] ReadRemoteMemory(IntPtr address, int size) { Contract.Requires(size >= 0); @@ -202,213 +187,13 @@ public byte[] ReadRemoteMemory(IntPtr address, int size) return data; } - /// Reads the object from the address in the remote process. - /// Type of the value to read. - /// The address to read from. - /// The remote object. - public T ReadRemoteObject(IntPtr address) where T : struct - { - var data = ReadRemoteMemory(address, Marshal.SizeOf()); - - var gcHandle = GCHandle.Alloc(data, GCHandleType.Pinned); - var obj = (T)Marshal.PtrToStructure(gcHandle.AddrOfPinnedObject(), typeof(T)); - gcHandle.Free(); - - return obj; - } - - #region Read Remote Primitive Types - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public sbyte ReadRemoteInt8(IntPtr address) - { - var data = ReadRemoteMemory(address, sizeof(sbyte)); - - return (sbyte)data[0]; - } - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public byte ReadRemoteUInt8(IntPtr address) - { - var data = ReadRemoteMemory(address, sizeof(byte)); - - return data[0]; - } - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public short ReadRemoteInt16(IntPtr address) - { - var data = ReadRemoteMemory(address, sizeof(short)); - - return BitConverter.ToInt16(data, 0); - } - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public ushort ReadRemoteUInt16(IntPtr address) - { - var data = ReadRemoteMemory(address, sizeof(ushort)); - - return BitConverter.ToUInt16(data, 0); - } - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public int ReadRemoteInt32(IntPtr address) - { - var data = ReadRemoteMemory(address, sizeof(int)); - - return BitConverter.ToInt32(data, 0); - } - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public uint ReadRemoteUInt32(IntPtr address) - { - var data = ReadRemoteMemory(address, sizeof(uint)); - - return BitConverter.ToUInt32(data, 0); - } - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public long ReadRemoteInt64(IntPtr address) - { - var data = ReadRemoteMemory(address, sizeof(long)); - - return BitConverter.ToInt64(data, 0); - } - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public ulong ReadRemoteUInt64(IntPtr address) - { - var data = ReadRemoteMemory(address, sizeof(ulong)); - - return BitConverter.ToUInt64(data, 0); - } - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public float ReadRemoteFloat(IntPtr address) - { - var data = ReadRemoteMemory(address, sizeof(float)); - - return BitConverter.ToSingle(data, 0); - } - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public double ReadRemoteDouble(IntPtr address) - { - var data = ReadRemoteMemory(address, sizeof(double)); - - return BitConverter.ToDouble(data, 0); - } - - /// Reads a from the address in the remote process. - /// The address to read from. - /// The data read as or 0 if the read fails. - public IntPtr ReadRemoteIntPtr(IntPtr address) - { -#if RECLASSNET64 - return (IntPtr)ReadRemoteInt64(address); -#else - return (IntPtr)ReadRemoteInt32(address); -#endif - } - - #endregion - - /// Reads a string from the address in the remote process with the given length using the provided encoding. - /// The encoding used by the string. - /// The address of the string. - /// The length of the string. - /// The string. - public string ReadRemoteString(Encoding encoding, IntPtr address, int length) - { - Contract.Requires(encoding != null); - Contract.Requires(length >= 0); - Contract.Ensures(Contract.Result() != null); - - var data = ReadRemoteMemory(address, length * encoding.GetSimpleByteCountPerChar()); - - try - { - var sb = new StringBuilder(encoding.GetString(data)); - for (var i = 0; i < sb.Length; ++i) - { - if (sb[i] == 0) - { - sb.Length = i; - break; - } - if (!sb[i].IsPrintable()) - { - sb[i] = '.'; - } - } - return sb.ToString(); - } - catch - { - return string.Empty; - } - } - - /// Reads a string from the address in the remote process with the given length and encoding. The string gets truncated at the first zero character. - /// The encoding used by the string. - /// The address of the string. - /// The length of the string. - /// The string. - public string ReadRemoteStringUntilFirstNullCharacter(Encoding encoding, IntPtr address, int length) - { - Contract.Requires(encoding != null); - Contract.Requires(length >= 0); - Contract.Ensures(Contract.Result() != null); - - var data = ReadRemoteMemory(address, length * encoding.GetSimpleByteCountPerChar()); - - // TODO We should cache the pattern per encoding. - var index = PatternScanner.FindPattern(BytePattern.From(new byte[encoding.GetSimpleByteCountPerChar()]), data); - if (index == -1) - { - index = data.Length; - } - - try - { - return Encoding.UTF8.GetString(data, 0, Math.Min(index, data.Length)); - } - catch - { - return string.Empty; - } - } - - /// Reads remote runtime type information for the given address from the remote process. - /// The address. - /// A string containing the runtime type information or null if no information could get found. public string ReadRemoteRuntimeTypeInformation(IntPtr address) { if (address.MayBeValid()) { if (!rttiCache.TryGetValue(address, out var rtti)) { - var objectLocatorPtr = ReadRemoteIntPtr(address - IntPtr.Size); + var objectLocatorPtr = this.ReadRemoteIntPtr(address - IntPtr.Size); if (objectLocatorPtr.MayBeValid()) { @@ -429,25 +214,25 @@ public string ReadRemoteRuntimeTypeInformation(IntPtr address) private string ReadRemoteRuntimeTypeInformation32(IntPtr address) { - var classHierarchyDescriptorPtr = ReadRemoteIntPtr(address + 0x10); + var classHierarchyDescriptorPtr = this.ReadRemoteIntPtr(address + 0x10); if (classHierarchyDescriptorPtr.MayBeValid()) { - var baseClassCount = ReadRemoteInt32(classHierarchyDescriptorPtr + 8); + var baseClassCount = this.ReadRemoteInt32(classHierarchyDescriptorPtr + 8); if (baseClassCount > 0 && baseClassCount < 25) { - var baseClassArrayPtr = ReadRemoteIntPtr(classHierarchyDescriptorPtr + 0xC); + var baseClassArrayPtr = this.ReadRemoteIntPtr(classHierarchyDescriptorPtr + 0xC); if (baseClassArrayPtr.MayBeValid()) { var sb = new StringBuilder(); for (var i = 0; i < baseClassCount; ++i) { - var baseClassDescriptorPtr = ReadRemoteIntPtr(baseClassArrayPtr + (4 * i)); + var baseClassDescriptorPtr = this.ReadRemoteIntPtr(baseClassArrayPtr + (4 * i)); if (baseClassDescriptorPtr.MayBeValid()) { - var typeDescriptorPtr = ReadRemoteIntPtr(baseClassDescriptorPtr); + var typeDescriptorPtr = this.ReadRemoteIntPtr(baseClassDescriptorPtr); if (typeDescriptorPtr.MayBeValid()) { - var name = ReadRemoteStringUntilFirstNullCharacter(Encoding.UTF8, typeDescriptorPtr + 0x0C, 60); + var name = this.ReadRemoteStringUntilFirstNullCharacter(typeDescriptorPtr + 0x0C, Encoding.UTF8, 60); if (name.EndsWith("@@")) { name = NativeMethods.UndecorateSymbolName("?" + name); @@ -478,20 +263,20 @@ private string ReadRemoteRuntimeTypeInformation32(IntPtr address) private string ReadRemoteRuntimeTypeInformation64(IntPtr address) { - int baseOffset = ReadRemoteInt32(address + 0x14); + int baseOffset = this.ReadRemoteInt32(address + 0x14); if (baseOffset != 0) { var baseAddress = address - baseOffset; - var classHierarchyDescriptorOffset = ReadRemoteInt32(address + 0x10); + var classHierarchyDescriptorOffset = this.ReadRemoteInt32(address + 0x10); if (classHierarchyDescriptorOffset != 0) { var classHierarchyDescriptorPtr = baseAddress + classHierarchyDescriptorOffset; - var baseClassCount = ReadRemoteInt32(classHierarchyDescriptorPtr + 0x08); + var baseClassCount = this.ReadRemoteInt32(classHierarchyDescriptorPtr + 0x08); if (baseClassCount > 0 && baseClassCount < 25) { - var baseClassArrayOffset = ReadRemoteInt32(classHierarchyDescriptorPtr + 0x0C); + var baseClassArrayOffset = this.ReadRemoteInt32(classHierarchyDescriptorPtr + 0x0C); if (baseClassArrayOffset != 0) { var baseClassArrayPtr = baseAddress + baseClassArrayOffset; @@ -499,17 +284,17 @@ private string ReadRemoteRuntimeTypeInformation64(IntPtr address) var sb = new StringBuilder(); for (var i = 0; i < baseClassCount; ++i) { - var baseClassDescriptorOffset = ReadRemoteInt32(baseClassArrayPtr + (4 * i)); + var baseClassDescriptorOffset = this.ReadRemoteInt32(baseClassArrayPtr + (4 * i)); if (baseClassDescriptorOffset != 0) { var baseClassDescriptorPtr = baseAddress + baseClassDescriptorOffset; - var typeDescriptorOffset = ReadRemoteInt32(baseClassDescriptorPtr); + var typeDescriptorOffset = this.ReadRemoteInt32(baseClassDescriptorPtr); if (typeDescriptorOffset != 0) { var typeDescriptorPtr = baseAddress + typeDescriptorOffset; - var name = ReadRemoteStringUntilFirstNullCharacter(Encoding.UTF8, typeDescriptorPtr + 0x14, 60); + var name = this.ReadRemoteStringUntilFirstNullCharacter(typeDescriptorPtr + 0x14, Encoding.UTF8, 60); if (string.IsNullOrEmpty(name)) { break; @@ -548,10 +333,6 @@ private string ReadRemoteRuntimeTypeInformation64(IntPtr address) #region WriteMemory - /// Writes the given to the in the remote process. - /// The address to write to. - /// The data to write. - /// True if it succeeds, false if it fails. public bool WriteRemoteMemory(IntPtr address, byte[] data) { Contract.Requires(data != null); @@ -564,29 +345,14 @@ public bool WriteRemoteMemory(IntPtr address, byte[] data) return coreFunctions.WriteRemoteMemory(handle, address, ref data, 0, data.Length); } - /// Writes the given to the in the remote process. - /// Type of the value to write. - /// The address to write to. - /// The value to write. - /// True if it succeeds, false if it fails. - public bool WriteRemoteMemory(IntPtr address, T value) where T : struct - { - var data = new byte[Marshal.SizeOf()]; - - var gcHandle = GCHandle.Alloc(data, GCHandleType.Pinned); - Marshal.StructureToPtr(value, gcHandle.AddrOfPinnedObject(), false); - gcHandle.Free(); - - return WriteRemoteMemory(address, data); - } - #endregion public Section GetSectionToPointer(IntPtr address) { lock (sections) { - return sections.BinaryFind(s => address.CompareToRange(s.Start, s.End)); + var index = sections.BinarySearch(s => address.CompareToRange(s.Start, s.End)); + return index < 0 ? null : sections[index]; } } @@ -594,7 +360,8 @@ public Module GetModuleToPointer(IntPtr address) { lock (modules) { - return modules.BinaryFind(m => address.CompareToRange(m.Start, m.End)); + var index = modules.BinarySearch(m => address.CompareToRange(m.Start, m.End)); + return index < 0 ? null : modules[index]; } } @@ -638,27 +405,20 @@ public string GetNamedAddress(IntPtr address) return null; } - public void EnumerateRemoteSectionsAndModules(Action
callbackSection, Action callbackModule) - { - if (!IsValid) - { - return; - } - - coreFunctions.EnumerateRemoteSectionsAndModules(handle, callbackSection, callbackModule); - } - - public bool EnumerateRemoteSectionsAndModules(out List
sections, out List modules) + public bool EnumerateRemoteSectionsAndModules(out List
_sections, out List _modules) { if (!IsValid) { - sections = null; - modules = null; + _sections = null; + _modules = null; return false; } - coreFunctions.EnumerateRemoteSectionsAndModules(handle, out sections, out modules); + _sections = new List
(); + _modules = new List(); + + coreFunctions.EnumerateRemoteSectionsAndModules(handle, _sections.Add, _modules.Add); return true; } @@ -677,11 +437,11 @@ public Task UpdateProcessInformationsAsync() if (!IsValid) { - lock(modules) + lock (modules) { modules.Clear(); } - lock(sections) + lock (sections) { sections.Clear(); } @@ -720,9 +480,9 @@ public IntPtr ParseAddress(string addressFormula) if (!formulaCache.TryGetValue(addressFormula, out var func)) { - var expression = ExpressionParser.Parse(addressFormula); + var expression = Parser.Parse(addressFormula); - func = DynamicCompiler.CompileAddressFormula(expression); + func = DynamicCompiler.CompileExpression(expression); formulaCache.Add(addressFormula, func); } diff --git a/ReClass.NET/Memory/SimplePeHeader.cs b/ReClass.NET/Memory/SimplePeHeader.cs new file mode 100644 index 00000000..89f0e804 --- /dev/null +++ b/ReClass.NET/Memory/SimplePeHeader.cs @@ -0,0 +1,46 @@ +using System; +using System.IO; + +namespace ReClassNET.Memory +{ + public class SimplePeHeader + { + private readonly byte[] data; + + private int e_lfanew => BitConverter.ToInt32(data, 60); + + private int FileHeader => e_lfanew + 4; + + public int NumberOfSections => BitConverter.ToInt16(data, FileHeader + 2); + + private int SizeOfOptionalHeader => BitConverter.ToInt16(data, FileHeader + 16); + + private int FirstSectionOffset => e_lfanew + 24 + SizeOfOptionalHeader; + + public int SectionOffset(int index) => FirstSectionOffset + index * 40; + + private SimplePeHeader(byte[] data) + { + this.data = data; + } + + /// + /// Rewrites the section headers to build a valid pe file. + /// + /// The memory of a dumped module. + public static void FixSectionHeaders(byte[] data) + { + var pe = new SimplePeHeader(data); + + using var ms = new MemoryStream(data); + using var bw = new BinaryWriter(ms); + for (var i = 0; i < pe.NumberOfSections; ++i) + { + var offset = pe.SectionOffset(i); + bw.Seek(offset + 16, SeekOrigin.Begin); + bw.Write(BitConverter.ToUInt32(data, offset + 8)); // SizeOfRawData = VirtualSize + bw.Write(BitConverter.ToUInt32(data, offset + 12)); // PointerToRawData = VirtualAddress + } + } + } +} diff --git a/ReClass.NET/Memory/UnionDataType.cs b/ReClass.NET/Memory/UnionDataType.cs index 3c53b48b..0cea977a 100644 --- a/ReClass.NET/Memory/UnionDataType.cs +++ b/ReClass.NET/Memory/UnionDataType.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; namespace ReClassNET.Memory @@ -26,6 +26,9 @@ public struct UInt16Data [StructLayout(LayoutKind.Explicit)] public struct UInt32FloatData { + [FieldOffset(0)] + public int Raw; + [FieldOffset(0)] public int IntValue; @@ -43,24 +46,30 @@ public struct UInt32FloatData [StructLayout(LayoutKind.Explicit)] public struct UInt64FloatDoubleData { + [FieldOffset(0)] + public int Raw1; + + [FieldOffset(4)] + public int Raw2; + [FieldOffset(0)] public long LongValue; public IntPtr IntPtr => -#if RECLASSNET32 - unchecked((IntPtr)(int)LongValue); -#else +#if RECLASSNET64 (IntPtr)LongValue; +#else + unchecked((IntPtr)(int)LongValue); #endif [FieldOffset(0)] public ulong ULongValue; public UIntPtr UIntPtr => -#if RECLASSNET32 - unchecked((UIntPtr)(uint)ULongValue); -#else +#if RECLASSNET64 (UIntPtr)ULongValue; +#else + unchecked((UIntPtr)(uint)ULongValue); #endif [FieldOffset(0)] @@ -69,12 +78,4 @@ public struct UInt64FloatDoubleData [FieldOffset(0)] public double DoubleValue; } - - [StructLayout(LayoutKind.Sequential)] - public struct ThreePointersData - { - public IntPtr Pointer1; - public IntPtr Pointer2; - public IntPtr Pointer3; - } } diff --git a/ReClass.NET/MemoryScanner/BytePattern.cs b/ReClass.NET/MemoryScanner/BytePattern.cs index 6f4779a7..3bbca9ed 100644 --- a/ReClass.NET/MemoryScanner/BytePattern.cs +++ b/ReClass.NET/MemoryScanner/BytePattern.cs @@ -8,7 +8,7 @@ namespace ReClassNET.MemoryScanner { - public enum PatternFormat + public enum PatternMaskFormat { /// /// Example: AA BB ?? D? ?E FF @@ -17,7 +17,7 @@ public enum PatternFormat /// /// Example: \xAA\xBB\x00\x00\x00\xFF xx???x /// - PatternAndMask + Separated } public class BytePattern @@ -42,7 +42,7 @@ private interface IPatternByte /// /// /// - Tuple ToString(PatternFormat format); + Tuple ToString(PatternMaskFormat format); } private class PatternByte : IPatternByte @@ -128,13 +128,13 @@ public bool Equals(byte b) return false; } - public Tuple ToString(PatternFormat format) + public Tuple ToString(PatternMaskFormat format) { switch (format) { - case PatternFormat.PatternAndMask: + case PatternMaskFormat.Separated: return HasWildcard ? Tuple.Create("\\x00", "?") : Tuple.Create($"\\x{ToByte():X02}", "x"); - case PatternFormat.Combined: + case PatternMaskFormat.Combined: var sb = new StringBuilder(); if (nibble1.IsWildcard) sb.Append('?'); else sb.AppendFormat("{0:X}", nibble1.Value); @@ -146,7 +146,7 @@ public Tuple ToString(PatternFormat format) } } - public override string ToString() => ToString(PatternFormat.Combined).Item1; + public override string ToString() => ToString(PatternMaskFormat.Combined).Item1; } private class SimplePatternByte : IPatternByte @@ -162,13 +162,13 @@ public SimplePatternByte(byte value) public bool Equals(byte b) => value == b; - public Tuple ToString(PatternFormat format) + public Tuple ToString(PatternMaskFormat format) { switch (format) { - case PatternFormat.PatternAndMask: + case PatternMaskFormat.Separated: return Tuple.Create($"\\x{ToByte():X02}", "x"); - case PatternFormat.Combined: + case PatternMaskFormat.Combined: return Tuple.Create($"{ToByte():X02}", (string)null); default: throw new ArgumentOutOfRangeException(nameof(format), format, null); @@ -213,10 +213,11 @@ public static BytePattern Parse(string value) var pattern = new BytePattern(); - using (var sr = new StringReader(value)) + using var sr = new StringReader(value); + while (true) { var pb = new PatternByte(); - while (pb.TryRead(sr)) + if (pb.TryRead(sr)) { if (!pb.HasWildcard) { @@ -227,14 +228,18 @@ public static BytePattern Parse(string value) pattern.pattern.Add(pb); } } - - // Check if we are not at the end of the stream - if (sr.Peek() != -1) + else { - throw new ArgumentException($"'{value}' is not a valid byte pattern."); + break; } } + // Check if we are not at the end of the stream + if (sr.Peek() != -1) + { + throw new ArgumentException($"'{value}' is not a valid byte pattern."); + } + return pattern; } @@ -259,9 +264,9 @@ public static BytePattern From(IEnumerable> data) { var pattern = new BytePattern(); - foreach (var i in data) + foreach (var (value, isWildcard) in data) { - var pb = i.Item2 ? (IPatternByte)PatternByte.NewWildcardByte() : new SimplePatternByte(i.Item1); + var pb = isWildcard ? (IPatternByte)PatternByte.NewWildcardByte() : new SimplePatternByte(value); pattern.pattern.Add(pb); } @@ -309,32 +314,32 @@ public byte[] ToByteArray() } /// - /// Formats the in the specified . + /// Formats the in the specified . /// /// The format of the pattern. - /// A tuple containing the format. If is not the second item is null. - public Tuple ToString(PatternFormat format) + /// A tuple containing the format. If is not the second item is null. + public Tuple ToString(PatternMaskFormat format) { switch (format) { - case PatternFormat.PatternAndMask: + case PatternMaskFormat.Separated: var sb1 = new StringBuilder(); var sb2 = new StringBuilder(); pattern - .Select(p => p.ToString(PatternFormat.PatternAndMask)) + .Select(p => p.ToString(PatternMaskFormat.Separated)) .ForEach(t => { sb1.Append(t.Item1); sb2.Append(t.Item2); }); return Tuple.Create(sb1.ToString(), sb2.ToString()); - case PatternFormat.Combined: - return Tuple.Create(string.Join(" ", pattern.Select(p => p.ToString(PatternFormat.Combined).Item1)), null); + case PatternMaskFormat.Combined: + return Tuple.Create(string.Join(" ", pattern.Select(p => p.ToString(PatternMaskFormat.Combined).Item1)), null); default: throw new ArgumentOutOfRangeException(nameof(format), format, null); } } - public override string ToString() => ToString(PatternFormat.Combined).Item1; + public override string ToString() => ToString(PatternMaskFormat.Combined).Item1; } } diff --git a/ReClass.NET/MemoryScanner/Comparer/ArrayOfBytesMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/ArrayOfBytesMemoryComparer.cs index e7e2bcbc..3e377f25 100644 --- a/ReClass.NET/MemoryScanner/Comparer/ArrayOfBytesMemoryComparer.cs +++ b/ReClass.NET/MemoryScanner/Comparer/ArrayOfBytesMemoryComparer.cs @@ -1,10 +1,10 @@ -using System; +using System; using System.Diagnostics; using System.Diagnostics.Contracts; namespace ReClassNET.MemoryScanner.Comparer { - public class ArrayOfBytesMemoryComparer : IScanComparer + public class ArrayOfBytesMemoryComparer : ISimpleScanComparer { public ScanCompareType CompareType => ScanCompareType.Equal; public int ValueSize => bytePattern?.Length ?? byteArray.Length; diff --git a/ReClass.NET/MemoryScanner/Comparer/ByteMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/ByteMemoryComparer.cs index 4d175d9f..10efe5cc 100644 --- a/ReClass.NET/MemoryScanner/Comparer/ByteMemoryComparer.cs +++ b/ReClass.NET/MemoryScanner/Comparer/ByteMemoryComparer.cs @@ -1,9 +1,9 @@ -using System.Diagnostics; -using ReClassNET.Util; +using System; +using System.Diagnostics; namespace ReClassNET.MemoryScanner.Comparer { - public class ByteMemoryComparer : IScanComparer + public class ByteMemoryComparer : ISimpleScanComparer { public ScanCompareType CompareType { get; } public byte Value1 { get; } @@ -14,59 +14,30 @@ public ByteMemoryComparer(ScanCompareType compareType, byte value1, byte value2) { CompareType = compareType; - if (compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual) - { - if (value1 > value2) - { - Utils.Swap(ref value1, ref value2); - } - } - Value1 = value1; Value2 = value2; } public bool Compare(byte[] data, int index, out ScanResult result) { - result = null; - - var value = data[index]; - - bool IsMatch() - { - switch (CompareType) + return CompareInternal( + data, + index, + value => CompareType switch { - case ScanCompareType.Equal: - return value == Value1; - case ScanCompareType.NotEqual: - return value != Value1; - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - case ScanCompareType.Unknown: - return true; - default: - throw new InvalidCompareTypeException(CompareType); - } - } - - if (!IsMatch()) - { - return false; - } - - result = new ByteScanResult(value); - - return true; + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); } public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) @@ -80,48 +51,51 @@ public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult public bool Compare(byte[] data, int index, ByteScanResult previous, out ScanResult result) { - result = null; + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } - var value = data[index]; + private static bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; - bool IsMatch() + if (data == null) { - switch (CompareType) - { - case ScanCompareType.Equal: - return value == Value1; - case ScanCompareType.NotEqual: - return value != Value1; - case ScanCompareType.Changed: - return value != previous.Value; - case ScanCompareType.NotChanged: - return value == previous.Value; - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.Increased: - return value > previous.Value; - case ScanCompareType.IncreasedOrEqual: - return value >= previous.Value; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Decreased: - return value < previous.Value; - case ScanCompareType.DecreasedOrEqual: - return value <= previous.Value; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - default: - throw new InvalidCompareTypeException(CompareType); - } + throw new ArgumentNullException(nameof(data)); + } + if ((uint)index >= data.Length) + { + throw new ArgumentOutOfRangeException(nameof(index)); } + if (index > data.Length - 1) + { + throw new ArgumentException(); + } + + var value = data[index]; - if (!IsMatch()) + if (!matcher(value)) { return false; } diff --git a/ReClass.NET/MemoryScanner/Comparer/DoubleMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/DoubleMemoryComparer.cs index 56c50164..5e866608 100644 --- a/ReClass.NET/MemoryScanner/Comparer/DoubleMemoryComparer.cs +++ b/ReClass.NET/MemoryScanner/Comparer/DoubleMemoryComparer.cs @@ -1,11 +1,11 @@ -using System; +using System; using System.Diagnostics; using ReClassNET.Extensions; -using ReClassNET.Util; +using ReClassNET.Util.Conversion; namespace ReClassNET.MemoryScanner.Comparer { - public class DoubleMemoryComparer : IScanComparer + public class DoubleMemoryComparer : ISimpleScanComparer { public ScanCompareType CompareType { get; } public ScanRoundMode RoundType { get; } @@ -17,18 +17,12 @@ public class DoubleMemoryComparer : IScanComparer private readonly double minValue; private readonly double maxValue; - public DoubleMemoryComparer(ScanCompareType compareType, ScanRoundMode roundType, int significantDigits, double value1, double value2) + private readonly EndianBitConverter bitConverter; + + public DoubleMemoryComparer(ScanCompareType compareType, ScanRoundMode roundType, int significantDigits, double value1, double value2, EndianBitConverter bitConverter) { CompareType = compareType; - if (compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual) - { - if (value1 > value2) - { - Utils.Swap(ref value1, ref value2); - } - } - RoundType = roundType; this.significantDigits = Math.Max(significantDigits, 1); Value1 = Math.Round(value1, this.significantDigits, MidpointRounding.AwayFromZero); @@ -38,64 +32,39 @@ public DoubleMemoryComparer(ScanCompareType compareType, ScanRoundMode roundType minValue = value1 - 1.0 / factor; maxValue = value1 + 1.0 / factor; + + this.bitConverter = bitConverter; } - private bool CheckRoundedEquality(double value) - { - switch (RoundType) + private bool CheckRoundedEquality(double value) => + RoundType switch { - case ScanRoundMode.Strict: - return Value1.IsNearlyEqual(Math.Round(value, significantDigits, MidpointRounding.AwayFromZero)); - case ScanRoundMode.Normal: - return minValue < value && value < maxValue; - case ScanRoundMode.Truncate: - return (long)value == (long)Value1; - default: - throw new ArgumentOutOfRangeException(); - } - } + ScanRoundMode.Strict => Value1.IsNearlyEqual(Math.Round(value, significantDigits, MidpointRounding.AwayFromZero), 0.0001), + ScanRoundMode.Normal => minValue < value && value < maxValue, + ScanRoundMode.Truncate => (long)value == (long)Value1, + _ => throw new ArgumentOutOfRangeException() + }; public bool Compare(byte[] data, int index, out ScanResult result) { - result = null; - - var value = BitConverter.ToDouble(data, index); - - bool IsMatch() - { - switch (CompareType) + return CompareInternal( + data, + index, + value => CompareType switch { - case ScanCompareType.Equal: - return CheckRoundedEquality(value); - case ScanCompareType.NotEqual: - return !CheckRoundedEquality(value); - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - case ScanCompareType.Unknown: - return true; - default: - throw new InvalidCompareTypeException(CompareType); - } - } - - if (!IsMatch()) - { - return false; - } - - result = new DoubleScanResult(value); - - return true; + ScanCompareType.Equal => CheckRoundedEquality(value), + ScanCompareType.NotEqual => !CheckRoundedEquality(value), + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); } public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) @@ -109,48 +78,38 @@ public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult public bool Compare(byte[] data, int index, DoubleScanResult previous, out ScanResult result) { - result = null; + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => CheckRoundedEquality(value), + ScanCompareType.NotEqual => !CheckRoundedEquality(value), + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } - var value = BitConverter.ToDouble(data, index); + private bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; - bool IsMatch() - { - switch (CompareType) - { - case ScanCompareType.Equal: - return CheckRoundedEquality(value); - case ScanCompareType.NotEqual: - return !CheckRoundedEquality(value); - case ScanCompareType.Changed: - return value != previous.Value; - case ScanCompareType.NotChanged: - return value == previous.Value; - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.Increased: - return value > previous.Value; - case ScanCompareType.IncreasedOrEqual: - return value >= previous.Value; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Decreased: - return value < previous.Value; - case ScanCompareType.DecreasedOrEqual: - return value <= previous.Value; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - default: - throw new InvalidCompareTypeException(CompareType); - } - } + var value = bitConverter.ToDouble(data, index); - if (!IsMatch()) + if (!matcher(value)) { return false; } diff --git a/ReClass.NET/MemoryScanner/Comparer/FloatMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/FloatMemoryComparer.cs index 52e96974..60a3acdf 100644 --- a/ReClass.NET/MemoryScanner/Comparer/FloatMemoryComparer.cs +++ b/ReClass.NET/MemoryScanner/Comparer/FloatMemoryComparer.cs @@ -1,11 +1,11 @@ -using System; +using System; using System.Diagnostics; using ReClassNET.Extensions; -using ReClassNET.Util; +using ReClassNET.Util.Conversion; namespace ReClassNET.MemoryScanner.Comparer { - public class FloatMemoryComparer : IScanComparer + public class FloatMemoryComparer : ISimpleScanComparer { public ScanCompareType CompareType { get; } public ScanRoundMode RoundType { get; } @@ -17,18 +17,12 @@ public class FloatMemoryComparer : IScanComparer private readonly float minValue; private readonly float maxValue; - public FloatMemoryComparer(ScanCompareType compareType, ScanRoundMode roundType, int significantDigits, float value1, float value2) + private readonly EndianBitConverter bitConverter; + + public FloatMemoryComparer(ScanCompareType compareType, ScanRoundMode roundType, int significantDigits, float value1, float value2, EndianBitConverter bitConverter) { CompareType = compareType; - if (compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual) - { - if (value1 > value2) - { - Utils.Swap(ref value1, ref value2); - } - } - RoundType = roundType; this.significantDigits = Math.Max(significantDigits, 1); Value1 = (float)Math.Round(value1, this.significantDigits, MidpointRounding.AwayFromZero); @@ -38,64 +32,39 @@ public FloatMemoryComparer(ScanCompareType compareType, ScanRoundMode roundType, minValue = value1 - 1.0f / factor; maxValue = value1 + 1.0f / factor; + + this.bitConverter = bitConverter; } - private bool CheckRoundedEquality(float value) - { - switch (RoundType) + private bool CheckRoundedEquality(float value) => + RoundType switch { - case ScanRoundMode.Strict: - return Value1.IsNearlyEqual((float)Math.Round(value, significantDigits, MidpointRounding.AwayFromZero)); - case ScanRoundMode.Normal: - return minValue < value && value < maxValue; - case ScanRoundMode.Truncate: - return (int)value == (int)Value1; - default: - throw new ArgumentOutOfRangeException(); - } - } + ScanRoundMode.Strict => Value1.IsNearlyEqual((float)Math.Round(value, significantDigits, MidpointRounding.AwayFromZero), 0.0001f), + ScanRoundMode.Normal => minValue < value && value < maxValue, + ScanRoundMode.Truncate => (int)value == (int)Value1, + _ => throw new ArgumentOutOfRangeException() + }; public bool Compare(byte[] data, int index, out ScanResult result) { - result = null; - - var value = BitConverter.ToSingle(data, index); - - bool IsMatch() - { - switch (CompareType) + return CompareInternal( + data, + index, + value => CompareType switch { - case ScanCompareType.Equal: - return CheckRoundedEquality(value); - case ScanCompareType.NotEqual: - return !CheckRoundedEquality(value); - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - case ScanCompareType.Unknown: - return true; - default: - throw new InvalidCompareTypeException(CompareType); - } - } - - if (!IsMatch()) - { - return false; - } - - result = new FloatScanResult(value); - - return true; + ScanCompareType.Equal => CheckRoundedEquality(value), + ScanCompareType.NotEqual => !CheckRoundedEquality(value), + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); } public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) @@ -109,48 +78,38 @@ public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult public bool Compare(byte[] data, int index, FloatScanResult previous, out ScanResult result) { - result = null; + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => CheckRoundedEquality(value), + ScanCompareType.NotEqual => !CheckRoundedEquality(value), + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } - var value = BitConverter.ToSingle(data, index); + private bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; - bool IsMatch() - { - switch (CompareType) - { - case ScanCompareType.Equal: - return CheckRoundedEquality(value); - case ScanCompareType.NotEqual: - return !CheckRoundedEquality(value); - case ScanCompareType.Changed: - return value != previous.Value; - case ScanCompareType.NotChanged: - return value == previous.Value; - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.Increased: - return value > previous.Value; - case ScanCompareType.IncreasedOrEqual: - return value >= previous.Value; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Decreased: - return value < previous.Value; - case ScanCompareType.DecreasedOrEqual: - return value <= previous.Value; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - default: - throw new InvalidCompareTypeException(CompareType); - } - } + var value = bitConverter.ToSingle(data, index); - if (!IsMatch()) + if (!matcher(value)) { return false; } diff --git a/ReClass.NET/MemoryScanner/Comparer/IComplexScanComparer.cs b/ReClass.NET/MemoryScanner/Comparer/IComplexScanComparer.cs new file mode 100644 index 00000000..55e1cd8e --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/IComplexScanComparer.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public interface IComplexScanComparer : IScanComparer + { + /// + /// Compares all data to the current . + /// + /// The byte array to be compared. + /// The index into the byte array. + /// List of matches. + IEnumerable Compare(byte[] data, int size); + + /// + /// Compares all data to the current . + /// The previous results may be used. + /// + /// The byte array to be compared. + /// The index into the byte array. + /// Scan result to be compared. + /// [out] The scan result if the matched. + /// True if matched. + bool CompareWithPrevious(byte[] data, int size, ScanResult previous, out ScanResult result); + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/IScanComparer.cs b/ReClass.NET/MemoryScanner/Comparer/IScanComparer.cs index 35be65f5..4f3c2e4f 100644 --- a/ReClass.NET/MemoryScanner/Comparer/IScanComparer.cs +++ b/ReClass.NET/MemoryScanner/Comparer/IScanComparer.cs @@ -1,64 +1,7 @@ -using System; -using System.Diagnostics.Contracts; - namespace ReClassNET.MemoryScanner.Comparer { - [ContractClass(typeof(ScanComparerContract))] public interface IScanComparer { ScanCompareType CompareType { get; } - int ValueSize { get; } - - /// - /// Compares the data at the provided index to the current . - /// - /// The byte array to be compared. - /// The index into the byte array. - /// [out] The scan result if the matched. - /// True if matched. - bool Compare(byte[] data, int index, out ScanResult result); - - /// - /// Compares the data at the provided index to the current . - /// The previous results may be used. - /// - /// The byte array to be compared. - /// The index into the byte array. - /// Scan result to be compared. - /// [out] The scan result if the matched. - /// True if matched. - bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result); - } - - [ContractClassFor(typeof(IScanComparer))] - internal abstract class ScanComparerContract : IScanComparer - { - public ScanCompareType CompareType => throw new NotImplementedException(); - - public int ValueSize - { - get - { - Contract.Ensures(ValueSize > 0); - - throw new NotImplementedException(); - } - } - public bool Compare(byte[] data, int index, out ScanResult result) - { - Contract.Requires(data != null); - Contract.Requires(index >= 0); - - throw new NotImplementedException(); - } - - public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) - { - Contract.Requires(data != null); - Contract.Requires(index >= 0); - Contract.Requires(previous != null); - - throw new NotImplementedException(); - } } } diff --git a/ReClass.NET/MemoryScanner/Comparer/ISimpleScanComparer.cs b/ReClass.NET/MemoryScanner/Comparer/ISimpleScanComparer.cs new file mode 100644 index 00000000..a54b2f70 --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/ISimpleScanComparer.cs @@ -0,0 +1,27 @@ +namespace ReClassNET.MemoryScanner.Comparer +{ + public interface ISimpleScanComparer : IScanComparer + { + int ValueSize { get; } + + /// + /// Compares the data at the provided index to the current . + /// + /// The byte array to be compared. + /// The index into the byte array. + /// [out] The scan result if the matched. + /// True if matched. + bool Compare(byte[] data, int index, out ScanResult result); + + /// + /// Compares the data at the provided index to the current . + /// The previous results may be used. + /// + /// The byte array to be compared. + /// The index into the byte array. + /// Scan result to be compared. + /// [out] The scan result if the matched. + /// True if matched. + bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result); + } +} \ No newline at end of file diff --git a/ReClass.NET/MemoryScanner/Comparer/IntegerMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/IntegerMemoryComparer.cs index 3a8b97ba..44b372af 100644 --- a/ReClass.NET/MemoryScanner/Comparer/IntegerMemoryComparer.cs +++ b/ReClass.NET/MemoryScanner/Comparer/IntegerMemoryComparer.cs @@ -1,73 +1,48 @@ -using System; +using System; using System.Diagnostics; -using ReClassNET.Util; +using ReClassNET.Util.Conversion; namespace ReClassNET.MemoryScanner.Comparer { - public class IntegerMemoryComparer : IScanComparer + public class IntegerMemoryComparer : ISimpleScanComparer { public ScanCompareType CompareType { get; } public int Value1 { get; } public int Value2 { get; } public int ValueSize => sizeof(int); - public IntegerMemoryComparer(ScanCompareType compareType, int value1, int value2) + private readonly EndianBitConverter bitConverter; + + public IntegerMemoryComparer(ScanCompareType compareType, int value1, int value2, EndianBitConverter bitConverter) { CompareType = compareType; - if (compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual) - { - if (value1 > value2) - { - Utils.Swap(ref value1, ref value2); - } - } - Value1 = value1; Value2 = value2; + + this.bitConverter = bitConverter; } public bool Compare(byte[] data, int index, out ScanResult result) { - result = null; - - var value = BitConverter.ToInt32(data, index); - - bool IsMatch() - { - switch (CompareType) + return CompareInternal( + data, + index, + value => CompareType switch { - case ScanCompareType.Equal: - return value == Value1; - case ScanCompareType.NotEqual: - return value != Value1; - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - case ScanCompareType.Unknown: - return true; - default: - throw new InvalidCompareTypeException(CompareType); - } - } - - if (!IsMatch()) - { - return false; - } - - result = new IntegerScanResult(value); - - return true; + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); } public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) @@ -81,48 +56,38 @@ public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult public bool Compare(byte[] data, int index, IntegerScanResult previous, out ScanResult result) { - result = null; + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } - var value = BitConverter.ToInt32(data, index); + private bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; - bool IsMatch() - { - switch (CompareType) - { - case ScanCompareType.Equal: - return value == Value1; - case ScanCompareType.NotEqual: - return value != Value1; - case ScanCompareType.Changed: - return value != previous.Value; - case ScanCompareType.NotChanged: - return value == previous.Value; - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.Increased: - return value > previous.Value; - case ScanCompareType.IncreasedOrEqual: - return value >= previous.Value; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Decreased: - return value < previous.Value; - case ScanCompareType.DecreasedOrEqual: - return value <= previous.Value; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - default: - throw new InvalidCompareTypeException(CompareType); - } - } + var value = bitConverter.ToInt32(data, index); - if (!IsMatch()) + if (!matcher(value)) { return false; } diff --git a/ReClass.NET/MemoryScanner/Comparer/LongMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/LongMemoryComparer.cs index 662f1a99..f95051ad 100644 --- a/ReClass.NET/MemoryScanner/Comparer/LongMemoryComparer.cs +++ b/ReClass.NET/MemoryScanner/Comparer/LongMemoryComparer.cs @@ -1,73 +1,48 @@ -using System; +using System; using System.Diagnostics; -using ReClassNET.Util; +using ReClassNET.Util.Conversion; namespace ReClassNET.MemoryScanner.Comparer { - public class LongMemoryComparer : IScanComparer + public class LongMemoryComparer : ISimpleScanComparer { public ScanCompareType CompareType { get; } public long Value1 { get; } public long Value2 { get; } public int ValueSize => sizeof(long); - public LongMemoryComparer(ScanCompareType compareType, long value1, long value2) + private readonly EndianBitConverter bitConverter; + + public LongMemoryComparer(ScanCompareType compareType, long value1, long value2, EndianBitConverter bitConverter) { CompareType = compareType; - if (compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual) - { - if (value1 > value2) - { - Utils.Swap(ref value1, ref value2); - } - } - Value1 = value1; Value2 = value2; + + this.bitConverter = bitConverter; } public bool Compare(byte[] data, int index, out ScanResult result) { - result = null; - - var value = BitConverter.ToInt64(data, index); - - bool IsMatch() - { - switch (CompareType) + return CompareInternal( + data, + index, + value => CompareType switch { - case ScanCompareType.Equal: - return value == Value1; - case ScanCompareType.NotEqual: - return value != Value1; - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - case ScanCompareType.Unknown: - return true; - default: - throw new InvalidCompareTypeException(CompareType); - } - } - - if (!IsMatch()) - { - return false; - } - - result = new LongScanResult(value); - - return true; + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); } public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) @@ -81,48 +56,38 @@ public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult public bool Compare(byte[] data, int index, LongScanResult previous, out ScanResult result) { - result = null; + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } - var value = BitConverter.ToInt64(data, index); + private bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; - bool IsMatch() - { - switch (CompareType) - { - case ScanCompareType.Equal: - return value == Value1; - case ScanCompareType.NotEqual: - return value != Value1; - case ScanCompareType.Changed: - return value != previous.Value; - case ScanCompareType.NotChanged: - return value == previous.Value; - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.Increased: - return value > previous.Value; - case ScanCompareType.IncreasedOrEqual: - return value >= previous.Value; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Decreased: - return value < previous.Value; - case ScanCompareType.DecreasedOrEqual: - return value <= previous.Value; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - default: - throw new InvalidCompareTypeException(CompareType); - } - } + var value = bitConverter.ToInt64(data, index); - if (!IsMatch()) + if (!matcher(value)) { return false; } diff --git a/ReClass.NET/MemoryScanner/Comparer/RegexStringMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/RegexStringMemoryComparer.cs new file mode 100644 index 00000000..efd9d448 --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/RegexStringMemoryComparer.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class RegexStringMemoryComparer : IComplexScanComparer + { + public ScanCompareType CompareType => ScanCompareType.Equal; + + public Regex Pattern { get; } + + public Encoding Encoding { get; } + + public RegexStringMemoryComparer(string pattern, Encoding encoding, bool caseSensitive) + { + var options = RegexOptions.Singleline | RegexOptions.Compiled; + if (!caseSensitive) + { + options |= RegexOptions.IgnoreCase; + } + + Pattern = new Regex(pattern, options); + + Encoding = encoding; + } + + public IEnumerable Compare(byte[] data, int size) + { + var buffer = Encoding.GetString(data, 0, size); + var bufferArray = buffer.ToCharArray(); + + var lastIndex = 0; + var lastOffset = 0; + + var match = Pattern.Match(buffer); + while (match.Success) + { + var byteOffset = Encoding.GetByteCount(bufferArray, lastIndex, match.Index - lastIndex) + lastOffset; + + lastIndex = match.Index; + lastOffset = byteOffset; + + yield return new RegexStringScanResult(match.Value, Encoding) + { + Address = (IntPtr)byteOffset + }; + + match = match.NextMatch(); + } + } + + public bool CompareWithPrevious(byte[] data, int size, ScanResult previous, out ScanResult result) + { + result = null; + + var byteOffset = previous.Address.ToInt32(); + if (byteOffset >= size) + { + return false; + } + + var buffer = Encoding.GetString(data, byteOffset, size - byteOffset); + + var match = Pattern.Match(buffer); + if (!match.Success) + { + return false; + } + + result = new RegexStringScanResult(match.Value, Encoding) + { + Address = (IntPtr)byteOffset + }; + + return true; + } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/ShortMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/ShortMemoryComparer.cs index 8e541704..6d8ba6a3 100644 --- a/ReClass.NET/MemoryScanner/Comparer/ShortMemoryComparer.cs +++ b/ReClass.NET/MemoryScanner/Comparer/ShortMemoryComparer.cs @@ -1,73 +1,48 @@ -using System; +using System; using System.Diagnostics; -using ReClassNET.Util; +using ReClassNET.Util.Conversion; namespace ReClassNET.MemoryScanner.Comparer { - public class ShortMemoryComparer : IScanComparer + public class ShortMemoryComparer : ISimpleScanComparer { public ScanCompareType CompareType { get; } public short Value1 { get; } public short Value2 { get; } public int ValueSize => sizeof(short); - public ShortMemoryComparer(ScanCompareType compareType, short value1, short value2) + private readonly EndianBitConverter bitConverter; + + public ShortMemoryComparer(ScanCompareType compareType, short value1, short value2, EndianBitConverter bitConverter) { CompareType = compareType; - if (compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual) - { - if (value1 > value2) - { - Utils.Swap(ref value1, ref value2); - } - } - Value1 = value1; Value2 = value2; + + this.bitConverter = bitConverter; } public bool Compare(byte[] data, int index, out ScanResult result) { - result = null; - - var value = BitConverter.ToInt16(data, index); - - bool IsMatch() - { - switch (CompareType) + return CompareInternal( + data, + index, + value => CompareType switch { - case ScanCompareType.Equal: - return value == Value1; - case ScanCompareType.NotEqual: - return value != Value1; - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - case ScanCompareType.Unknown: - return true; - default: - throw new InvalidCompareTypeException(CompareType); - } - } - - if (!IsMatch()) - { - return false; - } - - result = new ShortScanResult(value); - - return true; + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); } public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) @@ -81,48 +56,38 @@ public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult public bool Compare(byte[] data, int index, ShortScanResult previous, out ScanResult result) { - result = null; + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } - var value = BitConverter.ToInt16(data, index); + private bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; - bool IsMatch() - { - switch (CompareType) - { - case ScanCompareType.Equal: - return value == Value1; - case ScanCompareType.NotEqual: - return value != Value1; - case ScanCompareType.Changed: - return value != previous.Value; - case ScanCompareType.NotChanged: - return value == previous.Value; - case ScanCompareType.GreaterThan: - return value > Value1; - case ScanCompareType.GreaterThanOrEqual: - return value >= Value1; - case ScanCompareType.Increased: - return value > previous.Value; - case ScanCompareType.IncreasedOrEqual: - return value >= previous.Value; - case ScanCompareType.LessThan: - return value < Value1; - case ScanCompareType.LessThanOrEqual: - return value <= Value1; - case ScanCompareType.Decreased: - return value < previous.Value; - case ScanCompareType.DecreasedOrEqual: - return value <= previous.Value; - case ScanCompareType.Between: - return Value1 < value && value < Value2; - case ScanCompareType.BetweenOrEqual: - return Value1 <= value && value <= Value2; - default: - throw new InvalidCompareTypeException(CompareType); - } - } + var value = bitConverter.ToInt16(data, index); - if (!IsMatch()) + if (!matcher(value)) { return false; } diff --git a/ReClass.NET/MemoryScanner/Comparer/StringMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/StringMemoryComparer.cs index 44b958ed..c6875aba 100644 --- a/ReClass.NET/MemoryScanner/Comparer/StringMemoryComparer.cs +++ b/ReClass.NET/MemoryScanner/Comparer/StringMemoryComparer.cs @@ -1,12 +1,11 @@ -using System; +using System; using System.Diagnostics; using System.Text; using ReClassNET.Extensions; -using ReClassNET.Util; namespace ReClassNET.MemoryScanner.Comparer { - public class StringMemoryComparer : IScanComparer + public class StringMemoryComparer : ISimpleScanComparer { public ScanCompareType CompareType => ScanCompareType.Equal; public bool CaseSensitive { get; } @@ -19,14 +18,14 @@ public StringMemoryComparer(string value, Encoding encoding, bool caseSensitive) Value = value; Encoding = encoding; CaseSensitive = caseSensitive; - ValueSize = Value.Length * Encoding.GetSimpleByteCountPerChar(); + ValueSize = Value.Length * Encoding.GuessByteCountPerChar(); } public bool Compare(byte[] data, int index, out ScanResult result) { result = null; - var value = Encoding.GetString(data, index, Value.Length); + var value = Encoding.GetString(data, index, ValueSize); if (!Value.Equals(value, CaseSensitive ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase)) { diff --git a/ReClass.NET/MemoryScanner/ComplexScannerWorker.cs b/ReClass.NET/MemoryScanner/ComplexScannerWorker.cs new file mode 100644 index 00000000..fab1b22c --- /dev/null +++ b/ReClass.NET/MemoryScanner/ComplexScannerWorker.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using System.Threading; +using ReClassNET.MemoryScanner.Comparer; + +namespace ReClassNET.MemoryScanner +{ + internal class ComplexScannerWorker : IScannerWorker + { + private readonly ScanSettings settings; + private readonly IComplexScanComparer comparer; + + public ComplexScannerWorker(ScanSettings settings, IComplexScanComparer comparer) + { + this.settings = settings; + this.comparer = comparer; + } + + public IList Search(byte[] data, int count, CancellationToken ct) + { + var results = new List(); + + foreach (var result in comparer.Compare(data, count)) + { + results.Add(result); + + if (ct.IsCancellationRequested) + { + break; + } + } + + return results; + } + + public IList Search(byte[] data, int count, IEnumerable previousResults, CancellationToken ct) + { + var results = new List(); + + foreach (var previousResult in previousResults) + { + if (ct.IsCancellationRequested) + { + break; + } + + if (comparer.CompareWithPrevious(data, count, previousResult, out var result)) + { + results.Add(result); + } + } + + return results; + } + } +} diff --git a/ReClass.NET/MemoryScanner/IScannerWorker.cs b/ReClass.NET/MemoryScanner/IScannerWorker.cs new file mode 100644 index 00000000..494c5874 --- /dev/null +++ b/ReClass.NET/MemoryScanner/IScannerWorker.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Threading; +using ReClassNET.MemoryScanner.Comparer; + +namespace ReClassNET.MemoryScanner +{ + internal interface IScannerWorker + { + /// + /// Uses the to scan the byte array for results. + /// + /// The data to scan. + /// The length of the parameter. + /// The to stop the scan. + /// An enumeration of all s. + IList Search(byte[] data, int count, CancellationToken ct); + + /// + /// Uses the to scan the byte array for results. + /// The comparer uses the provided previous results to compare to the current value. + /// + /// The data to scan. + /// The length of the parameter. + /// The previous results to use. + /// The to stop the scan. + /// An enumeration of all s. + IList Search(byte[] data, int count, IEnumerable previousResults, CancellationToken ct); + } +} diff --git a/ReClass.NET/MemoryScanner/InputCorrelatedScanner.cs b/ReClass.NET/MemoryScanner/InputCorrelatedScanner.cs index 5e711e94..33e3b719 100644 --- a/ReClass.NET/MemoryScanner/InputCorrelatedScanner.cs +++ b/ReClass.NET/MemoryScanner/InputCorrelatedScanner.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; @@ -13,6 +13,7 @@ namespace ReClassNET.MemoryScanner { public class InputCorrelatedScanner : Scanner { + private readonly RemoteProcess process; private readonly KeyboardInput input; private readonly List hotkeys; @@ -29,6 +30,7 @@ public InputCorrelatedScanner(RemoteProcess process, KeyboardInput input, IEnume Contract.Requires(hotkeys != null); Contract.Ensures(this.input != null); + this.process = process; this.input = input; this.hotkeys = hotkeys.ToList(); } @@ -56,23 +58,16 @@ private IScanComparer CreateScanComparer(ScanCompareType compareType) { Contract.Ensures(Contract.Result() != null); - switch (Settings.ValueType) + return Settings.ValueType switch { - case ScanValueType.Byte: - return new ByteMemoryComparer(compareType, 0, 0); - case ScanValueType.Short: - return new ShortMemoryComparer(compareType, 0, 0); - case ScanValueType.Integer: - return new IntegerMemoryComparer(compareType, 0, 0); - case ScanValueType.Long: - return new LongMemoryComparer(compareType, 0, 0); - case ScanValueType.Float: - return new FloatMemoryComparer(compareType, ScanRoundMode.Normal, 2, 0, 0); - case ScanValueType.Double: - return new DoubleMemoryComparer(compareType, ScanRoundMode.Normal, 2, 0, 0); - default: - throw new InvalidOperationException(); - } + ScanValueType.Byte => new ByteMemoryComparer(compareType, 0, 0), + ScanValueType.Short => new ShortMemoryComparer(compareType, 0, 0, process.BitConverter), + ScanValueType.Integer => new IntegerMemoryComparer(compareType, 0, 0, process.BitConverter), + ScanValueType.Long => new LongMemoryComparer(compareType, 0, 0, process.BitConverter), + ScanValueType.Float => new FloatMemoryComparer(compareType, ScanRoundMode.Normal, 2, 0, 0, process.BitConverter), + ScanValueType.Double => new DoubleMemoryComparer(compareType, ScanRoundMode.Normal, 2, 0, 0, process.BitConverter), + _ => throw new InvalidOperationException(), + }; } /// diff --git a/ReClass.NET/MemoryScanner/MemoryRecord.cs b/ReClass.NET/MemoryScanner/MemoryRecord.cs index aefc35c7..e40e3ff9 100644 --- a/ReClass.NET/MemoryScanner/MemoryRecord.cs +++ b/ReClass.NET/MemoryScanner/MemoryRecord.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Diagnostics.Contracts; using System.Globalization; @@ -102,6 +102,7 @@ public MemoryRecord(ScanResult result) ValueStr = FormatValue(byteData); break; case ScanValueType.String: + case ScanValueType.Regex: var strResult = (StringScanResult)result; ValueLength = strResult.Value.Length; Encoding = strResult.Encoding; @@ -177,7 +178,8 @@ public void RefreshValue(RemoteProcess process) buffer = new byte[ValueLength]; break; case ScanValueType.String: - buffer = new byte[ValueLength * Encoding.GetSimpleByteCountPerChar()]; + case ScanValueType.Regex: + buffer = new byte[ValueLength * Encoding.GuessByteCountPerChar()]; break; default: throw new InvalidOperationException(); @@ -191,24 +193,25 @@ public void RefreshValue(RemoteProcess process) ValueStr = FormatValue(buffer[0], ShowValueHexadecimal); break; case ScanValueType.Short: - ValueStr = FormatValue(BitConverter.ToInt16(buffer, 0), ShowValueHexadecimal); + ValueStr = FormatValue(process.BitConverter.ToInt16(buffer, 0), ShowValueHexadecimal); break; case ScanValueType.Integer: - ValueStr = FormatValue(BitConverter.ToInt32(buffer, 0), ShowValueHexadecimal); + ValueStr = FormatValue(process.BitConverter.ToInt32(buffer, 0), ShowValueHexadecimal); break; case ScanValueType.Long: - ValueStr = FormatValue(BitConverter.ToInt64(buffer, 0), ShowValueHexadecimal); + ValueStr = FormatValue(process.BitConverter.ToInt64(buffer, 0), ShowValueHexadecimal); break; case ScanValueType.Float: - ValueStr = FormatValue(BitConverter.ToSingle(buffer, 0)); + ValueStr = FormatValue(process.BitConverter.ToSingle(buffer, 0)); break; case ScanValueType.Double: - ValueStr = FormatValue(BitConverter.ToDouble(buffer, 0)); + ValueStr = FormatValue(process.BitConverter.ToDouble(buffer, 0)); break; case ScanValueType.ArrayOfBytes: ValueStr = FormatValue(buffer); break; case ScanValueType.String: + case ScanValueType.Regex: ValueStr = FormatValue(Encoding.GetString(buffer)); break; } @@ -238,31 +241,31 @@ public void SetValue(RemoteProcess process, string input, bool isHex) switch (ValueType) { case ScanValueType.Byte: - data = BitConverter.GetBytes((byte)value); + data = process.BitConverter.GetBytes((byte)value); break; case ScanValueType.Short: - data = BitConverter.GetBytes((short)value); + data = process.BitConverter.GetBytes((short)value); break; case ScanValueType.Integer: - data = BitConverter.GetBytes((int)value); + data = process.BitConverter.GetBytes((int)value); break; case ScanValueType.Long: - data = BitConverter.GetBytes(value); + data = process.BitConverter.GetBytes(value); break; } } else if (ValueType == ScanValueType.Float || ValueType == ScanValueType.Double) { - var nf = Utils.GuessNumberFormat(input); + var nf = NumberFormat.GuessNumberFormat(input); double.TryParse(input, NumberStyles.Float, nf, out var value); switch (ValueType) { case ScanValueType.Float: - data = BitConverter.GetBytes((float)value); + data = process.BitConverter.GetBytes((float)value); break; case ScanValueType.Double: - data = BitConverter.GetBytes(value); + data = process.BitConverter.GetBytes(value); break; } } @@ -281,7 +284,7 @@ public void SetValue(RemoteProcess process, string input, bool isHex) private static string FormatValue(long value, bool showAsHex) => showAsHex ? value.ToString("X") : value.ToString(); private static string FormatValue(float value) => value.ToString("0.0000"); private static string FormatValue(double value) => value.ToString("0.0000"); - private static string FormatValue(byte[] value) => Utils.ByteArrayToHexString(value); + private static string FormatValue(byte[] value) => HexadecimalFormatter.ToString(value); private static string FormatValue(string value) => value; } } diff --git a/ReClass.NET/MemoryScanner/ScanResult.cs b/ReClass.NET/MemoryScanner/ScanResult.cs index cad1b337..d46ff437 100644 --- a/ReClass.NET/MemoryScanner/ScanResult.cs +++ b/ReClass.NET/MemoryScanner/ScanResult.cs @@ -1,6 +1,8 @@ -using System; +using System; using System.Diagnostics.Contracts; +using System.Linq; using System.Text; +using ReClassNET.Extensions; namespace ReClassNET.MemoryScanner { @@ -10,13 +12,17 @@ public abstract class ScanResult public IntPtr Address { get; set; } + public abstract int ValueSize { get; } + public abstract ScanResult Clone(); } - public class ByteScanResult : ScanResult + public class ByteScanResult : ScanResult, IEquatable { public override ScanValueType ValueType => ScanValueType.Byte; + public override int ValueSize => sizeof(byte); + public byte Value { get; } public ByteScanResult(byte value) @@ -28,12 +34,29 @@ public override ScanResult Clone() { return new ByteScanResult(Value) { Address = Address }; } + + public override bool Equals(object obj) + { + return Equals(obj as ByteScanResult); + } + + public bool Equals(ByteScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } } - public class ShortScanResult : ScanResult + public class ShortScanResult : ScanResult, IEquatable { public override ScanValueType ValueType => ScanValueType.Short; + public override int ValueSize => sizeof(short); + public short Value { get; } public ShortScanResult(short value) @@ -45,12 +68,29 @@ public override ScanResult Clone() { return new ShortScanResult(Value) { Address = Address }; } + + public override bool Equals(object obj) + { + return Equals(obj as ShortScanResult); + } + + public bool Equals(ShortScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } } - public class IntegerScanResult : ScanResult + public class IntegerScanResult : ScanResult, IEquatable { public override ScanValueType ValueType => ScanValueType.Integer; + public override int ValueSize => sizeof(int); + public int Value { get; } public IntegerScanResult(int value) @@ -62,12 +102,29 @@ public override ScanResult Clone() { return new IntegerScanResult(Value) { Address = Address }; } + + public override bool Equals(object obj) + { + return Equals(obj as IntegerScanResult); + } + + public bool Equals(IntegerScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } } - public class LongScanResult : ScanResult + public class LongScanResult : ScanResult, IEquatable { public override ScanValueType ValueType => ScanValueType.Long; + public override int ValueSize => sizeof(long); + public long Value { get; } public LongScanResult(long value) @@ -79,12 +136,29 @@ public override ScanResult Clone() { return new LongScanResult(Value) { Address = Address }; } + + public override bool Equals(object obj) + { + return Equals(obj as LongScanResult); + } + + public bool Equals(LongScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } } - public class FloatScanResult : ScanResult + public class FloatScanResult : ScanResult, IEquatable { public override ScanValueType ValueType => ScanValueType.Float; + public override int ValueSize => sizeof(float); + public float Value { get; } public FloatScanResult(float value) @@ -96,12 +170,29 @@ public override ScanResult Clone() { return new FloatScanResult(Value) { Address = Address }; } + + public override bool Equals(object obj) + { + return Equals(obj as FloatScanResult); + } + + public bool Equals(FloatScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } } - public class DoubleScanResult : ScanResult + public class DoubleScanResult : ScanResult, IEquatable { public override ScanValueType ValueType => ScanValueType.Double; + public override int ValueSize => sizeof(double); + public double Value { get; } public DoubleScanResult(double value) @@ -113,12 +204,29 @@ public override ScanResult Clone() { return new DoubleScanResult(Value) { Address = Address }; } + + public override bool Equals(object obj) + { + return Equals(obj as DoubleScanResult); + } + + public bool Equals(DoubleScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } } - public class ArrayOfBytesScanResult : ScanResult + public class ArrayOfBytesScanResult : ScanResult, IEquatable { public override ScanValueType ValueType => ScanValueType.ArrayOfBytes; + public override int ValueSize => Value.Length; + public byte[] Value { get; } public ArrayOfBytesScanResult(byte[] value) @@ -132,12 +240,29 @@ public override ScanResult Clone() { return new ArrayOfBytesScanResult(Value) { Address = Address }; } + + public override bool Equals(object obj) + { + return Equals(obj as ArrayOfBytesScanResult); + } + + public bool Equals(ArrayOfBytesScanResult other) + { + return other != null && Address == other.Address && Value.SequenceEqual(other.Value); + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } } - public class StringScanResult : ScanResult + public class StringScanResult : ScanResult, IEquatable { public override ScanValueType ValueType => ScanValueType.String; + public override int ValueSize => Value.Length * Encoding.GuessByteCountPerChar(); + public string Value { get; } public Encoding Encoding { get; } @@ -155,5 +280,36 @@ public override ScanResult Clone() { return new StringScanResult(Value, Encoding) { Address = Address }; } + + public override bool Equals(object obj) + { + return Equals(obj as StringScanResult); + } + + public bool Equals(StringScanResult other) + { + return other != null && Address == other.Address && Value == other.Value && Encoding.Equals(other.Encoding); + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode() * 19 + Encoding.GetHashCode(); + } + } + + public class RegexStringScanResult : StringScanResult + { + public override ScanValueType ValueType => ScanValueType.Regex; + + public RegexStringScanResult(string value, Encoding encoding) + : base(value, encoding) + { + + } + + public override ScanResult Clone() + { + return new RegexStringScanResult(Value, Encoding) { Address = Address }; + } } } diff --git a/ReClass.NET/MemoryScanner/ScanResultBlock.cs b/ReClass.NET/MemoryScanner/ScanResultBlock.cs index 14aad1ac..ab657c15 100644 --- a/ReClass.NET/MemoryScanner/ScanResultBlock.cs +++ b/ReClass.NET/MemoryScanner/ScanResultBlock.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Diagnostics.Contracts; using ReClassNET.Extensions; -using ReClassNET.Util; namespace ReClassNET.MemoryScanner { diff --git a/ReClass.NET/MemoryScanner/ScanResultStore.cs b/ReClass.NET/MemoryScanner/ScanResultStore.cs index 70a03d04..e88033b8 100644 --- a/ReClass.NET/MemoryScanner/ScanResultStore.cs +++ b/ReClass.NET/MemoryScanner/ScanResultStore.cs @@ -1,10 +1,9 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.IO; using System.Text; using ReClassNET.Extensions; -using ReClassNET.Util; namespace ReClassNET.MemoryScanner { @@ -130,16 +129,14 @@ private void AppendBlockToFile(ScanResultBlock block) { Contract.Requires(block != null); - using (var bw = new BinaryWriter(fileStream, Encoding.Unicode, true)) - { - bw.Write(block.Start); - bw.Write(block.End); - bw.Write(block.Results.Count); + using var bw = new BinaryWriter(fileStream, Encoding.Unicode, true); + bw.Write(block.Start); + bw.Write(block.End); + bw.Write(block.Results.Count); - foreach (var result in block.Results) - { - WriteSearchResult(bw, result); - } + foreach (var result in block.Results) + { + WriteSearchResult(bw, result); } } @@ -150,28 +147,25 @@ private IEnumerable ReadBlocksFromFile() { Contract.Ensures(Contract.Result>() != null); - using (var stream = File.OpenRead(storePath)) - { - using (var br = new BinaryReader(stream, Encoding.Unicode)) - { - var length = stream.Length; + using var stream = File.OpenRead(storePath); + using var br = new BinaryReader(stream, Encoding.Unicode); - while (stream.Position < length) - { - var start = br.ReadIntPtr(); - var end = br.ReadIntPtr(); + var length = stream.Length; - var resultCount = br.ReadInt32(); + while (stream.Position < length) + { + var start = br.ReadIntPtr(); + var end = br.ReadIntPtr(); - var results = new List(resultCount); - for (var i = 0; i < resultCount; ++i) - { - results.Add(ReadScanResult(br)); - } + var resultCount = br.ReadInt32(); - yield return new ScanResultBlock(start, end, results); - } + var results = new List(resultCount); + for (var i = 0; i < resultCount; ++i) + { + results.Add(ReadScanResult(br)); } + + yield return new ScanResultBlock(start, end, results); } } @@ -212,8 +206,16 @@ private ScanResult ReadScanResult(BinaryReader br) result = new ArrayOfBytesScanResult(br.ReadBytes(br.ReadInt32())); break; case ScanValueType.String: - var encoding = br.ReadInt32(); - result = new StringScanResult(br.ReadString(), encoding == 0 ? Encoding.UTF8 : encoding == 1 ? Encoding.Unicode : Encoding.UTF32); + case ScanValueType.Regex: + var encoding = br.ReadInt32() switch + { + 0 => Encoding.UTF8, + 1 => Encoding.Unicode, + _ => Encoding.UTF32 + }; + var value = br.ReadString(); + + result = valueType == ScanValueType.String ? new StringScanResult(value, encoding) : new RegexStringScanResult(value, encoding); break; default: throw new ArgumentOutOfRangeException(); @@ -261,7 +263,7 @@ private static void WriteSearchResult(BinaryWriter bw, ScanResult result) bw.Write(arrayOfBytesSearchResult.Value); break; case StringScanResult stringSearchResult: - bw.Write(stringSearchResult.Encoding == Encoding.UTF8 ? 0 : stringSearchResult.Encoding == Encoding.Unicode ? 1 : 2); + bw.Write(stringSearchResult.Encoding.IsSameCodePage(Encoding.UTF8) ? 0 : stringSearchResult.Encoding.IsSameCodePage(Encoding.Unicode) ? 1 : 2); bw.Write(stringSearchResult.Value); break; } diff --git a/ReClass.NET/MemoryScanner/ScanValueType.cs b/ReClass.NET/MemoryScanner/ScanValueType.cs index 7bfef7a4..8371e061 100644 --- a/ReClass.NET/MemoryScanner/ScanValueType.cs +++ b/ReClass.NET/MemoryScanner/ScanValueType.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; namespace ReClassNET.MemoryScanner { @@ -19,6 +19,8 @@ public enum ScanValueType [Description("Array of Bytes")] ArrayOfBytes, [Description("String")] - String + String, + [Description("Regular Expression")] + Regex } } diff --git a/ReClass.NET/MemoryScanner/Scanner.cs b/ReClass.NET/MemoryScanner/Scanner.cs index 9f0aa41e..acf8532b 100644 --- a/ReClass.NET/MemoryScanner/Scanner.cs +++ b/ReClass.NET/MemoryScanner/Scanner.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.IO; @@ -82,9 +82,9 @@ public IEnumerable GetResults() return CurrentStore.GetResultBlocks().SelectMany(rb => rb.Results.Select(r => { // Convert the block offset to a real address. - var c = r.Clone(); - c.Address = c.Address.Add(rb.Start); - return c; + var scanResult = r.Clone(); + scanResult.Address = scanResult.Address.Add(rb.Start); + return scanResult; })); } @@ -122,48 +122,45 @@ private IList
GetSearchableSections() return process.Sections .Where(s => !s.Protection.HasFlag(SectionProtection.Guard)) - .Where(s => s.Start.InRange(Settings.StartAddress, Settings.StopAddress) - || Settings.StartAddress.InRange(s.Start, s.End) - || Settings.StopAddress.InRange(s.Start, s.End)) - .Where(s => + .Where(s => s.Start.IsInRange(Settings.StartAddress, Settings.StopAddress) + || Settings.StartAddress.IsInRange(s.Start, s.End) + || Settings.StopAddress.IsInRange(s.Start, s.End)) + .Where(s => s.Type switch { - switch (s.Type) - { - case SectionType.Private: return Settings.ScanPrivateMemory; - case SectionType.Image: return Settings.ScanImageMemory; - case SectionType.Mapped: return Settings.ScanMappedMemory; - default: return false; - } + SectionType.Private => Settings.ScanPrivateMemory, + SectionType.Image => Settings.ScanImageMemory, + SectionType.Mapped => Settings.ScanMappedMemory, + _ => false }) .Where(s => { var isWritable = s.Protection.HasFlag(SectionProtection.Write); - switch (Settings.ScanWritableMemory) + return Settings.ScanWritableMemory switch { - case SettingState.Yes: return isWritable; - case SettingState.No: return !isWritable; - default: return true; - } + SettingState.Yes => isWritable, + SettingState.No => !isWritable, + _ => true + }; }) .Where(s => { var isExecutable = s.Protection.HasFlag(SectionProtection.Execute); - switch (Settings.ScanExecutableMemory) + return Settings.ScanExecutableMemory switch { - case SettingState.Yes: return isExecutable; - case SettingState.No: return !isExecutable; - default: return true; - } + SettingState.Yes => isExecutable, + SettingState.No => !isExecutable, + _ => true + }; }) .Where(s => { var isCopyOnWrite = s.Protection.HasFlag(SectionProtection.CopyOnWrite); - switch (Settings.ScanCopyOnWriteMemory) + return Settings.ScanCopyOnWriteMemory switch { - case SettingState.Yes: return isCopyOnWrite; - case SettingState.No: return !isCopyOnWrite; - default: return true; - } + SettingState.Yes => isCopyOnWrite, + SettingState.No => !isCopyOnWrite, + _ => true + }; }) .ToList(); } @@ -219,7 +216,7 @@ private Task FirstScan(IScanComparer comparer, IProgress progress, Ca var result = Parallel.ForEach( regions, // Sections get grouped by the framework to balance the workers. - () => new ScannerContext(Settings, comparer, initialBufferSize), // Create a new context for every worker (thread). + () => new ScannerContext(CreateWorker(Settings, comparer), initialBufferSize), // Create a new context for every worker (thread). (s, state, _, context) => { if (!ct.IsCancellationRequested) @@ -228,14 +225,14 @@ private Task FirstScan(IScanComparer comparer, IProgress progress, Ca var end = s.Address + s.Size; var size = s.Size; - if (Settings.StartAddress.InRange(start, end)) + if (Settings.StartAddress.IsInRange(start, end)) { - size = size - Settings.StartAddress.Sub(start).ToInt32(); + size -= Settings.StartAddress.Sub(start).ToInt32(); start = Settings.StartAddress; } - if (Settings.StopAddress.InRange(start, end)) + if (Settings.StopAddress.IsInRange(start, end)) { - size = size - end.Sub(Settings.StopAddress).ToInt32(); + size -= end.Sub(Settings.StopAddress).ToInt32(); } context.EnsureBufferSize(size); @@ -247,7 +244,7 @@ private Task FirstScan(IScanComparer comparer, IProgress progress, Ca .ToList(); if (results.Count > 0) { - var block = CreateResultBlock(results, start, comparer.ValueSize); + var block = CreateResultBlock(results, start); store.AddBlock(block); // Store the result block. } } @@ -298,7 +295,7 @@ private Task NextScan(IScanComparer comparer, IProgress progress, Can { var result = Parallel.ForEach( CurrentStore.GetResultBlocks(), - () => new ScannerContext(Settings, comparer, 0), + () => new ScannerContext(CreateWorker(Settings, comparer), 0), (b, state, _, context) => { if (!ct.IsCancellationRequested) @@ -312,7 +309,7 @@ private Task NextScan(IScanComparer comparer, IProgress progress, Can .ToList(); if (results.Count > 0) { - var block = CreateResultBlock(results, b.Start, comparer.ValueSize); + var block = CreateResultBlock(results, b.Start); store.AddBlock(block); } } @@ -378,16 +375,18 @@ private static List ConsolidateSections(IList
///
/// The results in this block. /// The start address of the previous block or section. - /// The size of the value type. /// The new result block. - private static ScanResultBlock CreateResultBlock(IReadOnlyList results, IntPtr previousStartAddress, int valueSize) + private static ScanResultBlock CreateResultBlock(IReadOnlyList results, IntPtr previousStartAddress) { + var firstResult = results.First(); + var lastResult = results.Last(); + // Calculate start and end address - var startAddress = results.First().Address.Add(previousStartAddress); - var endAddress = results.Last().Address.Add(previousStartAddress) + valueSize; + var startAddress = firstResult.Address.Add(previousStartAddress); + var endAddress = lastResult.Address.Add(previousStartAddress) + lastResult.ValueSize; // Adjust the offsets of the results - var firstOffset = results.First().Address; + var firstOffset = firstResult.Address; foreach (var result in results) { result.Address = result.Address.Sub(firstOffset); @@ -400,5 +399,19 @@ private static ScanResultBlock CreateResultBlock(IReadOnlyList resul ); return block; } + + private static IScannerWorker CreateWorker(ScanSettings settings, IScanComparer comparer) + { + if (comparer is ISimpleScanComparer simpleScanComparer) + { + return new SimpleScannerWorker(settings, simpleScanComparer); + } + if (comparer is IComplexScanComparer complexScanComparer) + { + return new ComplexScannerWorker(settings, complexScanComparer); + } + + throw new Exception(); + } } } diff --git a/ReClass.NET/MemoryScanner/ScannerContext.cs b/ReClass.NET/MemoryScanner/ScannerContext.cs index 6b6f20cc..55caffc1 100644 --- a/ReClass.NET/MemoryScanner/ScannerContext.cs +++ b/ReClass.NET/MemoryScanner/ScannerContext.cs @@ -1,24 +1,21 @@ -using System.Diagnostics.Contracts; -using ReClassNET.MemoryScanner.Comparer; +using System.Diagnostics.Contracts; namespace ReClassNET.MemoryScanner { internal class ScannerContext { public byte[] Buffer { get; private set; } - public ScannerWorker Worker { get; } + public IScannerWorker Worker { get; } - public ScannerContext(ScanSettings settings, IScanComparer comparer, int bufferSize) + public ScannerContext(IScannerWorker worker, int bufferSize) { - Contract.Requires(settings != null); - Contract.Requires(comparer != null); Contract.Requires(bufferSize >= 0); Contract.Ensures(Buffer != null); Contract.Ensures(Worker != null); EnsureBufferSize(bufferSize); - Worker = new ScannerWorker(settings, comparer); + Worker = worker; } public void EnsureBufferSize(int size) diff --git a/ReClass.NET/MemoryScanner/ScannerWorker.cs b/ReClass.NET/MemoryScanner/SimpleScannerWorker.cs similarity index 57% rename from ReClass.NET/MemoryScanner/ScannerWorker.cs rename to ReClass.NET/MemoryScanner/SimpleScannerWorker.cs index b83dc714..3c384f5d 100644 --- a/ReClass.NET/MemoryScanner/ScannerWorker.cs +++ b/ReClass.NET/MemoryScanner/SimpleScannerWorker.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Threading; @@ -6,12 +6,12 @@ namespace ReClassNET.MemoryScanner { - internal class ScannerWorker + internal class SimpleScannerWorker : IScannerWorker { private readonly ScanSettings settings; - private readonly IScanComparer comparer; + private readonly ISimpleScanComparer comparer; - public ScannerWorker(ScanSettings settings, IScanComparer comparer) + public SimpleScannerWorker(ScanSettings settings, ISimpleScanComparer comparer) { Contract.Requires(settings != null); Contract.Requires(comparer != null); @@ -20,13 +20,6 @@ public ScannerWorker(ScanSettings settings, IScanComparer comparer) this.comparer = comparer; } - /// - /// Uses the to scan the byte array for results. - /// - /// The data to scan. - /// The length of the parameter. - /// The to stop the scan. - /// An enumeration of all s. public IList Search(byte[] data, int count, CancellationToken ct) { Contract.Requires(data != null); @@ -53,15 +46,6 @@ public IList Search(byte[] data, int count, CancellationToken ct) return results; } - /// - /// Uses the to scan the byte array for results. - /// The comparer uses the provided previous results to compare to the current value. - /// - /// The data to scan. - /// The length of the parameter. - /// The previous results to use. - /// The to stop the scan. - /// An enumeration of all s. public IList Search(byte[] data, int count, IEnumerable previousResults, CancellationToken ct) { Contract.Requires(data != null); diff --git a/ReClass.NET/Native/NativeMethods.Unix.cs b/ReClass.NET/Native/NativeMethods.Unix.cs index 50be47b3..c1b2e6c4 100644 --- a/ReClass.NET/Native/NativeMethods.Unix.cs +++ b/ReClass.NET/Native/NativeMethods.Unix.cs @@ -10,13 +10,13 @@ internal class NativeMethodsUnix : INativeMethods private const int RTLD_NOW = 2; - [DllImport("libdl.so")] + [DllImport("__Internal")] private static extern IntPtr dlopen(string fileName, int flags); - [DllImport("libdl.so")] + [DllImport("__Internal")] private static extern IntPtr dlsym(IntPtr handle, string symbol); - [DllImport("libdl.so")] + [DllImport("__Internal")] private static extern int dlclose(IntPtr handle); #endregion diff --git a/ReClass.NET/Native/NativeMethods.Windows.cs b/ReClass.NET/Native/NativeMethods.Windows.cs index d74bf135..f27f9184 100644 --- a/ReClass.NET/Native/NativeMethods.Windows.cs +++ b/ReClass.NET/Native/NativeMethods.Windows.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Drawing; using System.Runtime.InteropServices; @@ -177,85 +177,27 @@ public bool RegisterExtension(string fileExtension, string extensionId, string a { var classesRoot = Registry.ClassesRoot; - try - { - classesRoot.CreateSubKey(fileExtension); - } - catch (Exception) - { - - } - using (var fileExtensionKey = classesRoot.OpenSubKey(fileExtension, true)) + using (var fileExtensionKey = classesRoot.CreateSubKey(fileExtension)) { fileExtensionKey?.SetValue(string.Empty, extensionId, RegistryValueKind.String); } - try - { - classesRoot.CreateSubKey(extensionId); - } - catch (Exception) - { - - } - using (var extensionInfoKey = classesRoot.OpenSubKey(extensionId, true)) + using (var extensionInfoKey = classesRoot.CreateSubKey(extensionId)) { extensionInfoKey?.SetValue(string.Empty, applicationName, RegistryValueKind.String); - try + using (var icon = extensionInfoKey?.CreateSubKey("DefaultIcon")) { - extensionInfoKey?.CreateSubKey("DefaultIcon"); + icon?.SetValue(string.Empty, "\"" + applicationPath + "\",0", RegistryValueKind.String); } - catch (Exception) - { - } - - using (var icon = extensionInfoKey?.OpenSubKey("DefaultIcon", true)) - { - if (applicationPath.IndexOfAny(new[] { ' ', '\t' }) < 0) - { - icon?.SetValue(string.Empty, applicationPath + ",0", RegistryValueKind.String); - } - else - { - icon?.SetValue(string.Empty, "\"" + applicationPath + "\",0", RegistryValueKind.String); - } - } - - try - { - extensionInfoKey?.CreateSubKey("shell"); - } - catch (Exception) - { - } - using (var shellKey = extensionInfoKey?.OpenSubKey("shell", true)) + using (var shellKey = extensionInfoKey?.CreateSubKey("shell")) { - try - { - shellKey?.CreateSubKey("open"); - } - catch (Exception) + using (var openKey = shellKey?.CreateSubKey("open")) { - - } - - using (var openKey = shellKey?.OpenSubKey("open", true)) - { - openKey?.SetValue(string.Empty, $"&Open with {applicationName}", RegistryValueKind.String); - try - { - openKey?.CreateSubKey("command"); - } - catch (Exception) - { - - } - - using (var commandKey = openKey?.OpenSubKey("command", true)) + using (var commandKey = openKey?.CreateSubKey("command")) { commandKey?.SetValue(string.Empty, $"\"{applicationPath}\" \"%1\"", RegistryValueKind.String); } @@ -284,9 +226,9 @@ public void UnregisterExtension(string fileExtension, string extensionId) ShChangeNotify(); } - catch (Exception) + catch { - + // ignored } } @@ -296,9 +238,9 @@ private static void ShChangeNotify() { SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero); } - catch (Exception) + catch { - + // ignored } } @@ -321,9 +263,9 @@ public static void SetButtonShield(Button button, bool setShield) SendMessage(h, BCM_SETSHIELD, IntPtr.Zero, (IntPtr)(setShield ? 1 : 0)); } - catch (Exception) + catch { - + // ignored } } } diff --git a/ReClass.NET/Nodes/ArrayNode.cs b/ReClass.NET/Nodes/ArrayNode.cs index 85643e5d..4a0fbec3 100644 --- a/ReClass.NET/Nodes/ArrayNode.cs +++ b/ReClass.NET/Nodes/ArrayNode.cs @@ -1,7 +1,6 @@ -using System; +using System; using System.Drawing; -using ReClassNET.Extensions; -using ReClassNET.UI; +using ReClassNET.Controls; namespace ReClassNET.Nodes { @@ -20,22 +19,22 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) public override void Initialize() { - InnerNode = IntPtr.Size == 4 ? (BaseNode)new Hex32Node() : new Hex64Node(); + ChangeInnerNode(IntPtr.Size == 4 ? (BaseNode)new Hex32Node() : new Hex64Node()); } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return Draw(view, x, y, "Array"); + return Draw(context, x, y, "Array"); } - protected override Size DrawChild(ViewInfo view, int x, int y) + protected override Size DrawChild(DrawContext context, int x, int y) { - var v = view.Clone(); - v.Address = view.Address + Offset + InnerNode.MemorySize * CurrentIndex; - v.Memory = view.Memory.Clone(); - v.Memory.Offset += Offset + InnerNode.MemorySize * CurrentIndex; + var innerContext = context.Clone(); + innerContext.Address = context.Address + Offset + InnerNode.MemorySize * CurrentIndex; + innerContext.Memory = context.Memory.Clone(); + innerContext.Memory.Offset += Offset + InnerNode.MemorySize * CurrentIndex; - return InnerNode.Draw(v, x, y); + return InnerNode.Draw(innerContext, x, y); } } } diff --git a/ReClass.NET/Nodes/BaseClassWrapperNode.cs b/ReClass.NET/Nodes/BaseClassWrapperNode.cs index 6cc94aee..aa50aaba 100644 --- a/ReClass.NET/Nodes/BaseClassWrapperNode.cs +++ b/ReClass.NET/Nodes/BaseClassWrapperNode.cs @@ -4,8 +4,10 @@ public abstract class BaseClassWrapperNode : BaseWrapperNode { public override void Initialize() { - InnerNode = ClassNode.Create(); - InnerNode.Initialize(); + var node = ClassNode.Create(); + node.Initialize(); + + ChangeInnerNode(node); } public override bool CanChangeInnerNodeTo(BaseNode node) diff --git a/ReClass.NET/Nodes/BaseContainerNode.cs b/ReClass.NET/Nodes/BaseContainerNode.cs index f9201720..6926111f 100644 --- a/ReClass.NET/Nodes/BaseContainerNode.cs +++ b/ReClass.NET/Nodes/BaseContainerNode.cs @@ -8,6 +8,8 @@ public abstract class BaseContainerNode : BaseNode { private readonly List nodes = new List(); + private int updateCount; + /// The child nodes of the container. public IReadOnlyList Nodes => nodes; @@ -122,6 +124,35 @@ private bool TryGetNeighbour(BaseNode node, int offset, out BaseNode neighbour) return true; } + /// + /// Disables internal events to speed up batch processing. + /// must be called to restore the functionality. + /// + public void BeginUpdate() + { + updateCount++; + } + + /// + /// Enables internal events disabled by . + /// + public void EndUpdate() + { + updateCount = Math.Max(0, updateCount - 1); + + OnNodesUpdated(); + } + + private void OnNodesUpdated() + { + if (updateCount == 0) + { + UpdateOffsets(); + + GetParentContainer()?.ChildHasChanged(this); + } + } + /// Replaces the old node with the new node. /// The old node to replacce. /// The new node. @@ -172,9 +203,7 @@ public void ReplaceChildNode(BaseNode oldNode, BaseNode newNode, ref List @@ -253,9 +282,7 @@ protected void InsertBytes(int index, int size, ref List createdNodes) index++; } - UpdateOffsets(); - - GetParentContainer()?.ChildHasChanged(this); + OnNodesUpdated(); } /// @@ -286,9 +313,7 @@ public void AddNode(BaseNode node) nodes.Add(node); - UpdateOffsets(); - - GetParentContainer()?.ChildHasChanged(this); + OnNodesUpdated(); } /// @@ -312,9 +337,7 @@ public void InsertNode(BaseNode position, BaseNode node) nodes.Insert(index, node); - UpdateOffsets(); - - GetParentContainer()?.ChildHasChanged(this); + OnNodesUpdated(); } /// Removes the specified node. @@ -327,9 +350,7 @@ public bool RemoveNode(BaseNode node) var result = nodes.Remove(node); if (result) { - UpdateOffsets(); - - GetParentContainer()?.ChildHasChanged(this); + OnNodesUpdated(); } return result; } diff --git a/ReClass.NET/Nodes/BaseFunctionNode.cs b/ReClass.NET/Nodes/BaseFunctionNode.cs index 14ca74a4..8e143585 100644 --- a/ReClass.NET/Nodes/BaseFunctionNode.cs +++ b/ReClass.NET/Nodes/BaseFunctionNode.cs @@ -1,8 +1,9 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; +using ReClassNET.Controls; using ReClassNET.Memory; using ReClassNET.UI; @@ -17,10 +18,10 @@ protected class FunctionNodeInstruction public string Instruction { get; set; } } - protected IntPtr address = IntPtr.Zero; - protected readonly List instructions = new List(); + protected IntPtr Address = IntPtr.Zero; + protected readonly List Instructions = new List(); - protected Size DrawInstructions(ViewInfo view, int tx, int y) + protected Size DrawInstructions(DrawContext view, int tx, int y) { Contract.Requires(view != null); @@ -31,18 +32,18 @@ protected Size DrawInstructions(ViewInfo view, int tx, int y) using (var brush = new SolidBrush(view.Settings.HiddenColor)) { - foreach (var instruction in instructions) + foreach (var instruction in Instructions) { y += view.Font.Height; var x = AddText(view, tx, y, view.Settings.AddressColor, HotSpot.ReadOnlyId, instruction.Address) + 6; - view.Context.FillRectangle(brush, x, y, 1, view.Font.Height); + view.Graphics.FillRectangle(brush, x, y, 1, view.Font.Height); x += 6; x = Math.Max(AddText(view, x, y, view.Settings.HexColor, HotSpot.ReadOnlyId, instruction.Data) + 6, x + minWidth); - view.Context.FillRectangle(brush, x, y, 1, view.Font.Height); + view.Graphics.FillRectangle(brush, x, y, 1, view.Font.Height); x += 6; x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.ReadOnlyId, instruction.Instruction); @@ -54,18 +55,18 @@ protected Size DrawInstructions(ViewInfo view, int tx, int y) return new Size(maxWidth, y - origY); } - protected void DisassembleRemoteCode(MemoryBuffer memory, IntPtr address, out int memorySize) + protected void DisassembleRemoteCode(RemoteProcess process, IntPtr address, out int memorySize) { - Contract.Requires(memory != null); + Contract.Requires(process != null); memorySize = 0; - var disassembler = new Disassembler(memory.Process.CoreFunctions); - foreach (var instruction in disassembler.RemoteDisassembleFunction(memory.Process, address, 8192)) + var disassembler = new Disassembler(process.CoreFunctions); + foreach (var instruction in disassembler.RemoteDisassembleFunction(process, address, 8192)) { memorySize += instruction.Length; - instructions.Add(new FunctionNodeInstruction + Instructions.Add(new FunctionNodeInstruction { Address = instruction.Address.ToString(Constants.AddressHexFormat), Data = string.Join(" ", instruction.Data.Take(instruction.Length).Select(b => $"{b:X2}")), diff --git a/ReClass.NET/Nodes/BaseFunctionPtrNode.cs b/ReClass.NET/Nodes/BaseFunctionPtrNode.cs index c151c674..4fd73a2c 100644 --- a/ReClass.NET/Nodes/BaseFunctionPtrNode.cs +++ b/ReClass.NET/Nodes/BaseFunctionPtrNode.cs @@ -1,11 +1,11 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; -using ReClassNET.Util; namespace ReClassNET.Nodes { @@ -13,77 +13,77 @@ public abstract class BaseFunctionPtrNode : BaseFunctionNode { public override int MemorySize => IntPtr.Size; - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) + public override string GetToolTipText(HotSpot spot) { - var ptr = memory.ReadIntPtr(Offset); + var ptr = spot.Memory.ReadIntPtr(Offset); - DisassembleRemoteCode(memory, ptr); + DisassembleRemoteCode(spot.Process, ptr); - return string.Join("\n", instructions.Select(i => i.Instruction)); + return string.Join("\n", Instructions.Select(i => i.Instruction)); } - protected Size Draw(ViewInfo view, int x, int y, string type, string name) + protected Size Draw(DrawContext context, int x, int y, string type, string name) { - Contract.Requires(view != null); + Contract.Requires(context != null); Contract.Requires(type != null); Contract.Requires(name != null); if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x += TextPadding; + x = AddIconPadding(context, x); - x = AddIcon(view, x, y, Icons.Function, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(context, x, y, context.IconProvider.Function, HotSpot.NoneId, HotSpotType.None); var tx = x; - x = AddAddressOffset(view, x, y); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, name) + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, name) + context.Font.Width; } - x = AddOpenCloseIcon(view, x, y) + view.Font.Width; + x = AddOpenCloseIcon(context, x, y) + context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - if (view.Settings.ShowCommentSymbol) + if (context.Settings.ShowCommentSymbol) { - var value = view.Memory.ReadIntPtr(Offset); + var value = context.Memory.ReadIntPtr(Offset); - var module = view.Memory.Process.GetModuleToPointer(value); + var module = context.Process.GetModuleToPointer(value); if (module != null) { - var symbols = view.Memory.Process.Symbols.GetSymbolsForModule(module); + var symbols = context.Process.Symbols.GetSymbolsForModule(module); var symbol = symbols?.GetSymbolString(value, module); if (!string.IsNullOrEmpty(symbol)) { - x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.ReadOnlyId, symbol); + x = AddText(context, x, y, context.Settings.OffsetColor, HotSpot.ReadOnlyId, symbol); } } } - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - var size = new Size(x - origX, view.Font.Height); + var size = new Size(x - origX, context.Font.Height); - if (LevelsOpen[view.Level]) + if (LevelsOpen[context.Level]) { - var ptr = view.Memory.ReadIntPtr(Offset); + var ptr = context.Memory.ReadIntPtr(Offset); - DisassembleRemoteCode(view.Memory, ptr); + DisassembleRemoteCode(context.Process, ptr); - var instructionSize = DrawInstructions(view, tx, y); + var instructionSize = DrawInstructions(context, tx, y); size.Width = Math.Max(size.Width, instructionSize.Width + tx - origX); size.Height += instructionSize.Height; @@ -92,34 +92,34 @@ protected Size Draw(ViewInfo view, int x, int y, string type, string name) return size; } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { if (IsHidden) { return HiddenHeight; } - var height = view.Font.Height; - if (LevelsOpen[view.Level]) + var height = context.Font.Height; + if (LevelsOpen[context.Level]) { - height += instructions.Count * view.Font.Height; + height += Instructions.Count * context.Font.Height; } return height; } - private void DisassembleRemoteCode(MemoryBuffer memory, IntPtr address) + private void DisassembleRemoteCode(RemoteProcess process, IntPtr address) { - Contract.Requires(memory != null); + Contract.Requires(process != null); - if (this.address != address) + if (this.Address != address) { - instructions.Clear(); + Instructions.Clear(); - this.address = address; + this.Address = address; - if (!address.IsNull() && memory.Process.IsValid) + if (!address.IsNull() && process.IsValid) { - DisassembleRemoteCode(memory, address, out _); + DisassembleRemoteCode(process, address, out _); } } } diff --git a/ReClass.NET/Nodes/BaseHexCommentNode.cs b/ReClass.NET/Nodes/BaseHexCommentNode.cs index f59fca44..f2a4053f 100644 --- a/ReClass.NET/Nodes/BaseHexCommentNode.cs +++ b/ReClass.NET/Nodes/BaseHexCommentNode.cs @@ -1,7 +1,8 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Linq; using System.Text; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.UI; @@ -9,7 +10,7 @@ namespace ReClassNET.Nodes { public abstract class BaseHexCommentNode : BaseHexNode { - protected int AddComment(ViewInfo view, int x, int y, float fvalue, IntPtr ivalue, UIntPtr uvalue) + protected int AddComment(DrawContext view, int x, int y, float fvalue, IntPtr ivalue, UIntPtr uvalue) { Contract.Requires(view != null); @@ -30,65 +31,78 @@ protected int AddComment(ViewInfo view, int x, int y, float fvalue, IntPtr ivalu } } - var namedAddress = view.Memory.Process.GetNamedAddress(ivalue); - if (!string.IsNullOrEmpty(namedAddress)) + if (ivalue != IntPtr.Zero) { - if (view.Settings.ShowCommentPointer) + var namedAddress = view.Process.GetNamedAddress(ivalue); + if (!string.IsNullOrEmpty(namedAddress)) { - x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.NoneId, "->") + view.Font.Width; - x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.ReadOnlyId, namedAddress) + view.Font.Width; - } - - if (view.Settings.ShowCommentRtti) - { - var rtti = view.Memory.Process.ReadRemoteRuntimeTypeInformation(ivalue); - if (!string.IsNullOrEmpty(rtti)) + if (view.Settings.ShowCommentPointer) { - x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.ReadOnlyId, rtti) + view.Font.Width; + x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.NoneId, "->") + view.Font.Width; + x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.ReadOnlyId, namedAddress) + view.Font.Width; } - } - if (view.Settings.ShowCommentSymbol) - { - var module = view.Memory.Process.GetModuleToPointer(ivalue); - if (module != null) + if (view.Settings.ShowCommentRtti) { - var symbols = view.Memory.Process.Symbols.GetSymbolsForModule(module); - var symbol = symbols?.GetSymbolString(ivalue, module); - if (!string.IsNullOrEmpty(symbol)) + var rtti = view.Process.ReadRemoteRuntimeTypeInformation(ivalue); + if (!string.IsNullOrEmpty(rtti)) { - x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.ReadOnlyId, symbol) + view.Font.Width; + x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.ReadOnlyId, rtti) + view.Font.Width; } } - } - if (view.Settings.ShowCommentString) - { - var data = view.Memory.Process.ReadRemoteMemory(ivalue, 64); - - // First check if it could be an UTF8 string and if not try UTF16. - if (data.Take(IntPtr.Size).InterpretAsUtf8().IsPrintableData()) + if (view.Settings.ShowCommentSymbol) { - var text = new string(Encoding.UTF8.GetChars(data).TakeWhile(c => c != 0).ToArray()); - x = AddText(view, x, y, view.Settings.TextColor, HotSpot.ReadOnlyId, $"'{text}'") + view.Font.Width; + var module = view.Process.GetModuleToPointer(ivalue); + if (module != null) + { + var symbols = view.Process.Symbols.GetSymbolsForModule(module); + var symbol = symbols?.GetSymbolString(ivalue, module); + if (!string.IsNullOrEmpty(symbol)) + { + x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.ReadOnlyId, symbol) + view.Font.Width; + } + } } - else if(data.Take(IntPtr.Size * 2).InterpretAsUtf16().IsPrintableData()) + + if (view.Settings.ShowCommentString) { - var text = new string(Encoding.Unicode.GetChars(data).TakeWhile(c => c != 0).ToArray()); - x = AddText(view, x, y, view.Settings.TextColor, HotSpot.ReadOnlyId, $"L'{text}'") + view.Font.Width; - } - } + var data = view.Process.ReadRemoteMemory(ivalue, 64); - if (view.Settings.ShowCommentPluginInfo) - { - var nodeAddress = view.Address + Offset; + var isWideString = false; + string text = null; + + // First check if it could be an UTF8 string and if not try UTF16. + if (data.Take(IntPtr.Size).InterpretAsSingleByteCharacter().IsPrintableData()) + { + text = new string(Encoding.UTF8.GetChars(data).TakeWhile(c => c != 0).ToArray()); + } + else if (data.Take(IntPtr.Size * 2).InterpretAsDoubleByteCharacter().IsPrintableData()) + { + isWideString = true; + + text = new string(Encoding.Unicode.GetChars(data).TakeWhile(c => c != 0).ToArray()); + } + + if (text != null) + { + x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, isWideString ? "L'" : "'"); + x = AddText(view, x, y, view.Settings.TextColor, HotSpot.ReadOnlyId, text); + x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, "'") + view.Font.Width; + } + } - foreach (var reader in NodeInfoReader) + if (view.Settings.ShowCommentPluginInfo) { - var info = reader.ReadNodeInfo(this, nodeAddress, ivalue, view.Memory); - if (info != null) + var nodeAddress = view.Address + Offset; + + foreach (var reader in NodeInfoReader) { - x = AddText(view, x, y, view.Settings.PluginColor, HotSpot.ReadOnlyId, info) + view.Font.Width; + var info = reader.ReadNodeInfo(this, view.Process, view.Memory, nodeAddress, ivalue); + if (info != null) + { + x = AddText(view, x, y, view.Settings.PluginColor, HotSpot.ReadOnlyId, info) + view.Font.Width; + } } } } diff --git a/ReClass.NET/Nodes/BaseHexNode.cs b/ReClass.NET/Nodes/BaseHexNode.cs index 023bcd6e..060db7da 100644 --- a/ReClass.NET/Nodes/BaseHexNode.cs +++ b/ReClass.NET/Nodes/BaseHexNode.cs @@ -3,6 +3,7 @@ using System.Diagnostics.Contracts; using System.Drawing; using System.Globalization; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -31,51 +32,53 @@ protected BaseHexNode() buffer = new byte[MemorySize]; } - protected Size Draw(ViewInfo view, int x, int y, string text, int length) + protected Size Draw(DrawContext context, int x, int y, string text, int length) { - Contract.Requires(view != null); + Contract.Requires(context != null); if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x += TextPadding + 16; - x = AddAddressOffset(view, x, y); + x = AddIconPadding(context, x); + x = AddIconPadding(context, x); + + x = AddAddressOffset(context, x, y); if (!string.IsNullOrEmpty(text)) { - x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, text); + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, text); } - view.Memory.ReadBytes(Offset, buffer); + context.Memory.ReadBytes(Offset, buffer); - var color = view.Settings.HexColor; - if (view.Settings.HighlightChangedValues) + var color = context.Settings.HexColor; + if (context.Settings.HighlightChangedValues) { - var address = view.Address + Offset; + var address = context.Address + Offset; - highlightTimer.RemoveWhere(kv => kv.Value.Value < view.CurrentTime); + highlightTimer.RemoveWhere(kv => kv.Value.Value < context.CurrentTime); if (highlightTimer.TryGetValue(address, out var until)) { - if (until.Value >= view.CurrentTime) + if (until.Value >= context.CurrentTime) { color = GetRandomHighlightColor(); - if (view.Memory.HasChanged(Offset, MemorySize)) + if (context.Memory.HasChanged(Offset, MemorySize)) { - until.Value = view.CurrentTime.Add(hightlightDuration); + until.Value = context.CurrentTime.Add(hightlightDuration); } } } - else if (view.Memory.HasChanged(Offset, MemorySize)) + else if (context.Memory.HasChanged(Offset, MemorySize)) { - highlightTimer.Add(address, view.CurrentTime.Add(hightlightDuration)); + highlightTimer.Add(address, context.CurrentTime.Add(hightlightDuration)); color = GetRandomHighlightColor(); } @@ -83,21 +86,21 @@ protected Size Draw(ViewInfo view, int x, int y, string text, int length) for (var i = 0; i < length; ++i) { - x = AddText(view, x, y, color, i, $"{buffer[i]:X02}") + view.Font.Width; + x = AddText(context, x, y, color, i, $"{buffer[i]:X02}") + context.Font.Width; } - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - return new Size(x - origX, view.Font.Height); + return new Size(x - origX, context.Font.Height); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { - return IsHidden && !IsWrapped ? HiddenHeight : view.Font.Height; + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; } /// Updates the node from the given spot. Sets the value of the selected byte. @@ -113,7 +116,7 @@ public void Update(HotSpot spot, int maxId) { if (byte.TryParse(spot.Text, NumberStyles.HexNumber, null, out var val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address + spot.Id, val); + spot.Process.WriteRemoteMemory(spot.Address + spot.Id, val); } } } diff --git a/ReClass.NET/Nodes/BaseMatrixNode.cs b/ReClass.NET/Nodes/BaseMatrixNode.cs index 5a31bc84..84929c5e 100644 --- a/ReClass.NET/Nodes/BaseMatrixNode.cs +++ b/ReClass.NET/Nodes/BaseMatrixNode.cs @@ -1,5 +1,8 @@ -using System.Diagnostics.Contracts; +using System; +using System.Diagnostics.Contracts; using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; using ReClassNET.UI; namespace ReClassNET.Nodes @@ -16,115 +19,144 @@ protected BaseMatrixNode() protected delegate void DrawMatrixValues(int x, ref int maxX, ref int y); - protected Size DrawMatrixType(ViewInfo view, int x, int y, string type, DrawMatrixValues drawValues) + protected Size DrawMatrixType(DrawContext context, int x, int y, string type, int rows, int columns) { - Contract.Requires(view != null); + Contract.Requires(context != null); Contract.Requires(type != null); - Contract.Requires(drawValues != null); if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; var origY = y; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x += TextPadding; + x = AddIconPadding(context, x); - x = AddIcon(view, x, y, Icons.Matrix, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(context, x, y, context.IconProvider.Matrix, HotSpot.NoneId, HotSpotType.None); var tx = x; - x = AddAddressOffset(view, x, y); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name); + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name); } - x = AddOpenCloseIcon(view, x, y); + x = AddOpenCloseIcon(context, x, y); - x += view.Font.Width; + x += context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - if (LevelsOpen[view.Level]) + if (LevelsOpen[context.Level]) { - drawValues(tx, ref x, ref y); + var index = 0; + for (var row = 0; row < rows; ++row) + { + y += context.Font.Height; + var x2 = tx; + + x2 = AddText(context, x2, y, context.Settings.NameColor, HotSpot.NoneId, "|"); + + for (var column = 0; column < columns; ++column) + { + var value = context.Memory.ReadFloat(Offset + index * sizeof(float)); + x2 = AddText(context, x2, y, context.Settings.ValueColor, index, $"{value,14:0.000}"); + + index++; + } + + x2 = AddText(context, x2, y, context.Settings.NameColor, HotSpot.NoneId, "|"); + + x = Math.Max(x2, x); + } } - return new Size(x - origX, y - origY + view.Font.Height); + return new Size(x - origX, y - origY + context.Font.Height); } protected delegate void DrawVectorValues(ref int x, ref int y); - protected Size DrawVectorType(ViewInfo view, int x, int y, string type, DrawVectorValues drawValues) + protected Size DrawVectorType(DrawContext context, int x, int y, string type, int columns) { - Contract.Requires(view != null); + Contract.Requires(context != null); Contract.Requires(type != null); - Contract.Requires(drawValues != null); if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } - DrawInvalidMemoryIndicatorIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); var origX = x; var origY = y; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x += TextPadding; + x = AddIconPadding(context, x); - x = AddIcon(view, x, y, Icons.Vector, HotSpot.NoneId, HotSpotType.None); - x = AddAddressOffset(view, x, y); + x = AddIcon(context, x, y, context.IconProvider.Vector, HotSpot.NoneId, HotSpotType.None); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name); + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name); } - x = AddOpenCloseIcon(view, x, y); + x = AddOpenCloseIcon(context, x, y); - if (LevelsOpen[view.Level]) + if (LevelsOpen[context.Level]) { - drawValues(ref x, ref y); + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, "("); + for (var column = 0; column < columns; ++column) + { + var value = context.Memory.ReadFloat(Offset + column * sizeof(float)); + + x = AddText(context, x, y, context.Settings.ValueColor, column, $"{value:0.000}"); + + if (column < columns - 1) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, ","); + } + } + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, ")"); } - x += view.Font.Width; + x += context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - return new Size(x - origX, y - origY + view.Font.Height); + return new Size(x - origX, y - origY + context.Font.Height); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { if (IsHidden && !IsWrapped) { return HiddenHeight; } - var height = view.Font.Height; - if (LevelsOpen[view.Level]) + var height = context.Font.Height; + if (LevelsOpen[context.Level]) { - height += CalculateValuesHeight(view); + height += CalculateValuesHeight(context); } return height; } - protected abstract int CalculateValuesHeight(ViewInfo view); + protected abstract int CalculateValuesHeight(DrawContext context); public void Update(HotSpot spot, int max) { @@ -136,7 +168,7 @@ public void Update(HotSpot spot, int max) { if (float.TryParse(spot.Text, out var val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address + spot.Id * ValueTypeSize, val); + spot.Process.WriteRemoteMemory(spot.Address + spot.Id * ValueTypeSize, val); } } } diff --git a/ReClass.NET/Nodes/BaseNode.cs b/ReClass.NET/Nodes/BaseNode.cs index a0cfed16..adef39e5 100644 --- a/ReClass.NET/Nodes/BaseNode.cs +++ b/ReClass.NET/Nodes/BaseNode.cs @@ -1,10 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.Contracts; using System.Drawing; +using ReClassNET.Controls; using ReClassNET.Extensions; -using ReClassNET.Memory; using ReClassNET.UI; using ReClassNET.Util; @@ -16,11 +16,10 @@ namespace ReClassNET.Nodes [ContractClass(typeof(BaseNodeContract))] public abstract class BaseNode { - private string DebuggerDisplay => $"Type: {GetType().Name} Name: {Name} Offset: 0x{Offset.ToString("X")}"; + private string DebuggerDisplay => $"Type: {GetType().Name} Name: {Name} Offset: 0x{Offset:X}"; internal static readonly List NodeInfoReader = new List(); - protected static readonly int TextPadding = Icons.Dimensions; protected static readonly int HiddenHeight = 0; private static int nodeIndex = 0; @@ -106,10 +105,9 @@ protected BaseNode() public abstract void GetUserInterfaceInfo(out string name, out Image icon); - public virtual bool UseMemoryPreviewToolTip(HotSpot spot, MemoryBuffer memory, out IntPtr address) + public virtual bool UseMemoryPreviewToolTip(HotSpot spot, out IntPtr address) { Contract.Requires(spot != null); - Contract.Requires(memory != null); address = IntPtr.Zero; @@ -118,12 +116,10 @@ public virtual bool UseMemoryPreviewToolTip(HotSpot spot, MemoryBuffer memory, o /// Gets informations about this node to show in a tool tip. /// The spot. - /// The process memory. /// The information to show in a tool tip or null if no information should be shown. - public virtual string GetToolTipText(HotSpot spot, MemoryBuffer memory) + public virtual string GetToolTipText(HotSpot spot) { Contract.Requires(spot != null); - Contract.Requires(memory != null); return null; } @@ -225,20 +221,20 @@ public virtual void ClearSelection() } /// Draws the node. - /// The view information. + /// The drawing context. /// The x coordinate. /// The y coordinate. /// The pixel size the node occupies. - public abstract Size Draw(ViewInfo view, int x, int y); + public abstract Size Draw(DrawContext context, int x, int y); /// /// Calculates the height of the node if drawn. /// This method is used to determine if a node outside the visible area should be drawn. - /// The returned height must be equal to the height which is returned by the method. + /// The returned height must be equal to the height which is returned by the method. /// - /// The view information. + /// The drawing context. /// The calculated height. - public abstract int CalculateDrawnHeight(ViewInfo view); + public abstract int CalculateDrawnHeight(DrawContext context); /// Updates the node from the given . Sets the and of the node. /// The spot. @@ -272,64 +268,65 @@ internal void SetLevelOpen(int level, bool open) } /// Adds a the user can interact with. - /// The view information. + /// The drawing context. /// The spot. /// The text to edit. /// The id of the spot. /// The type of the spot. - protected void AddHotSpot(ViewInfo view, Rectangle spot, string text, int id, HotSpotType type) + protected void AddHotSpot(DrawContext context, Rectangle spot, string text, int id, HotSpotType type) { - Contract.Requires(view != null); - Contract.Requires(view.Memory != null); + Contract.Requires(context != null); + Contract.Requires(context.Memory != null); Contract.Requires(text != null); - if (spot.Top > view.ClientArea.Bottom || spot.Bottom < 0) + if (spot.Top > context.ClientArea.Bottom || spot.Bottom < 0) { return; } - view.HotSpots.Add(new HotSpot + context.HotSpots.Add(new HotSpot { Rect = spot, Text = text, - Address = view.Address + Offset, + Address = context.Address + Offset, Id = id, Type = type, Node = this, - Level = view.Level, - Memory = view.Memory + Level = context.Level, + Process = context.Process, + Memory = context.Memory }); } /// Draws the specific text and adds a if is not . - /// The view information. + /// The drawing context. /// The x coordinate. /// The y coordinate. /// The color of the text. /// Id for the clickable area. /// The text to draw. /// The new x coordinate after drawing the text. - protected int AddText(ViewInfo view, int x, int y, Color color, int hitId, string text) + protected int AddText(DrawContext context, int x, int y, Color color, int hitId, string text) { - Contract.Requires(view != null); - Contract.Requires(view.Context != null); - Contract.Requires(view.Font != null); + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + Contract.Requires(context.Font != null); Contract.Requires(text != null); - var width = Math.Max(text.Length, hitId != HotSpot.NoneId ? 1 : 0) * view.Font.Width; + var width = Math.Max(text.Length, hitId != HotSpot.NoneId ? 1 : 0) * context.Font.Width; - if (y >= -view.Font.Height && y + view.Font.Height <= view.ClientArea.Bottom + view.Font.Height) + if (y >= -context.Font.Height && y + context.Font.Height <= context.ClientArea.Bottom + context.Font.Height) { if (hitId != HotSpot.NoneId) { - var rect = new Rectangle(x, y, width, view.Font.Height); - AddHotSpot(view, rect, text, hitId, HotSpotType.Edit); + var rect = new Rectangle(x, y, width, context.Font.Height); + AddHotSpot(context, rect, text, hitId, HotSpotType.Edit); } - view.Context.DrawStringEx(text, view.Font.Font, color, x, y); + context.Graphics.DrawStringEx(text, context.Font.Font, color, x, y); /*using (var brush = new SolidBrush(color)) { - view.Context.DrawString(text, view.Font.Font, brush, x, y); + context.Graphics.DrawString(text, context.Font.Font, brush, x, y); }*/ } @@ -337,183 +334,190 @@ protected int AddText(ViewInfo view, int x, int y, Color color, int hitId, strin } /// Draws the address and of the node. - /// The view information. + /// The drawing context. /// The x coordinate. /// The y coordinate. /// The new x coordinate after drawing the text. - protected int AddAddressOffset(ViewInfo view, int x, int y) + protected int AddAddressOffset(DrawContext context, int x, int y) { - Contract.Requires(view != null); - Contract.Requires(view.Context != null); - Contract.Requires(view.Font != null); + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + Contract.Requires(context.Font != null); - if (view.Settings.ShowNodeOffset) + if (context.Settings.ShowNodeOffset) { - x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.NoneId, $"{Offset:X04}") + view.Font.Width; + x = AddText(context, x, y, context.Settings.OffsetColor, HotSpot.NoneId, $"{Offset:X04}") + context.Font.Width; } - if (view.Settings.ShowNodeAddress) + if (context.Settings.ShowNodeAddress) { - x = AddText(view, x, y, view.Settings.AddressColor, HotSpot.AddressId, (view.Address + Offset).ToString(Constants.AddressHexFormat)) + view.Font.Width; + x = AddText(context, x, y, context.Settings.AddressColor, HotSpot.AddressId, (context.Address + Offset).ToString(Constants.AddressHexFormat)) + context.Font.Width; } return x; } /// Draws a bar which indicates the selection status of the node. A for this area gets added too. - /// The view information. + /// The drawing context. /// The x coordinate. /// The y coordinate. /// The height of the bar. - protected void AddSelection(ViewInfo view, int x, int y, int height) + protected void AddSelection(DrawContext context, int x, int y, int height) { - Contract.Requires(view != null); - Contract.Requires(view.Context != null); + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); - if (y > view.ClientArea.Bottom || y + height < 0 || IsWrapped) + if (y > context.ClientArea.Bottom || y + height < 0 || IsWrapped) { return; } if (IsSelected) { - using (var brush = new SolidBrush(view.Settings.SelectedColor)) - { - view.Context.FillRectangle(brush, 0, y, view.ClientArea.Right, height); - } + using var brush = new SolidBrush(context.Settings.SelectedColor); + + context.Graphics.FillRectangle(brush, 0, y, context.ClientArea.Right, height); } - AddHotSpot(view, new Rectangle(0, y, view.ClientArea.Right - (IsSelected ? 16 : 0), height), string.Empty, HotSpot.NoneId, HotSpotType.Select); + AddHotSpot(context, new Rectangle(0, y, context.ClientArea.Right - (IsSelected ? 16 : 0), height), string.Empty, HotSpot.NoneId, HotSpotType.Select); + } + + protected int AddIconPadding(DrawContext view, int x) + { + return x + view.IconProvider.Dimensions; } /// Draws an icon and adds a if is not . - /// The view information. + /// The drawing context. /// The x coordinate. /// The y coordinate. /// The icon. /// The id of the spot. /// The type of the spot. /// The new x coordinate after drawing the icon. - protected int AddIcon(ViewInfo view, int x, int y, Image icon, int id, HotSpotType type) + protected int AddIcon(DrawContext context, int x, int y, Image icon, int id, HotSpotType type) { - Contract.Requires(view != null); - Contract.Requires(view.Context != null); + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); Contract.Requires(icon != null); - if (y > view.ClientArea.Bottom || y + Icons.Dimensions < 0) + var size = context.IconProvider.Dimensions; + + if (y > context.ClientArea.Bottom || y + size < 0) { - return x + Icons.Dimensions; + return x + size; } - view.Context.DrawImage(icon, x + 2, y, Icons.Dimensions, Icons.Dimensions); + context.Graphics.DrawImage(icon, x + 2, y, size, size); if (id != HotSpot.NoneId) { - AddHotSpot(view, new Rectangle(x, y, Icons.Dimensions, Icons.Dimensions), string.Empty, id, type); + AddHotSpot(context, new Rectangle(x, y, size, size), string.Empty, id, type); } - return x + Icons.Dimensions; + return x + size; } /// Adds a togglable Open/Close icon. - /// The view information. + /// The drawing context. /// The x coordinate. /// The y coordinate. /// The new x coordinate after drawing the icon. - protected int AddOpenCloseIcon(ViewInfo view, int x, int y) + protected int AddOpenCloseIcon(DrawContext context, int x, int y) { - Contract.Requires(view != null); - Contract.Requires(view.Context != null); + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); - if (y > view.ClientArea.Bottom || y + Icons.Dimensions < 0) + if (y > context.ClientArea.Bottom || y + context.IconProvider.Dimensions < 0) { - return x + Icons.Dimensions; + return x + context.IconProvider.Dimensions; } - return AddIcon(view, x, y, LevelsOpen[view.Level] ? Icons.OpenCloseOpen : Icons.OpenCloseClosed, 0, HotSpotType.OpenClose); + var icon = LevelsOpen[context.Level] ? context.IconProvider.OpenCloseOpen : context.IconProvider.OpenCloseClosed; + return AddIcon(context, x, y, icon, 0, HotSpotType.OpenClose); } /// Draws a context drop icon if the node is selected. - /// The view information. + /// The drawing context. /// The y coordinate. - protected void AddContextDropDownIcon(ViewInfo view, int y) + protected void AddContextDropDownIcon(DrawContext context, int y) { - Contract.Requires(view != null); - Contract.Requires(view.Context != null); + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); - if (view.MultipleNodesSelected || y > view.ClientArea.Bottom || y + Icons.Dimensions < 0 || IsWrapped) + if (context.MultipleNodesSelected || y > context.ClientArea.Bottom || y + context.IconProvider.Dimensions < 0 || IsWrapped) { return; } if (IsSelected) { - AddIcon(view, 0, y, Icons.DropArrow, 0, HotSpotType.Context); + AddIcon(context, 0, y, context.IconProvider.DropArrow, 0, HotSpotType.Context); } } /// Draws a delete icon if the node is selected. - /// The view information. + /// The drawing context. /// The y coordinate. - protected void AddDeleteIcon(ViewInfo view, int y) + protected void AddDeleteIcon(DrawContext context, int y) { - Contract.Requires(view != null); - Contract.Requires(view.Context != null); + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); - if (y > view.ClientArea.Bottom || y + Icons.Dimensions < 0 || IsWrapped) + if (y > context.ClientArea.Bottom || y + context.IconProvider.Dimensions < 0 || IsWrapped) { return; } if (IsSelected) { - AddIcon(view, view.ClientArea.Right - Icons.Dimensions, y, Icons.Delete, 0, HotSpotType.Delete); + AddIcon(context, context.ClientArea.Right - context.IconProvider.Dimensions, y, context.IconProvider.Delete, 0, HotSpotType.Delete); } } /// Draws the . - /// The view information. + /// The drawing context. /// The x coordinate. /// The y coordinate. /// The new x coordinate after drawing the comment. - protected virtual int AddComment(ViewInfo view, int x, int y) + protected virtual int AddComment(DrawContext context, int x, int y) { - Contract.Requires(view != null); - Contract.Requires(view.Context != null); - Contract.Requires(view.Font != null); + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + Contract.Requires(context.Font != null); - x = AddText(view, x, y, view.Settings.CommentColor, HotSpot.NoneId, "//"); - x = AddText(view, x, y, view.Settings.CommentColor, HotSpot.CommentId, Comment) + view.Font.Width; + x = AddText(context, x, y, context.Settings.CommentColor, HotSpot.NoneId, "//"); + x = AddText(context, x, y, context.Settings.CommentColor, HotSpot.CommentId, Comment) + context.Font.Width; return x; } /// Draws a vertical line to show the hidden state. - /// The view information. + /// The drawing context. /// The x coordinate. /// The y coordinate. /// The size of the drawing. - protected Size DrawHidden(ViewInfo view, int x, int y) + protected Size DrawHidden(DrawContext context, int x, int y) { - Contract.Requires(view != null); - Contract.Requires(view.Context != null); + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); - using (var brush = new SolidBrush(IsSelected ? view.Settings.SelectedColor : view.Settings.HiddenColor)) + using (var brush = new SolidBrush(IsSelected ? context.Settings.SelectedColor : context.Settings.HiddenColor)) { - view.Context.FillRectangle(brush, 0, y, view.ClientArea.Right, 1); + context.Graphics.FillRectangle(brush, 0, y, context.ClientArea.Right, 1); } return new Size(0, HiddenHeight); } /// Draws an error indicator if the used memory buffer is not valid. - /// The view information. + /// The drawing context. /// The y coordinate. - protected void DrawInvalidMemoryIndicatorIcon(ViewInfo view, int y) + protected void DrawInvalidMemoryIndicatorIcon(DrawContext context, int y) { - if (!view.Memory.ContainsValidData) + if (!context.Memory.ContainsValidData) { - AddIcon(view, 0, y, Properties.Resources.B16x16_Error, HotSpot.NoneId, HotSpotType.None); + AddIcon(context, 0, y, Properties.Resources.B16x16_Error, HotSpot.NoneId, HotSpotType.None); } } } @@ -531,16 +535,16 @@ public override int MemorySize } } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - Contract.Requires(view != null); + Contract.Requires(context != null); throw new NotImplementedException(); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { - Contract.Requires(view != null); + Contract.Requires(context != null); throw new NotImplementedException(); } diff --git a/ReClass.NET/Nodes/BaseNumericNode.cs b/ReClass.NET/Nodes/BaseNumericNode.cs index edbbfacc..61782ca6 100644 --- a/ReClass.NET/Nodes/BaseNumericNode.cs +++ b/ReClass.NET/Nodes/BaseNumericNode.cs @@ -1,5 +1,6 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; using System.Drawing; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes @@ -7,7 +8,7 @@ namespace ReClassNET.Nodes public abstract class BaseNumericNode : BaseNode { /// Draws the node. - /// The view information. + /// The drawing context. /// The x coordinate. /// The y coordinate. /// The icon of the node. @@ -15,51 +16,51 @@ public abstract class BaseNumericNode : BaseNode /// The value of the node. /// An alternative value of the node. /// The pixel size the node occupies. - protected Size DrawNumeric(ViewInfo view, int x, int y, Image icon, string type, string value, string alternativeValue) + protected Size DrawNumeric(DrawContext context, int x, int y, Image icon, string type, string value, string alternativeValue) { - Contract.Requires(view != null); + Contract.Requires(context != null); Contract.Requires(icon != null); Contract.Requires(type != null); Contract.Requires(value != null); if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x += TextPadding; + x = AddIconPadding(context, x); - x = AddIcon(view, x, y, icon, HotSpot.NoneId, HotSpotType.None); - x = AddAddressOffset(view, x, y); + x = AddIcon(context, x, y, icon, HotSpot.NoneId, HotSpotType.None); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; } - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "=") + view.Font.Width; - x = AddText(view, x, y, view.Settings.ValueColor, 0, value) + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, "=") + context.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, 0, value) + context.Font.Width; if (alternativeValue != null) { - x = AddText(view, x, y, view.Settings.ValueColor, 1, alternativeValue) + view.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, 1, alternativeValue) + context.Font.Width; } - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - return new Size(x - origX, view.Font.Height); + return new Size(x - origX, context.Font.Height); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { - return IsHidden && !IsWrapped ? HiddenHeight : view.Font.Height; + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; } } } diff --git a/ReClass.NET/Nodes/BaseTextNode.cs b/ReClass.NET/Nodes/BaseTextNode.cs index e5ab03ce..d395b24d 100644 --- a/ReClass.NET/Nodes/BaseTextNode.cs +++ b/ReClass.NET/Nodes/BaseTextNode.cs @@ -1,6 +1,7 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; using System.Drawing; using System.Text; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -17,59 +18,60 @@ public abstract class BaseTextNode : BaseNode public abstract Encoding Encoding { get; } /// Size of one character in bytes. - private int CharacterSize => Encoding.GetSimpleByteCountPerChar(); + private int CharacterSize => Encoding.GuessByteCountPerChar(); public override void CopyFromNode(BaseNode node) { Length = node.MemorySize / CharacterSize; } - protected Size DrawText(ViewInfo view, int x, int y, string type) + protected Size DrawText(DrawContext context, int x, int y, string type) { - Contract.Requires(view != null); + Contract.Requires(context != null); Contract.Requires(type != null); if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var length = MemorySize / CharacterSize; - var text = ReadValueFromMemory(view.Memory); + var text = ReadValueFromMemory(context.Memory); var origX = x; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x += TextPadding; - x = AddIcon(view, x, y, Icons.Text, HotSpot.NoneId, HotSpotType.None); - x = AddAddressOffset(view, x, y); + x = AddIconPadding(context, x); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; + x = AddIcon(context, x, y, context.IconProvider.Text, HotSpot.NoneId, HotSpotType.None); + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name); + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name); } - x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "["); - x = AddText(view, x, y, view.Settings.IndexColor, 0, length.ToString()); - x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "]") + view.Font.Width; + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "["); + x = AddText(context, x, y, context.Settings.IndexColor, 0, length.ToString()); + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "]") + context.Font.Width; - x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, "= '"); - x = AddText(view, x, y, view.Settings.TextColor, 1, text.LimitLength(150)); - x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, "'") + view.Font.Width; + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, "= '"); + x = AddText(context, x, y, context.Settings.TextColor, 1, text.LimitLength(150)); + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, "'") + context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - return new Size(x - origX, view.Font.Height); + return new Size(x - origX, context.Font.Height); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { - return IsHidden && !IsWrapped ? HiddenHeight : view.Font.Height; + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; } public override void Update(HotSpot spot) @@ -88,7 +90,7 @@ public override void Update(HotSpot spot) else if (spot.Id == 1) { var data = Encoding.GetBytes(spot.Text); - spot.Memory.Process.WriteRemoteMemory(spot.Address, data); + spot.Process.WriteRemoteMemory(spot.Address, data); } } diff --git a/ReClass.NET/Nodes/BaseTextPtrNode.cs b/ReClass.NET/Nodes/BaseTextPtrNode.cs index 13857f2d..d7b00238 100644 --- a/ReClass.NET/Nodes/BaseTextPtrNode.cs +++ b/ReClass.NET/Nodes/BaseTextPtrNode.cs @@ -1,67 +1,72 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Drawing; using System.Text; +using ReClassNET.Controls; +using ReClassNET.Extensions; using ReClassNET.UI; namespace ReClassNET.Nodes { public abstract class BaseTextPtrNode : BaseNode { + private const int MaxStringCharacterCount = 256; + public override int MemorySize => IntPtr.Size; /// The encoding of the string. public abstract Encoding Encoding { get; } /// Draws this node. - /// The view information. + /// The drawing context. /// The x coordinate. /// The y coordinate. /// The name of the type. /// The pixel size the node occupies. - public Size DrawText(ViewInfo view, int x, int y, string type) + public Size DrawText(DrawContext context, int x, int y, string type) { - Contract.Requires(view != null); + Contract.Requires(context != null); Contract.Requires(type != null); if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } - var ptr = view.Memory.ReadIntPtr(Offset); - var text = view.Memory.Process.ReadRemoteString(Encoding, ptr, 64); + var ptr = context.Memory.ReadIntPtr(Offset); + var text = context.Process.ReadRemoteString(ptr, Encoding, MaxStringCharacterCount); var origX = x; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); - x += TextPadding; - x = AddIcon(view, x, y, Icons.Text, HotSpot.NoneId, HotSpotType.None); - x = AddAddressOffset(view, x, y); + x = AddIcon(context, x, y, context.IconProvider.Text, HotSpot.NoneId, HotSpotType.None); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; } - x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, "= '"); - x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, text); - x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, "'") + view.Font.Width; + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, "= '"); + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.ReadOnlyId, text); + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, "'") + context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - return new Size(x - origX, view.Font.Height); + return new Size(x - origX, context.Font.Height); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { - return IsHidden && !IsWrapped ? HiddenHeight : view.Font.Height; + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; } } } diff --git a/ReClass.NET/Nodes/BaseWrapperArrayNode.cs b/ReClass.NET/Nodes/BaseWrapperArrayNode.cs index 462940da..ee042751 100644 --- a/ReClass.NET/Nodes/BaseWrapperArrayNode.cs +++ b/ReClass.NET/Nodes/BaseWrapperArrayNode.cs @@ -1,5 +1,6 @@ -using System; +using System; using System.Drawing; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes @@ -27,55 +28,55 @@ public override bool CanChangeInnerNodeTo(BaseNode node) return true; } - protected Size Draw(ViewInfo view, int x, int y, string type) + protected Size Draw(DrawContext context, int x, int y, string type) { if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x = AddOpenCloseIcon(view, x, y); - x = AddIcon(view, x, y, Icons.Array, HotSpot.NoneId, HotSpotType.None); + x = AddOpenCloseIcon(context, x, y); + x = AddIcon(context, x, y, context.IconProvider.Array, HotSpot.NoneId, HotSpotType.None); var tx = x; - x = AddAddressOffset(view, x, y); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name); + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name); } - x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "["); - x = AddText(view, x, y, view.Settings.IndexColor, IsReadOnly ? HotSpot.NoneId : 0, Count.ToString()); - x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "]"); + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "["); + x = AddText(context, x, y, context.Settings.IndexColor, IsReadOnly ? HotSpot.NoneId : 0, Count.ToString()); + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "]"); - x = AddIcon(view, x, y, Icons.LeftArrow, 2, HotSpotType.Click); - x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, "("); - x = AddText(view, x, y, view.Settings.IndexColor, 1, CurrentIndex.ToString()); - x = AddText(view, x, y, view.Settings.IndexColor, HotSpot.NoneId, ")"); - x = AddIcon(view, x, y, Icons.RightArrow, 3, HotSpotType.Click) + view.Font.Width; + x = AddIcon(context, x, y, context.IconProvider.LeftArrow, 2, HotSpotType.Click); + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "("); + x = AddText(context, x, y, context.Settings.IndexColor, 1, CurrentIndex.ToString()); + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, ")"); + x = AddIcon(context, x, y, context.IconProvider.RightArrow, 3, HotSpotType.Click) + context.Font.Width; - x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"") + view.Font.Width; - x = AddIcon(view, x + 2, y, Icons.Change, 4, HotSpotType.ChangeWrappedType); + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"") + context.Font.Width; + x = AddIcon(context, x + 2, y, context.IconProvider.Change, 4, HotSpotType.ChangeWrappedType); - x += view.Font.Width; - x = AddComment(view, x, y); + x += context.Font.Width; + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - y += view.Font.Height; + y += context.Font.Height; - var size = new Size(x - origX, view.Font.Height); + var size = new Size(x - origX, context.Font.Height); - if (LevelsOpen[view.Level]) + if (LevelsOpen[context.Level]) { - var childSize = DrawChild(view, tx, y); + var childSize = DrawChild(context, tx, y); size.Width = Math.Max(size.Width, childSize.Width + tx - origX); size.Height += childSize.Height; @@ -84,19 +85,19 @@ protected Size Draw(ViewInfo view, int x, int y, string type) return size; } - protected abstract Size DrawChild(ViewInfo view, int x, int y); + protected abstract Size DrawChild(DrawContext context, int x, int y); - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { if (IsHidden && !IsWrapped) { return HiddenHeight; } - var height = view.Font.Height; - if (LevelsOpen[view.Level]) + var height = context.Font.Height; + if (LevelsOpen[context.Level]) { - height += InnerNode.CalculateDrawnHeight(view); + height += InnerNode.CalculateDrawnHeight(context); } return height; } @@ -115,6 +116,11 @@ public override void Update(HotSpot spot) { Count = value; + if (CurrentIndex >= value) + { + CurrentIndex = value - 1; + } + GetParentContainer()?.ChildHasChanged(this); } } diff --git a/ReClass.NET/Nodes/BaseWrapperNode.cs b/ReClass.NET/Nodes/BaseWrapperNode.cs index 687e03cc..b499f0ce 100644 --- a/ReClass.NET/Nodes/BaseWrapperNode.cs +++ b/ReClass.NET/Nodes/BaseWrapperNode.cs @@ -1,12 +1,11 @@ using System; -using System.Security.Permissions; namespace ReClassNET.Nodes { public abstract class BaseWrapperNode : BaseNode { /// Gets or sets the inner node. - public BaseNode InnerNode { get; protected set; } + public BaseNode InnerNode { get; private set; } /// Gets signaled if the inner node was changed. public event NodeEventHandler InnerNodeChanged; diff --git a/ReClass.NET/Nodes/BitFieldNode.cs b/ReClass.NET/Nodes/BitFieldNode.cs index 174e811a..22461c37 100644 --- a/ReClass.NET/Nodes/BitFieldNode.cs +++ b/ReClass.NET/Nodes/BitFieldNode.cs @@ -1,8 +1,11 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; +using ReClassNET.Util; namespace ReClassNET.Nodes { @@ -93,99 +96,99 @@ private string ConvertValueToBitString(MemoryBuffer memory) Contract.Requires(memory != null); Contract.Ensures(Contract.Result() != null); - string str; switch(bits) { case 64: - str = Convert.ToString(memory.ReadInt64(Offset), 2); - break; + return BitString.ToString(memory.ReadInt64(Offset)); case 32: - str = Convert.ToString(memory.ReadInt32(Offset), 2); - break; + return BitString.ToString(memory.ReadInt32(Offset)); case 16: - str = Convert.ToString(memory.ReadInt16(Offset), 2); - break; + return BitString.ToString(memory.ReadInt16(Offset)); default: - str = Convert.ToString(memory.ReadUInt8(Offset), 2); - break; + return BitString.ToString(memory.ReadUInt8(Offset)); } - return str.PadLeft(bits, '0'); } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { + const int BitsPerBlock = 4; + if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; var origY = y; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x += TextPadding + Icons.Dimensions; + x = AddIconPadding(context, x); + x = AddIconPadding(context, x); - x = AddAddressOffset(view, x, y); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Bits") + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Bits") + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; } - x = AddOpenCloseIcon(view, x, y) + view.Font.Width; + x = AddOpenCloseIcon(context, x, y) + context.Font.Width; var tx = x - 3; for (var i = 0; i < bits; ++i) { - var rect = new Rectangle(x + i * view.Font.Width, y, view.Font.Width, view.Font.Height); - AddHotSpot(view, rect, string.Empty, i, HotSpotType.Edit); + var rect = new Rectangle(x + (i + i / BitsPerBlock) * context.Font.Width, y, context.Font.Width, context.Font.Height); + AddHotSpot(context, rect, string.Empty, i, HotSpotType.Edit); } - x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, ConvertValueToBitString(view.Memory)) + view.Font.Width; - x += view.Font.Width; + var value = ConvertValueToBitString(context.Memory); + + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, value) + context.Font.Width; + + x += context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - if (LevelsOpen[view.Level]) + if (LevelsOpen[context.Level]) { - y += view.Font.Height; + y += context.Font.Height; var format = new StringFormat(StringFormatFlags.DirectionVertical); - using (var brush = new SolidBrush(view.Settings.ValueColor)) + using (var brush = new SolidBrush(context.Settings.ValueColor)) { - view.Context.DrawString("1", view.Font.Font, brush, tx + (bits - 1) * view.Font.Width + 1, y, format); + var maxCharCount = bits + (bits / 4 - 1) - 1; - for (var i = 8; i <= bits; i += 8) + for (int bitCount = 0, padding = 0; bitCount < bits; bitCount += 4, padding += 5) { - view.Context.DrawString(i.ToString(), view.Font.Font, brush, tx + (bits - i) * view.Font.Width, y, format); + context.Graphics.DrawString(bitCount.ToString(), context.Font.Font, brush, tx + (maxCharCount - padding) * context.Font.Width, y, format); } } - y += 2; + y += 8; } - return new Size(x - origX, y - origY + view.Font.Height); + return new Size(x - origX, y - origY + context.Font.Height); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { if (IsHidden && !IsWrapped) { return HiddenHeight; } - var height = view.Font.Height; - if (LevelsOpen[view.Level]) + var height = context.Font.Height; + if (LevelsOpen[context.Level]) { - height += view.Font.Height + 2; + height += context.Font.Height + 8; } return height; } @@ -211,7 +214,7 @@ public override void Update(HotSpot spot) { val &= (byte)~(1 << bit); } - spot.Memory.Process.WriteRemoteMemory(spot.Address + add, val); + spot.Process.WriteRemoteMemory(spot.Address + add, val); } } } diff --git a/ReClass.NET/Nodes/BoolNode.cs b/ReClass.NET/Nodes/BoolNode.cs index ba97f7ed..89e164dd 100644 --- a/ReClass.NET/Nodes/BoolNode.cs +++ b/ReClass.NET/Nodes/BoolNode.cs @@ -1,4 +1,6 @@ -using System.Drawing; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; using ReClassNET.UI; namespace ReClassNET.Nodes @@ -13,43 +15,44 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Bool; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x += TextPadding + Icons.Dimensions; + x = AddIconPadding(context, x); + x = AddIconPadding(context, x); - x = AddAddressOffset(view, x, y); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Bool") + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Bool") + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; } - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "=") + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, "=") + context.Font.Width; - var value = view.Memory.ReadUInt8(Offset); - x = AddText(view, x, y, view.Settings.ValueColor, 0, value == 0 ? "false" : "true") + view.Font.Width; + var value = context.Memory.ReadUInt8(Offset); + x = AddText(context, x, y, context.Settings.ValueColor, 0, value == 0 ? "false" : "true") + context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - return new Size(x - origX, view.Font.Height); + return new Size(x - origX, context.Font.Height); } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { - return IsHidden && !IsWrapped ? HiddenHeight : view.Font.Height; + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; } /// Updates the node from the given spot and sets the value. @@ -62,7 +65,7 @@ public override void Update(HotSpot spot) { if (bool.TryParse(spot.Text, out var val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, (byte)(val ? 1 : 0)); + spot.Process.WriteRemoteMemory(spot.Address, (byte)(val ? 1 : 0)); } } } diff --git a/ReClass.NET/Nodes/ClassInstanceNode.cs b/ReClass.NET/Nodes/ClassInstanceNode.cs index a8682dac..0a52b51a 100644 --- a/ReClass.NET/Nodes/ClassInstanceNode.cs +++ b/ReClass.NET/Nodes/ClassInstanceNode.cs @@ -1,6 +1,6 @@ -using System; +using System; using System.Drawing; -using ReClassNET.Extensions; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes @@ -17,50 +17,50 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Class_Instance; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; var origY = y; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x = AddOpenCloseIcon(view, x, y); - x = AddIcon(view, x, y, Icons.Class, HotSpot.NoneId, HotSpotType.None); + x = AddOpenCloseIcon(context, x, y); + x = AddIcon(context, x, y, context.IconProvider.Class, HotSpot.NoneId, HotSpotType.None); var tx = x; - x = AddAddressOffset(view, x, y); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Instance") + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Instance") + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; } - x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>") + view.Font.Width; - x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeClassType) + view.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>") + context.Font.Width; + x = AddIcon(context, x, y, context.IconProvider.Change, 4, HotSpotType.ChangeClassType) + context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - y += view.Font.Height; + y += context.Font.Height; var size = new Size(x - origX, y - origY); - if (LevelsOpen[view.Level]) + if (LevelsOpen[context.Level]) { - var v = view.Clone(); - v.Address = view.Address + Offset; - v.Memory = view.Memory.Clone(); - v.Memory.Offset += Offset; + var innerContext = context.Clone(); + innerContext.Address = context.Address + Offset; + innerContext.Memory = context.Memory.Clone(); + innerContext.Memory.Offset += Offset; - var innerSize = InnerNode.Draw(v, tx, y); + var innerSize = InnerNode.Draw(innerContext, tx, y); size.Width = Math.Max(size.Width, innerSize.Width + tx - origX); size.Height += innerSize.Height; } @@ -68,17 +68,17 @@ public override Size Draw(ViewInfo view, int x, int y) return size; } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { if (IsHidden && !IsWrapped) { return HiddenHeight; } - var height = view.Font.Height; - if (LevelsOpen[view.Level]) + var height = context.Font.Height; + if (LevelsOpen[context.Level]) { - height += InnerNode.CalculateDrawnHeight(view); + height += InnerNode.CalculateDrawnHeight(context); } return height; } diff --git a/ReClass.NET/Nodes/ClassNode.cs b/ReClass.NET/Nodes/ClassNode.cs index 3fd6543b..9b144061 100644 --- a/ReClass.NET/Nodes/ClassNode.cs +++ b/ReClass.NET/Nodes/ClassNode.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; +using System; using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; -using ReClassNET.AddressParser; -using ReClassNET.Extensions; -using ReClassNET.Memory; +using ReClassNET.Controls; using ReClassNET.UI; -using ReClassNET.Util; namespace ReClassNET.Nodes { @@ -19,40 +15,19 @@ public class ClassNode : BaseContainerNode #if RECLASSNET64 public static IntPtr DefaultAddress { get; } = (IntPtr)0x140000000; + public static string DefaultAddressFormula { get; } = "140000000"; #else public static IntPtr DefaultAddress { get; } = (IntPtr)0x400000; + public static string DefaultAddressFormula { get; } = "400000"; #endif public override int MemorySize => Nodes.Sum(n => n.MemorySize); protected override bool ShouldCompensateSizeChanges => true; - private NodeUuid uuid; - public NodeUuid Uuid - { - get => uuid; - set - { - Contract.Requires(value != null); - - uuid = value; - } - } - - private IntPtr address; - - public IntPtr Address - { - get => address; - set - { - Contract.Ensures(AddressFormula != null); - address = value; - AddressFormula = value.ToString("X"); - } - } + public Guid Uuid { get; set; } - public string AddressFormula { get; set; } + public string AddressFormula { get; set; } = DefaultAddressFormula; public event NodeEventHandler NodesChanged; @@ -62,9 +37,7 @@ internal ClassNode(bool notifyClassCreated) LevelsOpen.DefaultValue = true; - Uuid = new NodeUuid(true); - - Address = DefaultAddress; + Uuid = Guid.NewGuid(); if (notifyClassCreated) { @@ -102,65 +75,75 @@ public override void Initialize() AddBytes(IntPtr.Size); } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - AddSelection(view, 0, y, view.Font.Height); + AddSelection(context, 0, y, context.Font.Height); var origX = x; var origY = y; - x = AddOpenCloseIcon(view, x, y); + x = AddOpenCloseIcon(context, x, y); var tx = x; - x = AddIcon(view, x, y, Icons.Class, HotSpot.NoneId, HotSpotType.None); - x = AddText(view, x, y, view.Settings.OffsetColor, 0, AddressFormula) + view.Font.Width; + x = AddIcon(context, x, y, context.IconProvider.Class, HotSpot.NoneId, HotSpotType.None); + x = AddText(context, x, y, context.Settings.OffsetColor, 0, AddressFormula) + context.Font.Width; - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Class") + view.Font.Width; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; - x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"[{MemorySize}]") + view.Font.Width; - x = AddComment(view, x, y); + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Class") + context.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"[{MemorySize}]") + context.Font.Width; + x = AddComment(context, x, y); - y += view.Font.Height; + y += context.Font.Height; var size = new Size(x - origX, y - origY); - if (LevelsOpen[view.Level]) + if (LevelsOpen[context.Level]) { var childOffset = tx - origX; - var nv = view.Clone(); - nv.Level++; + var innerContext = context.Clone(); + innerContext.Level++; foreach (var node in Nodes) { + Size AggregateNodeSizes(Size baseSize, Size newSize) + { + return new Size(Math.Max(baseSize.Width, newSize.Width), baseSize.Height + newSize.Height); + } + + Size ExtendWidth(Size baseSize, int width) + { + return new Size(baseSize.Width + width, baseSize.Height); + } + // Draw the node if it is in the visible area. - if (view.ClientArea.Contains(tx, y)) + if (context.ClientArea.Contains(tx, y)) { - var innerSize = node.Draw(nv, tx, y); + var innerSize = node.Draw(innerContext, tx, y); - size = Utils.AggregateNodeSizes(size, innerSize.Extend(childOffset, 0)); + size = AggregateNodeSizes(size, ExtendWidth(innerSize, childOffset)); y += innerSize.Height; } else { // Otherwise calculate the height... - var calculatedHeight = node.CalculateDrawnHeight(nv); + var calculatedHeight = node.CalculateDrawnHeight(innerContext); // and check if the node area overlaps with the visible area... - if (new Rectangle(tx, y, 9999999, calculatedHeight).IntersectsWith(view.ClientArea)) + if (new Rectangle(tx, y, 9999999, calculatedHeight).IntersectsWith(context.ClientArea)) { // then draw the node... - var innerSize = node.Draw(nv, tx, y); + var innerSize = node.Draw(innerContext, tx, y); - size = Utils.AggregateNodeSizes(size, innerSize.Extend(childOffset, 0)); + size = AggregateNodeSizes(size, ExtendWidth(innerSize, childOffset)); y += innerSize.Height; } else { // or skip drawing and just use the calculated height. - size = Utils.AggregateNodeSizes(size, new Size(0, calculatedHeight)); + size = AggregateNodeSizes(size, new Size(0, calculatedHeight)); y += calculatedHeight; } @@ -171,17 +154,17 @@ public override Size Draw(ViewInfo view, int x, int y) return size; } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { if (IsHidden) { return HiddenHeight; } - var height = view.Font.Height; - if (LevelsOpen[view.Level]) + var height = context.Font.Height; + if (LevelsOpen[context.Level]) { - var nv = view.Clone(); + var nv = context.Clone(); nv.Level++; height += Nodes.Sum(n => n.CalculateDrawnHeight(nv)); } @@ -198,20 +181,6 @@ public override void Update(HotSpot spot) } } - public void UpdateAddress(RemoteProcess process) - { - Contract.Requires(process != null); - - try - { - address = process.ParseAddress(AddressFormula); - } - catch (ParseException) - { - Address = IntPtr.Zero; - } - } - protected internal override void ChildHasChanged(BaseNode child) { NodesChanged?.Invoke(this); diff --git a/ReClass.NET/Nodes/DoubleNode.cs b/ReClass.NET/Nodes/DoubleNode.cs index 495935fc..58df6e15 100644 --- a/ReClass.NET/Nodes/DoubleNode.cs +++ b/ReClass.NET/Nodes/DoubleNode.cs @@ -1,4 +1,6 @@ -using System.Drawing; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -14,9 +16,9 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Double; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return DrawNumeric(view, x, y, Icons.Double, "Double", ReadValueFromMemory(view.Memory).ToString("0.000"), null); + return DrawNumeric(context, x, y, context.IconProvider.Double, "Double", ReadValueFromMemory(context.Memory).ToString("0.000"), null); } public override void Update(HotSpot spot) @@ -27,7 +29,7 @@ public override void Update(HotSpot spot) { if (double.TryParse(spot.Text, out var val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); + spot.Process.WriteRemoteMemory(spot.Address, val); } } } diff --git a/ReClass.NET/Nodes/EnumNode.cs b/ReClass.NET/Nodes/EnumNode.cs index 9a4dd947..d2fcf746 100644 --- a/ReClass.NET/Nodes/EnumNode.cs +++ b/ReClass.NET/Nodes/EnumNode.cs @@ -1,184 +1,183 @@ -using System; -using System.Diagnostics.Contracts; -using System.Drawing; -using System.Text; -using ReClassNET.Extensions; -using ReClassNET.Memory; -using ReClassNET.Project; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class EnumNode : BaseNode - { - public override int MemorySize => (int)Enum.Size; - - public EnumDescription Enum { get; private set; } = EnumDescription.Default; - - public override void GetUserInterfaceInfo(out string name, out Image icon) - { - name = "Enum"; - icon = Properties.Resources.B16x16_Button_Enum; - } - - public void ChangeEnum(EnumDescription @enum) - { - Contract.Requires(@enum != null); - - Enum = @enum; - - GetParentContainer()?.ChildHasChanged(this); - } - - /// - /// Gets the underlaying node for the enum field. - /// - /// - public BaseNumericNode GetUnderlayingNode() - { - switch (Enum.Size) - { - case EnumDescription.UnderlyingTypeSize.OneByte: - return new UInt8Node(); - case EnumDescription.UnderlyingTypeSize.TwoBytes: - return new UInt16Node(); - case EnumDescription.UnderlyingTypeSize.FourBytes: - return new UInt32Node(); - case EnumDescription.UnderlyingTypeSize.EightBytes: - return new UInt64Node(); - } - - throw new Exception(); // TODO - } - - public long ReadValueFromMemory(MemoryBuffer memory) - { - switch (Enum.Size) - { - case EnumDescription.UnderlyingTypeSize.OneByte: - return memory.ReadInt8(Offset); - case EnumDescription.UnderlyingTypeSize.TwoBytes: - return memory.ReadInt16(Offset); - case EnumDescription.UnderlyingTypeSize.FourBytes: - return memory.ReadInt32(Offset); - case EnumDescription.UnderlyingTypeSize.EightBytes: - return memory.ReadInt64(Offset); - } - - throw new Exception(); // TODO - } - - private string GetStringRepresentation(long value) - { - if (!Enum.UseFlagsMode) - { - var index = Enum.Values.FindIndex(kv => kv.Value == value); - if (index == -1) - { - return value.ToString(); - } - - return Enum.Values[index].Key; - } - - return GetFlagsStringRepresentation(value); - } - - private string GetFlagsStringRepresentation(long value) - { - var result = (ulong)value; - - var values = Enum.Values; - - var index = values.Count - 1; - var retval = new StringBuilder(); - var firstTime = true; - var saveResult = result; - - while (index >= 0) - { - var temp = (ulong)values[index].Value; - if (index == 0 && temp == 0) - { - break; - } - - if ((result & temp) == temp) - { - result -= temp; - if (!firstTime) - { - retval.Prepend(" | "); - } - - retval.Prepend(values[index].Key); - firstTime = false; - } - - index--; - } - - if (result != 0) - { - return value.ToString(); - } - - if (saveResult == 0) - { - if (values.Count > 0 && values[0].Value == 0) - { - return values[0].Key; - } - - return "0"; - } - - return retval.ToString(); - } - - public override Size Draw(ViewInfo view, int x, int y) - { - if (IsHidden && !IsWrapped) - { - return DrawHidden(view, x, y); - } - - var origX = x; - - AddSelection(view, x, y, view.Font.Height); - - x += TextPadding; - - x = AddIcon(view, x, y, Icons.Enum, HotSpot.NoneId, HotSpotType.None); - - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Enum") + view.Font.Width; - if (!IsWrapped) - { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; - } - x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"<{Enum.Name}>") + view.Font.Width; - x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeEnumType) + view.Font.Width; - - x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, "=") + view.Font.Width; - - var value = ReadValueFromMemory(view.Memory); - - x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, GetStringRepresentation(value)) + view.Font.Width; - - x = AddComment(view, x, y); - - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); - - return new Size(x - origX, view.Font.Height); - } - - public override int CalculateDrawnHeight(ViewInfo view) - { - return IsHidden && !IsWrapped ? HiddenHeight : view.Font.Height; - } - } -} +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Text; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.Project; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class EnumNode : BaseNode + { + public override int MemorySize => (int)Enum.Size; + + public EnumDescription Enum { get; private set; } = EnumDescription.Default; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Enum"; + icon = Properties.Resources.B16x16_Button_Enum; + } + + public void ChangeEnum(EnumDescription @enum) + { + Contract.Requires(@enum != null); + + Enum = @enum; + + GetParentContainer()?.ChildHasChanged(this); + } + + private string GetTextRepresentation(MemoryBuffer memory) + { + return Enum.UseFlagsMode ? GetFlagsStringRepresentation(memory) : GetStringRepresentation(memory); + } + + private long ReadSignedValueFromMemory(MemoryBuffer memory) + { + switch (Enum.Size) + { + case EnumDescription.UnderlyingTypeSize.OneByte: + return memory.ReadInt8(Offset); + case EnumDescription.UnderlyingTypeSize.TwoBytes: + return memory.ReadInt16(Offset); + case EnumDescription.UnderlyingTypeSize.FourBytes: + return memory.ReadInt32(Offset); + case EnumDescription.UnderlyingTypeSize.EightBytes: + return memory.ReadInt64(Offset); + default: + throw new ArgumentOutOfRangeException(); + } + } + + private string GetStringRepresentation(MemoryBuffer memory) + { + var value = ReadSignedValueFromMemory(memory); + var index = Enum.Values.FindIndex(kv => kv.Value == value); + if (index == -1) + { + return value.ToString(); + } + + return Enum.Values[index].Key; + } + + private ulong ReadUnsignedValueFromMemory(MemoryBuffer memory) + { + switch (Enum.Size) + { + case EnumDescription.UnderlyingTypeSize.OneByte: + return memory.ReadUInt8(Offset); + case EnumDescription.UnderlyingTypeSize.TwoBytes: + return memory.ReadUInt16(Offset); + case EnumDescription.UnderlyingTypeSize.FourBytes: + return memory.ReadUInt32(Offset); + case EnumDescription.UnderlyingTypeSize.EightBytes: + return memory.ReadUInt64(Offset); + default: + throw new ArgumentOutOfRangeException(); + } + } + + private string GetFlagsStringRepresentation(MemoryBuffer memory) + { + var value = ReadUnsignedValueFromMemory(memory); + var result = value; + + var values = Enum.Values; + + var index = values.Count - 1; + var retval = new StringBuilder(); + var firstTime = true; + var saveResult = result; + + while (index >= 0) + { + var temp = (ulong)values[index].Value; + if (index == 0 && temp == 0) + { + break; + } + + if ((result & temp) == temp) + { + result -= temp; + if (!firstTime) + { + retval.Prepend(" | "); + } + + retval.Prepend(values[index].Key); + firstTime = false; + } + + index--; + } + + if (result != 0) + { + return value.ToString(); + } + + if (saveResult == 0) + { + if (values.Count > 0 && values[0].Value == 0) + { + return values[0].Key; + } + + return "0"; + } + + return retval.ToString(); + } + + public override Size Draw(DrawContext context, int x, int y) + { + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + + x = AddIcon(context, x, y, context.IconProvider.Enum, HotSpot.NoneId, HotSpotType.None); + + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Enum") + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + } + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"<{Enum.Name}>") + context.Font.Width; + x = AddIcon(context, x, y, context.IconProvider.Change, 4, HotSpotType.ChangeEnumType) + context.Font.Width; + + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, "=") + context.Font.Width; + + var text = GetTextRepresentation(context.Memory); + + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, text) + context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + return new Size(x - origX, context.Font.Height); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; + } + } +} diff --git a/ReClass.NET/Nodes/FloatNode.cs b/ReClass.NET/Nodes/FloatNode.cs index e607b26f..b02ebaff 100644 --- a/ReClass.NET/Nodes/FloatNode.cs +++ b/ReClass.NET/Nodes/FloatNode.cs @@ -1,4 +1,6 @@ -using System.Drawing; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -14,9 +16,9 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Float; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return DrawNumeric(view, x, y, Icons.Float, "Float", ReadValueFromMemory(view.Memory).ToString("0.000"), null); + return DrawNumeric(context, x, y, context.IconProvider.Float, "Float", ReadValueFromMemory(context.Memory).ToString("0.000"), null); } public override void Update(HotSpot spot) @@ -27,7 +29,7 @@ public override void Update(HotSpot spot) { if (float.TryParse(spot.Text, out var val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); + spot.Process.WriteRemoteMemory(spot.Address, val); } } } diff --git a/ReClass.NET/Nodes/FunctionNode.cs b/ReClass.NET/Nodes/FunctionNode.cs index 1c0608f3..8a6c4429 100644 --- a/ReClass.NET/Nodes/FunctionNode.cs +++ b/ReClass.NET/Nodes/FunctionNode.cs @@ -1,7 +1,8 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -23,69 +24,69 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Function; } - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) + public override string GetToolTipText(HotSpot spot) { - DisassembleRemoteCode(memory, spot.Address); + DisassembleRemoteCode(spot.Process, spot.Address); - return string.Join("\n", instructions.Select(i => i.Instruction)); + return string.Join("\n", Instructions.Select(i => i.Instruction)); } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - Contract.Requires(view != null); + Contract.Requires(context != null); if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x += TextPadding; + x = AddIconPadding(context, x); - x = AddIcon(view, x, y, Icons.Function, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(context, x, y, context.IconProvider.Function, HotSpot.NoneId, HotSpotType.None); var tx = x; - x = AddAddressOffset(view, x, y); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Function") + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Function") + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; } - x = AddOpenCloseIcon(view, x, y) + view.Font.Width; + x = AddOpenCloseIcon(context, x, y) + context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - var size = new Size(x - origX, view.Font.Height); + var size = new Size(x - origX, context.Font.Height); - var ptr = view.Address + Offset; - DisassembleRemoteCode(view.Memory, ptr); + var ptr = context.Address + Offset; + DisassembleRemoteCode(context.Process, ptr); - if (LevelsOpen[view.Level]) + if (LevelsOpen[context.Level]) { - y += view.Font.Height; - x = AddText(view, tx, y, view.Settings.TypeColor, HotSpot.NoneId, "Signature:") + view.Font.Width; - x = AddText(view, x, y, view.Settings.ValueColor, 0, Signature); + y += context.Font.Height; + x = AddText(context, tx, y, context.Settings.TypeColor, HotSpot.NoneId, "Signature:") + context.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, 0, Signature); size.Width = Math.Max(size.Width, x - origX); - size.Height += view.Font.Height; + size.Height += context.Font.Height; - y += view.Font.Height; - x = AddText(view, tx, y, view.Settings.TextColor, HotSpot.NoneId, "Belongs to: "); - x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, BelongsToClass == null ? "" : $"<{BelongsToClass.Name}>") + view.Font.Width; - x = AddIcon(view, x, y, Icons.Change, 1, HotSpotType.ChangeClassType); + y += context.Font.Height; + x = AddText(context, tx, y, context.Settings.TextColor, HotSpot.NoneId, "Belongs to: "); + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, BelongsToClass == null ? "" : $"<{BelongsToClass.Name}>") + context.Font.Width; + x = AddIcon(context, x, y, context.IconProvider.Change, 1, HotSpotType.ChangeClassType); size.Width = Math.Max(size.Width, x - origX); - size.Height += view.Font.Height; + size.Height += context.Font.Height; - var instructionSize = DrawInstructions(view, tx, y + 4); + var instructionSize = DrawInstructions(context, tx, y + 4); size.Width = Math.Max(size.Width, instructionSize.Width + tx - origX); size.Height += instructionSize.Height + 4; } @@ -93,17 +94,17 @@ public override Size Draw(ViewInfo view, int x, int y) return size; } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { if (IsHidden && !IsWrapped) { return HiddenHeight; } - var height = view.Font.Height; - if (LevelsOpen[view.Level]) + var height = context.Font.Height; + if (LevelsOpen[context.Level]) { - height += instructions.Count * view.Font.Height; + height += Instructions.Count * context.Font.Height; } return height; } @@ -118,19 +119,19 @@ public override void Update(HotSpot spot) } } - private void DisassembleRemoteCode(MemoryBuffer memory, IntPtr address) + private void DisassembleRemoteCode(RemoteProcess process, IntPtr address) { - Contract.Requires(memory != null); + Contract.Requires(process != null); - if (this.address != address) + if (this.Address != address) { - instructions.Clear(); + Instructions.Clear(); - this.address = address; + this.Address = address; - if (!address.IsNull() && memory.Process.IsValid) + if (!address.IsNull() && process.IsValid) { - DisassembleRemoteCode(memory, address, out memorySize); + DisassembleRemoteCode(process, address, out memorySize); } GetParentContainer()?.ChildHasChanged(this); diff --git a/ReClass.NET/Nodes/FunctionPtrNode.cs b/ReClass.NET/Nodes/FunctionPtrNode.cs index 7530d91c..6b7d28e7 100644 --- a/ReClass.NET/Nodes/FunctionPtrNode.cs +++ b/ReClass.NET/Nodes/FunctionPtrNode.cs @@ -1,5 +1,5 @@ -using System.Drawing; -using ReClassNET.UI; +using System.Drawing; +using ReClassNET.Controls; namespace ReClassNET.Nodes { @@ -11,9 +11,9 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Function_Pointer; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return Draw(view, x, y, "FunctionPtr", Name); + return Draw(context, x, y, "FunctionPtr", Name); } } } diff --git a/ReClass.NET/Nodes/Hex16Node.cs b/ReClass.NET/Nodes/Hex16Node.cs index b63fbddc..2e18994a 100644 --- a/ReClass.NET/Nodes/Hex16Node.cs +++ b/ReClass.NET/Nodes/Hex16Node.cs @@ -1,4 +1,5 @@ -using System.Drawing; +using System.Drawing; +using ReClassNET.Controls; using ReClassNET.Memory; using ReClassNET.UI; @@ -14,16 +15,16 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Hex_16; } - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) + public override string GetToolTipText(HotSpot spot) { - var value = memory.ReadObject(Offset); + var value = new UInt16Data { ShortValue = spot.Memory.ReadInt16(Offset) }; return $"Int16: {value.ShortValue}\nUInt16: 0x{value.UShortValue:X04}"; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return Draw(view, x, y, view.Settings.ShowNodeText ? view.Memory.ReadPrintableAsciiString(Offset, 2) + " " : null, 2); + return Draw(context, x, y, context.Settings.ShowNodeText ? context.Memory.ReadString(context.Settings.RawDataEncoding, Offset, 2) + " " : null, 2); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/Hex32Node.cs b/ReClass.NET/Nodes/Hex32Node.cs index 0ccfb4d3..c7b54027 100644 --- a/ReClass.NET/Nodes/Hex32Node.cs +++ b/ReClass.NET/Nodes/Hex32Node.cs @@ -1,5 +1,6 @@ -using System; +using System; using System.Drawing; +using ReClassNET.Controls; using ReClassNET.Memory; using ReClassNET.UI; @@ -15,25 +16,25 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Hex_32; } - public override bool UseMemoryPreviewToolTip(HotSpot spot, MemoryBuffer memory, out IntPtr address) + public override bool UseMemoryPreviewToolTip(HotSpot spot, out IntPtr address) { - var value = memory.ReadObject(Offset); + var value = ReadFromBuffer(spot.Memory, Offset); address = value.IntPtr; - return memory.Process?.GetNamedAddress(value.IntPtr) != null; + return spot.Process?.GetNamedAddress(value.IntPtr) != null; } - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) + public override string GetToolTipText(HotSpot spot) { - var value = memory.ReadObject(Offset); + var value = ReadFromBuffer(spot.Memory, Offset); return $"Int32: {value.IntValue}\nUInt32: 0x{value.UIntValue:X08}\nFloat: {value.FloatValue:0.000}"; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return Draw(view, x, y, view.Settings.ShowNodeText ? view.Memory.ReadPrintableAsciiString(Offset, 4) + " " : null, 4); + return Draw(context, x, y, context.Settings.ShowNodeText ? context.Memory.ReadString(context.Settings.RawDataEncoding, Offset, 4) + " " : null, 4); } public override void Update(HotSpot spot) @@ -41,15 +42,20 @@ public override void Update(HotSpot spot) Update(spot, 4); } - protected override int AddComment(ViewInfo view, int x, int y) + protected override int AddComment(DrawContext context, int x, int y) { - x = base.AddComment(view, x, y); + x = base.AddComment(context, x, y); - var value = view.Memory.ReadObject(Offset); + var value = ReadFromBuffer(context.Memory, Offset); - x = AddComment(view, x, y, value.FloatValue, value.IntPtr, value.UIntPtr); + x = AddComment(context, x, y, value.FloatValue, value.IntPtr, value.UIntPtr); return x; } + + private static UInt32FloatData ReadFromBuffer(MemoryBuffer memory, int offset) => new UInt32FloatData + { + Raw = memory.ReadInt32(offset) + }; } } diff --git a/ReClass.NET/Nodes/Hex64Node.cs b/ReClass.NET/Nodes/Hex64Node.cs index 82a54782..d54f1e71 100644 --- a/ReClass.NET/Nodes/Hex64Node.cs +++ b/ReClass.NET/Nodes/Hex64Node.cs @@ -1,5 +1,6 @@ -using System; +using System; using System.Drawing; +using ReClassNET.Controls; using ReClassNET.Memory; using ReClassNET.UI; @@ -15,25 +16,25 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Hex_64; } - public override bool UseMemoryPreviewToolTip(HotSpot spot, MemoryBuffer memory, out IntPtr address) + public override bool UseMemoryPreviewToolTip(HotSpot spot, out IntPtr address) { - var value = memory.ReadObject(Offset); + var value = ReadFromBuffer(spot.Memory, Offset); address = value.IntPtr; - return memory.Process.GetSectionToPointer(value.IntPtr) != null; + return spot.Process.GetSectionToPointer(value.IntPtr) != null; } - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) + public override string GetToolTipText(HotSpot spot) { - var value = memory.ReadObject(Offset); + var value = ReadFromBuffer(spot.Memory, Offset); return $"Int64: {value.LongValue}\nUInt64: 0x{value.ULongValue:X016}\nFloat: {value.FloatValue:0.000}\nDouble: {value.DoubleValue:0.000}"; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return Draw(view, x, y, view.Settings.ShowNodeText ? view.Memory.ReadPrintableAsciiString(Offset, 8) + " " : null, 8); + return Draw(context, x, y, context.Settings.ShowNodeText ? context.Memory.ReadString(context.Settings.RawDataEncoding, Offset, 8) + " " : null, 8); } public override void Update(HotSpot spot) @@ -41,15 +42,21 @@ public override void Update(HotSpot spot) Update(spot, 8); } - protected override int AddComment(ViewInfo view, int x, int y) + protected override int AddComment(DrawContext context, int x, int y) { - x = base.AddComment(view, x, y); + x = base.AddComment(context, x, y); - var value = view.Memory.ReadObject(Offset); + var value = ReadFromBuffer(context.Memory, Offset); - x = AddComment(view, x, y, value.FloatValue, value.IntPtr, value.UIntPtr); + x = AddComment(context, x, y, value.FloatValue, value.IntPtr, value.UIntPtr); return x; } + + private static UInt64FloatDoubleData ReadFromBuffer(MemoryBuffer memory, int offset) => new UInt64FloatDoubleData + { + Raw1 = memory.ReadInt32(offset), + Raw2 = memory.ReadInt32(offset + sizeof(int)) + }; } } diff --git a/ReClass.NET/Nodes/Hex8Node.cs b/ReClass.NET/Nodes/Hex8Node.cs index 9319f65d..7c29884e 100644 --- a/ReClass.NET/Nodes/Hex8Node.cs +++ b/ReClass.NET/Nodes/Hex8Node.cs @@ -1,5 +1,5 @@ -using System.Drawing; -using ReClassNET.Memory; +using System.Drawing; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes @@ -14,16 +14,16 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Hex_8; } - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) + public override string GetToolTipText(HotSpot spot) { - var b = memory.ReadUInt8(Offset); + var b = spot.Memory.ReadUInt8(Offset); return $"Int8: {(int)b}\nUInt8: 0x{b:X02}"; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return Draw(view, x, y, view.Settings.ShowNodeText ? view.Memory.ReadPrintableAsciiString(Offset, 1) + " " : null, 1); + return Draw(context, x, y, context.Settings.ShowNodeText ? context.Memory.ReadString(context.Settings.RawDataEncoding, Offset, 1) + " " : null, 1); } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/INodeInfoReader.cs b/ReClass.NET/Nodes/INodeInfoReader.cs index 59a3a249..75289ccf 100644 --- a/ReClass.NET/Nodes/INodeInfoReader.cs +++ b/ReClass.NET/Nodes/INodeInfoReader.cs @@ -11,19 +11,21 @@ public interface INodeInfoReader /// Used to print custom informations about a node. /// /// The node. - /// The absolute address of the node. - /// /// The memory value of the node as . + /// The current . /// The current . + /// The absolute address of the node. + /// The memory value of the node as . /// Custom informations about the node or null. - string ReadNodeInfo(BaseHexCommentNode node, IntPtr nodeAddress, IntPtr nodeValue, MemoryBuffer memory); + string ReadNodeInfo(BaseHexCommentNode node, IRemoteMemoryReader reader, MemoryBuffer memory, IntPtr nodeAddress, IntPtr nodeValue); } [ContractClassFor(typeof(INodeInfoReader))] internal abstract class NodeInfoReaderContract : INodeInfoReader { - public string ReadNodeInfo(BaseHexCommentNode node, IntPtr nodeAddress, IntPtr nodeValue, MemoryBuffer memory) + public string ReadNodeInfo(BaseHexCommentNode node, IRemoteMemoryReader reader, MemoryBuffer memory, IntPtr nodeAddress, IntPtr nodeValue) { Contract.Requires(node != null); + Contract.Requires(reader != null); Contract.Requires(memory != null); throw new NotImplementedException(); diff --git a/ReClass.NET/Nodes/Int16Node.cs b/ReClass.NET/Nodes/Int16Node.cs index e54c9351..e67b2145 100644 --- a/ReClass.NET/Nodes/Int16Node.cs +++ b/ReClass.NET/Nodes/Int16Node.cs @@ -1,5 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Globalization; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -16,10 +17,10 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Int_16; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Signed, "Int16", value.ToString(), $"0x{value:X}"); + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Signed, "Int16", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) @@ -30,7 +31,7 @@ public override void Update(HotSpot spot) { if (short.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && short.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); + spot.Process.WriteRemoteMemory(spot.Address, val); } } } diff --git a/ReClass.NET/Nodes/Int32Node.cs b/ReClass.NET/Nodes/Int32Node.cs index f2742cbc..5ba2090e 100644 --- a/ReClass.NET/Nodes/Int32Node.cs +++ b/ReClass.NET/Nodes/Int32Node.cs @@ -1,5 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Globalization; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -16,10 +17,10 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Int_32; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Signed, "Int32", value.ToString(), $"0x{value:X}"); + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Signed, "Int32", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) @@ -30,7 +31,7 @@ public override void Update(HotSpot spot) { if (int.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && int.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); + spot.Process.WriteRemoteMemory(spot.Address, val); } } } diff --git a/ReClass.NET/Nodes/Int64Node.cs b/ReClass.NET/Nodes/Int64Node.cs index d4146f22..935e4569 100644 --- a/ReClass.NET/Nodes/Int64Node.cs +++ b/ReClass.NET/Nodes/Int64Node.cs @@ -1,5 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Globalization; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -16,10 +17,10 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Int_64; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Signed, "Int64", value.ToString(), $"0x{value:X}"); + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Signed, "Int64", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) @@ -30,7 +31,7 @@ public override void Update(HotSpot spot) { if (long.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && long.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); + spot.Process.WriteRemoteMemory(spot.Address, val); } } } diff --git a/ReClass.NET/Nodes/Int8Node.cs b/ReClass.NET/Nodes/Int8Node.cs index e1ed38c9..fbfe4038 100644 --- a/ReClass.NET/Nodes/Int8Node.cs +++ b/ReClass.NET/Nodes/Int8Node.cs @@ -1,5 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Globalization; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -16,10 +17,10 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Int_8; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Signed, "Int8", value.ToString(), $"0x{value:X}"); + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Signed, "Int8", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) @@ -30,7 +31,7 @@ public override void Update(HotSpot spot) { if (sbyte.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && sbyte.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); + spot.Process.WriteRemoteMemory(spot.Address, val); } } } diff --git a/ReClass.NET/Nodes/Matrix3x3Node.cs b/ReClass.NET/Nodes/Matrix3x3Node.cs index 6d6b87f1..37bc1802 100644 --- a/ReClass.NET/Nodes/Matrix3x3Node.cs +++ b/ReClass.NET/Nodes/Matrix3x3Node.cs @@ -1,35 +1,11 @@ -using System; using System.Drawing; -using System.Runtime.InteropServices; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes { public class Matrix3x3Node : BaseMatrixNode { - [StructLayout(LayoutKind.Explicit)] - private struct Matrix3x3Data - { - [FieldOffset(0)] - public readonly float _11; - [FieldOffset(4)] - public readonly float _12; - [FieldOffset(8)] - public readonly float _13; - [FieldOffset(12)] - public readonly float _21; - [FieldOffset(16)] - public readonly float _22; - [FieldOffset(20)] - public readonly float _23; - [FieldOffset(24)] - public readonly float _31; - [FieldOffset(28)] - public readonly float _32; - [FieldOffset(32)] - public readonly float _33; - } - public override int ValueTypeSize => sizeof(float); public override int MemorySize => 9 * ValueTypeSize; @@ -40,50 +16,14 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Matrix_3x3; } - public override Size Draw(ViewInfo view, int x2, int y2) + public override Size Draw(DrawContext context, int x2, int y2) { - return DrawMatrixType(view, x2, y2, "Matrix (3x3)", (int defaultX, ref int maxX, ref int y) => - { - var value = view.Memory.ReadObject(Offset); - - y += view.Font.Height; - var x = defaultX; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, view.Settings.ValueColor, 0, $"{value._11,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 1, $"{value._12,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 2, $"{value._13,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - maxX = Math.Max(x, maxX); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, view.Settings.ValueColor, 3, $"{value._21,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 4, $"{value._22,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 5, $"{value._23,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - maxX = Math.Max(x, maxX); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, view.Settings.ValueColor, 6, $"{value._31,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 7, $"{value._32,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 8, $"{value._33,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - maxX = Math.Max(x, maxX); - }); + return DrawMatrixType(context, x2, y2, "Matrix (3x3)", 3, 3); } - protected override int CalculateValuesHeight(ViewInfo view) + protected override int CalculateValuesHeight(DrawContext context) { - return 3 * view.Font.Height; + return 3 * context.Font.Height; } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/Matrix3x4Node.cs b/ReClass.NET/Nodes/Matrix3x4Node.cs index d00322da..96948064 100644 --- a/ReClass.NET/Nodes/Matrix3x4Node.cs +++ b/ReClass.NET/Nodes/Matrix3x4Node.cs @@ -1,41 +1,11 @@ -using System; using System.Drawing; -using System.Runtime.InteropServices; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes { public class Matrix3x4Node : BaseMatrixNode { - [StructLayout(LayoutKind.Explicit)] - private struct Matrix3x4Data - { - [FieldOffset(0)] - public readonly float _11; - [FieldOffset(4)] - public readonly float _12; - [FieldOffset(8)] - public readonly float _13; - [FieldOffset(12)] - public readonly float _14; - [FieldOffset(16)] - public readonly float _21; - [FieldOffset(20)] - public readonly float _22; - [FieldOffset(24)] - public readonly float _23; - [FieldOffset(28)] - public readonly float _24; - [FieldOffset(32)] - public readonly float _31; - [FieldOffset(36)] - public readonly float _32; - [FieldOffset(40)] - public readonly float _33; - [FieldOffset(44)] - public readonly float _34; - } - public override int ValueTypeSize => sizeof(float); public override int MemorySize => 12 * ValueTypeSize; @@ -46,56 +16,14 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Matrix_3x4; } - public override Size Draw(ViewInfo view, int x2, int y2) + public override Size Draw(DrawContext context, int x2, int y2) { - return DrawMatrixType(view, x2, y2, "Matrix (3x4)", (int defaultX, ref int maxX, ref int y) => - { - var value = view.Memory.ReadObject(Offset); - - y += view.Font.Height; - var x = defaultX; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, view.Settings.ValueColor, 0, $"{value._11,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 1, $"{value._12,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 2, $"{value._13,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 3, $"{value._14,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - maxX = Math.Max(x, maxX); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, view.Settings.ValueColor, 4, $"{value._21,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 5, $"{value._22,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 6, $"{value._23,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 7, $"{value._24,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - maxX = Math.Max(x, maxX); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, view.Settings.ValueColor, 8, $"{value._31,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 9, $"{value._32,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 10, $"{value._33,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 11, $"{value._34,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - maxX = Math.Max(x, maxX); - }); + return DrawMatrixType(context, x2, y2, "Matrix (3x4)", 3, 4); } - protected override int CalculateValuesHeight(ViewInfo view) + protected override int CalculateValuesHeight(DrawContext context) { - return 3 * view.Font.Height; + return 3 * context.Font.Height; } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/Matrix4x4Node.cs b/ReClass.NET/Nodes/Matrix4x4Node.cs index a2adb2f0..69318694 100644 --- a/ReClass.NET/Nodes/Matrix4x4Node.cs +++ b/ReClass.NET/Nodes/Matrix4x4Node.cs @@ -1,49 +1,11 @@ -using System; using System.Drawing; -using System.Runtime.InteropServices; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes { public class Matrix4x4Node : BaseMatrixNode { - [StructLayout(LayoutKind.Explicit)] - private struct Matrix4x4Data - { - [FieldOffset(0)] - public readonly float _11; - [FieldOffset(4)] - public readonly float _12; - [FieldOffset(8)] - public readonly float _13; - [FieldOffset(12)] - public readonly float _14; - [FieldOffset(16)] - public readonly float _21; - [FieldOffset(20)] - public readonly float _22; - [FieldOffset(24)] - public readonly float _23; - [FieldOffset(28)] - public readonly float _24; - [FieldOffset(32)] - public readonly float _31; - [FieldOffset(36)] - public readonly float _32; - [FieldOffset(40)] - public readonly float _33; - [FieldOffset(44)] - public readonly float _34; - [FieldOffset(48)] - public readonly float _41; - [FieldOffset(52)] - public readonly float _42; - [FieldOffset(56)] - public readonly float _43; - [FieldOffset(60)] - public readonly float _44; - } - public override int ValueTypeSize => sizeof(float); public override int MemorySize => 16 * ValueTypeSize; @@ -54,69 +16,14 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Matrix_4x4; } - public override Size Draw(ViewInfo view, int x2, int y2) + public override Size Draw(DrawContext context, int x2, int y2) { - return DrawMatrixType(view, x2, y2, "Matrix (4x4)", (int defaultX, ref int maxX, ref int y) => - { - var value = view.Memory.ReadObject(Offset); - - y += view.Font.Height; - var x = defaultX; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, view.Settings.ValueColor, 0, $"{value._11,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 1, $"{value._12,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 2, $"{value._13,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 3, $"{value._14,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - maxX = Math.Max(x, maxX); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, view.Settings.ValueColor, 4, $"{value._21,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 5, $"{value._22,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 6, $"{value._23,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 7, $"{value._24,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - maxX = Math.Max(x, maxX); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, view.Settings.ValueColor, 8, $"{value._31,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 9, $"{value._32,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 10, $"{value._33,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 11, $"{value._34,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - maxX = Math.Max(x, maxX); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, view.Settings.ValueColor, 12, $"{value._41,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 13, $"{value._42,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 14, $"{value._43,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 15, $"{value._44,14:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|"); - maxX = Math.Max(x, maxX); - }); + return DrawMatrixType(context, x2, y2, "Matrix (4x4)", 4, 4); } - protected override int CalculateValuesHeight(ViewInfo view) + protected override int CalculateValuesHeight(DrawContext context) { - return 4 * view.Font.Height; + return 4 * context.Font.Height; } public override void Update(HotSpot spot) diff --git a/ReClass.NET/Nodes/NIntNode.cs b/ReClass.NET/Nodes/NIntNode.cs new file mode 100644 index 00000000..77d021e0 --- /dev/null +++ b/ReClass.NET/Nodes/NIntNode.cs @@ -0,0 +1,57 @@ +using System; +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class NIntNode : BaseNumericNode + { + public override int MemorySize => IntPtr.Size; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "NInt"; + icon = Properties.Resources.B16x16_Button_NInt; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory) +#if RECLASSNET64 + .ToInt64(); +#else + .ToInt32(); +#endif + return DrawNumeric(context, x, y, context.IconProvider.Signed, "NInt", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { +#if RECLASSNET64 + if (long.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && long.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } +#else + if (int.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && int.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } +#endif + } + } + + public IntPtr ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadIntPtr(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/NUIntNode.cs b/ReClass.NET/Nodes/NUIntNode.cs new file mode 100644 index 00000000..1b502ad0 --- /dev/null +++ b/ReClass.NET/Nodes/NUIntNode.cs @@ -0,0 +1,57 @@ +using System; +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class NUIntNode : BaseNumericNode + { + public override int MemorySize => UIntPtr.Size; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "NUInt"; + icon = Properties.Resources.B16x16_Button_NUInt; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory) +#if RECLASSNET64 + .ToUInt64(); +#else + .ToUInt32(); +#endif + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "NUInt", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { +#if RECLASSNET64 + if (ulong.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && ulong.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } +#else + if (uint.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && uint.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } +#endif + } + } + + public UIntPtr ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadUIntPtr(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/NodeUuid.cs b/ReClass.NET/Nodes/NodeUuid.cs deleted file mode 100644 index 3eddf506..00000000 --- a/ReClass.NET/Nodes/NodeUuid.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Diagnostics.Contracts; - -namespace ReClassNET.Nodes -{ - public sealed class NodeUuid : IComparable, IEquatable - { - /// Size in bytes of a UUID. - public const int UuidSize = 16; - - /// Zero UUID (all bytes are zero). - public static readonly NodeUuid Zero = new NodeUuid(false); - - /// The maximum reserved UUID value. - private static readonly NodeUuid maxReserved = new NodeUuid(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF }); - - /// Checks if the given UUID is reserved. - /// The uuid. - /// True if reserved, false if not. - public static bool IsReserved(NodeUuid uuid) - { - Contract.Requires(uuid != null); - - return uuid.CompareTo(maxReserved) <= 0; - } - - private byte[] uuidBytes; - private readonly int uuidHash; - - /// Get the 16 UUID bytes. - public byte[] UuidBytes => uuidBytes; - - /// Construct a new UUID object. - /// If this parameter is true, a new UUID is generated. - /// If it is false, the UUID is initialized to zero. - public NodeUuid(bool createNew) - { - Contract.Ensures(uuidBytes != null); - - if (createNew) - { - CreateNew(); - } - else - { - SetZero(); - } - - uuidHash = CalculateHash(); - } - - /// Construct a new UUID object. - /// Initial value of the object. - private NodeUuid(byte[] valueBytes) - { - Contract.Requires(valueBytes != null); - Contract.Requires(valueBytes.Length == UuidSize); - Contract.Ensures(uuidBytes != null); - - SetValue(valueBytes); - - uuidHash = CalculateHash(); - } - - public static NodeUuid FromBase64String(string base64, bool createNew) - { - try - { - if (base64 != null) - { - var bytes = Convert.FromBase64String(base64); - - if (bytes.Length == UuidSize) - { - return new NodeUuid(bytes); - } - } - } - catch (ArgumentNullException) - { - - } - - return new NodeUuid(createNew); - } - - /// Create a new, random UUID. - /// Returns true if a random UUID has been generated, otherwise it returns false. - private void CreateNew() - { - Contract.Ensures(uuidBytes != null); - - while (true) - { - uuidBytes = Guid.NewGuid().ToByteArray(); - - if (uuidBytes == null || uuidBytes.Length != UuidSize) - { - throw new InvalidOperationException(); - } - - // Do not generate reserved UUIDs. - if (!IsReserved(this)) - { - break; - } - } - } - - /// Sets the UUID to the given value. - /// Initial value of the object. - private void SetValue(byte[] valueBytes) - { - Contract.Requires(valueBytes != null); - Contract.Requires(valueBytes.Length == UuidSize); - Contract.Ensures(uuidBytes != null); - - uuidBytes = new byte[UuidSize]; - - Array.Copy(valueBytes, uuidBytes, UuidSize); - } - - /// Sets the UUID to zero. - private void SetZero() - { - Contract.Ensures(uuidBytes != null); - - uuidBytes = new byte[UuidSize]; - } - - public override bool Equals(object obj) - { - return Equals(obj as NodeUuid); - } - - public bool Equals(NodeUuid other) - { - if (other == null) - { - return false; - } - - for (var i = 0; i < UuidSize; ++i) - { - if (uuidBytes[i] != other.uuidBytes[i]) - { - return false; - } - } - - return true; - } - - private int CalculateHash() - { - var hash = 17; - unchecked - { - foreach (var b in uuidBytes) - { - hash = hash * 31 + b.GetHashCode(); - } - } - return hash; - } - - public override int GetHashCode() - { - return uuidHash; - } - - public int CompareTo(NodeUuid other) - { - for (var i = 0; i < UuidSize; ++i) - { - if (uuidBytes[i] < other.uuidBytes[i]) - { - return -1; - } - if (uuidBytes[i] > other.uuidBytes[i]) - { - return 1; - } - } - - return 0; - } - - public string ToBase64String() - { - return Convert.ToBase64String(uuidBytes); - } - - /// Convert the UUID to its string representation. - /// String containing the UUID value. - public string ToHexString() - { - return BitConverter.ToString(uuidBytes).Replace("-", string.Empty); - } - - public override string ToString() - { - return ToHexString(); - } - } -} diff --git a/ReClass.NET/Nodes/PointerNode.cs b/ReClass.NET/Nodes/PointerNode.cs index 04c001b1..027b0d28 100644 --- a/ReClass.NET/Nodes/PointerNode.cs +++ b/ReClass.NET/Nodes/PointerNode.cs @@ -1,5 +1,6 @@ -using System; +using System; using System.Drawing; +using ReClassNET.Controls; using ReClassNET.Memory; using ReClassNET.UI; @@ -18,95 +19,99 @@ public PointerNode() LevelsOpen.DefaultValue = true; } + public override void Initialize() + { + var node = new ClassInstanceNode(); + node.Initialize(); + ((BaseContainerNode)node.InnerNode).AddBytes(16 * IntPtr.Size); + + ChangeInnerNode(node); + } + public override void GetUserInterfaceInfo(out string name, out Image icon) { name = "Pointer"; icon = Properties.Resources.B16x16_Button_Pointer; } - public override bool UseMemoryPreviewToolTip(HotSpot spot, MemoryBuffer memory, out IntPtr address) + public override bool UseMemoryPreviewToolTip(HotSpot spot, out IntPtr address) { // TODO Should the preview be disabled if an inner node is set? - address = memory.ReadIntPtr(Offset); + address = spot.Memory.ReadIntPtr(Offset); - return memory.Process?.GetNamedAddress(address) != null; + return spot.Process.GetNamedAddress(address) != null; } - public override bool CanChangeInnerNodeTo(BaseNode node) - { - switch (node) + public override bool CanChangeInnerNodeTo(BaseNode node) => + node switch { - case ClassNode _: - case VirtualMethodNode _: - return false; - } - - return true; - } + ClassNode _ => false, + VirtualMethodNode _ => false, + _ => true + }; - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; var origY = y; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); if (InnerNode != null) { - x = AddOpenCloseIcon(view, x, y); + x = AddOpenCloseIcon(context, x, y); } else { - x += TextPadding; + x = AddIconPadding(context, x); } - x = AddIcon(view, x, y, Icons.Pointer, HotSpot.NoneId, HotSpotType.None); + x = AddIcon(context, x, y, context.IconProvider.Pointer, HotSpot.NoneId, HotSpotType.None); var tx = x; - x = AddAddressOffset(view, x, y); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Ptr") + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Ptr") + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; } if (InnerNode == null) { - x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, "") + view.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, "") + context.Font.Width; } - x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeWrappedType) + view.Font.Width; + x = AddIcon(context, x, y, context.IconProvider.Change, 4, HotSpotType.ChangeWrappedType) + context.Font.Width; - var ptr = view.Memory.ReadIntPtr(Offset); + var ptr = context.Memory.ReadIntPtr(Offset); - x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.NoneId, "->") + view.Font.Width; - x = AddText(view, x, y, view.Settings.ValueColor, 0, "0x" + ptr.ToString(Constants.AddressHexFormat)) + view.Font.Width; + x = AddText(context, x, y, context.Settings.OffsetColor, HotSpot.NoneId, "->") + context.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, 0, "0x" + ptr.ToString(Constants.AddressHexFormat)) + context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - y += view.Font.Height; + y += context.Font.Height; var size = new Size(x - origX, y - origY); - if (LevelsOpen[view.Level] && InnerNode != null) + if (LevelsOpen[context.Level] && InnerNode != null) { memory.Size = InnerNode.MemorySize; - memory.Process = view.Memory.Process; - memory.Update(ptr); + memory.UpdateFrom(context.Process, ptr); - var v = view.Clone(); - v.Address = ptr; - v.Memory = memory; + var innerContext = context.Clone(); + innerContext.Address = ptr; + innerContext.Memory = memory; - var innerSize = InnerNode.Draw(v, tx, y); + var innerSize = InnerNode.Draw(innerContext, tx, y); size.Width = Math.Max(size.Width, innerSize.Width + tx - origX); size.Height += innerSize.Height; @@ -115,17 +120,17 @@ public override Size Draw(ViewInfo view, int x, int y) return size; } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { if (IsHidden && !IsWrapped) { return HiddenHeight; } - var height = view.Font.Height; - if (LevelsOpen[view.Level] && InnerNode != null) + var height = context.Font.Height; + if (LevelsOpen[context.Level] && InnerNode != null) { - height += InnerNode.CalculateDrawnHeight(view); + height += InnerNode.CalculateDrawnHeight(context); } return height; } diff --git a/ReClass.NET/Nodes/UInt16Node.cs b/ReClass.NET/Nodes/UInt16Node.cs index c0b28138..47f72602 100644 --- a/ReClass.NET/Nodes/UInt16Node.cs +++ b/ReClass.NET/Nodes/UInt16Node.cs @@ -1,5 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Globalization; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -16,10 +17,10 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_UInt_16; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt16", value.ToString(), $"0x{value:X}"); + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "UInt16", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) @@ -30,7 +31,7 @@ public override void Update(HotSpot spot) { if (ushort.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && ushort.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); + spot.Process.WriteRemoteMemory(spot.Address, val); } } } diff --git a/ReClass.NET/Nodes/UInt32Node.cs b/ReClass.NET/Nodes/UInt32Node.cs index 19925380..ad97faae 100644 --- a/ReClass.NET/Nodes/UInt32Node.cs +++ b/ReClass.NET/Nodes/UInt32Node.cs @@ -1,5 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Globalization; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -16,10 +17,10 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_UInt_32; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt32", value.ToString(), $"0x{value:X}"); + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "UInt32", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) @@ -30,7 +31,7 @@ public override void Update(HotSpot spot) { if (uint.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && uint.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); + spot.Process.WriteRemoteMemory(spot.Address, val); } } } diff --git a/ReClass.NET/Nodes/UInt64Node.cs b/ReClass.NET/Nodes/UInt64Node.cs index b8a1b8f3..603eb784 100644 --- a/ReClass.NET/Nodes/UInt64Node.cs +++ b/ReClass.NET/Nodes/UInt64Node.cs @@ -1,5 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Globalization; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -16,10 +17,10 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_UInt_64; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt64", value.ToString(), $"0x{value:X}"); + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "UInt64", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) @@ -30,7 +31,7 @@ public override void Update(HotSpot spot) { if (ulong.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && ulong.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); + spot.Process.WriteRemoteMemory(spot.Address, val); } } } diff --git a/ReClass.NET/Nodes/UInt8Node.cs b/ReClass.NET/Nodes/UInt8Node.cs index 7f157a23..ce6def15 100644 --- a/ReClass.NET/Nodes/UInt8Node.cs +++ b/ReClass.NET/Nodes/UInt8Node.cs @@ -1,5 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Globalization; +using ReClassNET.Controls; using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.UI; @@ -16,10 +17,10 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_UInt_8; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - var value = ReadValueFromMemory(view.Memory); - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt8", value.ToString(), $"0x{value:X}"); + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "UInt8", value.ToString(), $"0x{value:X}"); } public override void Update(HotSpot spot) @@ -30,7 +31,7 @@ public override void Update(HotSpot spot) { if (byte.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && byte.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); + spot.Process.WriteRemoteMemory(spot.Address, val); } } } diff --git a/ReClass.NET/Nodes/UTF16TextNode.cs b/ReClass.NET/Nodes/UTF16TextNode.cs index 8a7cef54..9ea1bc6a 100644 --- a/ReClass.NET/Nodes/UTF16TextNode.cs +++ b/ReClass.NET/Nodes/UTF16TextNode.cs @@ -1,6 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Text; -using ReClassNET.UI; +using ReClassNET.Controls; namespace ReClassNET.Nodes { @@ -14,9 +14,9 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_UText; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return DrawText(view, x, y, "Text16"); + return DrawText(context, x, y, "Text16"); } } } diff --git a/ReClass.NET/Nodes/UTF16TextPtrNode.cs b/ReClass.NET/Nodes/UTF16TextPtrNode.cs index ec210c23..dc02f3f1 100644 --- a/ReClass.NET/Nodes/UTF16TextPtrNode.cs +++ b/ReClass.NET/Nodes/UTF16TextPtrNode.cs @@ -1,6 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Text; -using ReClassNET.UI; +using ReClassNET.Controls; namespace ReClassNET.Nodes { @@ -14,9 +14,9 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_UText_Pointer; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return DrawText(view, x, y, "Text16Ptr"); + return DrawText(context, x, y, "Text16Ptr"); } } } diff --git a/ReClass.NET/Nodes/UTF32TextNode.cs b/ReClass.NET/Nodes/UTF32TextNode.cs index 0868a3ae..f08d7735 100644 --- a/ReClass.NET/Nodes/UTF32TextNode.cs +++ b/ReClass.NET/Nodes/UTF32TextNode.cs @@ -1,6 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Text; -using ReClassNET.UI; +using ReClassNET.Controls; namespace ReClassNET.Nodes { @@ -14,9 +14,9 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_UText; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return DrawText(view, x, y, "Text32"); + return DrawText(context, x, y, "Text32"); } } } diff --git a/ReClass.NET/Nodes/UTF32TextPtrNode.cs b/ReClass.NET/Nodes/UTF32TextPtrNode.cs index 840717fd..3e7b920e 100644 --- a/ReClass.NET/Nodes/UTF32TextPtrNode.cs +++ b/ReClass.NET/Nodes/UTF32TextPtrNode.cs @@ -1,6 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Text; -using ReClassNET.UI; +using ReClassNET.Controls; namespace ReClassNET.Nodes { @@ -14,9 +14,9 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_UText_Pointer; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return DrawText(view, x, y, "Text32Ptr"); + return DrawText(context, x, y, "Text32Ptr"); } } } diff --git a/ReClass.NET/Nodes/UTF8TextNode.cs b/ReClass.NET/Nodes/UTF8TextNode.cs index 934c2d19..ef9c5ff6 100644 --- a/ReClass.NET/Nodes/UTF8TextNode.cs +++ b/ReClass.NET/Nodes/UTF8TextNode.cs @@ -1,6 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Text; -using ReClassNET.UI; +using ReClassNET.Controls; namespace ReClassNET.Nodes { @@ -14,9 +14,9 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Text; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return DrawText(view, x, y, "Text8"); + return DrawText(context, x, y, "Text8"); } } } diff --git a/ReClass.NET/Nodes/UTF8TextPtrNode.cs b/ReClass.NET/Nodes/UTF8TextPtrNode.cs index 71c7bfc8..d1173ff2 100644 --- a/ReClass.NET/Nodes/UTF8TextPtrNode.cs +++ b/ReClass.NET/Nodes/UTF8TextPtrNode.cs @@ -1,6 +1,6 @@ -using System.Drawing; +using System.Drawing; using System.Text; -using ReClassNET.UI; +using ReClassNET.Controls; namespace ReClassNET.Nodes { @@ -14,9 +14,9 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Text_Pointer; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return DrawText(view, x, y, "Text8Ptr"); + return DrawText(context, x, y, "Text8Ptr"); } } } diff --git a/ReClass.NET/Nodes/UnionNode.cs b/ReClass.NET/Nodes/UnionNode.cs index 80d43c85..f46108c2 100644 --- a/ReClass.NET/Nodes/UnionNode.cs +++ b/ReClass.NET/Nodes/UnionNode.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.Drawing; using System.Linq; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes @@ -43,50 +44,50 @@ public override void UpdateOffsets() } } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; var origY = y; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x = AddOpenCloseIcon(view, x, y); - x = AddIcon(view, x, y, Icons.Union, -1, HotSpotType.None); + x = AddOpenCloseIcon(context, x, y); + x = AddIcon(context, x, y, context.IconProvider.Union, -1, HotSpotType.None); var tx = x; - x = AddAddressOffset(view, x, y); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Union") + view.Font.Width; + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Union") + context.Font.Width; - x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"[Nodes: {Nodes.Count}, Size: {MemorySize}]") + view.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"[Nodes: {Nodes.Count}, Size: {MemorySize}]") + context.Font.Width; - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - y += view.Font.Height; + y += context.Font.Height; var size = new Size(x - origX, y - origY); - if (LevelsOpen[view.Level]) + if (LevelsOpen[context.Level]) { - var v = view.Clone(); - v.Settings = Program.Settings.Clone(); - v.Settings.ShowNodeAddress = false; - v.Address = view.Address + Offset; - v.Memory = view.Memory.Clone(); - v.Memory.Offset += Offset; + var innerContext = context.Clone(); + innerContext.Settings = Program.Settings.Clone(); + innerContext.Settings.ShowNodeAddress = false; + innerContext.Address = context.Address + Offset; + innerContext.Memory = context.Memory.Clone(); + innerContext.Memory.Offset += Offset; foreach (var node in Nodes) { - var innerSize = node.Draw(v, tx, y); + var innerSize = node.Draw(innerContext, tx, y); size.Width = Math.Max(size.Width, innerSize.Width + tx - origX); size.Height += innerSize.Height; @@ -98,17 +99,17 @@ public override Size Draw(ViewInfo view, int x, int y) return size; } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { if (IsHidden && !IsWrapped) { return HiddenHeight; } - var height = view.Font.Height; - if (LevelsOpen[view.Level]) + var height = context.Font.Height; + if (LevelsOpen[context.Level]) { - height += Nodes.Sum(n => n.CalculateDrawnHeight(view)); + height += Nodes.Sum(n => n.CalculateDrawnHeight(context)); } return height; } diff --git a/ReClass.NET/Nodes/Vector2Node.cs b/ReClass.NET/Nodes/Vector2Node.cs index b0b1643e..a3df104a 100644 --- a/ReClass.NET/Nodes/Vector2Node.cs +++ b/ReClass.NET/Nodes/Vector2Node.cs @@ -1,20 +1,11 @@ -using System.Drawing; -using System.Runtime.InteropServices; +using System.Drawing; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes { public class Vector2Node : BaseMatrixNode { - [StructLayout(LayoutKind.Explicit)] - private struct Vector2Data - { - [FieldOffset(0)] - public readonly float X; - [FieldOffset(4)] - public readonly float Y; - } - public override int ValueTypeSize => sizeof(float); public override int MemorySize => 2 * ValueTypeSize; @@ -25,21 +16,12 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Vector_2; } - public override Size Draw(ViewInfo view, int x2, int y2) + public override Size Draw(DrawContext context, int x2, int y2) { - return DrawVectorType(view, x2, y2, "Vector2", (ref int x, ref int y) => - { - var value = view.Memory.ReadObject(Offset); - - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "("); - x = AddText(view, x, y, view.Settings.ValueColor, 0, $"{value.X:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 1, $"{value.Y:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ")"); - }); + return DrawVectorType(context, x2, y2, "Vector2", 2); } - protected override int CalculateValuesHeight(ViewInfo view) + protected override int CalculateValuesHeight(DrawContext context) { return 0; } diff --git a/ReClass.NET/Nodes/Vector3Node.cs b/ReClass.NET/Nodes/Vector3Node.cs index 99c14b49..b2b84b25 100644 --- a/ReClass.NET/Nodes/Vector3Node.cs +++ b/ReClass.NET/Nodes/Vector3Node.cs @@ -1,22 +1,11 @@ -using System.Drawing; -using System.Runtime.InteropServices; +using System.Drawing; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes { public class Vector3Node : BaseMatrixNode { - [StructLayout(LayoutKind.Explicit)] - private struct Vector3Data - { - [FieldOffset(0)] - public readonly float X; - [FieldOffset(4)] - public readonly float Y; - [FieldOffset(8)] - public readonly float Z; - } - public override int ValueTypeSize => sizeof(float); public override int MemorySize => 3 * ValueTypeSize; @@ -27,23 +16,12 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Vector_3; } - public override Size Draw(ViewInfo view, int x2, int y2) + public override Size Draw(DrawContext context, int x2, int y2) { - return DrawVectorType(view, x2, y2, "Vector3", (ref int x, ref int y) => - { - var value = view.Memory.ReadObject(Offset); - - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "("); - x = AddText(view, x, y, view.Settings.ValueColor, 0, $"{value.X:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 1, $"{value.Y:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 2, $"{value.Z:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ")"); - }); + return DrawVectorType(context, x2, y2, "Vector3", 3); } - protected override int CalculateValuesHeight(ViewInfo view) + protected override int CalculateValuesHeight(DrawContext context) { return 0; } diff --git a/ReClass.NET/Nodes/Vector4Node.cs b/ReClass.NET/Nodes/Vector4Node.cs index 2fc086b4..54f1a43c 100644 --- a/ReClass.NET/Nodes/Vector4Node.cs +++ b/ReClass.NET/Nodes/Vector4Node.cs @@ -1,24 +1,11 @@ -using System.Drawing; -using System.Runtime.InteropServices; +using System.Drawing; +using ReClassNET.Controls; using ReClassNET.UI; namespace ReClassNET.Nodes { public class Vector4Node : BaseMatrixNode { - [StructLayout(LayoutKind.Explicit)] - private struct Vector4Data - { - [FieldOffset(0)] - public readonly float X; - [FieldOffset(4)] - public readonly float Y; - [FieldOffset(8)] - public readonly float Z; - [FieldOffset(12)] - public readonly float W; - } - public override int ValueTypeSize => sizeof(float); public override int MemorySize => 4 * ValueTypeSize; @@ -29,25 +16,12 @@ public override void GetUserInterfaceInfo(out string name, out Image icon) icon = Properties.Resources.B16x16_Button_Vector_4; } - public override Size Draw(ViewInfo view, int x2, int y2) + public override Size Draw(DrawContext context, int x2, int y2) { - return DrawVectorType(view, x2, y2, "Vector4", (ref int x, ref int y) => - { - var value = view.Memory.ReadObject(Offset); - - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "("); - x = AddText(view, x, y, view.Settings.ValueColor, 0, $"{value.X:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 1, $"{value.Y:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 2, $"{value.Z:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, view.Settings.ValueColor, 3, $"{value.W:0.000}"); - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ")"); - }); + return DrawVectorType(context, x2, y2, "Vector4", 4); } - protected override int CalculateValuesHeight(ViewInfo view) + protected override int CalculateValuesHeight(DrawContext context) { return 0; } diff --git a/ReClass.NET/Nodes/VirtualMethodNode.cs b/ReClass.NET/Nodes/VirtualMethodNode.cs index 88b80a61..22bae685 100644 --- a/ReClass.NET/Nodes/VirtualMethodNode.cs +++ b/ReClass.NET/Nodes/VirtualMethodNode.cs @@ -1,7 +1,7 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Drawing; -using ReClassNET.UI; +using ReClassNET.Controls; namespace ReClassNET.Nodes { @@ -21,9 +21,9 @@ public VirtualMethodNode() Name = string.Empty; } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { - return Draw(view, x, y, $"({Offset / IntPtr.Size})", MethodName); + return Draw(context, x, y, $"({Offset / IntPtr.Size})", MethodName); } } } diff --git a/ReClass.NET/Nodes/VirtualMethodTableNode.cs b/ReClass.NET/Nodes/VirtualMethodTableNode.cs index 76465ec9..9e82ab40 100644 --- a/ReClass.NET/Nodes/VirtualMethodTableNode.cs +++ b/ReClass.NET/Nodes/VirtualMethodTableNode.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.Drawing; using System.Linq; +using ReClassNET.Controls; using ReClassNET.Memory; using ReClassNET.UI; @@ -33,55 +34,54 @@ public override void Initialize() } } - public override Size Draw(ViewInfo view, int x, int y) + public override Size Draw(DrawContext context, int x, int y) { if (IsHidden && !IsWrapped) { - return DrawHidden(view, x, y); + return DrawHidden(context, x, y); } var origX = x; var origY = y; - AddSelection(view, x, y, view.Font.Height); + AddSelection(context, x, y, context.Font.Height); - x = AddOpenCloseIcon(view, x, y); - x = AddIcon(view, x, y, Icons.VTable, HotSpot.NoneId, HotSpotType.None); + x = AddOpenCloseIcon(context, x, y); + x = AddIcon(context, x, y, context.IconProvider.VirtualTable, HotSpot.NoneId, HotSpotType.None); var tx = x; - x = AddAddressOffset(view, x, y); + x = AddAddressOffset(context, x, y); - x = AddText(view, x, y, view.Settings.VTableColor, HotSpot.NoneId, $"VTable[{Nodes.Count}]") + view.Font.Width; + x = AddText(context, x, y, context.Settings.VTableColor, HotSpot.NoneId, $"VTable[{Nodes.Count}]") + context.Font.Width; if (!IsWrapped) { - x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; } - x = AddComment(view, x, y); + x = AddComment(context, x, y); - DrawInvalidMemoryIndicatorIcon(view, y); - AddContextDropDownIcon(view, y); - AddDeleteIcon(view, y); + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); - y += view.Font.Height; + y += context.Font.Height; var size = new Size(x - origX, y - origY); - if (LevelsOpen[view.Level]) + if (LevelsOpen[context.Level]) { - var ptr = view.Memory.ReadIntPtr(Offset); + var ptr = context.Memory.ReadIntPtr(Offset); memory.Size = Nodes.Count * IntPtr.Size; - memory.Process = view.Memory.Process; - memory.Update(ptr); + memory.UpdateFrom(context.Process, ptr); - var v = view.Clone(); - v.Address = ptr; - v.Memory = memory; + var innerContext = context.Clone(); + innerContext.Address = ptr; + innerContext.Memory = memory; foreach (var node in Nodes) { - var innerSize = node.Draw(v, tx, y); + var innerSize = node.Draw(innerContext, tx, y); size.Width = Math.Max(size.Width, innerSize.Width + tx - origX); size.Height += innerSize.Height; @@ -93,17 +93,17 @@ public override Size Draw(ViewInfo view, int x, int y) return size; } - public override int CalculateDrawnHeight(ViewInfo view) + public override int CalculateDrawnHeight(DrawContext context) { if (IsHidden && !IsWrapped) { return HiddenHeight; } - var height = view.Font.Height; - if (LevelsOpen[view.Level]) + var height = context.Font.Height; + if (LevelsOpen[context.Level]) { - height += Nodes.Sum(n => n.CalculateDrawnHeight(view)); + height += Nodes.Sum(n => n.CalculateDrawnHeight(context)); } return height; } diff --git a/ReClass.NET/Plugins/PluginInfo.cs b/ReClass.NET/Plugins/PluginInfo.cs index ccf29df2..c9c9e72f 100644 --- a/ReClass.NET/Plugins/PluginInfo.cs +++ b/ReClass.NET/Plugins/PluginInfo.cs @@ -79,7 +79,7 @@ public void Dispose() } catch { - + // ignored } } diff --git a/ReClass.NET/Program.cs b/ReClass.NET/Program.cs index 2a65548b..f28cb0bd 100644 --- a/ReClass.NET/Program.cs +++ b/ReClass.NET/Program.cs @@ -1,4 +1,5 @@ -using System; +using System; +using System.Diagnostics; using System.Drawing; using System.Globalization; using System.Windows.Forms; @@ -43,10 +44,11 @@ static void Main(string[] args) try { DpiUtil.ConfigureProcess(); + DpiUtil.TrySetDpiFromCurrentDesktop(); } catch { - + // ignored } MonoSpaceFont = new FontEx @@ -66,6 +68,12 @@ static void Main(string[] args) Settings = SettingsSerializer.Load(); Logger = new GuiLogger(); + if (!NativeMethods.IsUnix() && Settings.RunAsAdmin && !WinUtil.IsAdministrator) + { + WinUtil.RunElevated(Process.GetCurrentProcess().MainModule?.FileName, args.Length > 0 ? string.Join(" ", args) : null); + return; + } + #if !DEBUG try { @@ -99,6 +107,7 @@ public static void ShowException(Exception ex) var msg = new ExceptionMessageBox(ex) { + Beep = false, ShowToolBar = true, Symbol = ExceptionMessageBoxSymbol.Error }; diff --git a/ReClass.NET/Project/CppTypeMapping.cs b/ReClass.NET/Project/CppTypeMapping.cs index eb90a174..03e1bc48 100644 --- a/ReClass.NET/Project/CppTypeMapping.cs +++ b/ReClass.NET/Project/CppTypeMapping.cs @@ -1,4 +1,4 @@ -using System.Xml.Linq; +using System.Xml.Linq; using ReClassNET.Util; namespace ReClassNET.Project @@ -11,11 +11,13 @@ public class CppTypeMapping public string TypeInt16 { get; set; } = "int16_t"; public string TypeInt32 { get; set; } = "int32_t"; public string TypeInt64 { get; set; } = "int64_t"; + public string TypeNInt { get; set; } = "ptrdiff_t"; public string TypeUInt8 { get; set; } = "uint8_t"; public string TypeUInt16 { get; set; } = "uint16_t"; public string TypeUInt32 { get; set; } = "uint32_t"; public string TypeUInt64 { get; set; } = "uint64_t"; + public string TypeNUInt { get; set; } = "size_t"; public string TypeFloat { get; set; } = "float"; public string TypeDouble { get; set; } = "double"; @@ -43,10 +45,12 @@ internal XElement Serialize(string name) XElementSerializer.ToXml(nameof(TypeInt16), TypeInt16), XElementSerializer.ToXml(nameof(TypeInt32), TypeInt32), XElementSerializer.ToXml(nameof(TypeInt64), TypeInt64), + XElementSerializer.ToXml(nameof(TypeNInt), TypeNInt), XElementSerializer.ToXml(nameof(TypeUInt8), TypeUInt8), XElementSerializer.ToXml(nameof(TypeUInt16), TypeUInt16), XElementSerializer.ToXml(nameof(TypeUInt32), TypeUInt32), XElementSerializer.ToXml(nameof(TypeUInt64), TypeUInt64), + XElementSerializer.ToXml(nameof(TypeNUInt), TypeNUInt), XElementSerializer.ToXml(nameof(TypeFloat), TypeFloat), XElementSerializer.ToXml(nameof(TypeDouble), TypeDouble), XElementSerializer.ToXml(nameof(TypeVector2), TypeVector2), @@ -69,10 +73,12 @@ internal void Deserialize(XElement element) XElementSerializer.TryRead(element, nameof(TypeInt16), e => TypeInt16 = XElementSerializer.ToString(e)); XElementSerializer.TryRead(element, nameof(TypeInt32), e => TypeInt32 = XElementSerializer.ToString(e)); XElementSerializer.TryRead(element, nameof(TypeInt64), e => TypeInt64 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeNInt), e => TypeNInt = XElementSerializer.ToString(e)); XElementSerializer.TryRead(element, nameof(TypeUInt8), e => TypeUInt8 = XElementSerializer.ToString(e)); XElementSerializer.TryRead(element, nameof(TypeUInt16), e => TypeUInt16 = XElementSerializer.ToString(e)); XElementSerializer.TryRead(element, nameof(TypeUInt32), e => TypeUInt32 = XElementSerializer.ToString(e)); XElementSerializer.TryRead(element, nameof(TypeUInt64), e => TypeUInt64 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeNUInt), e => TypeNUInt = XElementSerializer.ToString(e)); XElementSerializer.TryRead(element, nameof(TypeFloat), e => TypeFloat = XElementSerializer.ToString(e)); XElementSerializer.TryRead(element, nameof(TypeDouble), e => TypeDouble = XElementSerializer.ToString(e)); XElementSerializer.TryRead(element, nameof(TypeVector2), e => TypeVector2 = XElementSerializer.ToString(e)); diff --git a/ReClass.NET/Project/EnumDescription.cs b/ReClass.NET/Project/EnumDescription.cs index e40d647c..6c72596b 100644 --- a/ReClass.NET/Project/EnumDescription.cs +++ b/ReClass.NET/Project/EnumDescription.cs @@ -26,7 +26,7 @@ public enum UnderlyingTypeSize public void SetData(bool useFlagsMode, UnderlyingTypeSize size, IEnumerable> values) { - var temp = values.OrderBy(t => t.Key).ToList(); + var temp = values.OrderBy(t => t.Value).ToList(); if (useFlagsMode) { diff --git a/ReClass.NET/Project/ReClassNetProject.cs b/ReClass.NET/Project/ReClassNetProject.cs index c91a3286..90f4b5ca 100644 --- a/ReClass.NET/Project/ReClassNetProject.cs +++ b/ReClass.NET/Project/ReClassNetProject.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; @@ -59,14 +59,14 @@ public void AddClass(ClassNode node) ClassAdded?.Invoke(node); } - public bool ContainsClass(NodeUuid uuid) + public bool ContainsClass(Guid uuid) { Contract.Requires(uuid != null); return classes.Any(c => c.Uuid.Equals(uuid)); } - public ClassNode GetClassByUuid(NodeUuid uuid) + public ClassNode GetClassByUuid(Guid uuid) { Contract.Requires(uuid != null); diff --git a/ReClass.NET/Properties/Resources.Designer.cs b/ReClass.NET/Properties/Resources.Designer.cs index 538bd01c..3d412074 100644 --- a/ReClass.NET/Properties/Resources.Designer.cs +++ b/ReClass.NET/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace ReClassNET.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -510,6 +510,26 @@ internal static System.Drawing.Bitmap B16x16_Button_Matrix_4x4 { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_NInt { + get { + object obj = ResourceManager.GetObject("B16x16_Button_NInt", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_NUInt { + get { + object obj = ResourceManager.GetObject("B16x16_Button_NUInt", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1351,7 +1371,7 @@ internal static System.Drawing.Bitmap B32x32_Plugin { } /// - /// Looks up a localized string similar to 2019/03/31 20:34:22 + /// Looks up a localized string similar to 2020/10/17 09:45:04 ///. /// internal static string BuildDate { diff --git a/ReClass.NET/Properties/Resources.resx b/ReClass.NET/Properties/Resources.resx index 7c64e77f..48c2c826 100644 --- a/ReClass.NET/Properties/Resources.resx +++ b/ReClass.NET/Properties/Resources.resx @@ -511,4 +511,10 @@ ..\Resources\Images\B16x16_Button_Union.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Button_NInt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Button_NUInt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ReClass.NET/Properties/Settings.Designer.cs b/ReClass.NET/Properties/Settings.Designer.cs index 8d3e4a41..cfa4e29c 100644 --- a/ReClass.NET/Properties/Settings.Designer.cs +++ b/ReClass.NET/Properties/Settings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -12,7 +12,7 @@ namespace ReClassNET.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/ReClass.NET/ReClass.NET.csproj b/ReClass.NET/ReClass.NET.csproj index 6c1157b2..0c990cc2 100644 --- a/ReClass.NET/ReClass.NET.csproj +++ b/ReClass.NET/ReClass.NET.csproj @@ -9,12 +9,14 @@ Properties ReClassNET ReClass.NET - v4.6.1 + v4.7.2 512 true 0 + + latest x86 @@ -23,7 +25,7 @@ false $(SolutionDir)bin\Debug\x86\ $(SolutionDir)obj\$(Configuration)\x86\$(MSBuildProjectName)\ - TRACE;DEBUG;RECLASSNET32 + TRACE;DEBUG prompt 4 false @@ -77,7 +79,7 @@ true $(SolutionDir)bin\Release\x86\ $(SolutionDir)obj\$(Configuration)\x86\$(MSBuildProjectName)\ - TRACE;RECLASSNET32;RELEASE + TRACE;RELEASE prompt 4 @@ -128,21 +130,20 @@ - - - + + - + - + @@ -171,6 +172,11 @@ + + + + + @@ -238,17 +244,22 @@ + + + + + - + @@ -259,10 +270,14 @@ + + + + @@ -276,13 +291,14 @@ - + + - + Component @@ -297,7 +313,6 @@ - Form @@ -306,13 +321,14 @@ - + + - + UserControl - + ProjectView.cs @@ -321,13 +337,13 @@ CodeForm.cs - + UserControl - + ColorBox.cs - + Component @@ -339,45 +355,50 @@ LogForm.cs - + UserControl - + DualValueBox.cs - + Component - - + + UserControl - + HotkeyBox.cs - + Component + - + Component - + UserControl - + MemoryRecordList.cs - + MemoryViewControl.cs - + Component + + + + @@ -388,7 +409,6 @@ - @@ -406,12 +426,10 @@ SettingsForm.cs - - + Component - Form @@ -427,7 +445,7 @@ - + UserControl @@ -493,20 +511,18 @@ - - UserControl - - - + + + + - @@ -548,7 +564,7 @@ ScannerForm.cs - + ProjectView.cs Designer @@ -559,19 +575,19 @@ MainForm.cs Designer - + ColorBox.cs - + DualValueBox.cs - + HotkeyBox.cs - + MemoryRecordList.cs - + MemoryViewControl.cs @@ -992,11 +1008,6 @@ - - - 1.0.109.2 - - @@ -1006,6 +1017,12 @@ + + + + + + powershell -Command "((Get-Date).ToUniversalTime()).ToString(\"yyyy\/MM\/dd HH:mm:ss\") | Out-File '$(ProjectDir)Resources\BuildDate.txt'" diff --git a/ReClass.NET/Resources/Images/B16x16_Button_NInt.png b/ReClass.NET/Resources/Images/B16x16_Button_NInt.png new file mode 100644 index 00000000..0e07b576 Binary files /dev/null and b/ReClass.NET/Resources/Images/B16x16_Button_NInt.png differ diff --git a/ReClass.NET/Resources/Images/B16x16_Button_NUInt.png b/ReClass.NET/Resources/Images/B16x16_Button_NUInt.png new file mode 100644 index 00000000..0c8f5a18 Binary files /dev/null and b/ReClass.NET/Resources/Images/B16x16_Button_NUInt.png differ diff --git a/ReClass.NET/Settings.cs b/ReClass.NET/Settings.cs index 16421515..b5d9268b 100644 --- a/ReClass.NET/Settings.cs +++ b/ReClass.NET/Settings.cs @@ -1,4 +1,5 @@ using System.Drawing; +using System.Text; using ReClassNET.Util; namespace ReClassNET @@ -11,6 +12,10 @@ public class Settings public bool StayOnTop { get; set; } = false; + public bool RunAsAdmin { get; set; } = false; + + public bool RandomizeWindowTitle { get; set; } = false; + // Node Drawing Settings public bool ShowNodeAddress { get; set; } = true; @@ -21,6 +26,8 @@ public class Settings public bool HighlightChangedValues { get; set; } = true; + public Encoding RawDataEncoding { get; set; } = Encoding.GetEncoding(1252); /* Windows-1252 */ + // Comment Drawing Settings public bool ShowCommentFloat { get; set; } = true; diff --git a/ReClass.NET/Symbols/ComDisposableWrapper.cs b/ReClass.NET/Symbols/ComDisposableWrapper.cs index aedd3224..8666bb75 100644 --- a/ReClass.NET/Symbols/ComDisposableWrapper.cs +++ b/ReClass.NET/Symbols/ComDisposableWrapper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Runtime.InteropServices; @@ -6,26 +6,26 @@ namespace ReClassNET.Symbols { class DisposableWrapper : IDisposable { - protected object obj; + protected object Object; [ContractInvariantMethod] private void ObjectInvariants() { - Contract.Invariant(obj != null); + Contract.Invariant(Object != null); } public DisposableWrapper(object obj) { Contract.Requires(obj != null); - this.obj = obj; + this.Object = obj; } protected virtual void Dispose(bool disposing) { if (disposing) { - Marshal.ReleaseComObject(obj); + Marshal.ReleaseComObject(Object); } } @@ -44,7 +44,7 @@ public void Dispose() class ComDisposableWrapper : DisposableWrapper { - public T Interface => (T)obj; + public T Interface => (T)Object; public ComDisposableWrapper(T com) : base(com) diff --git a/ReClass.NET/Symbols/SymbolReader.cs b/ReClass.NET/Symbols/SymbolReader.cs index c3df31b6..230880b2 100644 --- a/ReClass.NET/Symbols/SymbolReader.cs +++ b/ReClass.NET/Symbols/SymbolReader.cs @@ -5,7 +5,6 @@ using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.Native; -using ReClassNET.Util; namespace ReClassNET.Symbols { @@ -49,10 +48,8 @@ public static void TryResolveSymbolsForModule(Module module, string searchPath) { Contract.Requires(module != null); - using (var diaSource = new ComDisposableWrapper(new DiaSource())) - { - diaSource.Interface.loadDataForExe(module.Path, searchPath, null); - } + using var diaSource = new ComDisposableWrapper(new DiaSource()); + diaSource.Interface.loadDataForExe(module.Path, searchPath, null); } public static SymbolReader FromModule(Module module, string searchPath) @@ -93,12 +90,11 @@ public string GetSymbolString(IntPtr address, Module module) diaSession.Interface.findSymbolByRVA((uint)rva.ToInt32(), SymTagEnum.SymTagNull, out var diaSymbol); if (diaSymbol != null) { - using (var symbol = new ComDisposableWrapper(diaSymbol)) - { - var sb = new StringBuilder(); - ReadSymbol(symbol.Interface, sb); - return sb.ToString(); - } + using var symbol = new ComDisposableWrapper(diaSymbol); + + var sb = new StringBuilder(); + ReadSymbol(symbol.Interface, sb); + return sb.ToString(); } return null; } @@ -134,10 +130,9 @@ private void ReadSymbolType(IDiaSymbol symbol, StringBuilder sb) if (symbol.type != null) { - using (var type = new ComDisposableWrapper(symbol.type)) - { - ReadType(type.Interface, sb); - } + using var type = new ComDisposableWrapper(symbol.type); + + ReadType(type.Interface, sb); } } diff --git a/ReClass.NET/Symbols/SymbolStore.cs b/ReClass.NET/Symbols/SymbolStore.cs index 5f9d3f16..80aee721 100644 --- a/ReClass.NET/Symbols/SymbolStore.cs +++ b/ReClass.NET/Symbols/SymbolStore.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.IO; @@ -9,22 +9,21 @@ using ReClassNET.Extensions; using ReClassNET.Memory; using ReClassNET.Native; -using ReClassNET.Util; namespace ReClassNET.Symbols { class DiaUtil : IDisposable { - public readonly IDiaDataSource diaDataSource; - public readonly IDiaSession diaSession; + public readonly IDiaDataSource DiaDataSource; + public readonly IDiaSession DiaSession; public DiaUtil(string pdbName) { Contract.Requires(pdbName != null); - diaDataSource = new DiaSource(); - diaDataSource.loadDataFromPdb(pdbName); - diaDataSource.openSession(out diaSession); + DiaDataSource = new DiaSource(); + DiaDataSource.loadDataFromPdb(pdbName); + DiaDataSource.openSession(out DiaSession); } private bool isDisposed; @@ -33,8 +32,8 @@ protected virtual void Dispose(bool disposing) { if (!isDisposed) { - Marshal.ReleaseComObject(diaSession); - Marshal.ReleaseComObject(diaDataSource); + Marshal.ReleaseComObject(DiaSession); + Marshal.ReleaseComObject(DiaDataSource); isDisposed = true; } @@ -89,25 +88,23 @@ public SymbolStore() private void ResolveSearchPath() { - using (var vsKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VisualStudio")) + using var vsKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VisualStudio"); + if (vsKey == null) { - if (vsKey != null) + return; + } + + foreach (var subKeyName in vsKey.GetSubKeyNames()) + { + using var debuggerKey = vsKey.OpenSubKey($@"{subKeyName}\Debugger"); + if (debuggerKey?.GetValue("SymbolCacheDir") is string symbolCacheDir) { - foreach (var subKeyName in vsKey.GetSubKeyNames()) + if (Directory.Exists(symbolCacheDir)) { - using (var debuggerKey = vsKey.OpenSubKey($@"{subKeyName}\Debugger")) - { - if (debuggerKey?.GetValue("SymbolCacheDir") is string symbolCacheDir) - { - if (Directory.Exists(symbolCacheDir)) - { - SymbolCachePath = symbolCacheDir; - } - - return; - } - } + SymbolCachePath = symbolCacheDir; } + + break; } } } diff --git a/ReClass.NET/UI/BannerFactory.cs b/ReClass.NET/UI/BannerFactory.cs index 7e4c697d..87448e09 100644 --- a/ReClass.NET/UI/BannerFactory.cs +++ b/ReClass.NET/UI/BannerFactory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Drawing; @@ -113,13 +113,10 @@ public static Image CreateBanner(int bannerWidth, int bannerHeight, Image icon, private static void DrawText(Graphics g, string text, int x, int y, Font font, Color color) { - using (var brush = new SolidBrush(color)) - { - using (var format = new StringFormat(StringFormatFlags.FitBlackBox | StringFormatFlags.NoClip)) - { - g.DrawString(text, font, brush, x, y, format); - } - } + using var brush = new SolidBrush(color); + using var format = new StringFormat(StringFormatFlags.FitBlackBox | StringFormatFlags.NoClip); + + g.DrawString(text, font, brush, x, y, format); } private static int DpiScaleInt(int x, int height) => (int)Math.Round((x * height) / (double)StdHeight); diff --git a/ReClass.NET/UI/DpiUtil.cs b/ReClass.NET/UI/DpiUtil.cs index 398a090f..58b8b7e0 100644 --- a/ReClass.NET/UI/DpiUtil.cs +++ b/ReClass.NET/UI/DpiUtil.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.Drawing; using System.Drawing.Drawing2D; @@ -9,151 +9,126 @@ namespace ReClassNET.UI { public static class DpiUtil { - private const int StdDpi = 96; + public const int DefalutDpi = 96; - private static bool initialized; - - private static int dpiX = StdDpi; - private static int dpiY = StdDpi; + private static int dpiX = DefalutDpi; + private static int dpiY = DefalutDpi; private static double scaleX = 1.0; private static double scaleY = 1.0; - public static bool ScalingRequired + public static void ConfigureProcess() { - get - { - if (Program.DesignMode) - { - return false; - } - - EnsureInitialized(); - - return dpiX != StdDpi || dpiY != StdDpi; - } + NativeMethods.SetProcessDpiAwareness(); } - private static void EnsureInitialized() + public static void SetDpi(int x, int y) { - if (initialized) + dpiX = x; + dpiY = y; + + if (dpiX <= 0 || dpiY <= 0) { - return; + dpiX = DefalutDpi; + dpiY = DefalutDpi; } + scaleX = dpiX / (double)DefalutDpi; + scaleY = dpiY / (double)DefalutDpi; + } + + public static void TrySetDpiFromCurrentDesktop() + { try { - using (var g = Graphics.FromHwnd(IntPtr.Zero)) - { - dpiX = (int)g.DpiX; - dpiY = (int)g.DpiY; - - if (dpiX <= 0 || dpiY <= 0) - { - dpiX = StdDpi; - dpiY = StdDpi; - } - } + using var g = Graphics.FromHwnd(IntPtr.Zero); + + SetDpi((int)g.DpiX, (int)g.DpiY); } catch { - + // ignored } - - scaleX = dpiX / (double)StdDpi; - scaleY = dpiY / (double)StdDpi; - - initialized = true; - } - - public static void ConfigureProcess() - { - NativeMethods.SetProcessDpiAwareness(); } public static int ScaleIntX(int i) { - EnsureInitialized(); - return (int)Math.Round(i * scaleX); } public static int ScaleIntY(int i) { - EnsureInitialized(); - return (int)Math.Round(i * scaleY); } - public static Image ScaleImage(Image img) + public static Image ScaleImage(Image sourceImage) { - if (img == null) + if (sourceImage == null) { return null; } - int w = img.Width; - int h = img.Height; - int sw = ScaleIntX(w); - int sh = ScaleIntY(h); + var width = sourceImage.Width; + var height = sourceImage.Height; + var scaledWidth = ScaleIntX(width); + var scaledHeight = ScaleIntY(height); - if (w == sw && h == sh) + if (width == scaledWidth && height == scaledHeight) { - return img; + return sourceImage; } - return ScaleImage(img, sw, sh); + return ScaleImage(sourceImage, scaledWidth, scaledHeight); } - private static Image ScaleImage(Image img, int w, int h) + private static Image ScaleImage(Image sourceImage, int width, int height) { - Contract.Requires(img != null); - Contract.Requires(w >= 0); - Contract.Requires(h >= 0); + Contract.Requires(sourceImage != null); + Contract.Requires(width >= 0); + Contract.Requires(height >= 0); - var bmp = new Bitmap(w, h, PixelFormat.Format32bppArgb); - using (Graphics g = Graphics.FromImage(bmp)) - { - g.Clear(Color.Transparent); + var scaledImage = new Bitmap(width, height, PixelFormat.Format32bppArgb); + + using var g = Graphics.FromImage(scaledImage); + g.Clear(Color.Transparent); - g.SmoothingMode = SmoothingMode.HighQuality; - g.CompositingQuality = CompositingQuality.HighQuality; + g.SmoothingMode = SmoothingMode.HighQuality; + g.CompositingQuality = CompositingQuality.HighQuality; - var wSrc = img.Width; - var hSrc = img.Height; + var sourceWidth = sourceImage.Width; + var sourceHeight = sourceImage.Height; - InterpolationMode im = InterpolationMode.HighQualityBicubic; - if (wSrc > 0 && hSrc > 0) + var interpolationMode = InterpolationMode.HighQualityBicubic; + if (sourceWidth > 0 && sourceHeight > 0) + { + if ((width % sourceWidth) == 0 && (height % sourceHeight) == 0) { - if ((w % wSrc) == 0 && (h % hSrc) == 0) - { - im = InterpolationMode.NearestNeighbor; - } + interpolationMode = InterpolationMode.NearestNeighbor; } + } - g.InterpolationMode = im; + g.InterpolationMode = interpolationMode; - var rSource = new RectangleF(0.0f, 0.0f, wSrc, hSrc); - var rDest = new RectangleF(0.0f, 0.0f, w, h); - AdjustScaleRects(ref rSource, ref rDest); + var srcRect = new RectangleF(0.0f, 0.0f, sourceWidth, sourceHeight); + var destRect = new RectangleF(0.0f, 0.0f, width, height); + AdjustScaleRects(ref srcRect, ref destRect); - g.DrawImage(img, rDest, rSource, GraphicsUnit.Pixel); - } + g.DrawImage(sourceImage, destRect, srcRect, GraphicsUnit.Pixel); - return bmp; + return scaledImage; } - private static void AdjustScaleRects(ref RectangleF rSource, ref RectangleF rDest) + private static void AdjustScaleRects(ref RectangleF srcRect, ref RectangleF destRect) { - if (rDest.Width > rSource.Width) - rSource.X = rSource.X - 0.5f; - if (rDest.Height > rSource.Height) - rSource.Y = rSource.Y - 0.5f; - - if (rDest.Width < rSource.Width) - rSource.X = rSource.X + 0.5f; - if (rDest.Height < rSource.Height) - rSource.Y = rSource.Y + 0.5f; + if (destRect.Width > srcRect.Width) + srcRect.X -= 0.5f; + if (destRect.Height > srcRect.Height) + srcRect.Y -= 0.5f; + + if (destRect.Width < srcRect.Width) + srcRect.X += 0.5f; + if (destRect.Height < srcRect.Height) + srcRect.Y += 0.5f; } } } diff --git a/ReClass.NET/UI/HotSpot.cs b/ReClass.NET/UI/HotSpot.cs index fc5e1dfc..3a0d4bc0 100644 --- a/ReClass.NET/UI/HotSpot.cs +++ b/ReClass.NET/UI/HotSpot.cs @@ -42,6 +42,8 @@ public class HotSpot public IntPtr Address { get; set; } + public RemoteProcess Process { get; set; } + public MemoryBuffer Memory { get; set; } } } diff --git a/ReClass.NET/UI/HotSpotTextBox.cs b/ReClass.NET/UI/HotSpotTextBox.cs deleted file mode 100644 index be90dc8d..00000000 --- a/ReClass.NET/UI/HotSpotTextBox.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; - -namespace ReClassNET.UI -{ - public class HotSpotTextBox : TextBox - { - private HotSpot hotSpot; - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public HotSpot HotSpot - { - get => hotSpot; - set - { - if (hotSpot != value) - { - hotSpot = value; - - Left = hotSpot.Rect.Left + 2; - Top = hotSpot.Rect.Top; - Width = hotSpot.Rect.Width; - Height = hotSpot.Rect.Height; - - MinimumWidth = Width; - - Text = hotSpot.Text.Trim(); - } - } - } - - public int MinimumWidth { get; set; } - - private FontEx font; - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public new FontEx Font - { - get => font; - set - { - if (font != value) - { - font = value; - - base.Font = font.Font; - } - } - } - - public event EventHandler Committed; - - public HotSpotTextBox() - { - BorderStyle = BorderStyle.None; - } - - protected override void OnVisibleChanged(EventArgs e) - { - base.OnVisibleChanged(e); - - if (Visible) - { - if (HotSpot != null) - { - Focus(); - Select(0, TextLength); - } - } - } - - protected override void OnKeyDown(KeyEventArgs e) - { - if (e.KeyCode == Keys.Enter) - { - OnCommit(); - - e.Handled = true; - e.SuppressKeyPress = true; - } - - base.OnKeyDown(e); - } - - /*protected override void OnLeave(EventArgs e) - { - base.OnLeave(e); - - OnCommit(); - }*/ - - protected override void OnTextChanged(EventArgs e) - { - base.OnTextChanged(e); - - var w = (TextLength + 1) * font.Width; - if (w > MinimumWidth) - { - Width = w; - } - } - - private void OnCommit() - { - Visible = false; - - hotSpot.Text = Text.Trim(); - - Committed?.Invoke(this, EventArgs.Empty); - } - } -} diff --git a/ReClass.NET/UI/IconProvider.cs b/ReClass.NET/UI/IconProvider.cs new file mode 100644 index 00000000..f60bce26 --- /dev/null +++ b/ReClass.NET/UI/IconProvider.cs @@ -0,0 +1,31 @@ +using System.Drawing; + +namespace ReClassNET.UI +{ + public class IconProvider + { + public int Dimensions { get; } = DpiUtil.ScaleIntX(16); + + public Image OpenCloseOpen { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Open_Icon); + public Image OpenCloseClosed { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Closed_Icon); + public Image Delete { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Button_Delete); + public Image DropArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Button_Drop_Down); + public Image Class { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Class_Type); + public Image Enum { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Enum_Type); + public Image Array { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Array_Type); + public Image Union => Array; + public Image LeftArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Left_Button); + public Image RightArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Right_Button); + public Image Change { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Exchange_Button); + public Image Unsigned { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Unsigned_Type); + public Image Signed { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Signed_Type); + public Image Float { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Float_Type); + public Image Double { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Double_Type); + public Image Vector { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Vector_Type); + public Image Matrix { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Matrix_Type); + public Image Text { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Text_Type); + public Image Pointer { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Pointer_Type); + public Image Function { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Function_Type); + public Image VirtualTable { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Interface_Type); + } +} diff --git a/ReClass.NET/UI/Icons.cs b/ReClass.NET/UI/Icons.cs deleted file mode 100644 index 0ae65d0e..00000000 --- a/ReClass.NET/UI/Icons.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Drawing; - -namespace ReClassNET.UI -{ - public class Icons - { - public static int Dimensions { get; } = DpiUtil.ScaleIntX(16); - - public static Image OpenCloseOpen { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Open_Icon); - public static Image OpenCloseClosed { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Closed_Icon); - public static Image Delete { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Button_Delete); - public static Image DropArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Button_Drop_Down); - public static Image Class { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Class_Type); - public static Image Enum { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Enum_Type); - public static Image Array { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Array_Type); - public static Image Union => Array; - public static Image LeftArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Left_Button); - public static Image RightArrow { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Right_Button); - public static Image Change { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Exchange_Button); - public static Image Unsigned { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Unsigned_Type); - public static Image Signed { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Signed_Type); - public static Image Float { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Float_Type); - public static Image Double { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Double_Type); - public static Image Vector { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Vector_Type); - public static Image Matrix { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Matrix_Type); - public static Image Text { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Text_Type); - public static Image Pointer { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Pointer_Type); - public static Image Function { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Function_Type); - public static Image VTable { get; } = DpiUtil.ScaleImage(Properties.Resources.B16x16_Interface_Type); - } -} diff --git a/ReClass.NET/UI/LinkedWindowFeatures.cs b/ReClass.NET/UI/LinkedWindowFeatures.cs index 02f3f3e9..36dab03e 100644 --- a/ReClass.NET/UI/LinkedWindowFeatures.cs +++ b/ReClass.NET/UI/LinkedWindowFeatures.cs @@ -1,15 +1,12 @@ -using System; -using System.Collections.Generic; +using System; using System.Diagnostics.Contracts; using System.Linq; using System.Windows.Forms; -using ReClassNET.CodeGenerator; using ReClassNET.Debugger; using ReClassNET.Forms; using ReClassNET.MemoryScanner; using ReClassNET.MemoryScanner.Comparer; using ReClassNET.Nodes; -using ReClassNET.Project; namespace ReClassNET.UI { @@ -22,10 +19,10 @@ public static ClassNode CreateClassAtAddress(IntPtr address, bool addDefaultByte var classView = Program.MainForm.ProjectView; var node = ClassNode.Create(); - node.Address = address; + node.AddressFormula = address.ToString("X"); if (addDefaultBytes) { - node.AddBytes(64); + node.AddBytes(16 * IntPtr.Size); } classView.SelectedClass = node; @@ -56,7 +53,7 @@ public static void SetCurrentClassAddress(IntPtr address) return; } - classNode.Address = address; + classNode.AddressFormula = address.ToString("X"); } public static void FindWhatInteractsWithAddress(IntPtr address, int size, bool writeOnly) diff --git a/ReClass.NET/UI/MemoryViewControl.Designer.cs b/ReClass.NET/UI/MemoryViewControl.Designer.cs deleted file mode 100644 index 5642eba4..00000000 --- a/ReClass.NET/UI/MemoryViewControl.Designer.cs +++ /dev/null @@ -1,75 +0,0 @@ -namespace ReClassNET.UI -{ - partial class MemoryViewControl - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Komponenten-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.repaintTimer = new System.Windows.Forms.Timer(this.components); - this.editBox = new ReClassNET.UI.HotSpotTextBox(); - this.nodeInfoToolTip = new System.Windows.Forms.ToolTip(this.components); - this.SuspendLayout(); - // - // repaintTimer - // - this.repaintTimer.Enabled = true; - this.repaintTimer.Interval = 250; - this.repaintTimer.Tick += new System.EventHandler(this.repaintTimer_Tick); - // - // editBox - // - this.editBox.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.editBox.Location = new System.Drawing.Point(36, 81); - this.editBox.MinimumWidth = 0; - this.editBox.Name = "editBox"; - this.editBox.Size = new System.Drawing.Size(100, 13); - this.editBox.TabIndex = 1; - this.editBox.TabStop = false; - this.editBox.Visible = false; - this.editBox.Committed += new System.EventHandler(this.editBox_Committed); - // - // nodeInfoToolTip - // - this.nodeInfoToolTip.ShowAlways = true; - // - // MemoryViewControl - // - this.Controls.Add(this.editBox); - this.DoubleBuffered = true; - this.Name = "MemoryViewControl"; - this.Size = new System.Drawing.Size(150, 162); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private System.Windows.Forms.Timer repaintTimer; - private HotSpotTextBox editBox; - private System.Windows.Forms.ToolTip nodeInfoToolTip; - } -} diff --git a/ReClass.NET/UI/NodeTypesBuilder.cs b/ReClass.NET/UI/NodeTypesBuilder.cs index 33828756..8d519022 100644 --- a/ReClass.NET/UI/NodeTypesBuilder.cs +++ b/ReClass.NET/UI/NodeTypesBuilder.cs @@ -1,10 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; using System.Windows.Forms; -using ReClassNET.Extensions; +using ReClassNET.Controls; using ReClassNET.Nodes; using ReClassNET.Plugins; @@ -18,8 +18,8 @@ internal static class NodeTypesBuilder static NodeTypesBuilder() { defaultNodeTypeGroupList.Add(new[] { typeof(Hex64Node), typeof(Hex32Node), typeof(Hex16Node), typeof(Hex8Node) }); - defaultNodeTypeGroupList.Add(new[] { typeof(Int64Node), typeof(Int32Node), typeof(Int16Node), typeof(Int8Node) }); - defaultNodeTypeGroupList.Add(new[] { typeof(UInt64Node), typeof(UInt32Node), typeof(UInt16Node), typeof(UInt8Node) }); + defaultNodeTypeGroupList.Add(new[] { typeof(NIntNode), typeof(Int64Node), typeof(Int32Node), typeof(Int16Node), typeof(Int8Node) }); + defaultNodeTypeGroupList.Add(new[] { typeof(NUIntNode), typeof(UInt64Node), typeof(UInt32Node), typeof(UInt16Node), typeof(UInt8Node) }); defaultNodeTypeGroupList.Add(new[] { typeof(BoolNode), typeof(BitFieldNode), typeof(EnumNode) }); defaultNodeTypeGroupList.Add(new[] { typeof(FloatNode), typeof(DoubleNode) }); defaultNodeTypeGroupList.Add(new[] { typeof(Vector4Node), typeof(Vector3Node), typeof(Vector2Node), typeof(Matrix4x4Node), typeof(Matrix3x4Node), typeof(Matrix3x3Node) }); @@ -119,7 +119,7 @@ public static IEnumerable CreateToolStripMenuItems(Action h Text = "None" }; - items = noneItem.Yield().Append(new ToolStripSeparator()).Concat(items); + items = items.Prepend(new ToolStripSeparator()).Prepend(noneItem); } return items; diff --git a/ReClass.NET/UI/ScrollableCustomControl.cs b/ReClass.NET/UI/ScrollableCustomControl.cs deleted file mode 100644 index ce254b83..00000000 --- a/ReClass.NET/UI/ScrollableCustomControl.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Windows.Forms; - -namespace ReClassNET.UI -{ - public class ScrollableCustomControl : UserControl - { - public ScrollableCustomControl() - { - VScroll = true; - HScroll = true; - } - - protected override void OnMouseWheel(MouseEventArgs e) - { - Contract.Assume(VerticalScroll != null); - Contract.Assume(HorizontalScroll != null); - - const int WHEEL_DELTA = 120; - - var scrollProperties = VerticalScroll.Enabled ? VerticalScroll : (ScrollProperties)HorizontalScroll; - - var wheelDelta = e.Delta; - while (Math.Abs(wheelDelta) >= WHEEL_DELTA) - { - if (wheelDelta > 0) - { - wheelDelta -= WHEEL_DELTA; - DoScroll(ScrollEventType.SmallDecrement, scrollProperties); - } - else - { - wheelDelta += WHEEL_DELTA; - DoScroll(ScrollEventType.SmallIncrement, scrollProperties); - } - } - - base.OnMouseWheel(e); - } - - private const int SB_LINEUP = 0; - private const int SB_LINEDOWN = 1; - private const int SB_PAGEUP = 2; - private const int SB_PAGEDOWN = 3; - private const int SB_THUMBPOSITION = 4; - private const int SB_THUMBTRACK = 5; - private const int SB_TOP = 6; - private const int SB_BOTTOM = 7; - private const int SB_ENDSCROLL = 8; - - private ScrollEventType WParamToScrollEventType(IntPtr wParam) - { - switch (LoWord((int)wParam)) - { - case SB_LINEUP: - return ScrollEventType.SmallDecrement; - case SB_LINEDOWN: - return ScrollEventType.SmallIncrement; - case SB_PAGEUP: - return ScrollEventType.LargeDecrement; - case SB_PAGEDOWN: - return ScrollEventType.LargeIncrement; - case SB_THUMBTRACK: - return ScrollEventType.ThumbTrack; - case SB_TOP: - return ScrollEventType.First; - case SB_BOTTOM: - return ScrollEventType.Last; - case SB_THUMBPOSITION: - return ScrollEventType.ThumbPosition; - case SB_ENDSCROLL: - return ScrollEventType.EndScroll; - default: - return ScrollEventType.EndScroll; - } - } - - private const int WM_HSCROLL = 0x114; - private const int WM_VSCROLL = 0x115; - - private void SetValue(ScrollEventType type, ScrollProperties scrollProperties, int newValue) - { - Contract.Requires(scrollProperties != null); - - if (!scrollProperties.Enabled) - { - return; - } - - if (newValue < scrollProperties.Minimum) - { - newValue = scrollProperties.Minimum; - } - if (newValue > scrollProperties.Maximum - scrollProperties.LargeChange) - { - newValue = scrollProperties.Maximum - scrollProperties.LargeChange + 1; - } - if (scrollProperties.Value != newValue) - { - var oldValue = scrollProperties.Value; - - scrollProperties.Value = newValue; - - if (type != ScrollEventType.EndScroll) - { - OnScroll(new ScrollEventArgs( - type, - oldValue, - newValue, - scrollProperties is VScrollProperties ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll - )); - Invalidate(); - } - } - } - - private void DoScroll(ScrollEventType type, ScrollProperties scrollProperties) - { - Contract.Requires(scrollProperties != null); - - var oldValue = scrollProperties.Value; - var newValue = oldValue; - - switch (type) - { - case ScrollEventType.SmallDecrement: - newValue = oldValue - (ModifierKeys == Keys.Control ? 1 : scrollProperties.SmallChange); - break; - case ScrollEventType.SmallIncrement: - newValue = oldValue + (ModifierKeys == Keys.Control ? 1 : scrollProperties.SmallChange); - break; - case ScrollEventType.LargeDecrement: - newValue = oldValue - scrollProperties.LargeChange; - break; - case ScrollEventType.LargeIncrement: - newValue = oldValue + scrollProperties.LargeChange; - break; - case ScrollEventType.First: - newValue = scrollProperties.Minimum; - break; - case ScrollEventType.Last: - newValue = scrollProperties.Maximum; - break; - } - - SetValue(type, scrollProperties, newValue); - } - - public void DoScroll(ScrollOrientation orientation, int amount) - { - if (orientation == ScrollOrientation.VerticalScroll && VerticalScroll.Enabled == false) - { - return; - } - if (orientation == ScrollOrientation.HorizontalScroll && HorizontalScroll.Enabled == false) - { - return; - } - - var scrollProperties = orientation == ScrollOrientation.VerticalScroll ? VerticalScroll : (ScrollProperties)HorizontalScroll; - - SetValue(ScrollEventType.ThumbPosition, scrollProperties, scrollProperties.Value + amount); - } - - private void ProcessMessage(ref Message msg, ScrollProperties scrollProperties) - { - Contract.Requires(scrollProperties != null); - - var type = WParamToScrollEventType(msg.WParam); - switch (type) - { - case ScrollEventType.SmallDecrement: - case ScrollEventType.SmallIncrement: - case ScrollEventType.LargeDecrement: - case ScrollEventType.LargeIncrement: - case ScrollEventType.First: - case ScrollEventType.Last: - DoScroll(type, scrollProperties); - break; - case ScrollEventType.ThumbTrack: - case ScrollEventType.ThumbPosition: - SetValue(type, scrollProperties, HiWord((int)msg.WParam)); - break; - } - } - - protected override void WndProc(ref Message msg) - { - if (msg.HWnd == Handle) - { - switch (msg.Msg) - { - case WM_VSCROLL: - case WM_HSCROLL: - if (msg.LParam != IntPtr.Zero) - { - break; - } - - ProcessMessage(ref msg, msg.Msg == WM_VSCROLL ? VerticalScroll : (ScrollProperties)HorizontalScroll); - - return; - } - } - - base.WndProc(ref msg); - } - - static int HiWord(int number) => (number >> 16) & 0xffff; - - static int LoWord(int number) => number & 0xffff; - } -} diff --git a/ReClass.NET/Util/BitString.cs b/ReClass.NET/Util/BitString.cs new file mode 100644 index 00000000..ba3cd1f8 --- /dev/null +++ b/ReClass.NET/Util/BitString.cs @@ -0,0 +1,98 @@ +using System; +using System.Text; + +namespace ReClassNET.Util +{ + public static class BitString + { + /// + /// Converts the value to the corresponding bit string. + /// Format: 0000 0000 + /// + /// The value to convert. + /// The corresponding bit string. + public static string ToString(byte value) + { + return AddPaddingAndBuildBlocks(8, Convert.ToString(value, 2)); + } + + /// + /// Converts the value to the corresponding bit string. + /// Format: 0000 0000 0000 0000 + /// + /// The value to convert. + /// The corresponding bit string. + public static string ToString(short value) + { + return AddPaddingAndBuildBlocks(16, Convert.ToString(value, 2)); + } + + /// + /// Converts the value to the corresponding bit string. + /// Format: 0000 0000 0000 0000 0000 0000 0000 0000 + /// + /// The value to convert. + /// The corresponding bit string. + public static string ToString(int value) + { + return AddPaddingAndBuildBlocks(32, Convert.ToString(value, 2)); + } + + /// + /// Converts the value to the corresponding bit string. + /// Format: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 + /// + /// The value to convert. + /// The corresponding bit string. + public static string ToString(long value) + { + return AddPaddingAndBuildBlocks(64, Convert.ToString(value, 2)); + } + + private static string AddPaddingAndBuildBlocks(int bits, string value) + { + const int BitsPerBlock = 4; + + var sb = new StringBuilder(bits); + + var padding = bits - value.Length; + + // Add full padding blocks. + while (padding > BitsPerBlock) + { + sb.Append("0000 "); + padding -= BitsPerBlock; + } + + // Add only a part of a block. + if (padding > 0) + { + // {padding} 0 bits + for (var i = 0; i < padding; ++i) + { + sb.Append('0'); + } + + // and {4 - padding} bits of the value. + sb.Append(value, 0, BitsPerBlock - padding); + + if (value.Length > padding) + { + sb.Append(' '); + } + } + + // Add all remaining blocks. + for (var i = padding == 0 ? 0 : BitsPerBlock - padding; i < value.Length; i += BitsPerBlock) + { + sb.Append(value, i, BitsPerBlock); + if (i < value.Length - BitsPerBlock) + { + sb.Append(' '); + } + } + + return sb.ToString(); + } + } +} diff --git a/ReClass.NET/Util/CircularBuffer.cs b/ReClass.NET/Util/CircularBuffer.cs index 4a802c6a..4a10ae72 100644 --- a/ReClass.NET/Util/CircularBuffer.cs +++ b/ReClass.NET/Util/CircularBuffer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; @@ -56,7 +56,7 @@ public T Dequeue() } var dequeued = buffer[head]; - buffer[head] = default(T); + buffer[head] = default; if (head == 0) { head = Capacity - 1; diff --git a/ReClass.NET/Util/CommandLineArgs.cs b/ReClass.NET/Util/CommandLineArgs.cs index 2a22fc5a..ed504a92 100644 --- a/ReClass.NET/Util/CommandLineArgs.cs +++ b/ReClass.NET/Util/CommandLineArgs.cs @@ -60,11 +60,6 @@ public string this[string strKey] { get { - if (string.IsNullOrEmpty(strKey)) - { - return FileName; - } - if (parms.TryGetValue(strKey.ToLower(), out var strValue)) { return strValue; diff --git a/ReClass.NET/Util/Conversion/BigEndianBitConverter.cs b/ReClass.NET/Util/Conversion/BigEndianBitConverter.cs new file mode 100644 index 00000000..4469dca0 --- /dev/null +++ b/ReClass.NET/Util/Conversion/BigEndianBitConverter.cs @@ -0,0 +1,39 @@ +using System; + +namespace ReClassNET.Util.Conversion +{ + public sealed class BigEndianBitConverter : EndianBitConverter + { + protected override long FromBytes(byte[] buffer, int index, int bytesToConvert) + { + if (buffer == null) + { + throw new ArgumentNullException(nameof(buffer)); + } + if (index + bytesToConvert > buffer.Length) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + + long ret = 0; + for (var i = 0; i < bytesToConvert; i++) + { + ret = unchecked((ret << 8) | buffer[index + i]); + } + return ret; + } + + protected override byte[] ToBytes(long value, int bytes) + { + var endOffset = bytes - 1; + + var buffer = new byte[bytes]; + for (var i = 0; i < bytes; i++) + { + buffer[endOffset - i] = unchecked((byte)(value & 0xFF)); + value >>= 8; + } + return buffer; + } + } +} diff --git a/ReClass.NET/Util/Conversion/EndianBitConverter.cs b/ReClass.NET/Util/Conversion/EndianBitConverter.cs new file mode 100644 index 00000000..eb231dd8 --- /dev/null +++ b/ReClass.NET/Util/Conversion/EndianBitConverter.cs @@ -0,0 +1,83 @@ +using System; +using System.Runtime.InteropServices; + +namespace ReClassNET.Util.Conversion +{ + public abstract class EndianBitConverter + { + public static LittleEndianBitConverter Little { get; } = new LittleEndianBitConverter(); + + public static BigEndianBitConverter Big { get; } = new BigEndianBitConverter(); + + public static EndianBitConverter System { get; } = BitConverter.IsLittleEndian ? (EndianBitConverter)Little : Big; + + + public bool ToBoolean(byte[] value, int startIndex) => BitConverter.ToBoolean(value, startIndex); + + public char ToChar(byte[] value, int startIndex) => unchecked((char)FromBytes(value, startIndex, 2)); + + public double ToDouble(byte[] value, int startIndex) => BitConverter.Int64BitsToDouble(ToInt64(value, startIndex)); + + public float ToSingle(byte[] value, int startIndex) => new Int32FloatUnion(ToInt32(value, startIndex)).FloatValue; + + public short ToInt16(byte[] value, int startIndex) => unchecked((short)FromBytes(value, startIndex, 2)); + + public int ToInt32(byte[] value, int startIndex) => unchecked((int)FromBytes(value, startIndex, 4)); + + public long ToInt64(byte[] value, int startIndex) => FromBytes(value, startIndex, 8); + + public ushort ToUInt16(byte[] value, int startIndex) => unchecked((ushort)FromBytes(value, startIndex, 2)); + + public uint ToUInt32(byte[] value, int startIndex) => unchecked((uint)FromBytes(value, startIndex, 4)); + + public ulong ToUInt64(byte[] value, int startIndex) => unchecked((ulong)FromBytes(value, startIndex, 8)); + + protected abstract long FromBytes(byte[] value, int index, int bytesToConvert); + + + public byte[] GetBytes(bool value) => BitConverter.GetBytes(value); + + public byte[] GetBytes(char value) => ToBytes(value, 2); + + public byte[] GetBytes(double value) => ToBytes(BitConverter.DoubleToInt64Bits(value), 8); + + public byte[] GetBytes(short value) => ToBytes(value, 2); + + public byte[] GetBytes(int value) => ToBytes(value, 4); + + public byte[] GetBytes(long value) => ToBytes(value, 8); + + public byte[] GetBytes(float value) => ToBytes(new Int32FloatUnion(value).IntValue, 4); + + public byte[] GetBytes(ushort value) => ToBytes(value, 2); + + public byte[] GetBytes(uint value) => ToBytes(value, 4); + + public byte[] GetBytes(ulong value) => ToBytes(unchecked((long)value), 8); + + protected abstract byte[] ToBytes(long value, int bytes); + + + [StructLayout(LayoutKind.Explicit)] + private readonly struct Int32FloatUnion + { + [FieldOffset(0)] + public readonly int IntValue; + + [FieldOffset(0)] + public readonly float FloatValue; + + internal Int32FloatUnion(int value) + { + FloatValue = 0.0f; + IntValue = value; + } + + internal Int32FloatUnion(float value) + { + IntValue = 0; + FloatValue = value; + } + } + } +} diff --git a/ReClass.NET/Util/Conversion/LittleEndianBitConverter.cs b/ReClass.NET/Util/Conversion/LittleEndianBitConverter.cs new file mode 100644 index 00000000..af12706a --- /dev/null +++ b/ReClass.NET/Util/Conversion/LittleEndianBitConverter.cs @@ -0,0 +1,39 @@ +using System; + +namespace ReClassNET.Util.Conversion +{ + public sealed class LittleEndianBitConverter : EndianBitConverter + { + protected override long FromBytes(byte[] buffer, int index, int bytesToConvert) + { + if (buffer == null) + { + throw new ArgumentNullException(nameof(buffer)); + } + if (index + bytesToConvert > buffer.Length) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + + var ret = 0L; + for (var i = 0; i < bytesToConvert; i++) + { + ret = unchecked((ret << 8) | buffer[index + bytesToConvert - 1 - i]); + } + return ret; + } + + protected override byte[] ToBytes(long value, int bytes) + { + var buffer = new byte[bytes]; + + for (var i = 0; i < bytes; i++) + { + buffer[i] = unchecked((byte)(value & 0xFF)); + value >>= 8; + } + + return buffer; + } + } +} diff --git a/ReClass.NET/Util/CustomDataMap.cs b/ReClass.NET/Util/CustomDataMap.cs index 224fa39d..6a077486 100644 --- a/ReClass.NET/Util/CustomDataMap.cs +++ b/ReClass.NET/Util/CustomDataMap.cs @@ -47,36 +47,30 @@ public string this[string key] } /// - /// Sets a configuration item. + /// Removes an item. /// /// The key of the item. - /// - /// The value of the item. - /// If the value is null the item gets removed. - /// + public void RemoveValue(string key) + { + ValidateKey(key); + + data.Remove(key); + } + + /// + /// Sets the string value of an item. + /// + /// The key of the item. + /// The value of the item. public void SetString(string key, string value) { - if (key == null) - { - throw new ArgumentNullException(nameof(key)); - } - if (key.Length == 0) - { - throw new ArgumentException(); - } + ValidateKey(key); - if (value == null) - { - data.Remove(key); - } - else - { - data[key] = value; - } + data[key] = value; } /// - /// Sets a configuration item. + /// Sets the boolean value of an item. /// /// The key of the item. /// The value of the item. @@ -86,7 +80,7 @@ public void SetBool(string key, bool value) } /// - /// Sets a configuration item. + /// Sets the long value of an item. /// /// The key of the item. /// The value of the item. @@ -96,7 +90,7 @@ public void SetLong(string key, long value) } /// - /// Sets a configuration item. + /// Sets the ulong value of an item. /// /// The key of the item. /// The value of the item. @@ -105,13 +99,18 @@ public void SetULong(string key, ulong value) SetString(key, value.ToString(NumberFormatInfo.InvariantInfo)); } + /// + /// Sets the XElement value of an item. + /// + /// The key of the item. + /// The value of the item. public void SetXElement(string key, XElement value) { - SetString(key, value.ToString()); + SetString(key, value?.ToString()); } /// - /// Gets the value of the config item. + /// Gets the string value of the item. /// /// The key of the item. /// The value of the config item or null if the key does not exists. @@ -121,21 +120,14 @@ public string GetString(string key) } /// - /// Gets the value of the config item. + /// Gets the string value of the item. /// /// The key of the item. /// The default value if the key does not exists. /// The value of the config item or if the key does not exists. public string GetString(string key, string def) { - if (key == null) - { - throw new ArgumentNullException(nameof(key)); - } - if (key.Length == 0) - { - throw new ArgumentException(); - } + ValidateKey(key); if (data.TryGetValue(key, out var value)) { @@ -146,7 +138,7 @@ public string GetString(string key, string def) } /// - /// Gets the value of the config item. + /// Gets the boolean value of the item. /// /// The key of the item. /// The default value if the key does not exists. @@ -163,7 +155,7 @@ public bool GetBool(string key, bool def) } /// - /// Gets the value of the config item. + /// Gets the long value of the item. /// /// The key of the item. /// The default value if the key does not exists. @@ -185,7 +177,7 @@ public long GetLong(string key, long def) } /// - /// Gets the value of the config item. + /// Gets the ulong value of the item. /// /// The key of the item. /// The default value if the key does not exists. @@ -207,7 +199,7 @@ public ulong GetULong(string key, ulong def) } /// - /// Gets the value of the config item. + /// Gets the XElement value of the item. /// /// The key of the item. /// The default value if the key does not exists. @@ -222,5 +214,17 @@ public XElement GetXElement(string key, XElement def) return XElement.Parse(str); } + + /// + /// Validates the given key. + /// + /// The key of an item. + private static void ValidateKey(string key) + { + if (key == null) + { + throw new ArgumentNullException(nameof(key)); + } + } } } diff --git a/ReClass.NET/Util/DirectedGraph.cs b/ReClass.NET/Util/DirectedGraph.cs index 9e07ab9a..51968b92 100644 --- a/ReClass.NET/Util/DirectedGraph.cs +++ b/ReClass.NET/Util/DirectedGraph.cs @@ -47,7 +47,7 @@ public void AddVertices(IEnumerable vertices) /// /// /// - public bool HasVertex(T vertex) + public bool ContainsVertex(T vertex) { return adjacencyList.ContainsKey(vertex); } @@ -60,7 +60,7 @@ public bool HasVertex(T vertex) /// True if a new edge was added, false otherwise. public bool AddEdge(T from, T to) { - if (!HasVertex(to) || !adjacencyList.TryGetValue(from, out var edges)) + if (!ContainsVertex(to) || !adjacencyList.TryGetValue(from, out var edges)) { throw new ArgumentException("Vertex does not exist in graph."); } @@ -74,9 +74,9 @@ public bool AddEdge(T from, T to) /// /// /// - public bool HasEdge(T from, T to) + public bool ContainsEdge(T from, T to) { - if (!HasVertex(to) || !adjacencyList.TryGetValue(from, out var edges)) + if (!ContainsVertex(to) || !adjacencyList.TryGetValue(from, out var edges)) { throw new ArgumentException("Vertex does not exist in graph."); } diff --git a/ReClass.NET/Util/GrowingList.cs b/ReClass.NET/Util/GrowingList.cs index 49bd66b5..2c08e9f4 100644 --- a/ReClass.NET/Util/GrowingList.cs +++ b/ReClass.NET/Util/GrowingList.cs @@ -9,6 +9,8 @@ public class GrowingList public T DefaultValue { get; set; } + public int Count => list.Count; + public GrowingList() { Contract.Ensures(list != null); @@ -24,6 +26,8 @@ public GrowingList(T defaultValue) private void GrowToSize(int size) { + list.Capacity = size; + for (var i = list.Count; i <= size; ++i) { list.Add(DefaultValue); diff --git a/ReClass.NET/Util/HexadecimalFormatter.cs b/ReClass.NET/Util/HexadecimalFormatter.cs new file mode 100644 index 00000000..18f6e907 --- /dev/null +++ b/ReClass.NET/Util/HexadecimalFormatter.cs @@ -0,0 +1,46 @@ +using System.Diagnostics.Contracts; + +namespace ReClassNET.Util +{ + public static class HexadecimalFormatter + { + private static readonly uint[] lookup = CreateHexLookup(); + + private static uint[] CreateHexLookup() + { + var result = new uint[256]; + for (var i = 0; i < 256; i++) + { + var s = i.ToString("X2"); + result[i] = s[0] + ((uint)s[1] << 16); + } + return result; + } + + public static string ToString(byte[] data) + { + Contract.Requires(data != null); + + if (data.Length == 0) + { + return string.Empty; + } + + var result = new char[data.Length * 2 + data.Length - 1]; + + var val = lookup[data[0]]; + result[0] = (char)val; + result[1] = (char)(val >> 16); + + for (var i = 1; i < data.Length; i++) + { + val = lookup[data[i]]; + result[3 * i - 1] = ' '; + result[3 * i] = (char)val; + result[3 * i + 1] = (char)(val >> 16); + } + + return new string(result); + } + } +} diff --git a/ReClass.NET/Util/IntPtrComparer.cs b/ReClass.NET/Util/IntPtrComparer.cs index 3400e39d..857c9782 100644 --- a/ReClass.NET/Util/IntPtrComparer.cs +++ b/ReClass.NET/Util/IntPtrComparer.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using ReClassNET.Extensions; namespace ReClassNET.Util { @@ -9,7 +10,7 @@ public class IntPtrComparer : IComparer public int Compare(IntPtr x, IntPtr y) { - return x.ToInt64().CompareTo(y.ToInt64()); + return x.CompareTo(y); } } } diff --git a/ReClass.NET/Util/NumberFormat.cs b/ReClass.NET/Util/NumberFormat.cs new file mode 100644 index 00000000..6c4e91be --- /dev/null +++ b/ReClass.NET/Util/NumberFormat.cs @@ -0,0 +1,32 @@ +using System.Diagnostics.Contracts; +using System.Globalization; + +namespace ReClassNET.Util +{ + public static class NumberFormat + { + public static NumberFormatInfo GuessNumberFormat(string input) + { + Contract.Requires(input != null); + Contract.Ensures(Contract.Result() != null); + + var commaIndex = input.IndexOf(','); + var dotIndex = input.IndexOf('.'); + + if (commaIndex > dotIndex) + { + return new NumberFormatInfo + { + NumberDecimalSeparator = ",", + NumberGroupSeparator = "." + }; + } + + return new NumberFormatInfo + { + NumberDecimalSeparator = ".", + NumberGroupSeparator = "," + }; + } + } +} diff --git a/ReClass.NET/Util/PathUtil.cs b/ReClass.NET/Util/PathUtil.cs index 977da60d..e8823d5d 100644 --- a/ReClass.NET/Util/PathUtil.cs +++ b/ReClass.NET/Util/PathUtil.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.Contracts; using System.IO; using System.Reflection; @@ -14,9 +14,9 @@ public class PathUtil { path = Assembly.GetExecutingAssembly().Location; } - catch (Exception) + catch { - + // ignored } if (string.IsNullOrEmpty(path)) @@ -89,7 +89,7 @@ public static string FileUrlToPath(string url) if (url.StartsWith("file:///", StringComparison.OrdinalIgnoreCase)) { - url = url.Substring(8, url.Length - 8); + url = url.Substring(8); } url = url.Replace('/', Path.DirectorySeparatorChar); diff --git a/ReClass.NET/Util/Rtf/RtfBuilder.RtfFormatLock.cs b/ReClass.NET/Util/Rtf/RtfBuilder.RtfFormatLock.cs deleted file mode 100644 index 52e52ac2..00000000 --- a/ReClass.NET/Util/Rtf/RtfBuilder.RtfFormatLock.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Diagnostics.Contracts; - -namespace ReClassNET.Util.Rtf -{ - partial class RtfBuilder - { - private class RtfFormatLock : IDisposable - { - private readonly RtfBuilder builder; - private readonly RtfFormatWrapper wrapped; - - public RtfFormatLock(RtfBuilder builder) - { - Contract.Requires(builder != null); - - this.builder = builder; - - wrapped = new RtfFormatWrapper(builder); - - builder.isLocked = true; - } - - public void Dispose() - { - wrapped.Dispose(); - - builder.isLocked = false; - } - } - } -} \ No newline at end of file diff --git a/ReClass.NET/Util/Rtf/RtfBuilder.RtfFormatWrapper.cs b/ReClass.NET/Util/Rtf/RtfBuilder.RtfFormatWrapper.cs index 55b55bcb..08078ebb 100644 --- a/ReClass.NET/Util/Rtf/RtfBuilder.RtfFormatWrapper.cs +++ b/ReClass.NET/Util/Rtf/RtfBuilder.RtfFormatWrapper.cs @@ -16,11 +16,6 @@ public RtfFormatWrapper(RtfBuilder builder) this.builder = builder; - if (builder.isLocked) - { - return; - } - var buffer = builder.buffer; int oldLength = buffer.Length; @@ -67,11 +62,6 @@ public RtfFormatWrapper(RtfBuilder builder) public void Dispose() { - if (builder.isLocked) - { - return; - } - var buffer = builder.buffer; var oldLength = buffer.Length; diff --git a/ReClass.NET/Util/Rtf/RtfBuilder.cs b/ReClass.NET/Util/Rtf/RtfBuilder.cs index a8732ce0..5f83c837 100644 --- a/ReClass.NET/Util/Rtf/RtfBuilder.cs +++ b/ReClass.NET/Util/Rtf/RtfBuilder.cs @@ -1,10 +1,8 @@ -using System; +using System; using System.Collections.Generic; -using System.Diagnostics; using System.Drawing; using System.Linq; using System.Text; -using ReClassNET.Extensions; namespace ReClassNET.Util.Rtf { @@ -28,8 +26,6 @@ public partial class RtfBuilder private float fontSize; private FontStyle fontStyle; - protected bool isLocked; - public RtfBuilder() : this(RtfFont.Calibri, 22.0f) { @@ -60,30 +56,46 @@ public RtfBuilder Append(char value) public RtfBuilder Append(string value) { - AppendInternal(value); + if (!string.IsNullOrEmpty(value)) + { + using (new RtfFormatWrapper(this)) + { + value = EscapeString(value); + if (value.IndexOf(Environment.NewLine, StringComparison.Ordinal) >= 0) + { + var lines = value.Split(new[] { Environment.NewLine }, StringSplitOptions.None); + + buffer.Append(string.Join(@"\line ", lines)); + } + else + { + buffer.Append(value); + } + } + } return this; } public RtfBuilder AppendLevel(int level) { - AppendLevelInternal(level); + buffer.AppendFormat(@"\level{0} ", level); return this; } public RtfBuilder AppendLine() { - AppendLineInternal(); + buffer.AppendLine(@"\line"); return this; } public RtfBuilder AppendLine(string value) { - AppendLineInternal(value); + Append(value); - return this; + return AppendLine(); } public RtfBuilder AppendParagraph() @@ -95,12 +107,11 @@ public RtfBuilder AppendParagraph() public RtfBuilder AppendPage() { - AppendPageInternal(); + buffer.AppendLine(@"\page"); return this; } - [DebuggerStepThrough] public RtfBuilder SetForeColor(Color color) { foreColor = color; @@ -108,7 +119,6 @@ public RtfBuilder SetForeColor(Color color) return this; } - [DebuggerStepThrough] public RtfBuilder SetBackColor(Color color) { backColor = color; @@ -116,7 +126,6 @@ public RtfBuilder SetBackColor(Color color) return this; } - [DebuggerStepThrough] public RtfBuilder SetFont(RtfFont font) { fontIndex = IndexOfFont(font); @@ -124,7 +133,6 @@ public RtfBuilder SetFont(RtfFont font) return this; } - [DebuggerStepThrough] public RtfBuilder SetFontSize(float size) { fontSize = size; @@ -132,10 +140,9 @@ public RtfBuilder SetFontSize(float size) return this; } - [DebuggerStepThrough] - public RtfBuilder SetFontStyle(FontStyle fontStyle) + public RtfBuilder SetFontStyle(FontStyle style) { - this.fontStyle = fontStyle; + fontStyle = style; return this; } @@ -198,64 +205,11 @@ private static string GetKnownFontString(RtfFont font) public RtfBuilder Reset() { - ResetInternal(); + buffer.AppendLine(@"\pard"); return this; } - protected void AppendInternal(string value) - { - if (!string.IsNullOrEmpty(value)) - { - using (new RtfFormatWrapper(this)) - { - value = EscapeString(value); - if (value.IndexOf(Environment.NewLine, StringComparison.Ordinal) >= 0) - { - var lines = value.Split(new[] { Environment.NewLine }, StringSplitOptions.None); - - buffer.Append(string.Join(@"\line ", lines)); - } - else - { - buffer.Append(value); - } - } - } - } - - protected void AppendLevelInternal(int level) - { - buffer.AppendFormat(@"\level{0} ", level); - } - - protected void AppendLineInternal(string value) - { - Append(value); - - buffer.AppendLine(@"\line"); - } - - protected void AppendLineInternal() - { - buffer.AppendLine(@"\line"); - } - - protected void AppendPageInternal() - { - buffer.AppendLine(@"\page"); - } - - public IDisposable FormatLock() - { - return new RtfFormatLock(this); - } - - protected void ResetInternal() - { - buffer.AppendLine(@"\pard"); - } - public override string ToString() { var sb = new StringBuilder(); @@ -263,11 +217,17 @@ public override string ToString() sb.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang3081"); sb.Append(@"{\fonttbl"); - sb.Append(usedFonts.Select((f, i) => string.Format(f, i)).Join()); + for (var i = 0; i < usedFonts.Count; ++i) + { + sb.AppendFormat(usedFonts[i], i); + } sb.AppendLine("}"); sb.Append(@"{\colortbl ;"); - sb.Append(usedColors.Select(c => $@"\red{c.R}\green{c.G}\blue{c.B};").Join()); + foreach (var color in usedColors) + { + sb.Append($@"\red{color.R}\green{color.G}\blue{color.B};"); + } sb.AppendLine("}"); sb.Append(@"\viewkind4\uc1\pard\plain\f0"); @@ -287,22 +247,22 @@ private static string EscapeString(string value) { if (value.IndexOfAny(slashable) >= 0) { - value = value.Replace("\\", "\\\\").Replace("{", @"\{").Replace("}", @"\}"); + value = value.Replace(@"\", @"\\").Replace("{", @"\{").Replace("}", @"\}"); } - if (value.Any(c => c > 255)) + if (value.Any(c => c > 255 || c == '\t')) { var sb = new StringBuilder(); foreach (var c in value) { - if (c <= 255) + if (c == '\t') { - sb.Append(c); + sb.Append(@"\tab "); } - else if (c == '\t') + else if (c <= 255) { - sb.Append(@"\tab"); + sb.Append(c); } else { diff --git a/ReClass.NET/Util/SettingsSerializer.cs b/ReClass.NET/Util/SettingsSerializer.cs index 30897511..2a5a4e82 100644 --- a/ReClass.NET/Util/SettingsSerializer.cs +++ b/ReClass.NET/Util/SettingsSerializer.cs @@ -1,4 +1,3 @@ -using System; using System.Diagnostics.Contracts; using System.IO; using System.Xml.Linq; @@ -25,59 +24,60 @@ public static Settings Load() { var path = Path.Combine(PathUtil.SettingsFolderPath, Constants.SettingsFile); - using (var sr = new StreamReader(path)) + using var sr = new StreamReader(path); + + var document = XDocument.Load(sr); + var root = document.Root; + + var general = root?.Element(XmlGeneralElement); + if (general != null) + { + XElementSerializer.TryRead(general, nameof(settings.LastProcess), e => settings.LastProcess = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(general, nameof(settings.StayOnTop), e => settings.StayOnTop = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(general, nameof(settings.RunAsAdmin), e => settings.RunAsAdmin = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(general, nameof(settings.RandomizeWindowTitle), e => settings.RandomizeWindowTitle = XElementSerializer.ToBool(e)); + } + var display = root?.Element(XmlDisplayElement); + if (display != null) + { + XElementSerializer.TryRead(display, nameof(settings.ShowNodeAddress), e => settings.ShowNodeAddress = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(display, nameof(settings.ShowNodeOffset), e => settings.ShowNodeOffset = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(display, nameof(settings.ShowNodeText), e => settings.ShowNodeText = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(display, nameof(settings.HighlightChangedValues), e => settings.HighlightChangedValues = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(display, nameof(settings.ShowCommentFloat), e => settings.ShowCommentFloat = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(display, nameof(settings.ShowCommentInteger), e => settings.ShowCommentInteger = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(display, nameof(settings.ShowCommentPointer), e => settings.ShowCommentPointer = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(display, nameof(settings.ShowCommentRtti), e => settings.ShowCommentRtti = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(display, nameof(settings.ShowCommentSymbol), e => settings.ShowCommentSymbol = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(display, nameof(settings.ShowCommentString), e => settings.ShowCommentString = XElementSerializer.ToBool(e)); + XElementSerializer.TryRead(display, nameof(settings.ShowCommentPluginInfo), e => settings.ShowCommentPluginInfo = XElementSerializer.ToBool(e)); + } + var colors = root?.Element(XmlColorsElement); + if (colors != null) + { + XElementSerializer.TryRead(colors, nameof(settings.BackgroundColor), e => settings.BackgroundColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.SelectedColor), e => settings.SelectedColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.HiddenColor), e => settings.HiddenColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.OffsetColor), e => settings.OffsetColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.AddressColor), e => settings.AddressColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.HexColor), e => settings.HexColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.TypeColor), e => settings.TypeColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.NameColor), e => settings.NameColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.ValueColor), e => settings.ValueColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.IndexColor), e => settings.IndexColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.CommentColor), e => settings.CommentColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.TextColor), e => settings.TextColor = XElementSerializer.ToColor(e)); + XElementSerializer.TryRead(colors, nameof(settings.VTableColor), e => settings.VTableColor = XElementSerializer.ToColor(e)); + } + var customData = root?.Element(XmlCustomDataElement); + if (customData != null) { - var document = XDocument.Load(sr); - var root = document.Root; - - var general = root?.Element(XmlGeneralElement); - if (general != null) - { - XElementSerializer.TryRead(general, nameof(settings.LastProcess), e => settings.LastProcess = XElementSerializer.ToString(e)); - XElementSerializer.TryRead(general, nameof(settings.StayOnTop), e => settings.StayOnTop = XElementSerializer.ToBool(e)); - } - var display = root?.Element(XmlDisplayElement); - if (display != null) - { - XElementSerializer.TryRead(display, nameof(settings.ShowNodeAddress), e => settings.ShowNodeAddress = XElementSerializer.ToBool(e)); - XElementSerializer.TryRead(display, nameof(settings.ShowNodeOffset), e => settings.ShowNodeOffset = XElementSerializer.ToBool(e)); - XElementSerializer.TryRead(display, nameof(settings.ShowNodeText), e => settings.ShowNodeText = XElementSerializer.ToBool(e)); - XElementSerializer.TryRead(display, nameof(settings.HighlightChangedValues), e => settings.HighlightChangedValues = XElementSerializer.ToBool(e)); - XElementSerializer.TryRead(display, nameof(settings.ShowCommentFloat), e => settings.ShowCommentFloat = XElementSerializer.ToBool(e)); - XElementSerializer.TryRead(display, nameof(settings.ShowCommentInteger), e => settings.ShowCommentInteger = XElementSerializer.ToBool(e)); - XElementSerializer.TryRead(display, nameof(settings.ShowCommentPointer), e => settings.ShowCommentPointer = XElementSerializer.ToBool(e)); - XElementSerializer.TryRead(display, nameof(settings.ShowCommentRtti), e => settings.ShowCommentRtti = XElementSerializer.ToBool(e)); - XElementSerializer.TryRead(display, nameof(settings.ShowCommentSymbol), e => settings.ShowCommentSymbol = XElementSerializer.ToBool(e)); - XElementSerializer.TryRead(display, nameof(settings.ShowCommentString), e => settings.ShowCommentString = XElementSerializer.ToBool(e)); - XElementSerializer.TryRead(display, nameof(settings.ShowCommentPluginInfo), e => settings.ShowCommentPluginInfo = XElementSerializer.ToBool(e)); - } - var colors = root?.Element(XmlColorsElement); - if (colors != null) - { - XElementSerializer.TryRead(colors, nameof(settings.BackgroundColor), e => settings.BackgroundColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.SelectedColor), e => settings.SelectedColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.HiddenColor), e => settings.HiddenColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.OffsetColor), e => settings.OffsetColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.AddressColor), e => settings.AddressColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.HexColor), e => settings.HexColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.TypeColor), e => settings.TypeColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.NameColor), e => settings.NameColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.ValueColor), e => settings.ValueColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.IndexColor), e => settings.IndexColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.CommentColor), e => settings.CommentColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.TextColor), e => settings.TextColor = XElementSerializer.ToColor(e)); - XElementSerializer.TryRead(colors, nameof(settings.VTableColor), e => settings.VTableColor = XElementSerializer.ToColor(e)); - } - var customData = root?.Element(XmlCustomDataElement); - if (customData != null) - { - settings.CustomData.Deserialize(customData); - } + settings.CustomData.Deserialize(customData); } } catch { - + // ignored } return settings; @@ -95,54 +95,55 @@ public static void Save(Settings settings) var path = Path.Combine(PathUtil.SettingsFolderPath, Constants.SettingsFile); - using (var sw = new StreamWriter(path)) - { - var document = new XDocument( - new XComment($"{Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"), - new XComment($"Website: {Constants.HomepageUrl}"), + using var sw = new StreamWriter(path); + + var document = new XDocument( + new XComment($"{Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"), + new XComment($"Website: {Constants.HomepageUrl}"), + new XElement( + XmlRootElement, new XElement( - XmlRootElement, - new XElement( - XmlGeneralElement, - XElementSerializer.ToXml(nameof(settings.LastProcess), settings.LastProcess), - XElementSerializer.ToXml(nameof(settings.StayOnTop), settings.StayOnTop) - ), - new XElement( - XmlDisplayElement, - XElementSerializer.ToXml(nameof(settings.ShowNodeAddress), settings.ShowNodeAddress), - XElementSerializer.ToXml(nameof(settings.ShowNodeOffset), settings.ShowNodeOffset), - XElementSerializer.ToXml(nameof(settings.ShowNodeText), settings.ShowNodeText), - XElementSerializer.ToXml(nameof(settings.HighlightChangedValues), settings.HighlightChangedValues), - XElementSerializer.ToXml(nameof(settings.ShowCommentFloat), settings.ShowCommentFloat), - XElementSerializer.ToXml(nameof(settings.ShowCommentInteger), settings.ShowCommentInteger), - XElementSerializer.ToXml(nameof(settings.ShowCommentPointer), settings.ShowCommentPointer), - XElementSerializer.ToXml(nameof(settings.ShowCommentRtti), settings.ShowCommentRtti), - XElementSerializer.ToXml(nameof(settings.ShowCommentSymbol), settings.ShowCommentSymbol), - XElementSerializer.ToXml(nameof(settings.ShowCommentString), settings.ShowCommentString), - XElementSerializer.ToXml(nameof(settings.ShowCommentPluginInfo), settings.ShowCommentPluginInfo) - ), - new XElement( - XmlColorsElement, - XElementSerializer.ToXml(nameof(settings.BackgroundColor), settings.BackgroundColor), - XElementSerializer.ToXml(nameof(settings.SelectedColor), settings.SelectedColor), - XElementSerializer.ToXml(nameof(settings.HiddenColor), settings.HiddenColor), - XElementSerializer.ToXml(nameof(settings.OffsetColor), settings.OffsetColor), - XElementSerializer.ToXml(nameof(settings.AddressColor), settings.AddressColor), - XElementSerializer.ToXml(nameof(settings.HexColor), settings.HexColor), - XElementSerializer.ToXml(nameof(settings.TypeColor), settings.TypeColor), - XElementSerializer.ToXml(nameof(settings.NameColor), settings.NameColor), - XElementSerializer.ToXml(nameof(settings.ValueColor), settings.ValueColor), - XElementSerializer.ToXml(nameof(settings.IndexColor), settings.IndexColor), - XElementSerializer.ToXml(nameof(settings.CommentColor), settings.CommentColor), - XElementSerializer.ToXml(nameof(settings.TextColor), settings.TextColor), - XElementSerializer.ToXml(nameof(settings.VTableColor), settings.VTableColor) - ), - settings.CustomData.Serialize(XmlCustomDataElement) - ) - ); - - document.Save(sw); - } + XmlGeneralElement, + XElementSerializer.ToXml(nameof(settings.LastProcess), settings.LastProcess), + XElementSerializer.ToXml(nameof(settings.StayOnTop), settings.StayOnTop), + XElementSerializer.ToXml(nameof(settings.RunAsAdmin), settings.RunAsAdmin), + XElementSerializer.ToXml(nameof(settings.RandomizeWindowTitle), settings.RandomizeWindowTitle) + ), + new XElement( + XmlDisplayElement, + XElementSerializer.ToXml(nameof(settings.ShowNodeAddress), settings.ShowNodeAddress), + XElementSerializer.ToXml(nameof(settings.ShowNodeOffset), settings.ShowNodeOffset), + XElementSerializer.ToXml(nameof(settings.ShowNodeText), settings.ShowNodeText), + XElementSerializer.ToXml(nameof(settings.HighlightChangedValues), settings.HighlightChangedValues), + XElementSerializer.ToXml(nameof(settings.ShowCommentFloat), settings.ShowCommentFloat), + XElementSerializer.ToXml(nameof(settings.ShowCommentInteger), settings.ShowCommentInteger), + XElementSerializer.ToXml(nameof(settings.ShowCommentPointer), settings.ShowCommentPointer), + XElementSerializer.ToXml(nameof(settings.ShowCommentRtti), settings.ShowCommentRtti), + XElementSerializer.ToXml(nameof(settings.ShowCommentSymbol), settings.ShowCommentSymbol), + XElementSerializer.ToXml(nameof(settings.ShowCommentString), settings.ShowCommentString), + XElementSerializer.ToXml(nameof(settings.ShowCommentPluginInfo), settings.ShowCommentPluginInfo) + ), + new XElement( + XmlColorsElement, + XElementSerializer.ToXml(nameof(settings.BackgroundColor), settings.BackgroundColor), + XElementSerializer.ToXml(nameof(settings.SelectedColor), settings.SelectedColor), + XElementSerializer.ToXml(nameof(settings.HiddenColor), settings.HiddenColor), + XElementSerializer.ToXml(nameof(settings.OffsetColor), settings.OffsetColor), + XElementSerializer.ToXml(nameof(settings.AddressColor), settings.AddressColor), + XElementSerializer.ToXml(nameof(settings.HexColor), settings.HexColor), + XElementSerializer.ToXml(nameof(settings.TypeColor), settings.TypeColor), + XElementSerializer.ToXml(nameof(settings.NameColor), settings.NameColor), + XElementSerializer.ToXml(nameof(settings.ValueColor), settings.ValueColor), + XElementSerializer.ToXml(nameof(settings.IndexColor), settings.IndexColor), + XElementSerializer.ToXml(nameof(settings.CommentColor), settings.CommentColor), + XElementSerializer.ToXml(nameof(settings.TextColor), settings.TextColor), + XElementSerializer.ToXml(nameof(settings.VTableColor), settings.VTableColor) + ), + settings.CustomData.Serialize(XmlCustomDataElement) + ) + ); + + document.Save(sw); } #endregion @@ -156,9 +157,9 @@ private static void EnsureSettingsDirectoryAvailable() Directory.CreateDirectory(PathUtil.SettingsFolderPath); } } - catch (Exception) + catch { - + // ignored } } } diff --git a/ReClass.NET/Util/Util.cs b/ReClass.NET/Util/Util.cs index b756199f..a2f79378 100644 --- a/ReClass.NET/Util/Util.cs +++ b/ReClass.NET/Util/Util.cs @@ -1,8 +1,7 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; -using System.Drawing; -using System.Globalization; +using System.Linq; namespace ReClassNET.Util { @@ -34,7 +33,7 @@ public static T Max(T item1, T item2, Func keySelector) where U : IC return Max(item1, item2, keySelector, Comparer.Default); } - public static T Max(T item1, T item2, Func keySelector, IComparer comparer) + public static T1 Max(T1 item1, T1 item2, Func keySelector, IComparer comparer) { Contract.Requires(keySelector != null); Contract.Requires(comparer != null); @@ -53,68 +52,12 @@ public static void Swap(ref T lhs, ref T rhs) rhs = temp; } - public static Size AggregateNodeSizes(Size baseSize, Size newSize) + //thx again stack overflow https://stackoverflow.com/a/1344242 + public static string RandomString(int length) { - return new Size(Math.Max(baseSize.Width, newSize.Width), baseSize.Height + newSize.Height); - } - - public static NumberFormatInfo GuessNumberFormat(string input) - { - Contract.Requires(input != null); - Contract.Ensures(Contract.Result() != null); - - if (input.Contains(",") && !input.Contains(".")) - { - return new NumberFormatInfo - { - NumberDecimalSeparator = ",", - NumberGroupSeparator = "." - }; - } - return new NumberFormatInfo - { - NumberDecimalSeparator = ".", - NumberGroupSeparator = "," - }; - } - - private static readonly uint[] hexLookup = CreateHexLookup(); - - private static uint[] CreateHexLookup() - { - var result = new uint[256]; - for (var i = 0; i < 256; i++) - { - var s = i.ToString("X2"); - result[i] = (uint)s[0] + ((uint)s[1] << 16); - } - return result; - } - - public static string ByteArrayToHexString(byte[] data) - { - Contract.Requires(data != null); - - if (data.Length == 0) - { - return string.Empty; - } - - var lookup = hexLookup; - var result = new char[data.Length * 2 + data.Length - 1]; - - var val = lookup[data[0]]; - result[0] = (char)val; - result[1] = (char)(val >> 16); - - for (var i = 1; i < data.Length; i++) - { - val = lookup[data[i]]; - result[3 * i - 1] = ' '; - result[3 * i] = (char)val; - result[3 * i + 1] = (char)(val >> 16); - } - return new string(result); + const string Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + return new string(Enumerable.Repeat(Chars, length) + .Select(s => s[Program.GlobalRandom.Next(s.Length)]).ToArray()); } } } diff --git a/ReClass.NET/Util/WinUtil.cs b/ReClass.NET/Util/WinUtil.cs index f01c0b07..8173c315 100644 --- a/ReClass.NET/Util/WinUtil.cs +++ b/ReClass.NET/Util/WinUtil.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.Diagnostics; using System.Diagnostics.Contracts; +using System.Security.Principal; using Microsoft.Win32; namespace ReClassNET.Util @@ -23,6 +24,9 @@ public static class WinUtil public static bool IsAtLeastWindows10 { get; } + //from https://stackoverflow.com/a/11660205 + public static bool IsAdministrator => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); + static WinUtil() { var os = Environment.OSVersion; @@ -39,21 +43,19 @@ static WinUtil() try { - using (var rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false)) + using var rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false); + if (rk != null) { - if (rk != null) + var str = rk.GetValue("CurrentMajorVersionNumber", string.Empty)?.ToString(); + if (uint.TryParse(str, out var u)) { - var str = rk.GetValue("CurrentMajorVersionNumber", string.Empty)?.ToString(); - if (uint.TryParse(str, out var u)) - { - IsAtLeastWindows10 = u >= 10; - } + IsAtLeastWindows10 = u >= 10; } } } catch { - + // ignored } } diff --git a/ReClass.NET_Launcher/App.config b/ReClass.NET_Launcher/App.config index 731f6de6..ecdcf8a5 100644 --- a/ReClass.NET_Launcher/App.config +++ b/ReClass.NET_Launcher/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/ReClass.NET_Launcher/Makefile b/ReClass.NET_Launcher/Makefile index eb8e3c4d..bc9ddd11 100644 --- a/ReClass.NET_Launcher/Makefile +++ b/ReClass.NET_Launcher/Makefile @@ -1,3 +1,5 @@ +.PHONY: all clean debug clean_debug release clean_release docker_debug docker_release podman_debug podman_release + all: debug release clean: clean_debug clean_release @@ -13,3 +15,15 @@ release: clean_release: msbuild /t:Clean ReClass.NET_Launcher.csproj + +docker_debug: + docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET_Launcher && msbuild /p:Configuration=Debug ReClass.NET_Launcher.csproj" + +docker_release: + docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET_Launcher && msbuild /p:Configuration=Release ReClass.NET_Launcher.csproj" + +podman_debug: + podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET_Launcher && msbuild /p:Configuration=Debug ReClass.NET_Launcher.csproj" + +podman_release: + podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET_Launcher && msbuild /p:Configuration=Release ReClass.NET_Launcher.csproj" diff --git a/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj b/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj index 5da1c43a..87001366 100644 --- a/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj +++ b/ReClass.NET_Launcher/ReClass.NET_Launcher.csproj @@ -8,9 +8,10 @@ WinExe ReClassNET_Launcher ReClass.NET_Launcher - v4.6.1 + v4.7.2 512 true + AnyCPU @@ -23,6 +24,7 @@ prompt 4 false + latest AnyCPU @@ -34,6 +36,7 @@ prompt 4 false + latest ReClassNet.ico diff --git a/ReClass.NET_Tests/AddressParser/DynamicCompilerTest.cs b/ReClass.NET_Tests/AddressParser/DynamicCompilerTest.cs new file mode 100644 index 00000000..cada902a --- /dev/null +++ b/ReClass.NET_Tests/AddressParser/DynamicCompilerTest.cs @@ -0,0 +1,12 @@ +using ReClassNET.AddressParser; + +namespace ReClass.NET_Tests.AddressParser +{ + public class DynamicCompilerTest : ExecutorTest + { + protected override IExecutor CreateExecutor() + { + return new DynamicCompiler(); + } + } +} diff --git a/ReClass.NET_Tests/AddressParser/ExecutorTest.cs b/ReClass.NET_Tests/AddressParser/ExecutorTest.cs new file mode 100644 index 00000000..75de668e --- /dev/null +++ b/ReClass.NET_Tests/AddressParser/ExecutorTest.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using Moq; +using NFluent; +using ReClassNET.AddressParser; +using ReClassNET.Memory; +using ReClassNET.Util.Conversion; +using Xunit; + +namespace ReClass.NET_Tests.AddressParser +{ + public abstract class ExecutorTest + { + protected abstract IExecutor CreateExecutor(); + + public static IEnumerable GetSimpleExpressionTestData() => new List + { + new object[] { "0", (IntPtr)0x0 }, + new object[] { "0 + 0", (IntPtr)0x0 }, + new object[] { "+0", (IntPtr)0x0 }, + new object[] { "-0", (IntPtr)0x0 }, + new object[] { "-1", (IntPtr)(-1) }, + new object[] { "+0 + 0", (IntPtr)0x0 }, + new object[] { "-0 - 0", (IntPtr)0x0 }, + new object[] { "0 + 1", (IntPtr)0x1 }, + new object[] { "0 - 1", (IntPtr)(-1) }, + new object[] { "1 + 2 * 3", (IntPtr)0x7 }, + new object[] { "0x123 + 0x234 * 0x345", (IntPtr)0x73527 }, + new object[] { "4 / 0x2", (IntPtr)0x2 } + }; + + [Theory] + [MemberData(nameof(GetSimpleExpressionTestData))] + public void SimpleExpressionTest(string expression, IntPtr expected) + { + var mock = new Mock(); + + var executor = CreateExecutor(); + + Check.That(executor.Execute(Parser.Parse(expression), mock.Object)).IsEqualTo(expected); + } + + public static IEnumerable GetModuleExpressionTestData() => new List + { + new object[] { "", (IntPtr)0x100 }, + new object[] { " + 0", (IntPtr)0x100 }, + new object[] { " + 10", (IntPtr)0x110 }, + new object[] { " * 2", (IntPtr)0x200 }, + new object[] { "", (IntPtr)0x0 }, + }; + + [Theory] + [MemberData(nameof(GetModuleExpressionTestData))] + public void ModuleExpressionTest(string expression, IntPtr expected) + { + var mock = new Mock(); + mock.Setup(p => p.GetModuleByName("test.module")) + .Returns(new Module { Start = (IntPtr)0x100 }); + + var executor = CreateExecutor(); + + Check.That(executor.Execute(Parser.Parse(expression), mock.Object)).IsEqualTo(expected); + } + + public static IEnumerable GetReadMemoryExpressionTestData(int bytesToRead) => new List + { + new object[] { $"[0,{bytesToRead}]", (IntPtr)0x0 }, + new object[] { $"[0,{bytesToRead}] + 10", (IntPtr)0x10 }, + new object[] { $"[10,{bytesToRead}]", (IntPtr)0x10 }, + new object[] { $"[10 + 10,{bytesToRead}]", (IntPtr)0x20 }, + new object[] { $"[[10,{bytesToRead}] + 10,{bytesToRead}]", (IntPtr)0x20 }, + new object[] { $"[[10,{bytesToRead}] + [10,{bytesToRead}],{bytesToRead}] + [10,{bytesToRead}]", (IntPtr)0x30 } + }; + + [Theory] + [MemberData(nameof(GetReadMemoryExpressionTestData), 4)] + public void ReadMemoryExpression32Test(string expression, IntPtr expected) + { + var converter = EndianBitConverter.System; + + var mock = new Mock(); + mock.SetupProperty(p => p.BitConverter) + .SetupGet(p => p.BitConverter) + .Returns(converter); + mock.Setup(p => p.ReadRemoteMemory((IntPtr)0, sizeof(int))) + .Returns(converter.GetBytes(0)); + mock.Setup(p => p.ReadRemoteMemory((IntPtr)0x10, sizeof(int))) + .Returns(converter.GetBytes(0x10)); + mock.Setup(p => p.ReadRemoteMemory((IntPtr)0x20, sizeof(int))) + .Returns(converter.GetBytes(0x20)); + mock.Setup(p => p.ReadRemoteMemory((IntPtr)0x30, sizeof(int))) + .Returns(converter.GetBytes(0x30)); + + var executor = CreateExecutor(); + + Check.That(executor.Execute(Parser.Parse(expression), mock.Object)).IsEqualTo(expected); + } + + [Theory] + [MemberData(nameof(GetReadMemoryExpressionTestData), 8)] + public void ReadMemoryExpression64Test(string expression, IntPtr expected) + { + var converter = EndianBitConverter.System; + + var mock = new Mock(); + mock.SetupProperty(p => p.BitConverter) + .SetupGet(p => p.BitConverter) + .Returns(converter); + mock.Setup(p => p.ReadRemoteMemory((IntPtr)0, sizeof(long))) + .Returns(converter.GetBytes(0L)); + mock.Setup(p => p.ReadRemoteMemory((IntPtr)0x10, sizeof(long))) + .Returns(converter.GetBytes(0x10L)); + mock.Setup(p => p.ReadRemoteMemory((IntPtr)0x20, sizeof(long))) + .Returns(converter.GetBytes(0x20L)); + mock.Setup(p => p.ReadRemoteMemory((IntPtr)0x30, sizeof(long))) + .Returns(converter.GetBytes(0x30L)); + + var executor = CreateExecutor(); + + Check.That(executor.Execute(Parser.Parse(expression), mock.Object)).IsEqualTo(expected); + } + + [Fact] + public void ReadMemoryExpressionInvariantTest() + { + var converter = EndianBitConverter.System; + + var mock = new Mock(); + mock.SetupProperty(p => p.BitConverter) + .SetupGet(p => p.BitConverter) + .Returns(converter); + mock.Setup(p => p.ReadRemoteMemory((IntPtr)0x10, sizeof(int))) + .Returns(converter.GetBytes(0x10)); + mock.Setup(p => p.ReadRemoteMemory((IntPtr)0x10, sizeof(long))) + .Returns(converter.GetBytes(0x10L)); + + var executor = CreateExecutor(); + + Check.That(executor.Execute(Parser.Parse("[10]"), mock.Object)).IsEqualTo((IntPtr)0x10); + } + } +} diff --git a/ReClass.NET_Tests/AddressParser/InterpreterTest.cs b/ReClass.NET_Tests/AddressParser/InterpreterTest.cs new file mode 100644 index 00000000..b7ee2295 --- /dev/null +++ b/ReClass.NET_Tests/AddressParser/InterpreterTest.cs @@ -0,0 +1,12 @@ +using ReClassNET.AddressParser; + +namespace ReClass.NET_Tests.AddressParser +{ + public class InterpreterTest : ExecutorTest + { + protected override IExecutor CreateExecutor() + { + return new Interpreter(); + } + } +} diff --git a/ReClass.NET_Tests/AddressParser/ParserTest.cs b/ReClass.NET_Tests/AddressParser/ParserTest.cs new file mode 100644 index 00000000..40a2bfd3 --- /dev/null +++ b/ReClass.NET_Tests/AddressParser/ParserTest.cs @@ -0,0 +1,74 @@ +using System; +using NFluent; +using ReClassNET.AddressParser; +using Xunit; + +namespace ReClass.NET_Tests.AddressParser +{ + public class ParserTest + { + [Theory] + [InlineData("-")] + [InlineData("+")] + [InlineData("*")] + [InlineData("/")] + [InlineData(",")] + [InlineData("(")] + [InlineData(")")] + [InlineData("[")] + [InlineData("]")] + [InlineData("1-")] + [InlineData("1(")] + [InlineData("1)")] + [InlineData("1[")] + [InlineData("1]")] + [InlineData("(1")] + [InlineData(")1")] + [InlineData("[1")] + [InlineData("]1")] + [InlineData("1+(")] + [InlineData("1+)")] + [InlineData("1 + ()")] + [InlineData("(1 + 2")] + [InlineData("1 + 2)")] + [InlineData("[1 + 2)")] + [InlineData("(1 + 2]")] + [InlineData("[1,")] + [InlineData("[1,]")] + [InlineData("[1,2]")] + [InlineData("1,")] + [InlineData("1,2")] + public void InvalidExpressionTests(string expression) + { + Check.ThatCode(() => Parser.Parse(expression)).Throws(); + } + + [Theory] + [InlineData("1", typeof(ConstantExpression))] + [InlineData("1 + 2", typeof(AddExpression))] + [InlineData("1 - 2", typeof(SubtractExpression))] + [InlineData("1 * 2", typeof(MultiplyExpression))] + [InlineData("1 / 2", typeof(DivideExpression))] + [InlineData("1 + 2 * 3", typeof(AddExpression))] + [InlineData("(1 + 2) * 3", typeof(MultiplyExpression))] + [InlineData("1 + (2 * 3)", typeof(AddExpression))] + [InlineData("(1 + (2 * 3))", typeof(AddExpression))] + [InlineData("[1]", typeof(ReadMemoryExpression))] + [InlineData("[1,4]", typeof(ReadMemoryExpression))] + [InlineData("[1,8]", typeof(ReadMemoryExpression))] + [InlineData("", typeof(ModuleExpression))] + [InlineData("[]", typeof(ReadMemoryExpression))] + public void ValidExpressionTests(string expression, Type type) + { + Check.That(Parser.Parse(expression)).IsInstanceOfType(type); + } + + [Fact] + public void ReadMemoryDefaultByteCountCheck() + { + var expression = (ReadMemoryExpression)Parser.Parse("[1]"); + + Check.That(expression.ByteCount).IsEqualTo(IntPtr.Size); + } + } +} diff --git a/ReClass.NET_Tests/AddressParser/TokenizerTest.cs b/ReClass.NET_Tests/AddressParser/TokenizerTest.cs new file mode 100644 index 00000000..a3cd9a6e --- /dev/null +++ b/ReClass.NET_Tests/AddressParser/TokenizerTest.cs @@ -0,0 +1,102 @@ +using System.IO; +using NFluent; +using ReClassNET.AddressParser; +using Xunit; + +namespace ReClass.NET_Tests.AddressParser +{ + public class TokenizerTest + { + [Theory] + [InlineData("", Token.None)] + [InlineData(" ", Token.None)] + [InlineData("\t", Token.None)] + [InlineData("\n", Token.None)] + [InlineData(" \t\n", Token.None)] + [InlineData("0", Token.Number)] + [InlineData("1", Token.Number)] + [InlineData("0x0", Token.Number)] + [InlineData("0x1", Token.Number)] + [InlineData("00000000", Token.Number)] + [InlineData("0x00000000", Token.Number)] + [InlineData("+", Token.Add)] + [InlineData("-", Token.Subtract)] + [InlineData("*", Token.Multiply)] + [InlineData("/", Token.Divide)] + [InlineData("(", Token.OpenParenthesis)] + [InlineData(")", Token.CloseParenthesis)] + [InlineData("[", Token.OpenBrackets)] + [InlineData("]", Token.CloseBrackets)] + [InlineData(",", Token.Comma)] + [InlineData("", Token.Identifier)] + public void TestTokenType(string expression, Token type) + { + var tokenizer = new Tokenizer(new StringReader(expression)); + + Check.That(tokenizer.Token).IsEqualTo(type); + } + + [Theory] + [InlineData("0", 0)] + [InlineData("1", 1)] + [InlineData("0x0", 0)] + [InlineData("0x1", 1)] + [InlineData("00000000", 0)] + [InlineData("0x00000000", 0)] + [InlineData("12345678", 0x12345678)] + [InlineData("0x12345678", 0x12345678)] + public void TestNumberValue(string expression, long value) + { + var tokenizer = new Tokenizer(new StringReader(expression)); + + Check.That(tokenizer.Number).IsEqualTo(value); + } + + [Theory] + [InlineData("<>", "")] + [InlineData("", "test")] + [InlineData("", "module.test")] + public void TestIdentifierValue(string expression, string value) + { + var tokenizer = new Tokenizer(new StringReader(expression)); + + Check.That(tokenizer.Identifier).IsEqualTo(value); + } + + [Theory] + [InlineData("<")] + [InlineData(">")] + [InlineData("10000000000000000")] + [InlineData("0x")] + [InlineData("x")] + public void TestInvalidExpression(string expression) + { + Check.ThatCode(() => new Tokenizer(new StringReader(expression))).Throws(); + } + + [Theory] + [InlineData("1 + 2", Token.Number, Token.Add, Token.Number)] + [InlineData("1+2", Token.Number, Token.Add, Token.Number)] + [InlineData("+1", Token.Add, Token.Number)] + [InlineData("1 + ( 2 )", Token.Number, Token.Add, Token.OpenParenthesis, Token.Number, Token.CloseParenthesis)] + [InlineData("1 + )( 2", Token.Number, Token.Add, Token.CloseParenthesis, Token.OpenParenthesis, Token.Number)] + [InlineData("1+", Token.Number, Token.Add, Token.Identifier)] + [InlineData("0x1+", Token.Number, Token.Add, Token.Identifier)] + [InlineData("(0x1+)", Token.OpenParenthesis, Token.Number, Token.Add, Token.Identifier, Token.CloseParenthesis)] + [InlineData("[ 1 ] + 2", Token.OpenBrackets, Token.Number, Token.CloseBrackets, Token.Add, Token.Number)] + [InlineData("[1 + 2]", Token.OpenBrackets, Token.Number, Token.Add, Token.Number, Token.CloseBrackets)] + public void TestExpressions(string expression, params Token[] tokens) + { + var tokenizer = new Tokenizer(new StringReader(expression)); + + foreach (var token in tokens) + { + Check.That(tokenizer.Token).IsEqualTo(token); + + tokenizer.ReadNextToken(); + } + + Check.That(tokenizer.Token).IsEqualTo(Token.None); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/ByteExtensionTest.cs b/ReClass.NET_Tests/Extensions/ByteExtensionTest.cs new file mode 100644 index 00000000..e3633864 --- /dev/null +++ b/ReClass.NET_Tests/Extensions/ByteExtensionTest.cs @@ -0,0 +1,28 @@ +using System.Linq; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class ByteExtensionTest + { + public static TheoryData GetTestFillWithZeroData() => new TheoryData + { + new byte[0], + Enumerable.Repeat(1, 1).Select(i => (byte)i).ToArray(), + Enumerable.Repeat(1, 10).Select(i => (byte)i).ToArray(), + Enumerable.Repeat(1, 100).Select(i => (byte)i).ToArray(), + Enumerable.Repeat(1, 1000).Select(i => (byte)i).ToArray() + }; + + [Theory] + [MemberData(nameof(GetTestFillWithZeroData))] + public void TestFillWithZero(byte[] sut) + { + sut.FillWithZero(); + + Check.That(sut.All(b => b == 0)).IsTrue(); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/ColorExtensionTest.cs b/ReClass.NET_Tests/Extensions/ColorExtensionTest.cs new file mode 100644 index 00000000..fdc1a65c --- /dev/null +++ b/ReClass.NET_Tests/Extensions/ColorExtensionTest.cs @@ -0,0 +1,52 @@ +using System.Drawing; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class ColorExtensionTest + { + public static TheoryData GetTestInvertedColorData() => new TheoryData + { + { Color.White, Color.Black }, + { Color.Black, Color.White }, + { Color.Red, Color.Cyan }, + { Color.Cyan, Color.Red }, + { Color.Blue, Color.Yellow }, + { Color.Yellow, Color.Blue }, + { Color.Lime, Color.Fuchsia }, + { Color.Fuchsia, Color.Lime }, + { Color.FromArgb(100, 100, 100), Color.FromArgb(155, 155, 155) }, + { Color.FromArgb(50, 100, 150), Color.FromArgb(205, 155, 105) } + }; + + [Theory] + [MemberData(nameof(GetTestInvertedColorData))] + public void TestInvertedColor(Color sut, Color expected) + { + Check.That(sut.Invert().ToArgb()).IsEqualTo(expected.ToArgb()); + } + + public static TheoryData GetTestToRgbData() => new TheoryData + { + { Color.White, 0xFF_FF_FF }, + { Color.Black, 0x00_00_00 }, + { Color.Red, 0xFF_00_00 }, + { Color.Cyan, 0x00_FF_FF }, + { Color.Blue, 0x00_00_FF }, + { Color.Yellow, 0xFF_FF_00 }, + { Color.Lime, 0x00_FF_00 }, + { Color.Fuchsia, 0xFF_00_FF }, + { Color.FromArgb(100, 100, 100), 100 << 16 | 100 << 8 | 100 }, + { Color.FromArgb(50, 100, 150), 50 << 16 | 100 << 8 | 150 } + }; + + [Theory] + [MemberData(nameof(GetTestToRgbData))] + public void TestToRgb(Color sut, int expected) + { + Check.That(sut.ToRgb()).IsEqualTo(expected); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/DictionaryExtensionTest.cs b/ReClass.NET_Tests/Extensions/DictionaryExtensionTest.cs new file mode 100644 index 00000000..0b0d2a70 --- /dev/null +++ b/ReClass.NET_Tests/Extensions/DictionaryExtensionTest.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class DictionaryExtensionTest + { + [Fact] + public void TestRemoveWhere() + { + var sut = new Dictionary + { + { 0, "val0" }, + { 1, "val1" }, + { 2, "val2" }, + { 3, "val3" } + }; + + sut.RemoveWhere(kv => kv.Key % 2 == 1); + + Check.That(sut.Keys).IsEquivalentTo(0, 2); + + sut.RemoveWhere(kv => kv.Key == 2); + + Check.That(sut.Keys).IsEquivalentTo(0); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/EncodingExtensionTest.cs b/ReClass.NET_Tests/Extensions/EncodingExtensionTest.cs new file mode 100644 index 00000000..fa563b9c --- /dev/null +++ b/ReClass.NET_Tests/Extensions/EncodingExtensionTest.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class EncodingExtensionTest + { + public static TheoryData GetTestSimpleByteCountData() => new TheoryData + { + { Encoding.ASCII, 1 }, + { Encoding.GetEncoding(1252), 1 }, + { Encoding.UTF8, 1 }, + { Encoding.Unicode, 2 }, + { Encoding.BigEndianUnicode, 2 }, + { Encoding.UTF32, 4 } + }; + + [Theory] + [MemberData(nameof(GetTestSimpleByteCountData))] + public void TestSimpleByteCount(Encoding encoding, int expectedByteCount) + { + Check.That(encoding.GuessByteCountPerChar()).IsEqualTo(expectedByteCount); + } + + public static IEnumerable GetTestSimpleByteCountNotImplementedData() => Encoding.GetEncodings() + .Select(e => e.GetEncoding()) + .WhereNot(e => e.IsSameCodePage(Encoding.ASCII) || e.IsSameCodePage(Encoding.UTF8) || e.IsSameCodePage(Encoding.Unicode) || e.IsSameCodePage(Encoding.BigEndianUnicode) || e.IsSameCodePage(Encoding.UTF32) || e.CodePage == 1252) + .Select(e => new object[] { e }); + + [Theory] + [MemberData(nameof(GetTestSimpleByteCountNotImplementedData))] + public void TestSimpleByteCountNotImplemented(Encoding encoding) + { + Check.ThatCode(encoding.GuessByteCountPerChar).Throws(); + } + + public static TheoryData GetTestIsSameCodePageData() => new TheoryData + { + { Encoding.ASCII, Encoding.ASCII, true }, + { Encoding.UTF8, Encoding.UTF8, true }, + { Encoding.Unicode, Encoding.Unicode, true }, + { Encoding.UTF32, Encoding.UTF32, true }, + { Encoding.ASCII, Encoding.UTF8, false }, + { Encoding.ASCII, Encoding.Unicode, false }, + { Encoding.ASCII, Encoding.UTF32, false }, + { Encoding.UTF8, Encoding.UTF32, false }, + { Encoding.Unicode, Encoding.UTF32, false }, + { Encoding.UTF8, Encoding.Unicode, false } + }; + + [Theory] + [MemberData(nameof(GetTestIsSameCodePageData))] + public void TestIsSameCodePage(Encoding sut, Encoding other, bool expected) + { + Check.That(sut.IsSameCodePage(other)).IsEqualTo(expected); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/EnumerableExtensionTests.cs b/ReClass.NET_Tests/Extensions/EnumerableExtensionTests.cs new file mode 100644 index 00000000..90bb3573 --- /dev/null +++ b/ReClass.NET_Tests/Extensions/EnumerableExtensionTests.cs @@ -0,0 +1,225 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class EnumerableExtensionTest + { + public static TheoryData, bool> GetTestNoneData => new TheoryData, bool> + { + { new int[0], true }, + { new int[1], false }, + { Enumerable.Empty(), true } + }; + + [Theory] + [MemberData(nameof(GetTestNoneData))] + public void TestNone(IEnumerable sut, bool expected) + { + Check.That(sut.None()).IsEqualTo(expected); + } + + public static TheoryData, Func, bool> GetTestNoneWithSelectorData => new TheoryData, Func, bool> + { + { new int[0], i => false, true }, + { new int[0], i => true, true }, + { new [] { 1 }, i => i == 1, false }, + { new [] { 1 }, i => i != 1, true }, + { new [] { 1, 3, 5 }, i => i % 2 == 0, true } + }; + + [Theory] + [MemberData(nameof(GetTestNoneWithSelectorData))] + public void TestNoneWithSelector(IEnumerable sut, Func selector, bool expected) + { + Check.That(sut.None(selector)).IsEqualTo(expected); + } + + public static TheoryData, Func> GetTestWhereNotData => new TheoryData, Func> + { + { new int[0], i => false }, + { new int[0], i => true }, + { new [] { 1 }, i => i == 1 }, + { new [] { 1, 3, 5 }, i => i % 2 == 1 } + }; + + [Theory] + [MemberData(nameof(GetTestWhereNotData))] + public void TestWhereNot(IEnumerable sut, Func selector) + { + Check.That(sut.WhereNot(selector)).IsEmpty(); + } + + public static TheoryData, int, int> GetTestFindIndexData => new TheoryData, int, int> + { + { new int[0], 1, -1 }, + { new [] { 1 }, 1, 0 }, + { new [] { 1 }, 2, -1 }, + { new [] { 1, 3, 5 }, 1, 0 }, + { new [] { 1, 3, 5 }, 2, -1 }, + { new [] { 1, 3, 5 }, 3, 1 }, + { new [] { 1, 3, 5 }, 4, -1 }, + { new [] { 1, 3, 5 }, 5, 2 } + }; + + [Theory] + [MemberData(nameof(GetTestFindIndexData))] + public void TestFindIndex(IEnumerable sut, int item, int expected) + { + Check.That(sut.FindIndex(i => i == item)).IsEqualTo(expected); + } + + [Theory] + [InlineData(0)] + [InlineData(1)] + [InlineData(10)] + public void TestForEach(int expected) + { + var counter = 0; + Enumerable.Repeat(0, expected).ForEach(_ => ++counter); + + Check.That(counter).IsEqualTo(expected); + } + + public static TheoryData, Func, IEnumerable> GetTestDistinctByData => new TheoryData, Func, IEnumerable> + { + { Enumerable.Empty(), i => i, Enumerable.Empty() }, + { new [] { 1 }, i => i, new [] { 1 } }, + { new [] { 1, 1, 1, 1 }, i => i, new [] { 1 } }, + { new [] { 1, 2, 3, 4 }, i => i, new [] { 1, 2, 3, 4 } }, + { new [] { 1, 1, 2, 2, 3, 3 }, i => i, new [] { 1, 2, 3 } }, + { new [] { 1, 1, 2, 2, 3, 4 }, i => i, new [] { 1, 2, 3, 4 } }, + { new [] { 1, 1, 2, 2, 3, 4 }, i => 0, new [] { 1 } } + }; + + [Theory] + [MemberData(nameof(GetTestDistinctByData))] + public void TestDistinctBy(IEnumerable sut, Func selector, IEnumerable expected) + { + Check.That(sut.DistinctBy(selector)).IsEquivalentTo(expected); + } + + public static TheoryData, IEnumerable, bool> GetTestIsEquivalentToData => new TheoryData, IEnumerable, bool> + { + { Enumerable.Empty(), Enumerable.Empty(), true }, + { Enumerable.Empty(), new int[0], true }, + { new [] { 1 }, new int[0], false }, + { new [] { 1 }, new [] { 2 }, false }, + { new [] { 1, 2, 3 }, new [] { 1, 2, 3 }, true }, + { new [] { 1, 2, 3 }, new [] { 3, 1, 2 }, true } + }; + + [Theory] + [MemberData(nameof(GetTestIsEquivalentToData))] + public void TestIsEquivalentTo(IEnumerable sut, IEnumerable other, bool expected) + { + Check.That(sut.IsEquivalentTo(other)).IsEqualTo(expected); + } + + public static TheoryData, Func, IEnumerable> GetTestTakeWhileInclusiveData => new TheoryData, Func, IEnumerable> + { + { Enumerable.Empty(), i => false, Enumerable.Empty() }, + { new [] { 1 }, i => false, new [] { 1 } }, + { new [] { 1 }, i => true, new [] { 1 } }, + { new [] { 1, 1 }, i => false, new [] { 1 } }, + { new [] { 1, 1 }, i => true, new [] { 1, 1 } }, + { new [] { 1, 2, 3, 4 }, i => i != 2, new [] { 1, 2 } }, + { new [] { 1, 2, 3, 4 }, i => i != 3, new [] { 1, 2, 3 } }, + { new [] { 4, 3, 2, 1 }, i => false, new [] { 4 } } + }; + + [Theory] + [MemberData(nameof(GetTestTakeWhileInclusiveData))] + public void TestTakeWhileInclusive(IEnumerable sut, Func predicate, IEnumerable expected) + { + Check.That(sut.TakeWhileInclusive(predicate)).IsEquivalentTo(expected); + } + + public static TheoryData, Func, IEnumerable>> GetTestGroupWhileData => new TheoryData, Func, IEnumerable>> + { + { Enumerable.Empty(), (x, y) => false, Enumerable.Empty>() }, + { new [] { 1, 2, 3 }, (x, y) => x == y, new [] { new[] { 1 }, new[] { 2 }, new[] { 3 } } }, + { new [] { 1, 1, 2, 3, 3, 4 }, (x, y) => x == y, new [] { new[] { 1, 1 }, new[] { 2 }, new[] { 3, 3 }, new[] { 4 } } }, + { new [] { 1, 1, 2, 3, 3, 4 }, (x, y) => x != y, new [] { new[] { 1 }, new[] { 1, 2, 3 }, new[] { 3, 4 } } } + }; + + [Theory] + [MemberData(nameof(GetTestGroupWhileData))] + public void TestGroupWhile(IEnumerable sut, Func predicate, IEnumerable> expected) + { + using (var expectedIt = expected.GetEnumerator()) + { + using (var groupIt = sut.GroupWhile(predicate).GetEnumerator()) + { + while (groupIt.MoveNext()) + { + Check.That(expectedIt.MoveNext()).IsTrue(); + + Check.That(groupIt.Current).IsEquivalentTo(expectedIt.Current); + } + } + + Check.That(expectedIt.MoveNext()).IsFalse(); + } + } + + public static TheoryData, Func, int> GetTestPredicateOrFirstData => new TheoryData, Func, int> + { + { new [] { 1 }, i => false, 1 }, + { new [] { 1 }, i => true, 1 }, + { new [] { 1, 2, 3, 4 }, i => i == 2, 2 }, + { new [] { 1, 2, 3, 4 }, i => i == 4, 4 }, + { new [] { 1, 2, 3, 4 }, i => i == 5, 1 } + }; + + [Theory] + [MemberData(nameof(GetTestPredicateOrFirstData))] + public void TestPredicateOrFirst(IEnumerable sut, Func predicate, int expected) + { + Check.That(sut.PredicateOrFirst(predicate)).IsEqualTo(expected); + } + + [Fact] + public void TestPredicateOrFirstThrows() + { + Check.ThatCode(() => Enumerable.Empty().PredicateOrFirst(i => true)).Throws(); + } + + public class Traversable + { + public IList Children { get; } = new List(); + } + + [Fact] + public void TestTraverse() + { + var traversable = new Traversable(); + var child1 = new Traversable(); + child1.Children.Add(new Traversable()); + var child2 = new Traversable(); + child2.Children.Add(new Traversable()); + child2.Children.Add(new Traversable()); + var child3 = new Traversable(); + child3.Children.Add(new Traversable()); + child3.Children.Add(new Traversable()); + child3.Children.Add(new Traversable()); + traversable.Children.Add(child1); + traversable.Children.Add(child2); + traversable.Children.Add(child3); + + var expected = new[] { traversable } + .Append(child1) + .Append(child2) + .Append(child3) + .Concat(child1.Children) + .Concat(child2.Children) + .Concat(child3.Children); + + Check.That(new[] { traversable }.Traverse(t => t.Children)).ContainsExactly(expected); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/FloatingPointExtensionTest.cs b/ReClass.NET_Tests/Extensions/FloatingPointExtensionTest.cs new file mode 100644 index 00000000..844f8229 --- /dev/null +++ b/ReClass.NET_Tests/Extensions/FloatingPointExtensionTest.cs @@ -0,0 +1,51 @@ +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class FloatingPointExtensionTest + { + [Theory] + [InlineData(0.0f, 0.0f, 0.0f, true)] + [InlineData(0.0f, 1.0f, 0.0f, false)] + [InlineData(0.0f, 1.0f, 1.0f, true)] + [InlineData(1.0f, 0.0f, 1.0f, true)] + [InlineData(-1.0f, 0.0f, 1.0f, true)] + [InlineData(-1.0f, 1.0f, 1.0f, false)] + [InlineData(-0.5f, 0.5f, 1.0f, true)] + [InlineData(-0.25f, 0.75f, 1.0f, true)] + [InlineData(-0.25f, 0.25f, 0.5f, true)] + [InlineData(0.9999f, 1.0f, 0.0f, false)] + [InlineData(0.9999f, 1.0f, 0.1f, true)] + [InlineData(0.9999f, 1.0f, 0.01f, true)] + [InlineData(0.9999f, 1.0f, 0.001f, true)] + [InlineData(0.9999f, 1.0f, 0.0001f, true, Skip = "Should work but float can't hold these values")] + [InlineData(0.9999f, 1.0f, 0.00001f, false, Skip = "Should work but float can't hold these values")] + public void TestNearlyEqualFloat(float value1, float value2, float epsilon, bool expected) + { + Check.That(value1.IsNearlyEqual(value2, epsilon)).IsEqualTo(expected); + } + + [Theory] + [InlineData(0.0, 0.0, 0.0, true)] + [InlineData(0.0, 1.0, 0.0, false)] + [InlineData(0.0, 1.0, 1.0, true)] + [InlineData(1.0, 0.0, 1.0, true)] + [InlineData(-1.0, 0.0, 1.0, true)] + [InlineData(-1.0, 1.0, 1.0, false)] + [InlineData(-0.5, 0.5, 1.0, true)] + [InlineData(-0.25, 0.75, 1.0, true)] + [InlineData(-0.25, 0.25, 0.5, true)] + [InlineData(0.9999, 1.0, 0.0, false)] + [InlineData(0.9999, 1.0, 0.1, true)] + [InlineData(0.9999, 1.0, 0.01, true)] + [InlineData(0.9999, 1.0, 0.001, true)] + [InlineData(0.9999, 1.0, 0.0001, true)] + [InlineData(0.9999, 1.0, 0.00001, false)] + public void TestNearlyEqualDouble(double value1, double value2, double epsilon, bool expected) + { + Check.That(value1.IsNearlyEqual(value2, epsilon)).IsEqualTo(expected); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/IntPtrExtensionTest.cs b/ReClass.NET_Tests/Extensions/IntPtrExtensionTest.cs new file mode 100644 index 00000000..786c681f --- /dev/null +++ b/ReClass.NET_Tests/Extensions/IntPtrExtensionTest.cs @@ -0,0 +1,103 @@ +using System; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class IntPtrExtensionTest + { + public static TheoryData GetTestIsNullData => new TheoryData + { + { IntPtr.Zero, true }, + { (IntPtr)1, false } + }; + + [Theory] + [MemberData(nameof(GetTestIsNullData))] + public void TestIsNull(IntPtr ptr, bool expected) + { + Check.That(ptr.IsNull()).IsEqualTo(expected); + } + + public static TheoryData GetTestMayBeValidData => new TheoryData + { + { IntPtr.Zero, false }, + { (IntPtr)1, false }, + { (IntPtr)0x10000, true }, + { (IntPtr)int.MaxValue, true }, +#if RECLASSNET64 + { (IntPtr)long.MaxValue + 1, false } +#else + { (IntPtr)int.MaxValue + 1, false } +#endif + }; + + [Theory] + [MemberData(nameof(GetTestMayBeValidData))] + public void TestMayBeValid(IntPtr ptr, bool expected) + { + Check.That(ptr.MayBeValid()).IsEqualTo(expected); + } + + public static TheoryData GetTestIsInRangeData => new TheoryData + { + { (IntPtr)10, (IntPtr)100, (IntPtr)1000, false }, + { (IntPtr)100, (IntPtr)100, (IntPtr)1000, true }, + { (IntPtr)500, (IntPtr)100, (IntPtr)1000, true }, + { (IntPtr)1000, (IntPtr)100, (IntPtr)1000, true }, + { (IntPtr)1500, (IntPtr)100, (IntPtr)1000, false } + }; + + [Theory] + [MemberData(nameof(GetTestIsInRangeData))] + public void TestIsInRange(IntPtr ptr, IntPtr start, IntPtr end, bool expected) + { + Check.That(ptr.IsInRange(start, end)).IsEqualTo(expected); + } + + public static TheoryData GetTestCompareToData => new TheoryData + { + { (IntPtr)10, (IntPtr)100, -1 }, + { (IntPtr)100, (IntPtr)100, 0 }, + { (IntPtr)500, (IntPtr)100, 1 } + }; + + [Theory] + [MemberData(nameof(GetTestCompareToData))] + public void TestCompareTo(IntPtr ptr, IntPtr other, int expected) + { + Check.That(ptr.CompareTo(other)).IsEqualTo(expected); + } + + public static TheoryData GetTestCompareToRangeData => new TheoryData + { + { (IntPtr)10, (IntPtr)100, (IntPtr)1000, -1 }, + { (IntPtr)100, (IntPtr)100, (IntPtr)1000, 0 }, + { (IntPtr)500, (IntPtr)100, (IntPtr)1000, 0 }, + { (IntPtr)1000, (IntPtr)100, (IntPtr)1000, 0 }, + { (IntPtr)1500, (IntPtr)100, (IntPtr)1000, 1 } + }; + + [Theory] + [MemberData(nameof(GetTestCompareToRangeData))] + public void TestCompareToRange(IntPtr ptr, IntPtr start, IntPtr end, int expected) + { + Check.That(ptr.CompareToRange(start, end)).IsEqualTo(expected); + } + + public static TheoryData GetTestToInt64BitsData => new TheoryData + { + { (IntPtr)0x10, 0x10L }, + { (IntPtr)int.MaxValue, 0x7FFF_FFFFL }, + { (IntPtr)int.MaxValue + 1, 0x8000_0000L } + }; + + [Theory] + [MemberData(nameof(GetTestToInt64BitsData))] + public void TestToInt64Bits(IntPtr ptr, long expected) + { + Check.That(ptr.ToInt64Bits()).IsEqualTo(expected); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/ListExtensionTest.cs b/ReClass.NET_Tests/Extensions/ListExtensionTest.cs new file mode 100644 index 00000000..6cf535db --- /dev/null +++ b/ReClass.NET_Tests/Extensions/ListExtensionTest.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class ListExtensionTest + { + public static TheoryData, Func, int> GetTestBinarySearchData() => new TheoryData, Func, int> + { + { new List { 0, 2, 4, 6, 8, 10, 12 }, i => 2.CompareTo(i), 1 }, + { new List { 0, 2, 4, 6, 8, 10, 12 }, i => 8.CompareTo(i), 4 }, + { new List { 1, 3, 5, 7, 9, 11, 13 }, i => 1.CompareTo(i), 0 }, + { new List { 1, 3, 5, 7, 9, 11, 13 }, i => 2.CompareTo(i), ~1 }, + { new List { 1, 3, 5, 7, 9, 11, 13 }, i => 14.CompareTo(i), ~7 }, + }; + + [Theory] + [MemberData(nameof(GetTestBinarySearchData))] + public void TestBinarySearch(IList sut, Func comparer, int expected) + { + Check.That(sut.BinarySearch(comparer)).IsEqualTo(expected); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/PointExtensionTest.cs b/ReClass.NET_Tests/Extensions/PointExtensionTest.cs new file mode 100644 index 00000000..dc6264d6 --- /dev/null +++ b/ReClass.NET_Tests/Extensions/PointExtensionTest.cs @@ -0,0 +1,25 @@ +using System.Drawing; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class PointExtensionTest + { + public static TheoryData GetTestRelocateData() => new TheoryData + { + { Point.Empty, 0, 0, Point.Empty }, + { Point.Empty, 1, 1, new Point(1, 1) }, + { Point.Empty, -1, -1, new Point(-1, -1) }, + { new Point(-1, -1), 1, 1, Point.Empty }, + }; + + [Theory] + [MemberData(nameof(GetTestRelocateData))] + public void TestRelocate(Point sut, int offsetX, int offsetY, Point expected) + { + Check.That(sut.Relocate(offsetX, offsetY)).IsEqualTo(expected); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/StringBuilderExtensionTest.cs b/ReClass.NET_Tests/Extensions/StringBuilderExtensionTest.cs new file mode 100644 index 00000000..538f680a --- /dev/null +++ b/ReClass.NET_Tests/Extensions/StringBuilderExtensionTest.cs @@ -0,0 +1,31 @@ +using System.Text; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class StringBuilderExtensionTest + { + [Fact] + public void TestPrependChar() + { + var sut = new StringBuilder("test"); + sut.Prepend('x'); + + Check.That(sut.ToString()).IsEqualTo("xtest"); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData("test")] + public void TestPrependString(string value) + { + var sut = new StringBuilder("test"); + sut.Prepend(value); + + Check.That(sut.ToString()).IsEqualTo(value + "test"); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/StringExtensionTest.cs b/ReClass.NET_Tests/Extensions/StringExtensionTest.cs new file mode 100644 index 00000000..f1a0fcde --- /dev/null +++ b/ReClass.NET_Tests/Extensions/StringExtensionTest.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class StringExtensionTest + { + public static TheoryData GetTestIsPrintableData() => new TheoryData + { + '0', '9', ' ', 'a', 'A', 'z', 'Z', '-', '_', '°', '^', '"', '\\', '\"', '&', '@', '$', '|', '<', '>', ';', ',', '.', ':', '#', '*', '+', '~', '`', '´', 'ß', '?', '=', '(', ')', '[', ']', '{', '}' + }; + + [Theory] + [MemberData(nameof(GetTestIsPrintableData))] + public void TestIsPrintable(char c) + { + Check.That(c.IsPrintable()).IsTrue(); + } + + public static TheoryData GetTestIsNotPrintableData() => new TheoryData + { + '\u0000','\u0001', '\u0002', '\u009A','\u009B', '\u009C', '\u009D','\u009E', '\u009F' + }; + + [Theory] + [MemberData(nameof(GetTestIsNotPrintableData))] + public void TestIsNotPrintable(char c) + { + Check.That(c.IsPrintable()).IsFalse(); + } + + public static TheoryData GetTestLimitLengthData() => new TheoryData + { + { string.Empty, 0, string.Empty }, + { string.Empty, 1, string.Empty }, + { "01234", 0, string.Empty }, + { "01234", 1, "0" }, + { "01234", 5, "01234" }, + { "01234", 10, "01234" } + }; + + [Theory] + [MemberData(nameof(GetTestLimitLengthData))] + public void TestLimitLength(string sut, int length, string expected) + { + Check.That(sut.LimitLength(length)).IsEqualTo(expected); + } + + [Fact] + public void TestLimitLengthThrows() + { + Check.ThatCode(() => "".LimitLength(-1)).Throws(); + } + + public static TheoryData, IEnumerable> GetTestInterpretAsSingleByteCharacterData() => new TheoryData, IEnumerable> + { + { new byte[0], string.Empty }, + { new [] { (byte)'t', (byte)'e', (byte)'s', (byte)'t' }, "test" } + }; + + [Theory] + [MemberData(nameof(GetTestInterpretAsSingleByteCharacterData))] + public void TestInterpretAsSingleByteCharacter(IEnumerable sut, IEnumerable expected) + { + Check.That(sut.InterpretAsSingleByteCharacter()).ContainsExactly(expected); + } + + public static TheoryData, IEnumerable> GetTestInterpretAsDoubleByteCharacterData() => new TheoryData, IEnumerable> + { + { new byte[0], string.Empty }, + { new [] { (byte)'t', (byte)0, (byte)'e', (byte)0, (byte)'s', (byte)0, (byte)'t', (byte)0 }, "test" } + }; + + [Theory] + [MemberData(nameof(GetTestInterpretAsDoubleByteCharacterData))] + public void TestInterpretAsDoubleByteCharacter(IEnumerable sut, IEnumerable expected) + { + Check.That(sut.InterpretAsDoubleByteCharacter()).ContainsExactly(expected); + } + + public static TheoryData, float> GetTestCalculatePrintableDataThresholdData() => new TheoryData, float> + { + { new char[0], 0.0f }, + { new [] { '\0' }, 0.0f }, + { new [] { 'a' }, 1.0f }, + { new [] { '\0', 'a' }, 0.0f }, + { new [] { 'a', '\0' }, 0.5f }, + { new [] { '\0', 'a', 'a' }, 0.0f }, + { new [] { 'a', 'a', '\0' }, 2 / 3.0f }, + { new [] { 'a', 'a', '\0', '\0' }, 0.5f }, + { new [] { 'a', 'a', '\0', '\0', '\0' }, 2 / 5.0f } + }; + + [Theory] + [MemberData(nameof(GetTestCalculatePrintableDataThresholdData))] + public void TestCalculatePrintableDataThreshold(IEnumerable sut, float expected) + { + Check.That(sut.CalculatePrintableDataThreshold()).IsCloseTo(expected, 0.001); + } + + [Theory] + [InlineData('a')] + [InlineData('a', 'a')] + [InlineData('a', 'a', 'f')] + [InlineData('#', '+', 'r', '?', 'ß', '%', '&', '§', '_', '0', '/', '(', 'ö')] + public void TestIsPrintableData(params char[] sut) + { + Check.That(sut.IsPrintableData()).IsTrue(); + } + + [Theory] + [InlineData] + [InlineData('a', '\0')] + [InlineData('\0', 'a')] + [InlineData('a', 'a', '\0')] + [InlineData('a', 'a', 'f', '\0')] + [InlineData('a', 'a', '\0', 'f')] + [InlineData('a', '\0', 'a', 'f')] + [InlineData('\0', 'a', 'a', 'f')] + public void TestIsNotPrintableData(params char[] sut) + { + Check.That(sut.IsPrintableData()).IsFalse(); + } + + [Theory] + [InlineData('a', 'a', 'f', '\0')] + [InlineData('1', '2', '3', '4', '5', '6', '7', '8', '\0', '\0')] + [InlineData('1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', '\0', '\0', '\0', '\0')] + public void TestIsLikelyPrintableData(params char[] sut) + { + Check.That(sut.IsLikelyPrintableData()).IsTrue(); + } + + [Theory] + [InlineData] + [InlineData('a', '\0')] + [InlineData('\0', 'a')] + [InlineData('a', 'a', '\0')] + [InlineData('a', 'a', '\0', 'f')] + [InlineData('a', 'a', '\0', '\0')] + [InlineData('a', '\0', 'a', 'f')] + public void TestIsNotLikelyPrintableData(params char[] sut) + { + Check.That(sut.IsPrintableData()).IsFalse(); + } + + [Theory] + [InlineData("", false, null)] + [InlineData("-", false, null)] + [InlineData("-0", false, null)] + [InlineData("-0x0", false, null)] + [InlineData("-h0", false, null)] + [InlineData("0", true, "0")] + [InlineData("h0", true, "0")] + [InlineData("0x0", true, "0")] + [InlineData("0123456789abcdef", true, "0123456789abcdef")] + [InlineData("h0123456789abcdef", true, "0123456789abcdef")] + [InlineData("0x0123456789abcdef", true, "0123456789abcdef")] + [InlineData("0123456789ABCDEF", true, "0123456789ABCDEF")] + public void TestTryGetHexString(string input, bool expectedResult, string expectedValue) + { + Check.That(input.TryGetHexString(out var value)).IsEqualTo(expectedResult); + Check.That(value).IsEqualTo(expectedValue); + } + } +} diff --git a/ReClass.NET_Tests/Extensions/StringReaderExtensionTest.cs b/ReClass.NET_Tests/Extensions/StringReaderExtensionTest.cs new file mode 100644 index 00000000..6933f951 --- /dev/null +++ b/ReClass.NET_Tests/Extensions/StringReaderExtensionTest.cs @@ -0,0 +1,31 @@ +using System.IO; +using NFluent; +using ReClassNET.Extensions; +using Xunit; + +namespace ReClass.NET_Tests.Extensions +{ + public class StringReaderExtensionTest + { + [Theory] + [InlineData("", -1)] + [InlineData(" ", -1)] + [InlineData("\t", -1)] + [InlineData("\r", -1)] + [InlineData("\n", -1)] + [InlineData("x", (int)'x')] + [InlineData("x ", (int)'x')] + [InlineData(" x", (int)'x')] + [InlineData(" x", (int)'x')] + [InlineData("\tx ", (int)'x')] + [InlineData("\rx ", (int)'x')] + [InlineData("\nx ", (int)'x')] + public void TestReadSkipWhitespaces(string input, int expected) + { + using (var sut = new StringReader(input)) + { + Check.That(sut.ReadSkipWhitespaces()).IsEqualTo(expected); + } + } + } +} diff --git a/ReClass.NET_Tests/Memory/MemoryBufferTest.cs b/ReClass.NET_Tests/Memory/MemoryBufferTest.cs new file mode 100644 index 00000000..d9fb45a1 --- /dev/null +++ b/ReClass.NET_Tests/Memory/MemoryBufferTest.cs @@ -0,0 +1,171 @@ +using System; +using System.Text; +using NFluent; +using ReClassNET.Memory; +using Xunit; + +namespace ReClass.NET_Tests.Memory +{ + public class MemoryBufferTest + { + private static MemoryBuffer CreateFromBytes(params byte[] data) + { + var buffer = new MemoryBuffer + { + Size = data.Length + }; + Array.Copy(data, buffer.RawData, data.Length); + return buffer; + } + + public static TheoryData GetTestReadBytesData() => new TheoryData + { + { CreateFromBytes(), 0, 0, new byte[0] }, + { CreateFromBytes(), 0, 4, new byte[] { 0, 0, 0, 0 } }, + { CreateFromBytes(), 10, 4, new byte[] { 0, 0, 0, 0 } }, + { CreateFromBytes(1, 2, 3, 4), 0, 0, new byte[0] }, + { CreateFromBytes(1, 2, 3, 4), 0, 4, new byte[] { 1, 2, 3, 4 } }, + { CreateFromBytes(1, 2, 3, 4), 2, 4, new byte[] { 0, 0, 0, 0 } }, + { CreateFromBytes(1, 2, 3, 4), 10, 4, new byte[] { 0, 0, 0, 0 } }, + { CreateFromBytes(1, 2, 3, 4, 5, 6), 2, 4, new byte[] { 3, 4, 5, 6 } } + }; + + [Theory] + [MemberData(nameof(GetTestReadBytesData))] + public void TestReadBytesReturn(MemoryBuffer sut, int offset, int length, byte[] expected) + { + Check.That(sut.ReadBytes(offset, length)).ContainsExactly(expected); + } + + [Theory] + [MemberData(nameof(GetTestReadBytesData))] + public void TestReadBytesFill(MemoryBuffer sut, int offset, int length, byte[] expected) + { + var data = new byte[length]; + + sut.ReadBytes(offset, data); + + Check.That(data).ContainsExactly(expected); + } + + public static TheoryData GetTestReadUInt8Data() => new TheoryData + { + { CreateFromBytes(), 0, 0, 0 }, + { CreateFromBytes(), 4, 0, 0 }, + { CreateFromBytes(1, 2, 3, 4), 0, 1, 1 }, + { CreateFromBytes(1, 2, 3, 4), 2, 3, 3 }, + { CreateFromBytes(1, 2, 3, 0xFF), 3, -1, 255 } + }; + + [Theory] + [MemberData(nameof(GetTestReadUInt8Data))] + public void TestReadInt8(MemoryBuffer sut, int offset, sbyte expectedSigned, byte expectedUnsigned) + { + Check.That(sut.ReadInt8(offset)).IsEqualTo(expectedSigned); + Check.That(sut.ReadUInt8(offset)).IsEqualTo(expectedUnsigned); + } + + public static TheoryData GetTestReadUInt16Data() => new TheoryData + { + { CreateFromBytes(), 0, 0, 0 }, + { CreateFromBytes(), 4, 0, 0 }, + { CreateFromBytes(1, 2, 3, 4), 0, 0x0201, 0x0201 }, + { CreateFromBytes(1, 2, 3, 4), 2, 0x0403, 0x0403 }, + { CreateFromBytes(1, 2, 3, 0xBF, 0xFF), 3, unchecked((short)0xFFBF), 0xFFBF } + }; + + [Theory] + [MemberData(nameof(GetTestReadUInt16Data))] + public void TestReadInt16(MemoryBuffer sut, int offset, short expectedSigned, ushort expectedUnsigned) + { + Check.That(sut.ReadInt16(offset)).IsEqualTo(expectedSigned); + Check.That(sut.ReadUInt16(offset)).IsEqualTo(expectedUnsigned); + } + + public static TheoryData GetTestReadUInt32Data() => new TheoryData + { + { CreateFromBytes(), 0, 0, 0 }, + { CreateFromBytes(), 4, 0, 0 }, + { CreateFromBytes(1, 2, 3, 4), 0, 0x04030201, 0x04030201 }, + { CreateFromBytes(1, 2, 3, 4, 0xBF, 0xFF), 2, unchecked((int)0xFFBF0403), 0xFFBF0403 } + }; + + [Theory] + [MemberData(nameof(GetTestReadUInt32Data))] + public void TestReadInt32(MemoryBuffer sut, int offset, int expectedSigned, uint expectedUnsigned) + { + Check.That(sut.ReadInt32(offset)).IsEqualTo(expectedSigned); + Check.That(sut.ReadUInt32(offset)).IsEqualTo(expectedUnsigned); + } + + public static TheoryData GetTestReadUInt64Data() => new TheoryData + { + { CreateFromBytes(), 0, 0, 0 }, + { CreateFromBytes(), 4, 0, 0 }, + { CreateFromBytes(1, 2, 3, 4, 5, 6, 7, 8), 0, 0x0807060504030201, 0x0807060504030201 }, + { CreateFromBytes(1, 2, 3, 4, 5, 6, 0xBF, 0xFF, 0xBF, 0xFF), 2, unchecked((long)0xFFBFFFBF06050403), 0xFFBFFFBF06050403 } + }; + + [Theory] + [MemberData(nameof(GetTestReadUInt64Data))] + public void TestReadInt64(MemoryBuffer sut, int offset, long expectedSigned, ulong expectedUnsigned) + { + Check.That(sut.ReadInt64(offset)).IsEqualTo(expectedSigned); + Check.That(sut.ReadUInt64(offset)).IsEqualTo(expectedUnsigned); + } + + public static TheoryData GetTestReadFloatData() => new TheoryData + { + { CreateFromBytes(), 0, 0.0f }, + { CreateFromBytes(), 4, 0.0f }, + { CreateFromBytes(0, 0x40, 0x9A, 0x44), 0, 1234.0f }, + { CreateFromBytes(1, 2, 0, 8, 0x87, 0x45), 2, 4321.0f } + }; + + [Theory] + [MemberData(nameof(GetTestReadFloatData))] + public void TestReadFloat(MemoryBuffer sut, int offset, float expected) + { + Check.That(sut.ReadFloat(offset)).IsCloseTo(expected, 0.0001); + } + + public static TheoryData GetTestReadDoubleData() => new TheoryData + { + { CreateFromBytes(), 0, 0.0 }, + { CreateFromBytes(), 4, 0.0 }, + { CreateFromBytes(0x54, 0x74, 0x24, 0x97, 0x1F, 0xE1, 0xB0, 0x40), 0, 4321.1234 }, + { CreateFromBytes(1, 2, 0x68, 0x22, 0x6C, 0x78, 0xBA, 0x49, 0x93, 0x40), 2, 1234.4321 } + }; + + [Theory] + [MemberData(nameof(GetTestReadDoubleData))] + public void TestReadDouble(MemoryBuffer sut, int offset, double expected) + { + Check.That(sut.ReadDouble(offset)).IsCloseTo(expected, 0.0001); + } + + public static TheoryData GetTestReadStringData() => new TheoryData + { + { CreateFromBytes(), Encoding.ASCII, 0, 0, string.Empty }, + { CreateFromBytes(), Encoding.ASCII, 4, 0, string.Empty }, + { CreateFromBytes(), Encoding.ASCII, 0, 4, string.Empty }, + { CreateFromBytes(0x31, 0x32, 0x33, 0x61, 0x62, 0x63), Encoding.ASCII, 0, 6, "123abc" }, + { CreateFromBytes(0x31, 0x32, 0x33, 0x61, 0x62, 0x63), Encoding.ASCII, 2, 3, "3ab" }, + { CreateFromBytes(0, 0, 0, 0, 0, 0), Encoding.GetEncoding(1252), 0, 6, "......" }, + { CreateFromBytes(0, 0, 0, 0, 0, 0), Encoding.UTF8, 0, 6, "......" }, + { CreateFromBytes(0, 1, 2, 3, 4, 5), Encoding.UTF8, 0, 6, "......" }, + { CreateFromBytes(0x31, 0x32, 0x33, 0x61, 0x62, 0x63, 0xC4, 0xD6, 0xDC), Encoding.GetEncoding(1252), 0, 9, "123abcÄÖÜ" }, + { CreateFromBytes(0x31, 0x32, 0x33, 0x61, 0x62, 0x63, 0xC3, 0x84, 0xC3, 0x96, 0xC3, 0x9C), Encoding.UTF8, 0, 12, "123abcÄÖÜ" }, + { CreateFromBytes(0x61, 0xC3), Encoding.UTF8, 0, 2, "a." }, + { CreateFromBytes(0x31, 0x00, 0x32, 0x00, 0x33, 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0xC4, 0x00, 0xD6, 0x00, 0xDC, 0x00), Encoding.Unicode, 0, 18, "123abcÄÖÜ" }, + { CreateFromBytes(0x31, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0xC4, 0x00, 0x00, 0x00, 0xD6, 0x00, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00), Encoding.UTF32, 0, 36, "123abcÄÖÜ" } + }; + + [Theory] + [MemberData(nameof(GetTestReadStringData))] + public void TestReadString(MemoryBuffer sut, Encoding encoding, int offset, int length, string expected) + { + Check.That(sut.ReadString(encoding, offset, length)).IsEqualTo(expected); + } + } +} diff --git a/ReClass.NET_Tests/MemoryScanner/BytePatternTest.cs b/ReClass.NET_Tests/MemoryScanner/BytePatternTest.cs new file mode 100644 index 00000000..957863a4 --- /dev/null +++ b/ReClass.NET_Tests/MemoryScanner/BytePatternTest.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using NFluent; +using ReClassNET.MemoryScanner; +using Xunit; + +namespace ReClass.NET_Tests.MemoryScanner +{ + public class BytePatternTest + { + [Theory] + [InlineData("", 0, false)] + [InlineData("0", 1, true)] + [InlineData("a", 1, true)] + [InlineData("A", 1, true)] + [InlineData("00", 1, false)] + [InlineData("aa", 1, false)] + [InlineData("AA", 1, false)] + [InlineData("0000", 2, false)] + [InlineData("00aa", 2, false)] + [InlineData("00 aa", 2, false)] + [InlineData("00\taa", 2, false)] + [InlineData("?", 1, true)] + [InlineData("??", 1, true)] + [InlineData("????", 2, true)] + [InlineData("?? ??", 2, true)] + [InlineData("a?", 1, true)] + [InlineData("?a", 1, true)] + [InlineData("aa ?a", 2, true)] + [InlineData("aa ?? 00", 3, true)] + public void TestParse(string input, int expectedLength, bool expectedHasWildcards) + { + var sut = BytePattern.Parse(input); + + Check.That(sut.Length).IsEqualTo(expectedLength); + Check.That(sut.HasWildcards).IsEqualTo(expectedHasWildcards); + } + + [Fact] + public void TestParseThrows() + { + Check.ThatCode(() => BytePattern.Parse("aa bb zz")).Throws(); + } + + public static TheoryData, int> GetTestFromByteEnumerationData() => new TheoryData, int> + { + { new byte[0], 0 }, + { new byte[] { 0x00, 0x11, 0xaa }, 3 } + }; + + [Theory] + [MemberData(nameof(GetTestFromByteEnumerationData))] + public void TestFromByteEnumeration(IEnumerable input, int expectedLength) + { + var sut = BytePattern.From(input); + + Check.That(sut.Length).IsEqualTo(expectedLength); + Check.That(sut.HasWildcards).IsFalse(); + } + + public static TheoryData>, int, bool> GetTestFromByteEnumerationWithWildcardsData() => new TheoryData>, int, bool> + { + { new Tuple[0], 0, false }, + { new [] { Tuple.Create((byte)0, false) }, 1, false }, + { new [] { Tuple.Create((byte)0, true) }, 1, true }, + { new [] { Tuple.Create((byte)0xaa, false), Tuple.Create((byte)0, true) }, 2, true } + }; + + [Theory] + [MemberData(nameof(GetTestFromByteEnumerationWithWildcardsData))] + public void TestFromByteEnumerationWithWildcards(IEnumerable> input, int expectedLength, bool expectedHasWildcards) + { + var sut = BytePattern.From(input); + + Check.That(sut.Length).IsEqualTo(expectedLength); + Check.That(sut.HasWildcards).IsEqualTo(expectedHasWildcards); + } + + [Fact] + public void TestToArrayWithWildcardsThrows() + { + var sut = BytePattern.Parse("0?"); + + Check.ThatCode(() => sut.ToByteArray()).Throws(); + } + + [Theory] + [InlineData("")] + [InlineData("00AA", (byte)0x00, (byte)0xAA)] + [InlineData("00 aa bb 99", (byte)0x00, (byte)0xAA, (byte)0xBB, (byte)0x99)] + public void TestToArray(string input, params byte[] expected) + { + var sut = BytePattern.Parse(input); + + Check.That(sut.ToByteArray()).ContainsExactly(expected); + } + + public static TheoryData GetTestToStringData() => new TheoryData + { + { string.Empty, PatternMaskFormat.Separated, string.Empty, string.Empty }, + { string.Empty, PatternMaskFormat.Combined, string.Empty, null }, + { "aa bb 00", PatternMaskFormat.Separated, @"\xAA\xBB\x00", "xxx" }, + { "aa bb 00", PatternMaskFormat.Combined, "AA BB 00", null }, + { "aa ?? 00", PatternMaskFormat.Separated, @"\xAA\x00\x00", "x?x" }, + { "aa ?? 00", PatternMaskFormat.Combined, "AA ?? 00", null }, + { "a? ?? ?0", PatternMaskFormat.Separated, @"\x00\x00\x00", "???" }, + { "a? ?? ?0", PatternMaskFormat.Combined, "A? ?? ?0", null }, + }; + + [Theory] + [MemberData(nameof(GetTestToStringData))] + public void TestToString(string input, PatternMaskFormat format, string expectedPattern, string expectedMask) + { + var sut = BytePattern.Parse(input); + + var (pattern, mask) = sut.ToString(format); + + Check.That(pattern).IsEqualTo(expectedPattern); + Check.That(mask).IsEqualTo(expectedMask); + } + } +} diff --git a/ReClass.NET_Tests/MemoryScanner/Comparer/ByteMemoryComparerTest.cs b/ReClass.NET_Tests/MemoryScanner/Comparer/ByteMemoryComparerTest.cs new file mode 100644 index 00000000..bdb74875 --- /dev/null +++ b/ReClass.NET_Tests/MemoryScanner/Comparer/ByteMemoryComparerTest.cs @@ -0,0 +1,160 @@ +using System; +using NFluent; +using ReClassNET.MemoryScanner; +using ReClassNET.MemoryScanner.Comparer; +using Xunit; + +namespace ReClass.NET_Tests.MemoryScanner.Comparer +{ + public class ByteMemoryComparerTest + { + [Theory] + [InlineData(ScanCompareType.Equal, 0, 0)] + [InlineData(ScanCompareType.Equal, 1, 2)] + [InlineData(ScanCompareType.Equal, 2, 1)] + [InlineData(ScanCompareType.Between, 2, 4)] + [InlineData(ScanCompareType.BetweenOrEqual, 4, 2)] + [InlineData(ScanCompareType.NotEqual, 0, 0)] + public void TestConstructor(ScanCompareType compareType, byte value1, byte value2) + { + var sut = new ByteMemoryComparer(compareType, value1, value2); + + Check.That(sut.CompareType).IsEqualTo(compareType); + Check.That(sut.ValueSize).IsEqualTo(sizeof(byte)); + Check.That(sut.Value1).IsOneOf(value1, value2); + Check.That(sut.Value2).IsOneOf(value1, value2); + } + + public static TheoryData GetTestCompareBasicData() => new TheoryData + { + { ScanCompareType.Equal, 0, 0, new byte[] { 0 }, true, new ByteScanResult(0) }, + { ScanCompareType.Equal, 0, 0, new byte[] { 1 }, false, null }, + { ScanCompareType.Equal, 1, 0, new byte[] { 1 }, true, new ByteScanResult(1) }, + { ScanCompareType.Equal, 1, 0, new byte[] { 0 }, false, null }, + { ScanCompareType.NotEqual, 1, 0, new byte[] { 0 }, true, new ByteScanResult(0) }, + { ScanCompareType.NotEqual, 1, 0, new byte[] { 1 }, false, null }, + { ScanCompareType.GreaterThan, 1, 0, new byte[] { 0 }, false, null }, + { ScanCompareType.GreaterThan, 1, 0, new byte[] { 2 }, true, new ByteScanResult(2) }, + { ScanCompareType.GreaterThanOrEqual, 1, 0, new byte[] { 0 }, false, null }, + { ScanCompareType.GreaterThanOrEqual, 1, 0, new byte[] { 1 }, true, new ByteScanResult(1) }, + { ScanCompareType.GreaterThanOrEqual, 1, 0, new byte[] { 2 }, true, new ByteScanResult(2) }, + { ScanCompareType.LessThan, 1, 0, new byte[] { 1 }, false, null }, + { ScanCompareType.LessThan, 1, 0, new byte[] { 0 }, true, new ByteScanResult(0) }, + { ScanCompareType.LessThanOrEqual, 1, 0, new byte[] { 2 }, false, null }, + { ScanCompareType.LessThanOrEqual, 1, 0, new byte[] { 1 }, true, new ByteScanResult(1) }, + { ScanCompareType.LessThanOrEqual, 1, 0, new byte[] { 0 }, true, new ByteScanResult(0) }, + { ScanCompareType.Between, 1, 2, new byte[] { 0 }, false, null }, + { ScanCompareType.Between, 1, 2, new byte[] { 1 }, false, null }, + { ScanCompareType.Between, 1, 2, new byte[] { 2 }, false, null }, + { ScanCompareType.Between, 1, 2, new byte[] { 3 }, false, null }, + { ScanCompareType.BetweenOrEqual, 1, 2, new byte[] { 0 }, false, null }, + { ScanCompareType.BetweenOrEqual, 1, 2, new byte[] { 1 }, true, new ByteScanResult(1) }, + { ScanCompareType.BetweenOrEqual, 1, 2, new byte[] { 2 }, true, new ByteScanResult(2) }, + { ScanCompareType.BetweenOrEqual, 1, 2, new byte[] { 3 }, false, null } + }; + + public static TheoryData GetTestCompareScanCompareTypeUnknownData() => new TheoryData + { + { ScanCompareType.Unknown, 0, 0, new byte[] { 0 }, true, new ByteScanResult(0) }, + { ScanCompareType.Unknown, 0, 0, new byte[] { 1 }, true, new ByteScanResult(1) } + }; + + [Theory] + [MemberData(nameof(GetTestCompareBasicData))] + [MemberData(nameof(GetTestCompareScanCompareTypeUnknownData))] + public void TestCompare(ScanCompareType compareType, byte value1, byte value2, byte[] data, bool expectedResult, ScanResult expectedScanResult) + { + var sut = new ByteMemoryComparer(compareType, value1, value2); + + Check.That(sut.Compare(data, 0, out var scanResult)).IsEqualTo(expectedResult); + Check.That(scanResult).IsEqualTo(expectedScanResult); + if (scanResult != null) + { + Check.That(scanResult).IsInstanceOf(); + } + } + + [Theory] + [InlineData(ScanCompareType.Changed)] + [InlineData(ScanCompareType.NotChanged)] + [InlineData(ScanCompareType.Decreased)] + [InlineData(ScanCompareType.DecreasedOrEqual)] + [InlineData(ScanCompareType.Increased)] + [InlineData(ScanCompareType.IncreasedOrEqual)] + public void TestCompareInvalidCompareTypeThrows(ScanCompareType compareType) + { + var sut = new ByteMemoryComparer(compareType, 0, 0); + + Check.ThatCode(() => sut.Compare(new byte[] { 0 }, 0, out _)).Throws(); + } + + public static TheoryData GetTestCompareThrowsData() => new TheoryData + { + { null, 0, typeof(ArgumentNullException) }, + { new byte[0], 0, typeof(ArgumentOutOfRangeException) }, + { new byte[1], 1, typeof(ArgumentOutOfRangeException) } + }; + + [Theory] + [MemberData(nameof(GetTestCompareThrowsData))] + public void TestCompareInvalidDataThrows(byte[] data, int index, Type expectedExceptionType) + { + var sut = new ByteMemoryComparer(ScanCompareType.Equal, 0, 0); + + Check.ThatCode(() => sut.Compare(data, index, out _)).ThrowsType(expectedExceptionType); + } + + public static TheoryData GetTestCompareWithPreviousData() + { + var data = new TheoryData + { + { ScanCompareType.Changed, 0, 0, new byte[] { 0 }, new ByteScanResult(1), true, new ByteScanResult(0) }, + { ScanCompareType.Changed, 0, 0, new byte[] { 1 }, new ByteScanResult(1), false, null }, + { ScanCompareType.NotChanged, 0, 0, new byte[] { 1 }, new ByteScanResult(1), true, new ByteScanResult(1) }, + { ScanCompareType.NotChanged, 0, 0, new byte[] { 0 }, new ByteScanResult(1), false, null }, + { ScanCompareType.Increased, 0, 0, new byte[] { 2 }, new ByteScanResult(1), true, new ByteScanResult(2) }, + { ScanCompareType.Increased, 0, 0, new byte[] { 1 }, new ByteScanResult(1), false, null }, + { ScanCompareType.Increased, 0, 0, new byte[] { 0 }, new ByteScanResult(1), false, null }, + { ScanCompareType.IncreasedOrEqual, 0, 0, new byte[] { 2 }, new ByteScanResult(1), true, new ByteScanResult(2) }, + { ScanCompareType.IncreasedOrEqual, 0, 0, new byte[] { 1 }, new ByteScanResult(1), true, new ByteScanResult(1) }, + { ScanCompareType.IncreasedOrEqual, 0, 0, new byte[] { 0 }, new ByteScanResult(1), false, null }, + { ScanCompareType.Decreased, 0, 0, new byte[] { 0 }, new ByteScanResult(1), true, new ByteScanResult(0) }, + { ScanCompareType.Decreased, 0, 0, new byte[] { 1 }, new ByteScanResult(1), false, null }, + { ScanCompareType.Decreased, 0, 0, new byte[] { 2 }, new ByteScanResult(1), false, null }, + { ScanCompareType.DecreasedOrEqual, 0, 0, new byte[] { 0 }, new ByteScanResult(1), true, new ByteScanResult(0) }, + { ScanCompareType.DecreasedOrEqual, 0, 0, new byte[] { 1 }, new ByteScanResult(1), true, new ByteScanResult(1) }, + { ScanCompareType.DecreasedOrEqual, 0, 0, new byte[] { 2 }, new ByteScanResult(1), false, null } + }; + + var basicData = GetTestCompareBasicData(); + foreach (var x in basicData) + { + data.Add((ScanCompareType)x[0], (byte)x[1], (byte)x[2], (byte[])x[3], new ByteScanResult(1), (bool)x[4], (ScanResult)x[5]); + } + + return data; + } + + [Theory] + [MemberData(nameof(GetTestCompareWithPreviousData))] + public void TestCompareWithPrevious(ScanCompareType compareType, byte value1, byte value2, byte[] data, ScanResult previousScanResult, bool expectedResult, ScanResult expectedScanResult) + { + var sut = new ByteMemoryComparer(compareType, value1, value2); + + Check.That(sut.Compare(data, 0, previousScanResult, out var scanResult)).IsEqualTo(expectedResult); + Check.That(scanResult).IsEqualTo(expectedScanResult); + if (scanResult != null) + { + Check.That(scanResult).IsInstanceOf(); + } + } + + [Fact] + public void TestCompareWithPreviousThrows() + { + var sut = new ByteMemoryComparer(ScanCompareType.Unknown, 0, 0); + + Check.ThatCode(() => sut.Compare(new byte[] { 0 }, 0, new ByteScanResult(0), out _)).Throws(); + } + } +} diff --git a/ReClass.NET_Tests/MemoryScanner/Comparer/FloatMemoryComparerTest.cs b/ReClass.NET_Tests/MemoryScanner/Comparer/FloatMemoryComparerTest.cs new file mode 100644 index 00000000..b9824d4d --- /dev/null +++ b/ReClass.NET_Tests/MemoryScanner/Comparer/FloatMemoryComparerTest.cs @@ -0,0 +1,173 @@ +using System; +using NFluent; +using ReClassNET.MemoryScanner; +using ReClassNET.MemoryScanner.Comparer; +using ReClassNET.Util.Conversion; +using Xunit; + +namespace ReClass.NET_Tests.MemoryScanner.Comparer +{ + public class FloatMemoryComparerTest + { + private static EndianBitConverter BitConverter { get; } = EndianBitConverter.System; + + [Theory] + [InlineData(ScanCompareType.Equal, ScanRoundMode.Normal, 0.0f, 0.0f)] + [InlineData(ScanCompareType.Equal, ScanRoundMode.Strict, 1.0f, 2.0f)] + [InlineData(ScanCompareType.Equal, ScanRoundMode.Truncate, 2.0f, 1.0f)] + [InlineData(ScanCompareType.Between, ScanRoundMode.Normal, 2.0f, 4.0f)] + [InlineData(ScanCompareType.BetweenOrEqual, ScanRoundMode.Strict, 4.0f, 2.0f)] + [InlineData(ScanCompareType.NotEqual, ScanRoundMode.Truncate, 0.0f, 0.0f)] + public void TestConstructor(ScanCompareType compareType, ScanRoundMode roundMode, float value1, float value2) + { + var sut = new FloatMemoryComparer(compareType, roundMode, 1, value1, value2, BitConverter); + + Check.That(sut.CompareType).IsEqualTo(compareType); + Check.That(sut.RoundType).IsEqualTo(roundMode); + Check.That(sut.ValueSize).IsEqualTo(sizeof(float)); + Check.That(sut.Value1).IsOneOf(value1, value2); + Check.That(sut.Value2).IsOneOf(value1, value2); + } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + public void TestConstructorSignificantDigits(int significantDigits) + { + const float Value1 = 1.234567f; + const float Value2 = 7.654321f; + + var sut = new FloatMemoryComparer(ScanCompareType.Equal, ScanRoundMode.Normal, significantDigits, Value1, Value2, BitConverter); + + Check.That(sut.Value1).IsEqualTo((float)Math.Round(Value1, significantDigits, MidpointRounding.AwayFromZero)); + Check.That(sut.Value2).IsEqualTo((float)Math.Round(Value2, significantDigits, MidpointRounding.AwayFromZero)); + } + + public static TheoryData GetTestCompareBasicData() => new TheoryData + { + { ScanCompareType.GreaterThan, 1.0f, 0.0f, BitConverter.GetBytes(0.0f), false, null }, + { ScanCompareType.GreaterThan, 1.0f, 0.0f, BitConverter.GetBytes(2.0f), true, new FloatScanResult(2.0f) }, + { ScanCompareType.GreaterThanOrEqual, 1.0f, 0.0f, BitConverter.GetBytes(0.0f), false, null }, + { ScanCompareType.GreaterThanOrEqual, 1.0f, 0.0f, BitConverter.GetBytes(1.0f), true, new FloatScanResult(1.0f) }, + { ScanCompareType.GreaterThanOrEqual, 1.0f, 0.0f, BitConverter.GetBytes(2.0f), true, new FloatScanResult(2.0f) }, + { ScanCompareType.LessThan, 1.0f, 0.0f, BitConverter.GetBytes(1.0f), false, null }, + { ScanCompareType.LessThan, 1.0f, 0.0f, BitConverter.GetBytes(0.0f), true, new FloatScanResult(0.0f) }, + { ScanCompareType.LessThanOrEqual, 1.0f, 0.0f, BitConverter.GetBytes(2.0f), false, null }, + { ScanCompareType.LessThanOrEqual, 1.0f, 0.0f, BitConverter.GetBytes(1.0f), true, new FloatScanResult(1.0f) }, + { ScanCompareType.LessThanOrEqual, 1.0f, 0.0f, BitConverter.GetBytes(0.0f), true, new FloatScanResult(0.0f) }, + { ScanCompareType.Between, 1.0f, 2.0f, BitConverter.GetBytes(0.0f), false, null }, + { ScanCompareType.Between, 1.0f, 2.0f, BitConverter.GetBytes(1.0f), false, null }, + { ScanCompareType.Between, 1.0f, 2.0f, BitConverter.GetBytes(2.0f), false, null }, + { ScanCompareType.Between, 1.0f, 2.0f, BitConverter.GetBytes(3.0f), false, null }, + { ScanCompareType.BetweenOrEqual, 1.0f, 2.0f, BitConverter.GetBytes(0.0f), false, null }, + { ScanCompareType.BetweenOrEqual, 1.0f, 2.0f, BitConverter.GetBytes(1.0f), true, new FloatScanResult(1.0f) }, + { ScanCompareType.BetweenOrEqual, 1.0f, 2.0f, BitConverter.GetBytes(2.0f), true, new FloatScanResult(2.0f) }, + { ScanCompareType.BetweenOrEqual, 1.0f, 2.0f, BitConverter.GetBytes(3.0f), false, null } + }; + + public static TheoryData GetTestCompareScanCompareTypeUnknownData() => new TheoryData + { + { ScanCompareType.Unknown, 0.0f, 0.0f, BitConverter.GetBytes(0.0f), true, new FloatScanResult(0.0f) }, + { ScanCompareType.Unknown, 0.0f, 0.0f, BitConverter.GetBytes(1.0f), true, new FloatScanResult(1.0f) } + }; + + [Theory] + [MemberData(nameof(GetTestCompareBasicData))] + [MemberData(nameof(GetTestCompareScanCompareTypeUnknownData))] + public void TestCompare(ScanCompareType compareType, float value1, float value2, byte[] data, bool expectedResult, ScanResult expectedScanResult) + { + var sut = new FloatMemoryComparer(compareType, ScanRoundMode.Normal, 1, value1, value2, BitConverter); + + Check.That(sut.Compare(data, 0, out var scanResult)).IsEqualTo(expectedResult); + Check.That(scanResult).IsEqualTo(expectedScanResult); + if (scanResult != null) + { + Check.That(scanResult).IsInstanceOf(); + } + } + + [Theory] + [InlineData(ScanCompareType.Changed)] + [InlineData(ScanCompareType.NotChanged)] + [InlineData(ScanCompareType.Decreased)] + [InlineData(ScanCompareType.DecreasedOrEqual)] + [InlineData(ScanCompareType.Increased)] + [InlineData(ScanCompareType.IncreasedOrEqual)] + public void TestCompareInvalidCompareTypeThrows(ScanCompareType compareType) + { + var sut = new FloatMemoryComparer(compareType, ScanRoundMode.Normal, 1, 0.0f, 0.0f, BitConverter); + + Check.ThatCode(() => sut.Compare(BitConverter.GetBytes(0.0f), 0, out _)).Throws(); + } + + public static TheoryData GetTestCompareThrowsData() => new TheoryData + { + { null, 0, typeof(ArgumentNullException) }, + { new byte[0], 0, typeof(ArgumentOutOfRangeException) }, + { new byte[1], 1, typeof(ArgumentOutOfRangeException) } + }; + + [Theory] + [MemberData(nameof(GetTestCompareThrowsData))] + public void TestCompareInvalidDataThrows(byte[] data, int index, Type expectedExceptionType) + { + var sut = new FloatMemoryComparer(ScanCompareType.Unknown, ScanRoundMode.Normal, 1, 0.0f, 0.0f, BitConverter); + + Check.ThatCode(() => sut.Compare(data, index, out _)).ThrowsType(expectedExceptionType); + } + + public static TheoryData GetTestCompareWithPreviousData() + { + var data = new TheoryData + { + { ScanCompareType.Changed, 0.0f, 0.0f, BitConverter.GetBytes(0.0f), new FloatScanResult(1.0f), true, new FloatScanResult(0.0f) }, + { ScanCompareType.Changed, 0.0f, 0.0f, BitConverter.GetBytes(1.0f), new FloatScanResult(1.0f), false, null }, + { ScanCompareType.NotChanged, 0.0f, 0.0f, BitConverter.GetBytes(1.0f), new FloatScanResult(1.0f), true, new FloatScanResult(1.0f) }, + { ScanCompareType.NotChanged, 0.0f, 0.0f, BitConverter.GetBytes(0.0f), new FloatScanResult(1.0f), false, null }, + { ScanCompareType.Increased, 0.0f, 0.0f, BitConverter.GetBytes(2.0f), new FloatScanResult(1.0f), true, new FloatScanResult(2.0f) }, + { ScanCompareType.Increased, 0.0f, 0.0f, BitConverter.GetBytes(1.0f), new FloatScanResult(1.0f), false, null }, + { ScanCompareType.Increased, 0.0f, 0.0f, BitConverter.GetBytes(0.0f), new FloatScanResult(1.0f), false, null }, + { ScanCompareType.IncreasedOrEqual, 0.0f, 0.0f, BitConverter.GetBytes(2.0f), new FloatScanResult(1.0f), true, new FloatScanResult(2.0f) }, + { ScanCompareType.IncreasedOrEqual, 0.0f, 0.0f, BitConverter.GetBytes(1.0f), new FloatScanResult(1.0f), true, new FloatScanResult(1.0f) }, + { ScanCompareType.IncreasedOrEqual, 0.0f, 0.0f, BitConverter.GetBytes(0.0f), new FloatScanResult(1.0f), false, null }, + { ScanCompareType.Decreased, 0.0f, 0.0f, BitConverter.GetBytes(0.0f), new FloatScanResult(1.0f), true, new FloatScanResult(0.0f) }, + { ScanCompareType.Decreased, 0.0f, 0.0f, BitConverter.GetBytes(1.0f), new FloatScanResult(1.0f), false, null }, + { ScanCompareType.Decreased, 0.0f, 0.0f, BitConverter.GetBytes(2.0f), new FloatScanResult(1.0f), false, null }, + { ScanCompareType.DecreasedOrEqual, 0.0f, 0.0f, BitConverter.GetBytes(0.0f), new FloatScanResult(1.0f), true, new FloatScanResult(0.0f) }, + { ScanCompareType.DecreasedOrEqual, 0.0f, 0.0f, BitConverter.GetBytes(1.0f), new FloatScanResult(1.0f), true, new FloatScanResult(1.0f) }, + { ScanCompareType.DecreasedOrEqual, 0.0f, 0.0f, BitConverter.GetBytes(2.0f), new FloatScanResult(1.0f), false, null } + }; + + var basicData = GetTestCompareBasicData(); + foreach (var x in basicData) + { + data.Add((ScanCompareType)x[0], (float)x[1], (float)x[2], (byte[])x[3], new FloatScanResult(1.0f), (bool)x[4], (ScanResult)x[5]); + } + + return data; + } + + [Theory] + [MemberData(nameof(GetTestCompareWithPreviousData))] + public void TestCompareWithPrevious(ScanCompareType compareType, float value1, float value2, byte[] data, ScanResult previousScanResult, bool expectedResult, ScanResult expectedScanResult) + { + var sut = new FloatMemoryComparer(compareType, ScanRoundMode.Normal, 1, value1, value2, BitConverter); + + Check.That(sut.Compare(data, 0, previousScanResult, out var scanResult)).IsEqualTo(expectedResult); + Check.That(scanResult).IsEqualTo(expectedScanResult); + if (scanResult != null) + { + Check.That(scanResult).IsInstanceOf(); + } + } + + [Fact] + public void TestCompareWithPreviousThrows() + { + var sut = new FloatMemoryComparer(ScanCompareType.Unknown, ScanRoundMode.Normal, 1, 0, 0, BitConverter); + + Check.ThatCode(() => sut.Compare(BitConverter.GetBytes(0.0f), 0, new FloatScanResult(0.0f), out _)).Throws(); + } + } +} diff --git a/ReClass.NET_Tests/MemoryScanner/Comparer/IntegerMemoryComparerTest.cs b/ReClass.NET_Tests/MemoryScanner/Comparer/IntegerMemoryComparerTest.cs new file mode 100644 index 00000000..0d6b8e1d --- /dev/null +++ b/ReClass.NET_Tests/MemoryScanner/Comparer/IntegerMemoryComparerTest.cs @@ -0,0 +1,165 @@ +using System; +using NFluent; +using ReClassNET.MemoryScanner; +using ReClassNET.MemoryScanner.Comparer; +using ReClassNET.Util.Conversion; +using Xunit; + +namespace ReClass.NET_Tests.MemoryScanner.Comparer +{ + public class IntegerMemoryComparerTest + { + private static EndianBitConverter BitConverter { get; } = EndianBitConverter.System; + + [Theory] + [InlineData(ScanCompareType.Equal, 0, 0)] + [InlineData(ScanCompareType.Equal, 1, 2)] + [InlineData(ScanCompareType.Equal, 2, 1)] + [InlineData(ScanCompareType.Between, 2, 4)] + [InlineData(ScanCompareType.BetweenOrEqual, 4, 2)] + [InlineData(ScanCompareType.NotEqual, 0, 0)] + public void TestConstructor(ScanCompareType compareType, int value1, int value2) + { + var sut = new IntegerMemoryComparer(compareType, value1, value2, BitConverter); + + Check.That(sut.CompareType).IsEqualTo(compareType); + Check.That(sut.ValueSize).IsEqualTo(sizeof(int)); + Check.That(sut.Value1).IsOneOf(value1, value2); + Check.That(sut.Value2).IsOneOf(value1, value2); + } + + public static TheoryData GetTestCompareBasicData() => new TheoryData + { + { ScanCompareType.Equal, 0, 0, BitConverter.GetBytes(0), true, new IntegerScanResult(0) }, + { ScanCompareType.Equal, 0, 0, BitConverter.GetBytes(1), false, null }, + { ScanCompareType.Equal, 1, 0, BitConverter.GetBytes(1), true, new IntegerScanResult(1) }, + { ScanCompareType.Equal, 1, 0, BitConverter.GetBytes(0), false, null }, + { ScanCompareType.NotEqual, 1, 0, BitConverter.GetBytes(0), true, new IntegerScanResult(0) }, + { ScanCompareType.NotEqual, 1, 0, BitConverter.GetBytes(1), false, null }, + { ScanCompareType.GreaterThan, 1, 0, BitConverter.GetBytes(0), false, null }, + { ScanCompareType.GreaterThan, 1, 0, BitConverter.GetBytes(2), true, new IntegerScanResult(2) }, + { ScanCompareType.GreaterThanOrEqual, 1, 0, BitConverter.GetBytes(0), false, null }, + { ScanCompareType.GreaterThanOrEqual, 1, 0, BitConverter.GetBytes(1), true, new IntegerScanResult(1) }, + { ScanCompareType.GreaterThanOrEqual, 1, 0, BitConverter.GetBytes(2), true, new IntegerScanResult(2) }, + { ScanCompareType.LessThan, 1, 0, BitConverter.GetBytes(1), false, null }, + { ScanCompareType.LessThan, 1, 0, BitConverter.GetBytes(0), true, new IntegerScanResult(0) }, + { ScanCompareType.LessThanOrEqual, 1, 0, BitConverter.GetBytes(2), false, null }, + { ScanCompareType.LessThanOrEqual, 1, 0, BitConverter.GetBytes(1), true, new IntegerScanResult(1) }, + { ScanCompareType.LessThanOrEqual, 1, 0, BitConverter.GetBytes(0), true, new IntegerScanResult(0) }, + { ScanCompareType.Between, 1, 2, BitConverter.GetBytes(0), false, null }, + { ScanCompareType.Between, 1, 2, BitConverter.GetBytes(1), false, null }, + { ScanCompareType.Between, 1, 2, BitConverter.GetBytes(2), false, null }, + { ScanCompareType.Between, 1, 2, BitConverter.GetBytes(3), false, null }, + { ScanCompareType.BetweenOrEqual, 1, 2, BitConverter.GetBytes(0), false, null }, + { ScanCompareType.BetweenOrEqual, 1, 2, BitConverter.GetBytes(1), true, new IntegerScanResult(1) }, + { ScanCompareType.BetweenOrEqual, 1, 2, BitConverter.GetBytes(2), true, new IntegerScanResult(2) }, + { ScanCompareType.BetweenOrEqual, 1, 2, BitConverter.GetBytes(3), false, null } + }; + + public static TheoryData GetTestCompareScanCompareTypeUnknownData() => new TheoryData + { + { ScanCompareType.Unknown, 0, 0, BitConverter.GetBytes(0), true, new IntegerScanResult(0) }, + { ScanCompareType.Unknown, 0, 0, BitConverter.GetBytes(1), true, new IntegerScanResult(1) } + }; + + [Theory] + [MemberData(nameof(GetTestCompareBasicData))] + [MemberData(nameof(GetTestCompareScanCompareTypeUnknownData))] + public void TestCompare(ScanCompareType compareType, int value1, int value2, byte[] data, bool expectedResult, ScanResult expectedScanResult) + { + var sut = new IntegerMemoryComparer(compareType, value1, value2, BitConverter); + + Check.That(sut.Compare(data, 0, out var scanResult)).IsEqualTo(expectedResult); + Check.That(scanResult).IsEqualTo(expectedScanResult); + if (scanResult != null) + { + Check.That(scanResult).IsInstanceOf(); + } + } + + [Theory] + [InlineData(ScanCompareType.Changed)] + [InlineData(ScanCompareType.NotChanged)] + [InlineData(ScanCompareType.Decreased)] + [InlineData(ScanCompareType.DecreasedOrEqual)] + [InlineData(ScanCompareType.Increased)] + [InlineData(ScanCompareType.IncreasedOrEqual)] + public void TestCompareInvalidCompareTypeThrows(ScanCompareType compareType) + { + var sut = new IntegerMemoryComparer(compareType, 0, 0, BitConverter); + + Check.ThatCode(() => sut.Compare(BitConverter.GetBytes(0), 0, out _)).Throws(); + } + + public static TheoryData GetTestCompareThrowsData() => new TheoryData + { + { null, 0, typeof(ArgumentNullException) }, + { new byte[0], 0, typeof(ArgumentOutOfRangeException) }, + { new byte[4], 4, typeof(ArgumentOutOfRangeException) }, + { new byte[3], 0, typeof(ArgumentException) }, + { new byte[4], 1, typeof(ArgumentException) } + }; + + [Theory] + [MemberData(nameof(GetTestCompareThrowsData))] + public void TestCompareInvalidDataThrows(byte[] data, int index, Type expectedExceptionType) + { + var sut = new IntegerMemoryComparer(ScanCompareType.Equal, 0, 0, BitConverter); + + Check.ThatCode(() => sut.Compare(data, index, out _)).ThrowsType(expectedExceptionType); + } + + public static TheoryData GetTestCompareWithPreviousData() + { + var data = new TheoryData + { + { ScanCompareType.Changed, 0, 0, BitConverter.GetBytes(0), new IntegerScanResult(1), true, new IntegerScanResult(0) }, + { ScanCompareType.Changed, 0, 0, BitConverter.GetBytes(1), new IntegerScanResult(1), false, null }, + { ScanCompareType.NotChanged, 0, 0, BitConverter.GetBytes(1), new IntegerScanResult(1), true, new IntegerScanResult(1) }, + { ScanCompareType.NotChanged, 0, 0, BitConverter.GetBytes(0), new IntegerScanResult(1), false, null }, + { ScanCompareType.Increased, 0, 0, BitConverter.GetBytes(2), new IntegerScanResult(1), true, new IntegerScanResult(2) }, + { ScanCompareType.Increased, 0, 0, BitConverter.GetBytes(1), new IntegerScanResult(1), false, null }, + { ScanCompareType.Increased, 0, 0, BitConverter.GetBytes(0), new IntegerScanResult(1), false, null }, + { ScanCompareType.IncreasedOrEqual, 0, 0, BitConverter.GetBytes(2), new IntegerScanResult(1), true, new IntegerScanResult(2) }, + { ScanCompareType.IncreasedOrEqual, 0, 0, BitConverter.GetBytes(1), new IntegerScanResult(1), true, new IntegerScanResult(1) }, + { ScanCompareType.IncreasedOrEqual, 0, 0, BitConverter.GetBytes(0), new IntegerScanResult(1), false, null }, + { ScanCompareType.Decreased, 0, 0, BitConverter.GetBytes(0), new IntegerScanResult(1), true, new IntegerScanResult(0) }, + { ScanCompareType.Decreased, 0, 0, BitConverter.GetBytes(1), new IntegerScanResult(1), false, null }, + { ScanCompareType.Decreased, 0, 0, BitConverter.GetBytes(2), new IntegerScanResult(1), false, null }, + { ScanCompareType.DecreasedOrEqual, 0, 0, BitConverter.GetBytes(0), new IntegerScanResult(1), true, new IntegerScanResult(0) }, + { ScanCompareType.DecreasedOrEqual, 0, 0, BitConverter.GetBytes(1), new IntegerScanResult(1), true, new IntegerScanResult(1) }, + { ScanCompareType.DecreasedOrEqual, 0, 0, BitConverter.GetBytes(2), new IntegerScanResult(1), false, null } + }; + + var basicData = GetTestCompareBasicData(); + foreach (var x in basicData) + { + data.Add((ScanCompareType)x[0], (int)x[1], (int)x[2], (byte[])x[3], new IntegerScanResult(1), (bool)x[4], (ScanResult)x[5]); + } + + return data; + } + + [Theory] + [MemberData(nameof(GetTestCompareWithPreviousData))] + public void TestCompareWithPrevious(ScanCompareType compareType, int value1, int value2, byte[] data, ScanResult previousScanResult, bool expectedResult, ScanResult expectedScanResult) + { + var sut = new IntegerMemoryComparer(compareType, value1, value2, BitConverter); + + Check.That(sut.Compare(data, 0, previousScanResult, out var scanResult)).IsEqualTo(expectedResult); + Check.That(scanResult).IsEqualTo(expectedScanResult); + if (scanResult != null) + { + Check.That(scanResult).IsInstanceOf(); + } + } + + [Fact] + public void TestCompareWithPreviousThrows() + { + var sut = new IntegerMemoryComparer(ScanCompareType.Unknown, 0, 0, BitConverter); + + Check.ThatCode(() => sut.Compare(BitConverter.GetBytes(0), 0, new IntegerScanResult(0), out _)).Throws(); + } + } +} diff --git a/ReClass.NET_Tests/MemoryScanner/Comparer/LongMemoryComparerTest.cs b/ReClass.NET_Tests/MemoryScanner/Comparer/LongMemoryComparerTest.cs new file mode 100644 index 00000000..a298ebb3 --- /dev/null +++ b/ReClass.NET_Tests/MemoryScanner/Comparer/LongMemoryComparerTest.cs @@ -0,0 +1,165 @@ +using System; +using NFluent; +using ReClassNET.MemoryScanner; +using ReClassNET.MemoryScanner.Comparer; +using ReClassNET.Util.Conversion; +using Xunit; + +namespace ReClass.NET_Tests.MemoryScanner.Comparer +{ + public class LongMemoryComparerTest + { + private static EndianBitConverter BitConverter { get; } = EndianBitConverter.System; + + [Theory] + [InlineData(ScanCompareType.Equal, 0L, 0L)] + [InlineData(ScanCompareType.Equal, 1L, 2L)] + [InlineData(ScanCompareType.Equal, 2L, 1L)] + [InlineData(ScanCompareType.Between, 2L, 4L)] + [InlineData(ScanCompareType.BetweenOrEqual, 4L, 2L)] + [InlineData(ScanCompareType.NotEqual, 0L, 0L)] + public void TestConstructor(ScanCompareType compareType, long value1, long value2) + { + var sut = new LongMemoryComparer(compareType, value1, value2, BitConverter); + + Check.That(sut.CompareType).IsEqualTo(compareType); + Check.That(sut.ValueSize).IsEqualTo(sizeof(long)); + Check.That(sut.Value1).IsOneOf(value1, value2); + Check.That(sut.Value2).IsOneOf(value1, value2); + } + + public static TheoryData GetTestCompareBasicData() => new TheoryData + { + { ScanCompareType.Equal, 0L, 0L, BitConverter.GetBytes(0L), true, new LongScanResult(0L) }, + { ScanCompareType.Equal, 0L, 0L, BitConverter.GetBytes(1L), false, null }, + { ScanCompareType.Equal, 1L, 0L, BitConverter.GetBytes(1L), true, new LongScanResult(1L) }, + { ScanCompareType.Equal, 1L, 0L, BitConverter.GetBytes(0L), false, null }, + { ScanCompareType.NotEqual, 1L, 0L, BitConverter.GetBytes(0L), true, new LongScanResult(0L) }, + { ScanCompareType.NotEqual, 1L, 0L, BitConverter.GetBytes(1L), false, null }, + { ScanCompareType.GreaterThan, 1L, 0L, BitConverter.GetBytes(0L), false, null }, + { ScanCompareType.GreaterThan, 1L, 0L, BitConverter.GetBytes(2L), true, new LongScanResult(2L) }, + { ScanCompareType.GreaterThanOrEqual, 1L, 0L, BitConverter.GetBytes(0L), false, null }, + { ScanCompareType.GreaterThanOrEqual, 1L, 0L, BitConverter.GetBytes(1L), true, new LongScanResult(1L) }, + { ScanCompareType.GreaterThanOrEqual, 1L, 0L, BitConverter.GetBytes(2L), true, new LongScanResult(2L) }, + { ScanCompareType.LessThan, 1L, 0L, BitConverter.GetBytes(1L), false, null }, + { ScanCompareType.LessThan, 1L, 0L, BitConverter.GetBytes(0L), true, new LongScanResult(0L) }, + { ScanCompareType.LessThanOrEqual, 1L, 0L, BitConverter.GetBytes(2L), false, null }, + { ScanCompareType.LessThanOrEqual, 1L, 0L, BitConverter.GetBytes(1L), true, new LongScanResult(1L) }, + { ScanCompareType.LessThanOrEqual, 1L, 0L, BitConverter.GetBytes(0L), true, new LongScanResult(0L) }, + { ScanCompareType.Between, 1L, 2L, BitConverter.GetBytes(0L), false, null }, + { ScanCompareType.Between, 1L, 2L, BitConverter.GetBytes(1L), false, null }, + { ScanCompareType.Between, 1L, 2L, BitConverter.GetBytes(2L), false, null }, + { ScanCompareType.Between, 1L, 2L, BitConverter.GetBytes(3L), false, null }, + { ScanCompareType.BetweenOrEqual, 1L, 2L, BitConverter.GetBytes(0L), false, null }, + { ScanCompareType.BetweenOrEqual, 1L, 2L, BitConverter.GetBytes(1L), true, new LongScanResult(1L) }, + { ScanCompareType.BetweenOrEqual, 1L, 2L, BitConverter.GetBytes(2L), true, new LongScanResult(2L) }, + { ScanCompareType.BetweenOrEqual, 1L, 2L, BitConverter.GetBytes(3L), false, null } + }; + + public static TheoryData GetTestCompareScanCompareTypeUnknownData() => new TheoryData + { + { ScanCompareType.Unknown, 0L, 0L, BitConverter.GetBytes(0L), true, new LongScanResult(0L) }, + { ScanCompareType.Unknown, 0L, 0L, BitConverter.GetBytes(1L), true, new LongScanResult(1L) } + }; + + [Theory] + [MemberData(nameof(GetTestCompareBasicData))] + [MemberData(nameof(GetTestCompareScanCompareTypeUnknownData))] + public void TestCompare(ScanCompareType compareType, long value1, long value2, byte[] data, bool expectedResult, ScanResult expectedScanResult) + { + var sut = new LongMemoryComparer(compareType, value1, value2, BitConverter); + + Check.That(sut.Compare(data, 0, out var scanResult)).IsEqualTo(expectedResult); + Check.That(scanResult).IsEqualTo(expectedScanResult); + if (scanResult != null) + { + Check.That(scanResult).IsInstanceOf(); + } + } + + [Theory] + [InlineData(ScanCompareType.Changed)] + [InlineData(ScanCompareType.NotChanged)] + [InlineData(ScanCompareType.Decreased)] + [InlineData(ScanCompareType.DecreasedOrEqual)] + [InlineData(ScanCompareType.Increased)] + [InlineData(ScanCompareType.IncreasedOrEqual)] + public void TestCompareInvalidCompareTypeThrows(ScanCompareType compareType) + { + var sut = new LongMemoryComparer(compareType, 0L, 0L, BitConverter); + + Check.ThatCode(() => sut.Compare(BitConverter.GetBytes(0L), 0, out _)).Throws(); + } + + public static TheoryData GetTestCompareThrowsData() => new TheoryData + { + { null, 0, typeof(ArgumentNullException) }, + { new byte[0], 0, typeof(ArgumentOutOfRangeException) }, + { new byte[8], 8, typeof(ArgumentOutOfRangeException) }, + { new byte[7], 0, typeof(ArgumentException) }, + { new byte[8], 1, typeof(ArgumentException) } + }; + + [Theory] + [MemberData(nameof(GetTestCompareThrowsData))] + public void TestCompareInvalidDataThrows(byte[] data, int index, Type expectedExceptionType) + { + var sut = new LongMemoryComparer(ScanCompareType.Equal, 0L, 0L, BitConverter); + + Check.ThatCode(() => sut.Compare(data, index, out _)).ThrowsType(expectedExceptionType); + } + + public static TheoryData GetTestCompareWithPreviousData() + { + var data = new TheoryData + { + { ScanCompareType.Changed, 0L, 0L, BitConverter.GetBytes(0L), new LongScanResult(1L), true, new LongScanResult(0) }, + { ScanCompareType.Changed, 0L, 0L, BitConverter.GetBytes(1L), new LongScanResult(1L), false, null }, + { ScanCompareType.NotChanged, 0L, 0L, BitConverter.GetBytes(1L), new LongScanResult(1L), true, new LongScanResult(1) }, + { ScanCompareType.NotChanged, 0L, 0L, BitConverter.GetBytes(0L), new LongScanResult(1L), false, null }, + { ScanCompareType.Increased, 0L, 0L, BitConverter.GetBytes(2L), new LongScanResult(1L), true, new LongScanResult(2) }, + { ScanCompareType.Increased, 0L, 0L, BitConverter.GetBytes(1L), new LongScanResult(1L), false, null }, + { ScanCompareType.Increased, 0L, 0L, BitConverter.GetBytes(0L), new LongScanResult(1L), false, null }, + { ScanCompareType.IncreasedOrEqual, 0L, 0L, BitConverter.GetBytes(2L), new LongScanResult(1L), true, new LongScanResult(2) }, + { ScanCompareType.IncreasedOrEqual, 0L, 0L, BitConverter.GetBytes(1L), new LongScanResult(1L), true, new LongScanResult(1) }, + { ScanCompareType.IncreasedOrEqual, 0L, 0L, BitConverter.GetBytes(0L), new LongScanResult(1L), false, null }, + { ScanCompareType.Decreased, 0L, 0L, BitConverter.GetBytes(0L), new LongScanResult(1L), true, new LongScanResult(0) }, + { ScanCompareType.Decreased, 0L, 0L, BitConverter.GetBytes(1L), new LongScanResult(1L), false, null }, + { ScanCompareType.Decreased, 0L, 0L, BitConverter.GetBytes(2L), new LongScanResult(1L), false, null }, + { ScanCompareType.DecreasedOrEqual, 0L, 0L, BitConverter.GetBytes(0L), new LongScanResult(1L), true, new LongScanResult(0) }, + { ScanCompareType.DecreasedOrEqual, 0L, 0L, BitConverter.GetBytes(1L), new LongScanResult(1L), true, new LongScanResult(1) }, + { ScanCompareType.DecreasedOrEqual, 0L, 0L, BitConverter.GetBytes(2L), new LongScanResult(1L), false, null } + }; + + var basicData = GetTestCompareBasicData(); + foreach (var x in basicData) + { + data.Add((ScanCompareType)x[0], (long)x[1], (long)x[2], (byte[])x[3], new LongScanResult(1L), (bool)x[4], (ScanResult)x[5]); + } + + return data; + } + + [Theory] + [MemberData(nameof(GetTestCompareWithPreviousData))] + public void TestCompareWithPrevious(ScanCompareType compareType, long value1, long value2, byte[] data, ScanResult previousScanResult, bool expectedResult, ScanResult expectedScanResult) + { + var sut = new LongMemoryComparer(compareType, value1, value2, BitConverter); + + Check.That(sut.Compare(data, 0, previousScanResult, out var scanResult)).IsEqualTo(expectedResult); + Check.That(scanResult).IsEqualTo(expectedScanResult); + if (scanResult != null) + { + Check.That(scanResult).IsInstanceOf(); + } + } + + [Fact] + public void TestCompareWithPreviousThrows() + { + var sut = new LongMemoryComparer(ScanCompareType.Unknown, 0L, 0L, BitConverter); + + Check.ThatCode(() => sut.Compare(BitConverter.GetBytes(0L), 0, new LongScanResult(0L), out _)).Throws(); + } + } +} diff --git a/ReClass.NET_Tests/MemoryScanner/Comparer/ShortMemoryComparerTest.cs b/ReClass.NET_Tests/MemoryScanner/Comparer/ShortMemoryComparerTest.cs new file mode 100644 index 00000000..b87f37ef --- /dev/null +++ b/ReClass.NET_Tests/MemoryScanner/Comparer/ShortMemoryComparerTest.cs @@ -0,0 +1,165 @@ +using System; +using NFluent; +using ReClassNET.MemoryScanner; +using ReClassNET.MemoryScanner.Comparer; +using ReClassNET.Util.Conversion; +using Xunit; + +namespace ReClass.NET_Tests.MemoryScanner.Comparer +{ + public class ShortMemoryComparerTest + { + private static EndianBitConverter BitConverter { get; } = EndianBitConverter.System; + + [Theory] + [InlineData(ScanCompareType.Equal, 0, 0)] + [InlineData(ScanCompareType.Equal, 1, 2)] + [InlineData(ScanCompareType.Equal, 2, 1)] + [InlineData(ScanCompareType.Between, 2, 4)] + [InlineData(ScanCompareType.BetweenOrEqual, 4, 2)] + [InlineData(ScanCompareType.NotEqual, 0, 0)] + public void TestConstructor(ScanCompareType compareType, short value1, short value2) + { + var sut = new ShortMemoryComparer(compareType, value1, value2, BitConverter); + + Check.That(sut.CompareType).IsEqualTo(compareType); + Check.That(sut.ValueSize).IsEqualTo(sizeof(short)); + Check.That(sut.Value1).IsOneOf(value1, value2); + Check.That(sut.Value2).IsOneOf(value1, value2); + } + + public static TheoryData GetTestCompareBasicData() => new TheoryData + { + { ScanCompareType.Equal, 0, 0, BitConverter.GetBytes((short)0), true, new ShortScanResult(0) }, + { ScanCompareType.Equal, 0, 0, BitConverter.GetBytes((short)1), false, null }, + { ScanCompareType.Equal, 1, 0, BitConverter.GetBytes((short)1), true, new ShortScanResult(1) }, + { ScanCompareType.Equal, 1, 0, BitConverter.GetBytes((short)0), false, null }, + { ScanCompareType.NotEqual, 1, 0, BitConverter.GetBytes((short)0), true, new ShortScanResult(0) }, + { ScanCompareType.NotEqual, 1, 0, BitConverter.GetBytes((short)1), false, null }, + { ScanCompareType.GreaterThan, 1, 0, BitConverter.GetBytes((short)0), false, null }, + { ScanCompareType.GreaterThan, 1, 0, BitConverter.GetBytes((short)2), true, new ShortScanResult(2) }, + { ScanCompareType.GreaterThanOrEqual, 1, 0, BitConverter.GetBytes((short)0), false, null }, + { ScanCompareType.GreaterThanOrEqual, 1, 0, BitConverter.GetBytes((short)1), true, new ShortScanResult(1) }, + { ScanCompareType.GreaterThanOrEqual, 1, 0, BitConverter.GetBytes((short)2), true, new ShortScanResult(2) }, + { ScanCompareType.LessThan, 1, 0, BitConverter.GetBytes((short)1), false, null }, + { ScanCompareType.LessThan, 1, 0, BitConverter.GetBytes((short)0), true, new ShortScanResult(0) }, + { ScanCompareType.LessThanOrEqual, 1, 0, BitConverter.GetBytes((short)2), false, null }, + { ScanCompareType.LessThanOrEqual, 1, 0, BitConverter.GetBytes((short)1), true, new ShortScanResult(1) }, + { ScanCompareType.LessThanOrEqual, 1, 0, BitConverter.GetBytes((short)0), true, new ShortScanResult(0) }, + { ScanCompareType.Between, 1, 2, BitConverter.GetBytes((short)0), false, null }, + { ScanCompareType.Between, 1, 2, BitConverter.GetBytes((short)1), false, null }, + { ScanCompareType.Between, 1, 2, BitConverter.GetBytes((short)2), false, null }, + { ScanCompareType.Between, 1, 2, BitConverter.GetBytes((short)3), false, null }, + { ScanCompareType.BetweenOrEqual, 1, 2, BitConverter.GetBytes((short)0), false, null }, + { ScanCompareType.BetweenOrEqual, 1, 2, BitConverter.GetBytes((short)1), true, new ShortScanResult(1) }, + { ScanCompareType.BetweenOrEqual, 1, 2, BitConverter.GetBytes((short)2), true, new ShortScanResult(2) }, + { ScanCompareType.BetweenOrEqual, 1, 2, BitConverter.GetBytes((short)3), false, null } + }; + + public static TheoryData GetTestCompareScanCompareTypeUnknownData() => new TheoryData + { + { ScanCompareType.Unknown, 0, 0, BitConverter.GetBytes((short)0), true, new ShortScanResult(0) }, + { ScanCompareType.Unknown, 0, 0, BitConverter.GetBytes((short)1), true, new ShortScanResult(1) } + }; + + [Theory] + [MemberData(nameof(GetTestCompareBasicData))] + [MemberData(nameof(GetTestCompareScanCompareTypeUnknownData))] + public void TestCompare(ScanCompareType compareType, short value1, short value2, byte[] data, bool expectedResult, ScanResult expectedScanResult) + { + var sut = new ShortMemoryComparer(compareType, value1, value2, BitConverter); + + Check.That(sut.Compare(data, 0, out var scanResult)).IsEqualTo(expectedResult); + Check.That(scanResult).IsEqualTo(expectedScanResult); + if (scanResult != null) + { + Check.That(scanResult).IsInstanceOf(); + } + } + + [Theory] + [InlineData(ScanCompareType.Changed)] + [InlineData(ScanCompareType.NotChanged)] + [InlineData(ScanCompareType.Decreased)] + [InlineData(ScanCompareType.DecreasedOrEqual)] + [InlineData(ScanCompareType.Increased)] + [InlineData(ScanCompareType.IncreasedOrEqual)] + public void TestCompareInvalidCompareTypeThrows(ScanCompareType compareType) + { + var sut = new ShortMemoryComparer(compareType, 0, 0, BitConverter); + + Check.ThatCode(() => sut.Compare(BitConverter.GetBytes((short)0), 0, out _)).Throws(); + } + + public static TheoryData GetTestCompareThrowsData() => new TheoryData + { + { null, 0, typeof(ArgumentNullException) }, + { new byte[0], 0, typeof(ArgumentOutOfRangeException) }, + { new byte[2], 2, typeof(ArgumentOutOfRangeException) }, + { new byte[1], 0, typeof(ArgumentException) }, + { new byte[2], 1, typeof(ArgumentException) } + }; + + [Theory] + [MemberData(nameof(GetTestCompareThrowsData))] + public void TestCompareInvalidDataThrows(byte[] data, int index, Type expectedExceptionType) + { + var sut = new ShortMemoryComparer(ScanCompareType.Equal, 0, 0, BitConverter); + + Check.ThatCode(() => sut.Compare(data, index, out _)).ThrowsType(expectedExceptionType); + } + + public static TheoryData GetTestCompareWithPreviousData() + { + var data = new TheoryData + { + { ScanCompareType.Changed, 0, 0, BitConverter.GetBytes((short)0), new ShortScanResult(1), true, new ShortScanResult(0) }, + { ScanCompareType.Changed, 0, 0, BitConverter.GetBytes((short)1), new ShortScanResult(1), false, null }, + { ScanCompareType.NotChanged, 0, 0, BitConverter.GetBytes((short)1), new ShortScanResult(1), true, new ShortScanResult(1) }, + { ScanCompareType.NotChanged, 0, 0, BitConverter.GetBytes((short)0), new ShortScanResult(1), false, null }, + { ScanCompareType.Increased, 0, 0, BitConverter.GetBytes((short)2), new ShortScanResult(1), true, new ShortScanResult(2) }, + { ScanCompareType.Increased, 0, 0, BitConverter.GetBytes((short)1), new ShortScanResult(1), false, null }, + { ScanCompareType.Increased, 0, 0, BitConverter.GetBytes((short)0), new ShortScanResult(1), false, null }, + { ScanCompareType.IncreasedOrEqual, 0, 0, BitConverter.GetBytes((short)2), new ShortScanResult(1), true, new ShortScanResult(2) }, + { ScanCompareType.IncreasedOrEqual, 0, 0, BitConverter.GetBytes((short)1), new ShortScanResult(1), true, new ShortScanResult(1) }, + { ScanCompareType.IncreasedOrEqual, 0, 0, BitConverter.GetBytes((short)0), new ShortScanResult(1), false, null }, + { ScanCompareType.Decreased, 0, 0, BitConverter.GetBytes((short)0), new ShortScanResult(1), true, new ShortScanResult(0) }, + { ScanCompareType.Decreased, 0, 0, BitConverter.GetBytes((short)1), new ShortScanResult(1), false, null }, + { ScanCompareType.Decreased, 0, 0, BitConverter.GetBytes((short)2), new ShortScanResult(1), false, null }, + { ScanCompareType.DecreasedOrEqual, 0, 0, BitConverter.GetBytes((short)0), new ShortScanResult(1), true, new ShortScanResult(0) }, + { ScanCompareType.DecreasedOrEqual, 0, 0, BitConverter.GetBytes((short)1), new ShortScanResult(1), true, new ShortScanResult(1) }, + { ScanCompareType.DecreasedOrEqual, 0, 0, BitConverter.GetBytes((short)2), new ShortScanResult(1), false, null } + }; + + var basicData = GetTestCompareBasicData(); + foreach (var x in basicData) + { + data.Add((ScanCompareType)x[0], (short)x[1], (short)x[2], (byte[])x[3], new ShortScanResult(1), (bool)x[4], (ScanResult)x[5]); + } + + return data; + } + + [Theory] + [MemberData(nameof(GetTestCompareWithPreviousData))] + public void TestCompareWithPrevious(ScanCompareType compareType, short value1, short value2, byte[] data, ScanResult previousScanResult, bool expectedResult, ScanResult expectedScanResult) + { + var sut = new ShortMemoryComparer(compareType, value1, value2, BitConverter); + + Check.That(sut.Compare(data, 0, previousScanResult, out var scanResult)).IsEqualTo(expectedResult); + Check.That(scanResult).IsEqualTo(expectedScanResult); + if (scanResult != null) + { + Check.That(scanResult).IsInstanceOf(); + } + } + + [Fact] + public void TestCompareWithPreviousThrows() + { + var sut = new ShortMemoryComparer(ScanCompareType.Unknown, 0, 0, BitConverter); + + Check.ThatCode(() => sut.Compare(BitConverter.GetBytes((short)0), 0, new ShortScanResult(0), out _)).Throws(); + } + } +} diff --git a/ReClass.NET_Tests/Properties/AssemblyInfo.cs b/ReClass.NET_Tests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..dfba9306 --- /dev/null +++ b/ReClass.NET_Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("ReClass.NET_Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ReClass.NET_Tests")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("e2d0424d-738f-41c3-9935-1b282624600f")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ReClass.NET_Tests/ReClass.NET_Tests.csproj b/ReClass.NET_Tests/ReClass.NET_Tests.csproj new file mode 100644 index 00000000..02c7ae25 --- /dev/null +++ b/ReClass.NET_Tests/ReClass.NET_Tests.csproj @@ -0,0 +1,130 @@ + + + + + Debug + x86 + {E2D0424D-738F-41C3-9935-1B282624600F} + Library + Properties + ReClass.NET_Tests + ReClass.NET_Tests + v4.7.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + UnitTest + + + latest + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + x86 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + x86 + + + true + full + false + bin\Debug\ + TRACE;DEBUG;RECLASSNET64 + prompt + 4 + x64 + + + pdbonly + true + bin\Release\ + TRACE;RECLASSNET64 + prompt + 4 + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {bfb8917d-e9b4-463f-a6e8-612c35728c78} + ReClass.NET + + + + + 4.10.1 + + + 2.5.0 + + + 2.4.1 + + + 2.4.1 + runtime; build; native; contentfiles; analyzers + all + + + + + \ No newline at end of file diff --git a/ReClass.NET_Tests/UI/DpiUtilTest.cs b/ReClass.NET_Tests/UI/DpiUtilTest.cs new file mode 100644 index 00000000..bf768490 --- /dev/null +++ b/ReClass.NET_Tests/UI/DpiUtilTest.cs @@ -0,0 +1,43 @@ +using System.Drawing; +using NFluent; +using ReClassNET.UI; +using Xunit; + +namespace ReClass.NET_Tests.UI +{ + public class DpiUtilTest + { + [Fact] + public void ScaleImageReturnsNullOnNull() + { + Check.That(DpiUtil.ScaleImage(null)).IsNull(); + } + + [Fact] + public void ScaleImageReturnsOriginalInstanceOnSameSize() + { + DpiUtil.SetDpi(DpiUtil.DefalutDpi, DpiUtil.DefalutDpi); + + using var sourceImage = new Bitmap(10, 10); + var scaledImage = DpiUtil.ScaleImage(sourceImage); + + Check.That(sourceImage).IsSameReferenceAs(scaledImage); + } + + [Fact] + public void ScaleImageReturnsScaledImage() + { + const int SourceSize = 10; + const int ScaleFactor = 2; + + DpiUtil.SetDpi(DpiUtil.DefalutDpi * ScaleFactor, DpiUtil.DefalutDpi * ScaleFactor); + + using var sourceImage = new Bitmap(SourceSize, SourceSize); + using var scaledImage = DpiUtil.ScaleImage(sourceImage); + + Check.That(sourceImage).Not.IsSameReferenceAs(scaledImage); + Check.That(scaledImage.Width).IsEqualTo(sourceImage.Width * ScaleFactor); + Check.That(scaledImage.Height).IsEqualTo(sourceImage.Height * ScaleFactor); + } + } +} diff --git a/ReClass.NET_Tests/Util/BitStringTest.cs b/ReClass.NET_Tests/Util/BitStringTest.cs new file mode 100644 index 00000000..7a6a0b79 --- /dev/null +++ b/ReClass.NET_Tests/Util/BitStringTest.cs @@ -0,0 +1,69 @@ +using NFluent; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class BitStringTest + { + [Theory] + [InlineData(0, "0000 0000")] + [InlineData(1, "0000 0001")] + [InlineData(127, "0111 1111")] + [InlineData(128, "1000 0000")] + [InlineData(255, "1111 1111")] + [InlineData(0b1010_1010, "1010 1010")] + public void TestToStringByte(byte value, string expected) + { + Check.That(BitString.ToString(value)).IsEqualTo(expected); + } + + [Theory] + [InlineData(0, "0000 0000 0000 0000")] + [InlineData(1, "0000 0000 0000 0001")] + [InlineData(127, "0000 0000 0111 1111")] + [InlineData(128, "0000 0000 1000 0000")] + [InlineData(255, "0000 0000 1111 1111")] + [InlineData(short.MaxValue, "0111 1111 1111 1111")] + [InlineData(short.MinValue, "1000 0000 0000 0000")] + [InlineData(unchecked((short)0b1010_1010_1010_1010), "1010 1010 1010 1010")] + public void TestToStringShort(short value, string expected) + { + Check.That(BitString.ToString(value)).IsEqualTo(expected); + } + + [Theory] + [InlineData(0, "0000 0000 0000 0000 0000 0000 0000 0000")] + [InlineData(1, "0000 0000 0000 0000 0000 0000 0000 0001")] + [InlineData(127, "0000 0000 0000 0000 0000 0000 0111 1111")] + [InlineData(128, "0000 0000 0000 0000 0000 0000 1000 0000")] + [InlineData(255, "0000 0000 0000 0000 0000 0000 1111 1111")] + [InlineData(short.MaxValue, "0000 0000 0000 0000 0111 1111 1111 1111")] + [InlineData(short.MinValue, "1111 1111 1111 1111 1000 0000 0000 0000")] + [InlineData(int.MaxValue, "0111 1111 1111 1111 1111 1111 1111 1111")] + [InlineData(int.MinValue, "1000 0000 0000 0000 0000 0000 0000 0000")] + [InlineData(unchecked((int)0b1010_1010_1010_1010_1010_1010_1010_1010), "1010 1010 1010 1010 1010 1010 1010 1010")] + public void TestToStringInt(int value, string expected) + { + Check.That(BitString.ToString(value)).IsEqualTo(expected); + } + + [Theory] + [InlineData(0, "0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000")] + [InlineData(1, "0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001")] + [InlineData(127, "0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0111 1111")] + [InlineData(128, "0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1000 0000")] + [InlineData(255, "0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1111 1111")] + [InlineData(short.MaxValue, "0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0111 1111 1111 1111")] + [InlineData(short.MinValue, "1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1000 0000 0000 0000")] + [InlineData(int.MaxValue, "0000 0000 0000 0000 0000 0000 0000 0000 0111 1111 1111 1111 1111 1111 1111 1111")] + [InlineData(int.MinValue, "1111 1111 1111 1111 1111 1111 1111 1111 1000 0000 0000 0000 0000 0000 0000 0000")] + [InlineData(long.MaxValue, "0111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111")] + [InlineData(long.MinValue, "1000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000")] + [InlineData(unchecked((long)0b1010_1010_1010_1010_1010_1010_1010_1010_1010_1010_1010_1010_1010_1010_1010_1010), "1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010")] + public void TestToStringLong(long value, string expected) + { + Check.That(BitString.ToString(value)).IsEqualTo(expected); + } + } +} diff --git a/ReClass.NET_Tests/Util/CircularBufferTest.cs b/ReClass.NET_Tests/Util/CircularBufferTest.cs new file mode 100644 index 00000000..c82f4334 --- /dev/null +++ b/ReClass.NET_Tests/Util/CircularBufferTest.cs @@ -0,0 +1,86 @@ +using System; +using System.Linq; +using NFluent; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class CircularBufferTest + { + [Fact] + public void CheckInitialCapacityCount() + { + const int Capacity = 5; + + var cb = new CircularBuffer(Capacity); + + Check.That(cb.Capacity).IsEqualTo(Capacity); + Check.That(cb.Count).IsEqualTo(0); + } + + [Fact] + public void DequeueFromEmptyBufferThrows() + { + var cb = new CircularBuffer(1); + + Check.ThatCode(() => cb.Dequeue()).Throws(); + } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(10)] + [InlineData(100)] + public void CheckEnqueueAndDeque(int value) + { + var cb = new CircularBuffer(1); + + var overwrittenValue = cb.Enqueue(value); + + Check.That(overwrittenValue).IsEqualTo(default); + + Check.That(cb.Dequeue()).IsEqualTo(value); + } + + [Theory] + [InlineData(1)] + [InlineData(1, 2)] + [InlineData(1, 2, 3)] + [InlineData(1, 2, 3, 4)] + [InlineData(1, 2, 3, 4, 5)] + public void CheckMultipleEnqueueAndDeque(params int[] values) + { + var cb = new CircularBuffer(values.Length); + + foreach (var value in values) + { + cb.Enqueue(value); + } + + foreach (var value in values.Reverse()) + { + Check.That(cb.Dequeue()).IsEqualTo(value); + } + } + + [Theory] + [InlineData(1, 2)] + [InlineData(1, 2, 3)] + [InlineData(1, 2, 3, 4)] + [InlineData(1, 2, 3, 4, 5)] + public void CheckOverflow(params int[] values) + { + var cb = new CircularBuffer(1); + + cb.Enqueue(values[0]); + + for (var i = 1; i < values.Length; ++i) + { + Check.That(cb.Enqueue(values[i])).IsEqualTo(values[i - 1]); + } + + Check.That(cb.Dequeue()).IsEqualTo(values[values.Length - 1]); + } + } +} diff --git a/ReClass.NET_Tests/Util/CommandLineArgsTest.cs b/ReClass.NET_Tests/Util/CommandLineArgsTest.cs new file mode 100644 index 00000000..7ef2ff60 --- /dev/null +++ b/ReClass.NET_Tests/Util/CommandLineArgsTest.cs @@ -0,0 +1,112 @@ +using System.Collections.Generic; +using System.Linq; +using NFluent; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class CommandLineArgsTest + { + [Fact] + public void TestNullArgs() + { + var sut = new CommandLineArgs(null); + + Check.That(sut.FileNames).IsEmpty(); + Check.That(sut.Parameters).IsEmpty(); + } + + [Fact] + public void TestEmptyArgs() + { + var sut = new CommandLineArgs(new string[0]); + + Check.That(sut.FileNames).IsEmpty(); + Check.That(sut.Parameters).IsEmpty(); + } + + [Fact] + public void TestEmptyStringArgs() + { + var sut = new CommandLineArgs(new[] { string.Empty, string.Empty }); + + Check.That(sut.FileNames).IsEmpty(); + Check.That(sut.Parameters).IsEmpty(); + } + + [Theory] + [InlineData("test.test")] + [InlineData("test.test", "test2.test")] + [InlineData("C:/test.test", "test2.test")] + [InlineData("test.test", "C:/test2.test")] + [InlineData("C:/test.test", "C:/test2.test")] + [InlineData(@"C:\test.test", "test2.test")] + [InlineData(@"test.test", @"C:\test2.test")] + [InlineData(@"C:\test.test", @"C:\test2.test")] + public void TestFilenames(params string[] args) + { + var sut = new CommandLineArgs(args); + + Check.That(sut.FileName).IsEqualTo(args[0]); + Check.That(sut.FileNames).HasSize(args.Length); + Check.That(sut.FileNames).IsEquivalentTo(args); + + Check.That(sut.Parameters).IsEmpty(); + } + + [Theory] + [InlineData("-p")] + [InlineData("-p=")] + [InlineData("-p:")] + [InlineData("-p=123")] + [InlineData("-p:123")] + [InlineData("--p")] + [InlineData("--p=")] + [InlineData("--p:")] + [InlineData("--p=123")] + [InlineData("--p:123")] + public void TestParameterFormats(string arg) + { + var sut = new CommandLineArgs(new [] { arg }); + + Check.That(sut.Parameters).HasSize(1); + Check.That(sut.Parameters.First().Key).IsEqualTo("p"); + + Check.That(sut.FileNames).IsEmpty(); + } + + [Theory] + [InlineData("-p", "")] + [InlineData("-p=", "")] + [InlineData("-p:", "")] + [InlineData("-p=123", "123")] + [InlineData("-p:123", "123")] + public void TestParameterValues(string arg, string expectedValue) + { + var sut = new CommandLineArgs(new[] { arg }); + + Check.That(sut.Parameters.First().Value).IsEqualTo(expectedValue); + } + + public static IEnumerable GetTestFilenamesAndParametersData() => new List + { + new object[] { new[] { "test.test" }, 1, 0 }, + new object[] { new[] { "-p" }, 0, 1 }, + new object[] { new[] { "test.test", "-p" }, 1, 1 }, + new object[] { new[] { "test.test", "-p", "test2.test" }, 2, 1 }, + new object[] { new[] { "test.test", "-p", "-p2=123", "test2.test" }, 2, 2 }, + new object[] { new[] { "-p3:4", "test.test", "-p", "-p2=123", "test2.test" }, 2, 3 } + }; + + [Theory] + [MemberData(nameof(GetTestFilenamesAndParametersData))] + public void TestFilenamesAndParameters(string[] args, int expectedFilenames, int expectedParameters) + { + var sut = new CommandLineArgs(args); + + Check.That(sut.FileNames).HasSize(expectedFilenames); + Check.That(sut.Parameters).HasSize(expectedParameters); + } + } +} diff --git a/ReClass.NET_Tests/Util/Conversion/BigEndianBitConverterTest.cs b/ReClass.NET_Tests/Util/Conversion/BigEndianBitConverterTest.cs new file mode 100644 index 00000000..a55599a3 --- /dev/null +++ b/ReClass.NET_Tests/Util/Conversion/BigEndianBitConverterTest.cs @@ -0,0 +1,114 @@ +using System; +using NFluent; +using ReClassNET.Util.Conversion; +using Xunit; + +namespace ReClass.NET_Tests.Util.Conversion +{ + public class BigEndianBitConverterTest + { + [Fact] + public void ToXXX_ThrowsOnNull() + { + var sut = new BigEndianBitConverter(); + + Check.ThatCode(() => sut.ToInt32(null, 0)).Throws(); + } + + [Fact] + public void ToXXX_ThrowsOnInvalidIndexOrSize() + { + var sut = new BigEndianBitConverter(); + + var data = new byte[3]; + Check.ThatCode(() => sut.ToInt32(data, 0)).Throws(); + + data = new byte[4]; + Check.ThatCode(() => sut.ToInt32(data, 1)).Throws(); + } + + [Fact] + public void GetBytes() + { + var sut = new BigEndianBitConverter(); + + Check.That(new byte[] { 0 }).ContainsExactly(sut.GetBytes(false)); + Check.That(new byte[] { 1 }).ContainsExactly(sut.GetBytes(true)); + + Check.That(new byte[] { 0, 0 }).ContainsExactly(sut.GetBytes((short)0)); + Check.That(new byte[] { 0, 1 }).ContainsExactly(sut.GetBytes((short)1)); + Check.That(new byte[] { 1, 0 }).ContainsExactly(sut.GetBytes((short)256)); + Check.That(new byte[] { 255, 255 }).ContainsExactly(sut.GetBytes((short)-1)); + + Check.That(new byte[] { 0, 0 }).ContainsExactly(sut.GetBytes((ushort)0)); + Check.That(new byte[] { 0, 1 }).ContainsExactly(sut.GetBytes((ushort)1)); + Check.That(new byte[] { 1, 0 }).ContainsExactly(sut.GetBytes((ushort)256)); + Check.That(new byte[] { 255, 255 }).ContainsExactly(sut.GetBytes(ushort.MaxValue)); + + Check.That(new byte[] { 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(0)); + Check.That(new byte[] { 0, 0, 0, 1 }).ContainsExactly(sut.GetBytes(1)); + Check.That(new byte[] { 0, 0, 1, 0 }).ContainsExactly(sut.GetBytes(256)); + Check.That(new byte[] { 0, 1, 0, 0 }).ContainsExactly(sut.GetBytes(65536)); + Check.That(new byte[] { 1, 0, 0, 0 }).ContainsExactly(sut.GetBytes(16777216)); + Check.That(new byte[] { 255, 255, 255, 255 }).ContainsExactly(sut.GetBytes(-1)); + + Check.That(new byte[] { 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(0u)); + Check.That(new byte[] { 0, 0, 0, 1 }).ContainsExactly(sut.GetBytes(1u)); + Check.That(new byte[] { 0, 0, 1, 0 }).ContainsExactly(sut.GetBytes(256u)); + Check.That(new byte[] { 0, 1, 0, 0 }).ContainsExactly(sut.GetBytes(65536u)); + Check.That(new byte[] { 1, 0, 0, 0 }).ContainsExactly(sut.GetBytes(16777216u)); + Check.That(new byte[] { 255, 255, 255, 255 }).ContainsExactly(sut.GetBytes(uint.MaxValue)); + + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(0L)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }).ContainsExactly(sut.GetBytes(1L)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 1, 0 }).ContainsExactly(sut.GetBytes(256L)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0 }).ContainsExactly(sut.GetBytes(65536L)); + Check.That(new byte[] { 0, 0, 0, 0, 1, 0, 0, 0 }).ContainsExactly(sut.GetBytes(16777216L)); + Check.That(new byte[] { 0, 0, 0, 1, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(4294967296L)); + Check.That(new byte[] { 0, 0, 1, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(1099511627776L)); + Check.That(new byte[] { 0, 1, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(281474976710656L)); + Check.That(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(72057594037927936L)); + Check.That(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 }).ContainsExactly(sut.GetBytes(-1L)); + + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(0UL)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }).ContainsExactly(sut.GetBytes(1UL)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 1, 0 }).ContainsExactly(sut.GetBytes(256UL)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0 }).ContainsExactly(sut.GetBytes(65536UL)); + Check.That(new byte[] { 0, 0, 0, 0, 1, 0, 0, 0 }).ContainsExactly(sut.GetBytes(16777216UL)); + Check.That(new byte[] { 0, 0, 0, 1, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(4294967296UL)); + Check.That(new byte[] { 0, 0, 1, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(1099511627776UL)); + Check.That(new byte[] { 0, 1, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(281474976710656UL)); + Check.That(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(72057594037927936UL)); + Check.That(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 }).ContainsExactly(sut.GetBytes(ulong.MaxValue)); + } + + [Fact] + public void ToXXX() + { + var sut = new BigEndianBitConverter(); + + var data = new byte[] { 0, 0, 0, 0, 0, 0, 0, 3 }; + Check.That(sut.ToBoolean(data, 0)).IsFalse(); + Check.That(sut.ToBoolean(data, 7)).IsTrue(); + Check.That(sut.ToChar(data, 0)).IsEqualTo('\0'); + Check.That(sut.ToChar(data, 6)).IsEqualTo('\u0003'); + Check.That(sut.ToInt16(data, 0)).IsEqualTo(0); + Check.That(sut.ToInt16(data, 6)).IsEqualTo(3); + Check.That(sut.ToUInt16(data, 0)).IsEqualTo(0u); + Check.That(sut.ToUInt16(data, 6)).IsEqualTo(3u); + Check.That(sut.ToInt32(data, 0)).IsEqualTo(0); + Check.That(sut.ToInt32(data, 4)).IsEqualTo(3); + Check.That(sut.ToUInt32(data, 0)).IsEqualTo(0u); + Check.That(sut.ToUInt32(data, 4)).IsEqualTo(3u); + Check.That(sut.ToInt64(data, 0)).IsEqualTo(3L); + Check.That(sut.ToUInt64(data, 0)).IsEqualTo(3UL); + + data = new byte[] { 0x41, 0x20, 0, 0, 0, 0, 0, 0 }; + Check.That(sut.ToSingle(data, 0)).IsEqualTo(10.0f); + Check.That(sut.ToSingle(data, 4)).IsEqualTo(0.0f); + + data = new byte[] { 0x40, 0x24, 0, 0, 0, 0, 0, 0 }; + Check.That(sut.ToDouble(data, 0)).IsEqualTo(10.0); + } + } +} diff --git a/ReClass.NET_Tests/Util/Conversion/EndianBitConverterTest.cs b/ReClass.NET_Tests/Util/Conversion/EndianBitConverterTest.cs new file mode 100644 index 00000000..1a5e54a1 --- /dev/null +++ b/ReClass.NET_Tests/Util/Conversion/EndianBitConverterTest.cs @@ -0,0 +1,25 @@ +using System; +using NFluent; +using ReClassNET.Util.Conversion; +using Xunit; + +namespace ReClass.NET_Tests.Util.Conversion +{ + public class EndianBitConverterTest + { + [Fact] + public void Properties_AreNotNull() + { + Check.That(EndianBitConverter.System).IsNotNull(); + Check.That(EndianBitConverter.Big).IsNotNull(); + Check.That(EndianBitConverter.Little).IsNotNull(); + } + + [Fact] + public void Types() + { + Check.That(EndianBitConverter.Big.GetType()).IsNotEqualTo(EndianBitConverter.Little.GetType()); + Check.That(EndianBitConverter.System.GetType()).IsEqualTo(BitConverter.IsLittleEndian ? EndianBitConverter.Little.GetType() : EndianBitConverter.Big.GetType()); + } + } +} diff --git a/ReClass.NET_Tests/Util/Conversion/LittleEndianBitConverterTest.cs b/ReClass.NET_Tests/Util/Conversion/LittleEndianBitConverterTest.cs new file mode 100644 index 00000000..5a740ef5 --- /dev/null +++ b/ReClass.NET_Tests/Util/Conversion/LittleEndianBitConverterTest.cs @@ -0,0 +1,114 @@ +using System; +using NFluent; +using ReClassNET.Util.Conversion; +using Xunit; + +namespace ReClass.NET_Tests.Util.Conversion +{ + public class LittleEndianBitConverterTest + { + [Fact] + public void ToXXX_ThrowsOnNull() + { + var sut = new LittleEndianBitConverter(); + + Check.ThatCode(() => sut.ToInt32(null, 0)).Throws(); + } + + [Fact] + public void ToXXX_ThrowsOnInvalidIndexOrSize() + { + var sut = new LittleEndianBitConverter(); + + var data = new byte[3]; + Check.ThatCode(() => sut.ToInt32(data, 0)).Throws(); + + data = new byte[4]; + Check.ThatCode(() => sut.ToInt32(data, 1)).Throws(); + } + + [Fact] + public void GetBytes() + { + var sut = new LittleEndianBitConverter(); + + Check.That(new byte[] { 0 }).ContainsExactly(sut.GetBytes(false)); + Check.That(new byte[] { 1 }).ContainsExactly(sut.GetBytes(true)); + + Check.That(new byte[] { 0, 0 }).ContainsExactly(sut.GetBytes((short)0)); + Check.That(new byte[] { 1, 0 }).ContainsExactly(sut.GetBytes((short)1)); + Check.That(new byte[] { 0, 1 }).ContainsExactly(sut.GetBytes((short)256)); + Check.That(new byte[] { 255, 255 }).ContainsExactly(sut.GetBytes((short)-1)); + + Check.That(new byte[] { 0, 0 }).ContainsExactly(sut.GetBytes((ushort)0)); + Check.That(new byte[] { 1, 0 }).ContainsExactly(sut.GetBytes((ushort)1)); + Check.That(new byte[] { 0, 1 }).ContainsExactly(sut.GetBytes((ushort)256)); + Check.That(new byte[] { 255, 255 }).ContainsExactly(sut.GetBytes(ushort.MaxValue)); + + Check.That(new byte[] { 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(0)); + Check.That(new byte[] { 1, 0, 0, 0 }).ContainsExactly(sut.GetBytes(1)); + Check.That(new byte[] { 0, 1, 0, 0 }).ContainsExactly(sut.GetBytes(256)); + Check.That(new byte[] { 0, 0, 1, 0 }).ContainsExactly(sut.GetBytes(65536)); + Check.That(new byte[] { 0, 0, 0, 1 }).ContainsExactly(sut.GetBytes(16777216)); + Check.That(new byte[] { 255, 255, 255, 255 }).ContainsExactly(sut.GetBytes(-1)); + + Check.That(new byte[] { 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(0u)); + Check.That(new byte[] { 1, 0, 0, 0 }).ContainsExactly(sut.GetBytes(1u)); + Check.That(new byte[] { 0, 1, 0, 0 }).ContainsExactly(sut.GetBytes(256u)); + Check.That(new byte[] { 0, 0, 1, 0 }).ContainsExactly(sut.GetBytes(65536u)); + Check.That(new byte[] { 0, 0, 0, 1 }).ContainsExactly(sut.GetBytes(16777216u)); + Check.That(new byte[] { 255, 255, 255, 255 }).ContainsExactly(sut.GetBytes(uint.MaxValue)); + + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(0L)); + Check.That(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(1L)); + Check.That(new byte[] { 0, 1, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(256L)); + Check.That(new byte[] { 0, 0, 1, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(65536L)); + Check.That(new byte[] { 0, 0, 0, 1, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(16777216L)); + Check.That(new byte[] { 0, 0, 0, 0, 1, 0, 0, 0 }).ContainsExactly(sut.GetBytes(4294967296L)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0 }).ContainsExactly(sut.GetBytes(1099511627776L)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 1, 0 }).ContainsExactly(sut.GetBytes(281474976710656L)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }).ContainsExactly(sut.GetBytes(72057594037927936L)); + Check.That(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 }).ContainsExactly(sut.GetBytes(-1L)); + + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(0UL)); + Check.That(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(1UL)); + Check.That(new byte[] { 0, 1, 0, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(256UL)); + Check.That(new byte[] { 0, 0, 1, 0, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(65536UL)); + Check.That(new byte[] { 0, 0, 0, 1, 0, 0, 0, 0 }).ContainsExactly(sut.GetBytes(16777216UL)); + Check.That(new byte[] { 0, 0, 0, 0, 1, 0, 0, 0 }).ContainsExactly(sut.GetBytes(4294967296UL)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0 }).ContainsExactly(sut.GetBytes(1099511627776UL)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 1, 0 }).ContainsExactly(sut.GetBytes(281474976710656UL)); + Check.That(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }).ContainsExactly(sut.GetBytes(72057594037927936UL)); + Check.That(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 }).ContainsExactly(sut.GetBytes(ulong.MaxValue)); + } + + [Fact] + public void ToXXX() + { + var sut = new LittleEndianBitConverter(); + + var data = new byte[] { 0x03, 0, 0, 0, 0, 0, 0, 0 }; + Check.That(sut.ToBoolean(data, 0)).IsTrue(); + Check.That(sut.ToBoolean(data, 7)).IsFalse(); + Check.That(sut.ToChar(data, 0)).IsEqualTo('\u0003'); + Check.That(sut.ToChar(data, 6)).IsEqualTo('\0'); + Check.That(sut.ToInt16(data, 0)).IsEqualTo(3); + Check.That(sut.ToInt16(data, 6)).IsEqualTo(0); + Check.That(sut.ToUInt16(data, 0)).IsEqualTo(3u); + Check.That(sut.ToUInt16(data, 6)).IsEqualTo(0u); + Check.That(sut.ToInt32(data, 0)).IsEqualTo(3); + Check.That(sut.ToInt32(data, 4)).IsEqualTo(0); + Check.That(sut.ToUInt32(data, 0)).IsEqualTo(3u); + Check.That(sut.ToUInt32(data, 4)).IsEqualTo(0u); + Check.That(sut.ToInt64(data, 0)).IsEqualTo(3L); + Check.That(sut.ToUInt64(data, 0)).IsEqualTo(3UL); + + data = new byte[] { 0, 0, 0, 0, 0, 0, 0x20, 0x41 }; + Check.That(sut.ToSingle(data, 0)).IsEqualTo(0.0f); + Check.That(sut.ToSingle(data, 4)).IsEqualTo(10.0f); + + data = new byte[] { 0, 0, 0, 0, 0, 0, 0x24, 0x40 }; + Check.That(sut.ToDouble(data, 0)).IsEqualTo(10.0); + } + } +} diff --git a/ReClass.NET_Tests/Util/CustomDataMapTest.cs b/ReClass.NET_Tests/Util/CustomDataMapTest.cs new file mode 100644 index 00000000..74315728 --- /dev/null +++ b/ReClass.NET_Tests/Util/CustomDataMapTest.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using NFluent; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class CustomDataMapTest + { + [Fact] + public void TestNullKeyNotAllowed() + { + var sut = new CustomDataMap(); + + Check.ThatCode(() => sut.SetString(null, default)).Throws(); + Check.ThatCode(() => sut.SetBool(null, default)).Throws(); + Check.ThatCode(() => sut.SetLong(null, default)).Throws(); + Check.ThatCode(() => sut.SetULong(null, default)).Throws(); + Check.ThatCode(() => sut.SetXElement(null, default)).Throws(); + Check.ThatCode(() => sut.GetString(null)).Throws(); + Check.ThatCode(() => sut.GetBool(null, default)).Throws(); + Check.ThatCode(() => sut.GetLong(null, default)).Throws(); + Check.ThatCode(() => sut.GetULong(null, default)).Throws(); + Check.ThatCode(() => sut.GetXElement(null, default)).Throws(); + } + + [Theory] + [InlineData("key", "")] + [InlineData("key", "value")] + public void TestSetGetString(string key, string value) + { + var sut = new CustomDataMap(); + + sut.SetString(key, value); + + Check.That(sut.GetString(key)).IsEqualTo(value); + } + + [Theory] + [InlineData("key", "")] + [InlineData("key", "value")] + public void TestIndexString(string key, string value) + { + var sut = new CustomDataMap(); + + sut.SetString(key, value); + + Check.That(sut[key]).IsEqualTo(value); + } + + [Fact] + public void TestItemEnumeration() + { + var data = new Dictionary + { + { "key1", "value1" }, + { "key2", "value2" }, + { "key3", "value3" } + }; + + var sut = new CustomDataMap(); + + foreach (var kv in data) + { + sut.SetString(kv.Key, kv.Value); + } + + Check.That(sut).IsEquivalentTo(data); + } + + [Fact] + public void TestRemoveItem() + { + const string KeyToRemove = "key2"; + + var data = new Dictionary + { + { "key1", "value1" }, + { KeyToRemove, "value2" }, + { "key3", "value3" } + }; + + var sut = new CustomDataMap(); + + foreach (var kv in data) + { + sut.SetString(kv.Key, kv.Value); + } + + sut.RemoveValue(KeyToRemove); + + Check.That(sut).IsEquivalentTo(data.Where(kv => kv.Key != KeyToRemove)); + } + + [Theory] + [InlineData("key", true)] + [InlineData("key", false)] + public void TestSetGetBool(string key, bool value) + { + var sut = new CustomDataMap(); + + sut.SetBool(key, value); + + Check.That(sut.GetBool(key, !value)).IsEqualTo(value); + } + + [Theory] + [InlineData("key", -1)] + [InlineData("key", 0)] + [InlineData("key", 1)] + [InlineData("key", long.MaxValue)] + [InlineData("key", long.MinValue)] + public void TestSetGetLong(string key, long value) + { + var sut = new CustomDataMap(); + + sut.SetLong(key, value); + + Check.That(sut.GetLong(key, 0)).IsEqualTo(value); + } + + [Theory] + [InlineData("key", 0)] + [InlineData("key", 1)] + [InlineData("key", ulong.MaxValue)] + [InlineData("key", ulong.MinValue)] + public void TestSetGetULong(string key, ulong value) + { + var sut = new CustomDataMap(); + + sut.SetULong(key, value); + + Check.That(sut.GetULong(key, 0)).IsEqualTo(value); + } + + public static IEnumerable GetTestSetGetXElementData() => new List + { + new object[] { "key", null }, + new object[] { "key", new XElement("name") }, + new object[] { "key", new XElement("name", new XAttribute("attr", "test")) }, + new object[] { "key", new XElement("name", new XElement("value", "test")) } + }; + + [Theory] + [MemberData(nameof(GetTestSetGetXElementData))] + public void TestSetGetXElement(string key, XElement value) + { + var sut = new CustomDataMap(); + + sut.SetXElement(key, value); + + Check.That(XNode.DeepEquals(sut.GetXElement(key, null), value)).IsTrue(); + } + } +} diff --git a/ReClass.NET_Tests/Util/DirectedGraphTest.cs b/ReClass.NET_Tests/Util/DirectedGraphTest.cs new file mode 100644 index 00000000..feea18af --- /dev/null +++ b/ReClass.NET_Tests/Util/DirectedGraphTest.cs @@ -0,0 +1,192 @@ +using System; +using System.Collections.Generic; +using NFluent; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class DirectedGraphTest + { + [Fact] + public void TestAddContainsVertex() + { + const int Vertex = 0; + + var sut = new DirectedGraph(); + + Check.That(sut.AddVertex(Vertex)).IsTrue(); + + Check.That(sut.ContainsVertex(Vertex)).IsTrue(); + } + + [Fact] + public void TestAddExistingVertex() + { + const int Vertex = 0; + + var sut = new DirectedGraph(); + + sut.AddVertex(Vertex); + + Check.That(sut.AddVertex(Vertex)).IsFalse(); + } + + [Fact] + public void TestContainsWithEmptyGraph() + { + const int Vertex = 0; + + var sut = new DirectedGraph(); + + Check.That(sut.ContainsVertex(Vertex)).IsFalse(); + } + + [Fact] + public void TestAddContainsMultipleVertices() + { + var vertices = new[] { 0, 1, 2, 3 }; + + var sut = new DirectedGraph(); + + sut.AddVertices(vertices); + + foreach (var vertex in vertices) + { + Check.That(sut.ContainsVertex(vertex)).IsTrue(); + } + + Check.That(sut.Vertices).IsEquivalentTo(vertices); + } + + [Fact] + public void TestAddEdgeToNonExistingVertex() + { + const int Vertex1 = 0; + const int Vertex2 = 1; + + var sut = new DirectedGraph(); + + Check.ThatCode(() => sut.AddEdge(Vertex1, Vertex2)).Throws(); + + sut.AddVertex(Vertex1); + + Check.ThatCode(() => sut.AddEdge(Vertex1, Vertex2)).Throws(); + Check.ThatCode(() => sut.AddEdge(Vertex2, Vertex1)).Throws(); + } + + [Fact] + public void TestContainsEdgeToNonExistingVertex() + { + const int Vertex1 = 0; + const int Vertex2 = 1; + + var sut = new DirectedGraph(); + + Check.ThatCode(() => sut.ContainsEdge(Vertex1, Vertex2)).Throws(); + + sut.AddVertex(Vertex1); + + Check.ThatCode(() => sut.ContainsEdge(Vertex1, Vertex2)).Throws(); + Check.ThatCode(() => sut.ContainsEdge(Vertex2, Vertex1)).Throws(); + } + + [Fact] + public void TestAddContainsEdge() + { + const int Vertex1 = 0; + const int Vertex2 = 1; + + var sut = new DirectedGraph(); + + sut.AddVertex(Vertex1); + sut.AddVertex(Vertex2); + + Check.That(sut.ContainsEdge(Vertex1, Vertex2)).IsFalse(); + + Check.That(sut.AddEdge(Vertex1, Vertex2)).IsTrue(); + + Check.That(sut.ContainsEdge(Vertex1, Vertex2)).IsTrue(); + } + + [Fact] + public void TestAddExistingEdge() + { + const int Vertex1 = 0; + const int Vertex2 = 1; + + var sut = new DirectedGraph(); + + sut.AddVertex(Vertex1); + sut.AddVertex(Vertex2); + sut.AddEdge(Vertex1, Vertex2); + + Check.That(sut.AddEdge(Vertex1, Vertex2)).IsFalse(); + } + + [Fact] + public void TestGetNeighboursOfNonExistingVertex() + { + const int Vertex = 0; + + var sut = new DirectedGraph(); + + Check.ThatCode(() => sut.GetNeighbours(Vertex)).Throws(); + } + + public static IEnumerable GetTestGetNeighboursData() => new List + { + new object[] { new[] { 1 }, new[] { new[] { 1, 1 } }, new[] { 1 } }, + new object[] { new[] { 1, 2 }, new[] { new[] { 2, 1 } }, new int[0] }, + new object[] { new[] { 1, 2 }, new[] { new[] { 1, 2 } }, new[] { 2 } }, + new object[] { new[] { 1, 2, 3 }, new[] { new[] { 2, 1 }, new[] { 2, 3 } }, new int[0] }, + new object[] { new[] { 1, 2, 3 }, new[] { new[] { 1, 2 }, new[] { 2, 3 } }, new[] { 2 } }, + new object[] { new[] { 1, 2, 3 }, new[] { new[] { 1, 2 }, new[] { 1, 3 } }, new[] { 2, 3 } }, + new object[] { new[] { 1, 2, 3 }, new[] { new[] { 1, 1 }, new[] { 1, 2 }, new[] { 1, 3 } }, new[] { 1, 2, 3 } } + }; + + [Theory] + [MemberData(nameof(GetTestGetNeighboursData))] + public void TestGetNeighbours(int[] vertices, int[][] edges, int[] neighbours) + { + var sut = new DirectedGraph(); + + sut.AddVertices(vertices); + + foreach (var edge in edges) + { + sut.AddEdge(edge[0], edge[1]); + } + + Check.That(sut.GetNeighbours(vertices[0])).IsEquivalentTo(neighbours); + } + + public static IEnumerable GetTestContainsCycleData() => new List + { + new object[] { new[] { 1 }, new[] { new[] { 1, 1 } }, true }, + new object[] { new[] { 1, 2 }, new[] { new[] { 1, 2 } }, false }, + new object[] { new[] { 1, 2 }, new[] { new[] { 1, 2 }, new[] { 2, 1 } }, true }, + new object[] { new[] { 1, 2, 3 }, new[] { new[] { 1, 2 }, new[] { 2, 3 } }, false }, + new object[] { new[] { 1, 2, 3 }, new[] { new[] { 1, 2 }, new[] { 1, 3 }, new[] { 2, 3 } }, false }, + new object[] { new[] { 1, 2, 3 }, new[] { new[] { 1, 2 }, new[] { 2, 3 }, new[] { 3, 1 } }, true }, + new object[] { new[] { 1, 2, 3 }, new[] { new[] { 1, 2 }, new[] { 2, 3 }, new[] { 3, 2 } }, true }, + new object[] { new[] { 1, 2, 3 }, new[] { new[] { 1, 2 }, new[] { 2, 1 }, new[] { 2, 3 }, new[] { 3, 2 } }, true } + }; + + [Theory] + [MemberData(nameof(GetTestContainsCycleData))] + public void TestContainsCycle(int[] vertices, int[][] edges, bool containsCycle) + { + var sut = new DirectedGraph(); + + sut.AddVertices(vertices); + + foreach (var edge in edges) + { + sut.AddEdge(edge[0], edge[1]); + } + + Check.That(sut.ContainsCycle()).IsEqualTo(containsCycle); + } + } +} diff --git a/ReClass.NET_Tests/Util/GrowingListTest.cs b/ReClass.NET_Tests/Util/GrowingListTest.cs new file mode 100644 index 00000000..66af03bf --- /dev/null +++ b/ReClass.NET_Tests/Util/GrowingListTest.cs @@ -0,0 +1,91 @@ +using NFluent; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class GrowingListTest + { + [Theory] + [InlineData(0)] + [InlineData(1)] + [InlineData(2)] + [InlineData(10)] + [InlineData(100)] + public void CheckSetCount(int index) + { + var gl = new GrowingList + { + [index] = default + }; + + Check.That(gl.Count).IsEqualTo(index + 1); + } + + [Theory] + [InlineData(0, 1, 2)] + [InlineData(1, 2, 3)] + [InlineData(2, 10, 11)] + [InlineData(10, 8, 11)] + [InlineData(100, 200, 201)] + [InlineData(0, 0, 1)] + [InlineData(10, 1, 11)] + [InlineData(2, 1, 3)] + public void CheckMultipleSetCount(int index1, int index2, int expected) + { + var gl = new GrowingList + { + [index1] = default, + [index2] = default + }; + + Check.That(gl.Count).IsEqualTo(expected); + } + + [Theory] + [InlineData(0)] + [InlineData(1)] + [InlineData(2)] + [InlineData(10)] + [InlineData(100)] + public void CheckGetCount(int index) + { + var gl = new GrowingList(); + + var _ = gl[index]; + + Check.That(gl.Count).IsEqualTo(index + 1); + } + + [Theory] + [InlineData(0, 1, 2)] + [InlineData(1, 2, 3)] + [InlineData(2, 10, 11)] + [InlineData(10, 8, 11)] + [InlineData(100, 200, 201)] + [InlineData(0, 0, 1)] + [InlineData(10, 1, 11)] + [InlineData(2, 1, 3)] + public void CheckMultipleGetCount(int index1, int index2, int expected) + { + var gl = new GrowingList(); + + var _ = gl[index1]; + _ = gl[index2]; + + Check.That(gl.Count).IsEqualTo(expected); + } + + [Theory] + [InlineData(1, 0)] + [InlineData(1, 10)] + [InlineData(-1, 0)] + [InlineData(-1, 20)] + public void CheckDefaultValue(int value, int index) + { + var gl = new GrowingList(value); + + Check.That(gl[index]).IsEqualTo(value); + } + } +} diff --git a/ReClass.NET_Tests/Util/HexadecimalFormatterTest.cs b/ReClass.NET_Tests/Util/HexadecimalFormatterTest.cs new file mode 100644 index 00000000..abc2da21 --- /dev/null +++ b/ReClass.NET_Tests/Util/HexadecimalFormatterTest.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using NFluent; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class HexadecimalFormatterTest + { + public static IEnumerable GetTestData() => new List + { + new object[] { new byte[0], string.Empty }, + new object[] { new byte[] { 0x12 }, "12" }, + new object[] { new byte[] { 0x12, 0x23, 0x34, 0x45 }, "12 23 34 45" } + }; + + [Theory] + [MemberData(nameof(GetTestData))] + public void Test(byte[] data, string expected) + { + Check.That(HexadecimalFormatter.ToString(data)).IsEqualTo(expected); + } + } +} diff --git a/ReClass.NET_Tests/Util/IntPtrComparerTest.cs b/ReClass.NET_Tests/Util/IntPtrComparerTest.cs new file mode 100644 index 00000000..ec47827b --- /dev/null +++ b/ReClass.NET_Tests/Util/IntPtrComparerTest.cs @@ -0,0 +1,29 @@ +using System; +using NFluent; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class IntPtrComparerTest + { + public static TheoryData GetTestCompareData() => new TheoryData + { + { IntPtr.Zero, IntPtr.Zero, false }, + { (IntPtr)0x1, IntPtr.Zero, false }, + { (IntPtr)0x1, (IntPtr)0x10, true }, + { (IntPtr)0x1, unchecked((IntPtr)(int)0xFFFFFFFF), true }, + { unchecked((IntPtr)(int)0xFFFFFFFF), unchecked((IntPtr)(int)0xFFFFFFFF), false }, + { unchecked((IntPtr)(int)0xFFFFFFFF), IntPtr.Zero, false } + }; + + [Theory] + [MemberData(nameof(GetTestCompareData))] + public void TestCompare(IntPtr lhs, IntPtr rhs, bool lhsIsSmaller) + { + var comparer = IntPtrComparer.Instance; + + Check.That(comparer.Compare(lhs, rhs) < 0).IsEqualTo(lhsIsSmaller); + } + } +} diff --git a/ReClass.NET_Tests/Util/NumberFormatTest.cs b/ReClass.NET_Tests/Util/NumberFormatTest.cs new file mode 100644 index 00000000..9660f8a8 --- /dev/null +++ b/ReClass.NET_Tests/Util/NumberFormatTest.cs @@ -0,0 +1,22 @@ +using NFluent; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class NumberFormatTest + { + [Theory] + [InlineData("123,34", ",", ".")] + [InlineData("123.34", ".", ",")] + [InlineData("1.123,34", ",", ".")] + [InlineData("1,123.34", ".", ",")] + public void TestGuess(string input, string expectedDecimalSeparator, string expectedGroupSeparator) + { + var nf = NumberFormat.GuessNumberFormat(input); + + Check.That(nf.NumberDecimalSeparator).IsEqualTo(expectedDecimalSeparator); + Check.That(nf.NumberGroupSeparator).IsEqualTo(expectedGroupSeparator); + } + } +} diff --git a/ReClass.NET_Tests/Util/PathUtilTest.cs b/ReClass.NET_Tests/Util/PathUtilTest.cs new file mode 100644 index 00000000..5e28a654 --- /dev/null +++ b/ReClass.NET_Tests/Util/PathUtilTest.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.IO; +using NFluent; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class PathUtilTest + { + public static IEnumerable GetTestConversionData() => new List + { + new object[] { string.Empty, string.Empty }, + new object[] { "C:/", "C:" + Path.DirectorySeparatorChar }, + new object[] { @"C:\", "C:" + Path.DirectorySeparatorChar }, + new object[] { "C:/test.test", Path.Combine("C:" + Path.DirectorySeparatorChar, "test.test") }, + new object[] { "file:///C:/test.test", Path.Combine("C:" + Path.DirectorySeparatorChar, "test.test") }, + }; + + [Theory] + [MemberData(nameof(GetTestConversionData))] + public void TestConversion(string input, string expected) + { + Check.That(PathUtil.FileUrlToPath(input)).IsEqualTo(expected); + } + } +} diff --git a/ReClass.NET_Tests/Util/XElementSerializerTest.cs b/ReClass.NET_Tests/Util/XElementSerializerTest.cs new file mode 100644 index 00000000..d81a7a4f --- /dev/null +++ b/ReClass.NET_Tests/Util/XElementSerializerTest.cs @@ -0,0 +1,97 @@ +using System.Collections.Generic; +using System.Drawing; +using NFluent; +using ReClassNET.Extensions; +using ReClassNET.Util; +using Xunit; + +namespace ReClass.NET_Tests.Util +{ + public class XElementSerializerTest + { + [Theory] + [InlineData(true)] + [InlineData(false)] + public void TestBoolSerialization(bool value) + { + const string Name = "BoolValue"; + + var element = XElementSerializer.ToXml(Name, value); + + Check.That(element.Name.LocalName).IsEqualTo(Name); + + Check.That(XElementSerializer.ToBool(element)).IsEqualTo(value); + } + + [Theory] + [InlineData(0)] + [InlineData(1)] + [InlineData(-1)] + [InlineData(int.MaxValue)] + [InlineData(int.MinValue)] + public void TestIntSerialization(int value) + { + const string Name = "IntValue"; + + var element = XElementSerializer.ToXml(Name, value); + + Check.That(element.Name.LocalName).IsEqualTo(Name); + + Check.That(XElementSerializer.ToInt(element)).IsEqualTo(value); + } + + [Theory] + [InlineData("")] + [InlineData("test")] + public void TestStringSerialization(string value) + { + const string Name = "StringValue"; + + var element = XElementSerializer.ToXml(Name, value); + + Check.That(element.Name.LocalName).IsEqualTo(Name); + + Check.That(XElementSerializer.ToString(element)).IsEqualTo(value); + } + + public static IEnumerable GetTestColorSerializationData() => new List + { + new object[] { Color.Empty }, + new object[] { Color.Red }, + new object[] { Color.Blue }, + new object[] { Color.FromArgb(123, 123, 123) } + }; + + [Theory] + [MemberData(nameof(GetTestColorSerializationData))] + public void TestColorSerialization(Color value) + { + const string Name = "ColorValue"; + + var element = XElementSerializer.ToXml(Name, value); + + Check.That(element.Name.LocalName).IsEqualTo(Name); + + Check.That(XElementSerializer.ToColor(element).ToRgb()).IsEqualTo(value.ToRgb()); + } + + public static IEnumerable GetTestDictionarySerializationData() => new List + { + new object[] { new Dictionary() }, + new object[] { new Dictionary { { "test", "test" }, { "test2", "test2" } } } + }; + + [Theory] + [MemberData(nameof(GetTestDictionarySerializationData))] + public void TestDictionarySerialization(Dictionary value) + { + const string Name = "DictionaryValue"; + + var element = XElementSerializer.ToXml(Name, value); + + Check.That(element.Name.LocalName).IsEqualTo(Name); + + Check.That(XElementSerializer.ToDictionary(element)).IsEquivalentTo(value); + } + } +}