$npx -y skills add HLND2T/CS2_VibeSignatures --skill find-CCSGameRules__sm_mapGcBanInformationFind and identify the CCSGameRules__sm_mapGcBanInformation global variable in CS2 binary using IDA Pro MCP. Use this skill when reverse engineering CS2 server.dll or libserver.so to locate the GC ban information map structure by decompiling CCSPlayerController_ResourceDataThink's
| 1 | # Find CCSGameRules__sm_mapGcBanInformation |
| 2 | |
| 3 | Locate `CCSGameRules__sm_mapGcBanInformation` (global variable) in CS2 server.dll or libserver.so using IDA Pro MCP tools. |
| 4 | |
| 5 | ## Prerequisites |
| 6 | |
| 7 | - `CCSPlayerController_ResourceDataThink` must be identified first (Linux method depends on it) |
| 8 | - Use SKILL `/get-func-from-yaml` to load `CCSPlayerController_ResourceDataThink` if its YAML already exists |
| 9 | |
| 10 | ## Method |
| 11 | |
| 12 | ### Windows: String-based approach |
| 13 | |
| 14 | #### 1. Search for the debug string |
| 15 | |
| 16 | ``` |
| 17 | mcp__ida-pro-mcp__find_regex pattern="Notification about user penalty: %u/%u" |
| 18 | ``` |
| 19 | |
| 20 | #### 2. Get cross-references to the string |
| 21 | |
| 22 | ``` |
| 23 | mcp__ida-pro-mcp__xrefs_to addrs="<string_addr>" |
| 24 | ``` |
| 25 | |
| 26 | #### 3. Decompile the referencing function |
| 27 | |
| 28 | ``` |
| 29 | mcp__ida-pro-mcp__decompile addr="<function_addr>" |
| 30 | ``` |
| 31 | |
| 32 | #### 4. Identify the global variable |
| 33 | |
| 34 | Look for the pattern after the `DevMsg("Notification about user penalty: %u/%u (%u sec)\n", ...)` call: |
| 35 | |
| 36 | ```c |
| 37 | sub_XXXXXXXX(&unk_YYYYYYYY, &v10, &v12); |
| 38 | ``` |
| 39 | |
| 40 | Where `unk_YYYYYYYY` (the second argument, offset by +8 from the base) is `CCSGameRules__sm_mapGcBanInformation`. The base address is `unk_YYYYYYYY - 8`. |
| 41 | |
| 42 | More specifically, look for: |
| 43 | ```c |
| 44 | v12 = &unk_181E4C960; // unk_181E4C960 is CCSGameRules__sm_mapGcBanInformation - 8 |
| 45 | LOBYTE(v13) = 1; |
| 46 | v14 = &v17; |
| 47 | v18 = 0LL; |
| 48 | v19 = 0LL; |
| 49 | sub_XXXXXXXX(&unk_181E4C968, &v10, &v12); // unk_181E4C968 is CCSGameRules__sm_mapGcBanInformation |
| 50 | ``` |
| 51 | |
| 52 | The global variable to rename is the one passed as the first argument to the map lookup function (e.g., `unk_181E4C968`). |
| 53 | |
| 54 | ### Linux: Decompilation-based approach |
| 55 | |
| 56 | #### 1. Load CCSPlayerController_ResourceDataThink address |
| 57 | |
| 58 | Use SKILL `/get-func-from-yaml` to get the address, or decompile it directly: |
| 59 | |
| 60 | ``` |
| 61 | mcp__ida-pro-mcp__decompile addr="<CCSPlayerController_ResourceDataThink_addr>" |
| 62 | ``` |
| 63 | |
| 64 | #### 2. Decompile the sub-function called inside ResourceDataThink |
| 65 | |
| 66 | The wrapper function calls a sub-function as its second operation: |
| 67 | |
| 68 | ```c |
| 69 | __int64 __fastcall CCSPlayerController_ResourceDataThink(__int64 a1, ...) |
| 70 | { |
| 71 | ++*(_DWORD *)(a1 + 3084); |
| 72 | sub_YYYYYY(a1, ...); // <--- decompile this function |
| 73 | ... |
| 74 | } |
| 75 | ``` |
| 76 | |
| 77 | ``` |
| 78 | mcp__ida-pro-mcp__decompile addr="<sub_function_addr>" |
| 79 | ``` |
| 80 | |
| 81 | #### 3. Identify the global variable |
| 82 | |
| 83 | In the decompiled sub-function, look for the pattern: |
| 84 | |
| 85 | ```c |
| 86 | v43 = *((int *)&unk_XXXXXXXX + 6) |
| 87 | ``` |
| 88 | |
| 89 | or equivalently: |
| 90 | |
| 91 | ```c |
| 92 | if ( !*v26 || (v42 = sub_A85C10(v7), v43 = *((int *)&unk_XXXXXXXX + 6), (_DWORD)v43 == -1) ) |
| 93 | ``` |
| 94 | |
| 95 | Where `unk_XXXXXXXX` is `CCSGameRules__sm_mapGcBanInformation`. |
| 96 | |
| 97 | Additional verification — the same variable appears in the tree traversal loop: |
| 98 | |
| 99 | ```c |
| 100 | if ( (*((_DWORD *)&unk_XXXXXXXX + 3) & 0x7FFFFFFF) != 0 ) |
| 101 | { |
| 102 | v44 = *((_QWORD *)&unk_XXXXXXXX + 2); |
| 103 | do |
| 104 | { |
| 105 | v45 = 56 * v43; |
| 106 | v46 = (int *)(v44 + v45); |
| 107 | ... |
| 108 | } |
| 109 | while ( (_DWORD)v43 != -1 ); |
| 110 | } |
| 111 | ``` |
| 112 | |
| 113 | ### Common steps (both platforms) |
| 114 | |
| 115 | #### 5. Rename the global variable |
| 116 | |
| 117 | ``` |
| 118 | mcp__ida-pro-mcp__rename batch={"data": {"old": "<unk_XXXXXXXX>", "new": "CCSGameRules__sm_mapGcBanInformation"}} |
| 119 | ``` |
| 120 | |
| 121 | #### 6. Generate unique signature |
| 122 | |
| 123 | **ALWAYS** Use SKILL `/generate-signature-for-globalvar` to generate a robust and unique signature for `CCSGameRules__sm_mapGcBanInformation`. |
| 124 | |
| 125 | #### 7. Write IDA analysis output as YAML |
| 126 | |
| 127 | **ALWAYS** Use SKILL `/write-globalvar-as-yaml` to write the analysis results. |
| 128 | |
| 129 | Required parameters: |
| 130 | - `gv_name`: `CCSGameRules__sm_mapGcBanInformation` |
| 131 | - `gv_addr`: The global variable address from step 3/4 |
| 132 | - `gv_sig`: The validated signature from step 6 |
| 133 | - `gv_sig_va`: The virtual address that signature matches |
| 134 | - `gv_inst_offset`: Offset from signature start to GV-accessing instruction |
| 135 | - `gv_inst_length`: Length of the GV-accessing instruction |
| 136 | - `gv_inst_disp`: Displacement offset within the instruction |
| 137 | |
| 138 | ## Global Variable Characteristics |
| 139 | |
| 140 | - **Type**: Map/tree structure (CUtlMap or similar) |
| 141 | - **Purpose**: Stores GC (Game Coordinator) ban information per player, used during resource data updates |
| 142 | - **Usage**: Queried during `CCSPlayerController_ResourceDataThink` to check player penalty status |
| 143 | - **Structure fields accessed**: |
| 144 | - `+0x0C` (`+3` as DWORD): Node count / flags (masked with `0x7FFFFFFF`) |
| 145 | - `+0x10` (`+2` as QWORD): Pointer to tree node array |
| 146 | - `+0x18` (`+6` as int): Root node index (or `-1` if empty) |
| 147 | - Each node is 56 bytes with key at offset +16 and data at offset +48 |
| 148 | |
| 149 | ## Output YAML Format |
| 150 | |
| 151 | The output YAML filename depends on the platform: |
| 152 | - `server.dll` → `CCSGameRules__sm_mapGcBanInformation.windows.yaml` |
| 153 | - `libserver.so` / `libserver.so` → `CCSGameRules__sm_mapGc |