├── .gitattributes ├── .gitignore ├── BlazeLibWV ├── Blaze.cs ├── BlazeLibWV.csproj ├── BlazePrettyPrinter.cs └── Properties │ └── AssemblyInfo.cs ├── CNCEmu.sln ├── CNCEmu ├── App.config ├── BackendLog.cs ├── BlazeServer.cs ├── CNCEmu.csproj ├── CleanPackets.cs ├── Commands │ ├── NotifyClientGameSetupCommand.cs │ ├── NotifyGamePlayerStateChangeCommand.cs │ ├── NotifyGameSettingsChangeCommand.cs │ ├── NotifyGameStateChangeCommand.cs │ ├── NotifyPlatformHostInitializedCommand.cs │ ├── NotifyPlayerJoinCompletedCommand.cs │ ├── NotifyPlayerJoiningCommand.cs │ ├── NotifyPlayerRemovedCommand.cs │ ├── NotifyServerGameSetupCommand.cs │ ├── NotifyUserAddedCommand.cs │ ├── NotifyUserRemovedCommand.cs │ ├── NotifyUserStatusCommand.cs │ ├── UserAddedCommand.cs │ ├── UserAuthenticatedCommand.cs │ ├── UserSessionExtendedDataUpdateNotificationCommand.cs │ └── UserUpdatedCommand.cs ├── Components │ ├── AccountsComponent.cs │ ├── AssociationListsComponent.cs │ ├── AsyncNotification │ │ ├── AsyncGameManager.cs │ │ ├── AsyncStats.cs │ │ └── AsyncUserSessions.cs │ ├── AuthenticationComponent.cs │ ├── BlazeHelper.cs │ ├── GameManagerComponent.cs │ ├── InventoryComponent.cs │ ├── RSPComponent.cs │ ├── StatsComponent.cs │ ├── UserSessionsComponent.cs │ └── UtilComponent.cs ├── Config.cs ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── Form2.Designer.cs ├── Form2.cs ├── Form2.resx ├── GameInfo.cs ├── GenFiles.cs ├── Helper.cs ├── Logger.cs ├── PlayerInfo.cs ├── Profile.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.tt │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ProviderInfo.cs ├── RedirectorServer.cs ├── Resources │ └── external.png ├── Utils.cs └── blaze.ico ├── LICENSE ├── README.md └── cnc_shellui_wwwroot-1.2.2.zip /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET Core 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # ASP.NET Scaffolding 66 | ScaffoldingReadMe.txt 67 | 68 | # StyleCop 69 | StyleCopReport.xml 70 | 71 | # Files built by Visual Studio 72 | *_i.c 73 | *_p.c 74 | *_h.h 75 | *.ilk 76 | *.meta 77 | *.obj 78 | *.iobj 79 | *.pch 80 | *.pdb 81 | *.ipdb 82 | *.pgc 83 | *.pgd 84 | *.rsp 85 | *.sbr 86 | *.tlb 87 | *.tli 88 | *.tlh 89 | *.tmp 90 | *.tmp_proj 91 | *_wpftmp.csproj 92 | *.log 93 | *.tlog 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 298 | *.vbp 299 | 300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 301 | *.dsw 302 | *.dsp 303 | 304 | # Visual Studio 6 technical files 305 | *.ncb 306 | *.aps 307 | 308 | # Visual Studio LightSwitch build output 309 | **/*.HTMLClient/GeneratedArtifacts 310 | **/*.DesktopClient/GeneratedArtifacts 311 | **/*.DesktopClient/ModelManifest.xml 312 | **/*.Server/GeneratedArtifacts 313 | **/*.Server/ModelManifest.xml 314 | _Pvt_Extensions 315 | 316 | # Paket dependency manager 317 | .paket/paket.exe 318 | paket-files/ 319 | 320 | # FAKE - F# Make 321 | .fake/ 322 | 323 | # CodeRush personal settings 324 | .cr/personal 325 | 326 | # Python Tools for Visual Studio (PTVS) 327 | __pycache__/ 328 | *.pyc 329 | 330 | # Cake - Uncomment if you are using it 331 | # tools/** 332 | # !tools/packages.config 333 | 334 | # Tabs Studio 335 | *.tss 336 | 337 | # Telerik's JustMock configuration file 338 | *.jmconfig 339 | 340 | # BizTalk build output 341 | *.btp.cs 342 | *.btm.cs 343 | *.odx.cs 344 | *.xsd.cs 345 | 346 | # OpenCover UI analysis results 347 | OpenCover/ 348 | 349 | # Azure Stream Analytics local run output 350 | ASALocalRun/ 351 | 352 | # MSBuild Binary and Structured Log 353 | *.binlog 354 | 355 | # NVidia Nsight GPU debugger configuration file 356 | *.nvuser 357 | 358 | # MFractors (Xamarin productivity tool) working folder 359 | .mfractor/ 360 | 361 | # Local History for Visual Studio 362 | .localhistory/ 363 | 364 | # Visual Studio History (VSHistory) files 365 | .vshistory/ 366 | 367 | # BeatPulse healthcheck temp database 368 | healthchecksdb 369 | 370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 371 | MigrationBackup/ 372 | 373 | # Ionide (cross platform F# VS Code tools) working folder 374 | .ionide/ 375 | 376 | # Fody - auto-generated XML schema 377 | FodyWeavers.xsd 378 | 379 | # VS Code files for those working on multiple tools 380 | .vscode/* 381 | !.vscode/settings.json 382 | !.vscode/tasks.json 383 | !.vscode/launch.json 384 | !.vscode/extensions.json 385 | *.code-workspace 386 | 387 | # Local History for Visual Studio Code 388 | .history/ 389 | 390 | # Windows Installer files from build outputs 391 | *.cab 392 | *.msi 393 | *.msix 394 | *.msm 395 | *.msp 396 | 397 | # JetBrains Rider 398 | *.sln.iml 399 | 400 | *.vsidx 401 | /CNCEmu/Properties/AssemblyInfo.cs 402 | /CNCEmu/Properties/AssemblyInfo.cs 403 | /CNCEmu/Properties/AssemblyInfo.cs 404 | -------------------------------------------------------------------------------- /BlazeLibWV/BlazeLibWV.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7CE2BF11-C78D-49AB-A37A-538D2D0E0418} 8 | Library 9 | Properties 10 | BlazeLibWV 11 | BlazeLibWV 12 | v4.6.1 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /BlazeLibWV/BlazePrettyPrinter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BlazeLibWV 8 | { 9 | public static class BlazePrettyPrinter 10 | { 11 | public static string PrintPacket(Blaze.Packet p) 12 | { 13 | StringBuilder sb = new StringBuilder(); 14 | sb.AppendFormat("[{0}][{1}:{2}] {3}", Blaze.PacketToDescriber(p), p.Component.ToString("X4"), p.Command.ToString("X4"), p.QType == 0 ? "from client" : "from server"); 15 | sb.AppendLine(); 16 | sb.AppendLine("{"); 17 | List content = Blaze.ReadPacketContent(p); 18 | foreach (Blaze.Tdf tdf in content) 19 | sb.Append(PrintTdf(tdf, 1)); 20 | sb.AppendLine("}"); 21 | return sb.ToString(); 22 | } 23 | 24 | public static string PrintTdf(Blaze.Tdf tdf, int tabs) 25 | { 26 | StringBuilder sb = new StringBuilder(); 27 | string tab = ""; 28 | for (int i = 0; i < tabs; i++) 29 | tab += "\t"; 30 | sb.Append(tab + "[" + tdf.Label + "]:" + tdf.GetTypeDesc() + " = "); 31 | long n; 32 | string s; 33 | Blaze.DoubleVal dv; 34 | List tdfl; 35 | switch (tdf.Type) 36 | { 37 | case 0: 38 | n = ((Blaze.TdfInteger)tdf).Value; 39 | sb.AppendLine("0x" + n.ToString("X") + "(" + n + ")"); 40 | break; 41 | case 1: 42 | s = ((Blaze.TdfString)tdf).Value; 43 | sb.AppendLine("\"" + s + "\""); 44 | break; 45 | case 3: 46 | tdfl = ((Blaze.TdfStruct)tdf).Values; 47 | sb.AppendLine(); 48 | if (((Blaze.TdfStruct)tdf).startswith2) 49 | sb.AppendLine(tab + "{(*starts with 0x02)"); 50 | else 51 | sb.AppendLine(tab + "{"); 52 | foreach (Blaze.Tdf tdf2 in tdfl) 53 | sb.Append(PrintTdf(tdf2, tabs + 1)); 54 | sb.AppendLine(tab + "}"); 55 | break; 56 | case 4: 57 | sb.AppendLine(); 58 | sb.AppendLine(tab + "{"); 59 | sb.Append(PrintTdfList((Blaze.TdfList)tdf, tabs + 1)); 60 | sb.AppendLine(tab + "}"); 61 | break; 62 | case 5: 63 | sb.AppendLine(); 64 | sb.AppendLine(tab + "{"); 65 | sb.Append(PrintTdfDoubleList((Blaze.TdfDoubleList)tdf, tabs + 1)); 66 | sb.AppendLine(tab + "}"); 67 | break; 68 | case 6: 69 | if (((Blaze.TdfUnion)tdf).Type != 0x7f) 70 | { 71 | sb.AppendLine(); 72 | sb.AppendLine(tab + "{"); 73 | sb.Append(PrintTdf(((Blaze.TdfUnion)tdf).UnionContent, tabs + 1)); 74 | sb.AppendLine(tab + "}"); 75 | } 76 | break; 77 | case 8: 78 | dv = ((Blaze.TdfDoubleVal)tdf).Value; 79 | sb.AppendLine("{0x" + dv.v1.ToString("X") + "(" + dv.v1 + "),0x" + dv.v2.ToString("X") + "(" + dv.v2 + ")}"); 80 | break; 81 | default: 82 | sb.AppendLine(); 83 | break; 84 | } 85 | return sb.ToString(); 86 | } 87 | 88 | public static string PrintTdfList(Blaze.TdfList list, int tabs) 89 | { 90 | StringBuilder sb = new StringBuilder(); 91 | string tab = ""; 92 | for (int i = 0; i < tabs; i++) 93 | tab += "\t"; 94 | List li; 95 | List ls; 96 | List lt; 97 | int count = 0; 98 | switch (list.SubType) 99 | { 100 | case 0: 101 | li = ((List)list.List); 102 | foreach (long l in li) 103 | sb.AppendLine(tab + "0x" + l.ToString("X") + "(" + l + "),"); 104 | break; 105 | case 1: 106 | ls = ((List)list.List); 107 | foreach (string s in ls) 108 | sb.AppendLine(tab + "\"" + s + "\","); 109 | break; 110 | case 3: 111 | lt = ((List)list.List); 112 | foreach (Blaze.TdfStruct tdf in lt) 113 | { 114 | tdf.Type = 3; 115 | tdf.Label = (count++).ToString(); 116 | sb.Append(PrintTdf(tdf, tabs)); 117 | } 118 | break; 119 | } 120 | return sb.ToString(); 121 | } 122 | 123 | public static string PrintTdfDoubleList(Blaze.TdfDoubleList list, int tabs) 124 | { 125 | StringBuilder sb = new StringBuilder(); 126 | string tab = ""; 127 | for (int i = 0; i < tabs; i++) 128 | tab += "\t"; 129 | long l; 130 | string s; 131 | Blaze.TdfStruct t; 132 | for (int i = 0; i < list.Count; i++) 133 | { 134 | switch (list.SubType1) 135 | { 136 | case 0: 137 | l = ((List)list.List1)[i]; 138 | sb.Append(tab + "0x" + l.ToString("X") + "(" + l + ") = "); 139 | break; 140 | case 1: 141 | s = ((List)list.List1)[i]; 142 | sb.Append(tab + "\"" + s + "\" = "); 143 | break; 144 | default: 145 | sb.Append(tab + " = "); 146 | break; 147 | } 148 | switch (list.SubType2) 149 | { 150 | case 0: 151 | l = ((List)list.List2)[i]; 152 | sb.AppendLine("0x" + l.ToString("X") + "(" + l + "),"); 153 | break; 154 | case 1: 155 | s = ((List)list.List2)[i]; 156 | sb.AppendLine("\"" + s + "\","); 157 | break; 158 | case 3: 159 | t = ((List)list.List2)[i]; 160 | sb.AppendLine(" [" + i + "]:TdfStruct{"); 161 | foreach (Blaze.Tdf tdf in t.Values) 162 | sb.Append(PrintTdf(tdf, tabs + 1)); 163 | sb.AppendLine(tab + "},"); 164 | break; 165 | default: 166 | sb.AppendLine(","); 167 | break; 168 | } 169 | } 170 | return sb.ToString(); 171 | } 172 | 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /BlazeLibWV/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 7 | // die einer Assembly zugeordnet sind. 8 | [assembly: AssemblyTitle("BlazeLibWV")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BlazeLibWV")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly 18 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von 19 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. 20 | [assembly: ComVisible(false)] 21 | 22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 23 | [assembly: Guid("7ce2bf11-c78d-49ab-a37a-538d2d0e0418")] 24 | 25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 26 | // 27 | // Hauptversion 28 | // Nebenversion 29 | // Buildnummer 30 | // Revision 31 | // 32 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, 33 | // indem Sie "*" wie unten gezeigt eingeben: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CNCEmu.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.8.34408.163 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNCEmu", "CNCEmu\CNCEmu.csproj", "{1AA2DF60-D199-4C55-BBDD-0549E99C8949}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazeLibWV", "BlazeLibWV\BlazeLibWV.csproj", "{7CE2BF11-C78D-49AB-A37A-538D2D0E0418}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {1AA2DF60-D199-4C55-BBDD-0549E99C8949}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {1AA2DF60-D199-4C55-BBDD-0549E99C8949}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {1AA2DF60-D199-4C55-BBDD-0549E99C8949}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {1AA2DF60-D199-4C55-BBDD-0549E99C8949}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {7CE2BF11-C78D-49AB-A37A-538D2D0E0418}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {7CE2BF11-C78D-49AB-A37A-538D2D0E0418}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {7CE2BF11-C78D-49AB-A37A-538D2D0E0418}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {7CE2BF11-C78D-49AB-A37A-538D2D0E0418}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {BD5AF215-D368-4918-89D9-F5A2181F8B4F} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /CNCEmu/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CNCEmu/BackendLog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace CNCEmu 9 | { 10 | public static class BackendLog 11 | { 12 | public static string logFile = "BackendLog.txt"; 13 | public static void Clear() 14 | { 15 | if (File.Exists(logFile)) 16 | File.Delete(logFile); 17 | } 18 | 19 | public static void Write(string s) 20 | { 21 | File.AppendAllText(logFile, s); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CNCEmu/BlazeServer.cs: -------------------------------------------------------------------------------- 1 | using BlazeLibWV; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.IO; 6 | using System.Net; 7 | using System.Net.Sockets; 8 | using System.Threading; 9 | using System.Windows.Forms; 10 | 11 | namespace CNCEmu 12 | { 13 | public static class BlazeServer 14 | { 15 | public static readonly object _sync = new object(); 16 | public static bool _exit; 17 | public static bool _isRunning = false; 18 | public static RichTextBox box = null; 19 | public static TcpListener lBlaze = null; 20 | public static int idCounter; 21 | public static List allClients = new List(); 22 | 23 | public static void Start() 24 | { 25 | SetExit(false); 26 | _isRunning = true; 27 | Log("Starting Blaze..."); 28 | new Thread(tBlazeMain) { IsBackground = true }.Start(); 29 | idCounter = 1; 30 | for (int i = 0; i < 10; i++) 31 | { 32 | Thread.Sleep(10); 33 | Application.DoEvents(); 34 | } 35 | } 36 | 37 | public static void Stop() 38 | { 39 | Log("Backend stopping..."); 40 | if (lBlaze != null) lBlaze.Stop(); 41 | SetExit(true); 42 | Log("Done."); 43 | } 44 | 45 | public static void tBlazeMain(object obj) 46 | { 47 | try 48 | { 49 | Log("[MAIN] Blaze starting..."); 50 | Profiles.Refresh(); 51 | lBlaze = new TcpListener(IPAddress.Parse(ProviderInfo.backendIP), 3659); 52 | Log("[MAIN] Blaze bound to port: 3659"); 53 | lBlaze.Start(); 54 | Log("[MAIN] Blaze listening..."); 55 | TcpClient client; 56 | while (!GetExit()) 57 | { 58 | client = lBlaze.AcceptTcpClient(); 59 | new Thread(tBlazeClientHandler) { IsBackground = true }.Start(client); 60 | } 61 | } 62 | catch (Exception ex) 63 | { 64 | LogError("MAIN", ex); 65 | } 66 | } 67 | 68 | public static void tBlazeClientHandler(object obj) 69 | { 70 | TcpClient client = (TcpClient)obj; 71 | NetworkStream ns = client.GetStream(); 72 | PlayerInfo pi = new PlayerInfo(); 73 | allClients.Add(pi); 74 | pi.userId = idCounter++; 75 | if (idCounter > 100) 76 | idCounter = 0; 77 | pi.exIp = 0; 78 | pi.ns = ns; 79 | pi.timeout = new System.Diagnostics.Stopwatch(); 80 | pi.timeout.Start(); 81 | Log("[CLNT] #" + pi.userId + " Handler started"); 82 | //try 83 | //{ 84 | while (!GetExit()) 85 | { 86 | byte[] data = Helper.ReadContentTCP(ns); 87 | if (data != null && data.Length != 0) 88 | ProcessPackets(data, pi, ns); 89 | Thread.Sleep(1); 90 | if (pi.timeout.ElapsedMilliseconds > 5000 * 60) 91 | throw new Exception("Client timed out!"); 92 | } 93 | //} 94 | //catch (Exception ex) 95 | //{ 96 | // LogError("CLNT", ex, "Handler " + pi.userId); 97 | // throw new Exception(ex.StackTrace); 98 | //} 99 | client.Close(); 100 | Log("[CLNT] #" + pi.userId + " Client disconnected", System.Drawing.Color.Orange); 101 | BlazeServer.allClients.Remove(pi); 102 | } 103 | 104 | public static void ProcessPackets(byte[] data, PlayerInfo pi, NetworkStream ns) 105 | { 106 | List packets = Blaze.FetchAllBlazePackets(new MemoryStream(data)); 107 | 108 | if (Config.MakePacket.ToLower() == "true") 109 | { 110 | Logger.LogPacket("CLNT", Convert.ToInt32(pi.userId), data); 111 | } 112 | 113 | foreach (Blaze.Packet p in packets) 114 | { 115 | Log("[CLNT] #" + pi.userId + " " + Blaze.PacketToDescriber(p),System.Drawing.Color.Gray); 116 | 117 | switch (p.Component) 118 | { 119 | case 0x1: 120 | AuthenticationComponent.HandlePacket(p, pi, ns); 121 | break; 122 | case 0x4: 123 | GameManagerComponent.HandlePacket(p, pi, ns); 124 | break; 125 | case 0x7: 126 | StatsComponent.HandlePacket(p, pi, ns); 127 | break; 128 | case 0x9: 129 | UtilComponent.HandlePacket(p, pi, ns); 130 | break; 131 | case 0x19: 132 | AssociationListsComponent.HandlePacket(p, pi, ns); 133 | break; 134 | case 0x23: 135 | AccountsComponent.HandlePacket(p, pi, ns); 136 | break; 137 | case 0x801: 138 | RSPComponent.HandlePacket(p, pi, ns); 139 | break; 140 | case 0x803: 141 | InventoryComponent.HandlePacket(p, pi, ns); 142 | break; 143 | case 0x7802: 144 | UserSessionsComponent.HandlePacket(p, pi, ns); 145 | break; 146 | default: 147 | Log("[CLNT] #" + pi.userId + " Component: " + p.Component + " not found.", System.Drawing.Color.Red); 148 | break; 149 | } 150 | } 151 | } 152 | 153 | public static void SetExit(bool state) 154 | { 155 | lock (_sync) 156 | { 157 | _exit = state; 158 | } 159 | } 160 | 161 | public static bool GetExit() 162 | { 163 | bool result; 164 | lock (_sync) 165 | { 166 | result = _exit; 167 | } 168 | return result; 169 | } 170 | 171 | public static void Log(string s, object color = null) 172 | { 173 | if (box == null) return; 174 | try 175 | { 176 | box.Invoke(new Action(delegate 177 | { 178 | string stamp = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " : "; 179 | Color c; 180 | if (color != null) 181 | c = (Color)color; 182 | else 183 | c = Color.Black; 184 | box.SelectionStart = box.TextLength; 185 | box.SelectionLength = 0; 186 | box.SelectionColor = c; 187 | box.AppendText(stamp + s + "\n"); 188 | BackendLog.Write(stamp + s + "\n"); 189 | box.SelectionColor = box.ForeColor; 190 | box.ScrollToCaret(); 191 | })); 192 | } 193 | catch { } 194 | } 195 | 196 | public static void LogError(string who, Exception e, string cName = "") 197 | { 198 | string result = ""; 199 | if (who != "") result = "[" + who + "] " + cName + " ERROR: "; 200 | result += e.Message; 201 | if (e.InnerException != null) 202 | result += " - " + e.InnerException.Message; 203 | Log(result); 204 | } 205 | } 206 | } 207 | -------------------------------------------------------------------------------- /CNCEmu/CNCEmu.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1AA2DF60-D199-4C55-BBDD-0549E99C8949} 8 | WinExe 9 | CNCEmu 10 | CNCEmu 11 | v4.6.1 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | blaze.ico 37 | 38 | 39 | true 40 | true 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | Form 92 | 93 | 94 | Form1.cs 95 | 96 | 97 | Form 98 | 99 | 100 | Form2.cs 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | True 111 | True 112 | AssemblyInfo.tt 113 | 114 | 115 | 116 | 117 | 118 | Form1.cs 119 | Designer 120 | 121 | 122 | Form2.cs 123 | 124 | 125 | ResXFileCodeGenerator 126 | Resources.Designer.cs 127 | Designer 128 | 129 | 130 | True 131 | Resources.resx 132 | True 133 | 134 | 135 | SettingsSingleFileGenerator 136 | Settings.Designer.cs 137 | 138 | 139 | True 140 | Settings.settings 141 | True 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | {7ce2bf11-c78d-49ab-a37a-538d2d0e0418} 150 | BlazeLibWV 151 | 152 | 153 | 154 | 155 | TextTemplatingFileGenerator 156 | AssemblyInfo.cs 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /CNCEmu/CleanPackets.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace CNCEmu 9 | { 10 | public static class CleanPackets 11 | { 12 | public static void Clean() 13 | { 14 | if (Directory.Exists("logs\\packets")) 15 | Directory.Delete("logs\\packets",true); 16 | if (Directory.Exists("logs")) 17 | Directory.Delete("logs",true); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyClientGameSetupCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | 10 | namespace CNCEmu 11 | { 12 | class NotifyClientGameSetupCommand 13 | { 14 | public static List NotifyClientGameSetup(PlayerInfo pi, PlayerInfo srv) 15 | { 16 | long reas = 1; 17 | List Result = new List(); 18 | List GAME = new List(); 19 | GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List(new long[] { srv.userId }))); 20 | if (srv.game.ATTR != null) 21 | GAME.Add(srv.game.ATTR); 22 | GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List(new long[] { 0x20, 0 }))); 23 | GAME.Add(Blaze.TdfInteger.Create("GID\0", srv.game.id)); 24 | GAME.Add(Blaze.TdfString.Create("GNAM", srv.game.GNAM)); 25 | GAME.Add(Blaze.TdfInteger.Create("GPVH", 666)); 26 | GAME.Add(Blaze.TdfInteger.Create("GSET", srv.game.GSET)); 27 | GAME.Add(Blaze.TdfInteger.Create("GSID", 1)); 28 | GAME.Add(Blaze.TdfInteger.Create("GSTA", srv.game.GSTA)); 29 | GAME.Add(Blaze.TdfString.Create("GTYP", "")); 30 | GAME.Add(BlazeHelper.CreateNETField(srv, "HNET")); 31 | GAME.Add(Blaze.TdfInteger.Create("HSES", 13666)); 32 | GAME.Add(Blaze.TdfInteger.Create("IGNO", 0)); 33 | GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20)); 34 | GAME.Add(BlazeHelper.CreateNQOSField(srv, "NQOS")); 35 | GAME.Add(Blaze.TdfInteger.Create("NRES", 0)); 36 | GAME.Add(Blaze.TdfInteger.Create("NTOP", 1)); 37 | GAME.Add(Blaze.TdfString.Create("PGID", "")); 38 | List PHST = new List(); 39 | PHST.Add(Blaze.TdfInteger.Create("HPID", srv.userId)); 40 | PHST.Add(Blaze.TdfInteger.Create("HSLT", srv.slot)); 41 | GAME.Add(Blaze.TdfStruct.Create("PHST", PHST)); 42 | GAME.Add(Blaze.TdfInteger.Create("PRES", 1)); 43 | GAME.Add(Blaze.TdfString.Create("PSAS", "wv")); 44 | GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10)); 45 | GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F)); 46 | GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10)); 47 | List THST = new List(); 48 | THST.Add(Blaze.TdfInteger.Create("HPID", srv.userId)); 49 | THST.Add(Blaze.TdfInteger.Create("HSLT", srv.slot)); 50 | GAME.Add(Blaze.TdfStruct.Create("THST", THST)); 51 | List playerIdList = new List(); 52 | for (int i = 0; i < 32; i++) 53 | if (srv.game.slotUse[i] != -1) 54 | playerIdList.Add(srv.game.slotUse[i]); 55 | GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, playerIdList)); 56 | GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938")); 57 | GAME.Add(Blaze.TdfInteger.Create("VOIP", srv.game.VOIP)); 58 | GAME.Add(Blaze.TdfString.Create("VSTR", srv.game.VSTR)); 59 | Result.Add(Blaze.TdfStruct.Create("GAME", GAME)); 60 | List PROS = new List(); 61 | for (int i = 0; i < 32; i++) 62 | if (srv.game.players[i] != null) 63 | PROS.Add(BlazeHelper.MakePROSEntry(i, srv.game.players[i])); 64 | Result.Add(Blaze.TdfList.Create("PROS", 3, PROS.Count, PROS)); 65 | List VALU = new List(); 66 | VALU.Add(Blaze.TdfInteger.Create("DCTX", reas)); 67 | Result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU))); 68 | 69 | return Result; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyGamePlayerStateChangeCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | class NotifyGamePlayerStateChangeCommand 12 | { 13 | public static List NotifyGamePlayerStateChange(PlayerInfo pi, long stat) 14 | { 15 | List Result = new List(); 16 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 17 | Result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 18 | Result.Add(Blaze.TdfInteger.Create("STAT", stat)); 19 | return Result; 20 | } 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyGameSettingsChangeCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | class NotifyGameSettingsChangeCommand 12 | { 13 | public static List NotifyGameSettingsChange(PlayerInfo pi) 14 | { 15 | List Result = new List(); 16 | Result.Add(Blaze.TdfInteger.Create("ATTR", pi.game.GSET)); 17 | Result.Add(Blaze.TdfInteger.Create("GID", pi.game.id)); 18 | return Result; 19 | } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyGameStateChangeCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class NotifyGameStateChangeCommand 12 | { 13 | public static List NotifyGameStateChange(PlayerInfo pi) 14 | { 15 | List Result = new List(); 16 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 17 | Result.Add(Blaze.TdfInteger.Create("GSTA", pi.game.GSTA)); 18 | return Result; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyPlatformHostInitializedCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class NotifyPlatformHostInitializedCommand 12 | { 13 | public static List NotifyPlatformHostInitialized(PlayerInfo pi) 14 | { 15 | List Result = new List(); 16 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 17 | Result.Add(Blaze.TdfInteger.Create("PHID", pi.userId)); 18 | Result.Add(Blaze.TdfInteger.Create("PHST", 0)); 19 | return Result; 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyPlayerJoinCompletedCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | 10 | namespace CNCEmu 11 | { 12 | class NotifyPlayerJoinCompletedCommand 13 | { 14 | public static List NotifyPlayerJoinCompleted(PlayerInfo pi) 15 | { 16 | List Result = new List(); 17 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 18 | Result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 19 | return Result; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyPlayerJoiningCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | class NotifyPlayerJoiningCommand 12 | { 13 | public static List NotifyPlayerJoining(PlayerInfo pi) 14 | { 15 | uint t = Blaze.GetUnixTimeStamp(); 16 | List Result = new List(); 17 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 18 | List PDAT = new List(); 19 | PDAT.Add(Blaze.TdfInteger.Create("EXID", pi.userId)); 20 | PDAT.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 21 | PDAT.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc)); 22 | PDAT.Add(Blaze.TdfString.Create("NAME", pi.profile.name)); 23 | PDAT.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 24 | PDAT.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET")); 25 | PDAT.Add(Blaze.TdfInteger.Create("SID\0", pi.slot)); 26 | PDAT.Add(Blaze.TdfInteger.Create("STAT", pi.stat)); 27 | PDAT.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF)); 28 | PDAT.Add(Blaze.TdfInteger.Create("TIME", t)); 29 | PDAT.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); 30 | Result.Add(Blaze.TdfStruct.Create("PDAT", PDAT)); 31 | 32 | return Result; 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyPlayerRemovedCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | class NotifyPlayerRemovedCommand 12 | { 13 | public static List NotifyPlayerRemoved(PlayerInfo pi, long pid, long cntx, long reas) 14 | { 15 | List Result = new List(); 16 | Result.Add(Blaze.TdfInteger.Create("CNTX", cntx)); 17 | Result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 18 | Result.Add(Blaze.TdfInteger.Create("PID\0", pid)); 19 | Result.Add(Blaze.TdfInteger.Create("REAS", reas)); 20 | return Result; 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyServerGameSetupCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class NotifyServerGameSetupCommand 12 | { 13 | public static List NotifyServerGameSetup(Blaze.Packet p, PlayerInfo pi) 14 | { 15 | List input = Blaze.ReadPacketContent(p); 16 | 17 | uint t = Blaze.GetUnixTimeStamp(); 18 | pi.game.GNAM = ((Blaze.TdfString)input[4]).Value; 19 | pi.game.GSET = ((Blaze.TdfInteger)input[5]).Value; 20 | pi.game.VOIP = ((Blaze.TdfInteger)input[22]).Value; 21 | pi.game.VSTR = ((Blaze.TdfString)input[23]).Value; 22 | List result = new List(); 23 | List GAME = new List(); 24 | GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List(new long[] { pi.userId }))); 25 | GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List(new long[] { 0x20, 0 }))); 26 | GAME.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 27 | GAME.Add(Blaze.TdfString.Create("GNAM", pi.game.GNAM)); 28 | GAME.Add(Blaze.TdfInteger.Create("GPVH", 666)); 29 | GAME.Add(Blaze.TdfInteger.Create("GSET", pi.game.GSET)); 30 | GAME.Add(Blaze.TdfInteger.Create("GSID", 1)); 31 | GAME.Add(Blaze.TdfInteger.Create("GSTA", pi.game.GSTA)); 32 | GAME.Add(Blaze.TdfString.Create("GTYP", "")); 33 | GAME.Add(BlazeHelper.CreateNETField(pi, "HNET")); 34 | GAME.Add(Blaze.TdfInteger.Create("HSES", 13666)); 35 | GAME.Add(Blaze.TdfInteger.Create("IGNO", 0)); 36 | GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20)); 37 | GAME.Add(BlazeHelper.CreateNQOSField(pi, "NQOS")); 38 | GAME.Add(Blaze.TdfInteger.Create("NRES", 0)); 39 | GAME.Add(Blaze.TdfInteger.Create("NTOP", 1)); 40 | GAME.Add(Blaze.TdfString.Create("PGID", "")); 41 | List PHST = new List(); 42 | PHST.Add(Blaze.TdfInteger.Create("HPID", pi.userId)); 43 | GAME.Add(Blaze.TdfStruct.Create("PHST", PHST)); 44 | GAME.Add(Blaze.TdfInteger.Create("PRES", 1)); 45 | GAME.Add(Blaze.TdfString.Create("PSAS", "wv")); 46 | GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10)); 47 | GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F)); 48 | GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10)); 49 | List THST = new List(); 50 | THST.Add(Blaze.TdfInteger.Create("HPID", pi.userId)); 51 | GAME.Add(Blaze.TdfStruct.Create("THST", THST)); 52 | GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, new List(new long[] { 1, 2 }))); 53 | GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938")); 54 | GAME.Add(Blaze.TdfInteger.Create("VOIP", pi.game.VOIP)); 55 | GAME.Add(Blaze.TdfString.Create("VSTR", pi.game.VSTR)); 56 | result.Add(Blaze.TdfStruct.Create("GAME", GAME)); 57 | List PROS = new List(); 58 | List ee0 = new List(); 59 | ee0.Add(Blaze.TdfInteger.Create("EXID", pi.userId)); 60 | ee0.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 61 | ee0.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc)); 62 | ee0.Add(Blaze.TdfString.Create("NAME", pi.profile.name)); 63 | ee0.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 64 | ee0.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET")); 65 | ee0.Add(Blaze.TdfInteger.Create("SID\0", pi.slot)); 66 | ee0.Add(Blaze.TdfInteger.Create("SLOT", 0)); 67 | ee0.Add(Blaze.TdfInteger.Create("STAT", 2)); 68 | ee0.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF)); 69 | ee0.Add(Blaze.TdfInteger.Create("TIME", t)); 70 | ee0.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); 71 | PROS.Add(Blaze.TdfStruct.Create("0", ee0)); 72 | result.Add(Blaze.TdfList.Create("PROS", 3, 1, PROS)); 73 | List VALU = new List(); 74 | VALU.Add(Blaze.TdfInteger.Create("DCTX", 0)); 75 | result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU))); 76 | 77 | return result; 78 | } 79 | 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyUserAddedCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | class NotifyUserAddedCommand 12 | { 13 | public static List NotifyUserAdded(PlayerInfo pi) 14 | { 15 | List Result = new List(); 16 | Result.Add(BlazeHelper.CreateUserDataStruct(pi)); 17 | Result.Add(BlazeHelper.CreateUserStruct(pi)); 18 | return Result; 19 | } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyUserRemovedCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | class NotifyUserRemovedCommand 12 | { 13 | public static List NotifyUserRemoved(PlayerInfo pi, long pid) 14 | { 15 | List Result = new List(); 16 | Result.Add(Blaze.TdfInteger.Create("BUID", pid)); 17 | return Result; 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CNCEmu/Commands/NotifyUserStatusCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | 10 | namespace CNCEmu 11 | { 12 | class NotifyUserStatusCommand 13 | { 14 | public static List NotifyUserStatus(PlayerInfo pi) 15 | { 16 | List Result = new List(); 17 | Result.Add(Blaze.TdfInteger.Create("FLGS", 3)); 18 | Result.Add(Blaze.TdfInteger.Create("ID\0\0", pi.userId)); 19 | return Result; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CNCEmu/Commands/UserAddedCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class UserAddedCommand 12 | { 13 | public static List UserAdded(PlayerInfo pi) 14 | { 15 | List Result = new List(); 16 | List DATA = new List(); 17 | List USER = new List(); 18 | List QDAT = new List(); 19 | DATA.Add(Blaze.TdfString.Create("BPS", "ams")); //Best PingSite 20 | DATA.Add(Blaze.TdfString.Create("CTY", "")); //Country 21 | DATA.Add(Blaze.TdfInteger.Create("HWFG", 0)); //Hardware Flags 22 | List t = Helper.ConvertStringList("{354} {376} {241} {177} {206} {37}"); 23 | List t2 = new List(); 24 | foreach (string v in t) 25 | t2.Add(Convert.ToInt64(v)); 26 | DATA.Add(Blaze.TdfList.Create("PSLM", 0, t2.Count, t2)); //PingSite list # in ms 27 | DATA.Add(Blaze.TdfStruct.Create("QDAT", QDAT)); //Quality of Service Data 28 | DATA.Add(Blaze.TdfInteger.Create("UATT", 0)); //UserInfoAttribute 29 | Result.Add(Blaze.TdfStruct.Create("DATA", DATA)); 30 | 31 | USER.Add(Blaze.TdfInteger.Create("AID", pi.userId)); 32 | USER.Add(Blaze.TdfInteger.Create("ALOC", 1701729619)); 33 | USER.Add(Blaze.TdfInteger.Create("ID", pi.userId)); 34 | USER.Add(Blaze.TdfString.Create("NAME", pi.profile.name)); 35 | USER.Add(Blaze.TdfInteger.Create("ORIG", pi.userId)); 36 | USER.Add(Blaze.TdfInteger.Create("PIDI", 0)); 37 | Result.Add(Blaze.TdfStruct.Create("USER", USER)); 38 | 39 | return Result; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CNCEmu/Commands/UserAuthenticatedCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class UserAuthenticatedCommand 12 | { 13 | public static List UserAuthenticated(PlayerInfo pi) 14 | { 15 | List Result = new List(); 16 | Result.Add(Blaze.TdfInteger.Create("ALOC", 1403663841)); 17 | Result.Add(Blaze.TdfInteger.Create("BUID", pi.userId)); 18 | Result.Add(Blaze.TdfString.Create("DSNM", pi.profile.name)); 19 | Result.Add(Blaze.TdfInteger.Create("FRSC", 0)); 20 | Result.Add(Blaze.TdfInteger.Create("FRST", 0)); 21 | Result.Add(Blaze.TdfString.Create("KEY", "SESSKY")); 22 | Result.Add(Blaze.TdfInteger.Create("LAST", 1403663841)); 23 | Result.Add(Blaze.TdfInteger.Create("LLOG", 1403663841)); 24 | Result.Add(Blaze.TdfString.Create("MAIL", "cnc.server.pc@ea.com")); 25 | Result.Add(Blaze.TdfInteger.Create("PID", pi.userId)); 26 | Result.Add(Blaze.TdfInteger.Create("PLAT", 4)); 27 | Result.Add(Blaze.TdfInteger.Create("UID", pi.userId)); 28 | Result.Add(Blaze.TdfInteger.Create("USTP", 0)); 29 | Result.Add(Blaze.TdfInteger.Create("XREF", 0)); 30 | 31 | return Result; 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CNCEmu/Commands/UserSessionExtendedDataUpdateNotificationCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | class UserSessionExtendedDataUpdateNotificationCommand 12 | { 13 | public static List UserSessionExtendedDataUpdateNotification(PlayerInfo pi) 14 | { 15 | List Result = new List(); 16 | Result.Add(BlazeHelper.CreateUserDataStruct(pi)); 17 | Result.Add(Blaze.TdfInteger.Create("USID", pi.userId)); 18 | return Result; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CNCEmu/Commands/UserUpdatedCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class UserUpdatedCommand 12 | { 13 | public static List UserUpdated(PlayerInfo pi) 14 | { 15 | List Result = new List(); 16 | Result.Add(Blaze.TdfInteger.Create("FLGS", 3)); 17 | Result.Add(Blaze.TdfInteger.Create("ID", pi.userId)); 18 | 19 | return Result; 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CNCEmu/Components/AccountsComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class AccountsComponent 12 | { 13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 14 | { 15 | switch (p.Command) 16 | { 17 | case 0x0: 18 | //AuthLogin(p, pi, ns); 19 | break; 20 | default: 21 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [ACCOUNTS] " + " not found.", System.Drawing.Color.Red); 22 | break; 23 | } 24 | } 25 | 26 | public static void AuthLogin(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 27 | { 28 | 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CNCEmu/Components/AssociationListsComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class AssociationListsComponent 12 | { 13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 14 | { 15 | switch (p.Command) 16 | { 17 | case 0x00: 18 | break; 19 | default: 20 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [ASSOCIATIONLISTCOMP] " + " not found.", System.Drawing.Color.Red); 21 | break; 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CNCEmu/Components/AsyncNotification/AsyncGameManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class AsyncGameManager 12 | { 13 | public static void NotifyPlatformHostInitialized(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 14 | { 15 | List result = new List(); 16 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 17 | result.Add(Blaze.TdfInteger.Create("PHID", pi.userId)); 18 | result.Add(Blaze.TdfInteger.Create("PHST", 0)); 19 | byte[] buff = Blaze.CreatePacket(4, 0x47, 0, 0x2000, 0, result); 20 | ns.Write(buff, 0, buff.Length); 21 | ns.Flush(); 22 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0047] NotifyPlatformHostInitialized"); 23 | } 24 | 25 | public static void NotifyGameStateChange(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 26 | { 27 | List result = new List(); 28 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 29 | result.Add(Blaze.TdfInteger.Create("GSTA", pi.game.GSTA)); 30 | byte[] buff = Blaze.CreatePacket(4, 0x64, 0, 0x2000, 0, result); 31 | ns.Write(buff, 0, buff.Length); 32 | ns.Flush(); 33 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0064] NotifyGameStateChange"); 34 | } 35 | 36 | public static void NotifyServerGameSetup(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 37 | { 38 | List input = Blaze.ReadPacketContent(p); 39 | uint t = Blaze.GetUnixTimeStamp(); 40 | pi.game.GNAM = ((Blaze.TdfString)input[2]).Value; 41 | pi.game.GSET = ((Blaze.TdfInteger)input[3]).Value; 42 | pi.game.VOIP = ((Blaze.TdfInteger)input[21]).Value; 43 | pi.game.VSTR = ((Blaze.TdfString)input[22]).Value; 44 | List result = new List(); 45 | List GAME = new List(); 46 | GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List(new long[] { pi.userId }))); 47 | GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List(new long[] { 0x20, 0 }))); 48 | GAME.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 49 | GAME.Add(Blaze.TdfString.Create("GNAM", pi.game.GNAM)); 50 | GAME.Add(Blaze.TdfInteger.Create("GPVH", 666)); 51 | GAME.Add(Blaze.TdfInteger.Create("GSET", pi.game.GSET)); 52 | GAME.Add(Blaze.TdfInteger.Create("GSID", 1)); 53 | GAME.Add(Blaze.TdfInteger.Create("GSTA", pi.game.GSTA)); 54 | GAME.Add(Blaze.TdfString.Create("GTYP", "")); 55 | GAME.Add(BlazeHelper.CreateNETField(pi, "HNET")); 56 | GAME.Add(Blaze.TdfInteger.Create("HSES", 13666)); 57 | GAME.Add(Blaze.TdfInteger.Create("IGNO", 0)); 58 | GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20)); 59 | GAME.Add(BlazeHelper.CreateNQOSField(pi, "NQOS")); 60 | GAME.Add(Blaze.TdfInteger.Create("NRES", 0)); 61 | GAME.Add(Blaze.TdfInteger.Create("NTOP", 1)); 62 | GAME.Add(Blaze.TdfString.Create("PGID", "")); 63 | List PHST = new List(); 64 | PHST.Add(Blaze.TdfInteger.Create("HPID", pi.userId)); 65 | GAME.Add(Blaze.TdfStruct.Create("PHST", PHST)); 66 | GAME.Add(Blaze.TdfInteger.Create("PRES", 1)); 67 | GAME.Add(Blaze.TdfString.Create("PSAS", "wv")); 68 | GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10)); 69 | GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F)); 70 | GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10)); 71 | List THST = new List(); 72 | THST.Add(Blaze.TdfInteger.Create("HPID", pi.userId)); 73 | GAME.Add(Blaze.TdfStruct.Create("THST", THST)); 74 | GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, new List(new long[] { 1, 2 }))); 75 | GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938")); 76 | GAME.Add(Blaze.TdfInteger.Create("VOIP", pi.game.VOIP)); 77 | GAME.Add(Blaze.TdfString.Create("VSTR", pi.game.VSTR)); 78 | result.Add(Blaze.TdfStruct.Create("GAME", GAME)); 79 | List PROS = new List(); 80 | List ee0 = new List(); 81 | ee0.Add(Blaze.TdfInteger.Create("EXID", pi.userId)); 82 | ee0.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 83 | ee0.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc)); 84 | ee0.Add(Blaze.TdfString.Create("NAME", pi.profile.name)); 85 | ee0.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 86 | ee0.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET")); 87 | ee0.Add(Blaze.TdfInteger.Create("SID\0", pi.slot)); 88 | ee0.Add(Blaze.TdfInteger.Create("SLOT", 0)); 89 | ee0.Add(Blaze.TdfInteger.Create("STAT", 2)); 90 | ee0.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF)); 91 | ee0.Add(Blaze.TdfInteger.Create("TIME", t)); 92 | ee0.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); 93 | PROS.Add(Blaze.TdfStruct.Create("0", ee0)); 94 | result.Add(Blaze.TdfList.Create("PROS", 3, 1, PROS)); 95 | List VALU = new List(); 96 | VALU.Add(Blaze.TdfInteger.Create("DCTX", 0)); 97 | result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU))); 98 | byte[] buff = Blaze.CreatePacket(p.Component, 0x14, 0, 0x2000, 0, result); 99 | ns.Write(buff, 0, buff.Length); 100 | ns.Flush(); 101 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0014] NotifyServerGameSetup"); 102 | } 103 | 104 | public static void NotifyGameSettingsChange(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 105 | { 106 | List result = new List(); 107 | result.Add(Blaze.TdfInteger.Create("ATTR", pi.game.GSET)); 108 | result.Add(Blaze.TdfInteger.Create("GID", pi.game.id)); 109 | byte[] buff = Blaze.CreatePacket(p.Component, 0x6E, 0, 0x2000, 0, result); 110 | ns.Write(buff, 0, buff.Length); 111 | ns.Flush(); 112 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:006E] NotifyGameSettingsChange"); 113 | } 114 | 115 | public static void NotifyClientGameSetup(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, PlayerInfo srv, NetworkStream ns, long reas = 1) 116 | { 117 | List result = new List(); 118 | List GAME = new List(); 119 | GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List(new long[] { srv.userId }))); 120 | if (srv.game.ATTR != null) 121 | GAME.Add(srv.game.ATTR); 122 | GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List(new long[] { 0x20, 0 }))); 123 | GAME.Add(Blaze.TdfInteger.Create("GID\0", srv.game.id)); 124 | GAME.Add(Blaze.TdfString.Create("GNAM", srv.game.GNAM)); 125 | GAME.Add(Blaze.TdfInteger.Create("GPVH", 666)); 126 | GAME.Add(Blaze.TdfInteger.Create("GSET", srv.game.GSET)); 127 | GAME.Add(Blaze.TdfInteger.Create("GSID", 1)); 128 | GAME.Add(Blaze.TdfInteger.Create("GSTA", srv.game.GSTA)); 129 | GAME.Add(Blaze.TdfString.Create("GTYP", "")); 130 | GAME.Add(BlazeHelper.CreateNETField(srv, "HNET")); 131 | GAME.Add(Blaze.TdfInteger.Create("HSES", 13666)); 132 | GAME.Add(Blaze.TdfInteger.Create("IGNO", 0)); 133 | GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20)); 134 | GAME.Add(BlazeHelper.CreateNQOSField(srv, "NQOS")); 135 | GAME.Add(Blaze.TdfInteger.Create("NRES", 0)); 136 | GAME.Add(Blaze.TdfInteger.Create("NTOP", 1)); 137 | GAME.Add(Blaze.TdfString.Create("PGID", "")); 138 | List PHST = new List(); 139 | PHST.Add(Blaze.TdfInteger.Create("HPID", srv.userId)); 140 | PHST.Add(Blaze.TdfInteger.Create("HSLT", srv.slot)); 141 | GAME.Add(Blaze.TdfStruct.Create("PHST", PHST)); 142 | GAME.Add(Blaze.TdfInteger.Create("PRES", 1)); 143 | GAME.Add(Blaze.TdfString.Create("PSAS", "wv")); 144 | GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10)); 145 | GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F)); 146 | GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10)); 147 | List THST = new List(); 148 | THST.Add(Blaze.TdfInteger.Create("HPID", srv.userId)); 149 | THST.Add(Blaze.TdfInteger.Create("HSLT", srv.slot)); 150 | GAME.Add(Blaze.TdfStruct.Create("THST", THST)); 151 | List playerIdList = new List(); 152 | for (int i = 0; i < 32; i++) 153 | if (srv.game.slotUse[i] != -1) 154 | playerIdList.Add(srv.game.slotUse[i]); 155 | GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, playerIdList)); 156 | GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938")); 157 | GAME.Add(Blaze.TdfInteger.Create("VOIP", srv.game.VOIP)); 158 | GAME.Add(Blaze.TdfString.Create("VSTR", srv.game.VSTR)); 159 | result.Add(Blaze.TdfStruct.Create("GAME", GAME)); 160 | List PROS = new List(); 161 | for (int i = 0; i < 32; i++) 162 | if (srv.game.players[i] != null) 163 | PROS.Add(BlazeHelper.MakePROSEntry(i, srv.game.players[i])); 164 | result.Add(Blaze.TdfList.Create("PROS", 3, PROS.Count, PROS)); 165 | List VALU = new List(); 166 | VALU.Add(Blaze.TdfInteger.Create("DCTX", reas)); 167 | result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU))); 168 | byte[] buff = Blaze.CreatePacket(0x4, 0x14, 0, 0x2000, 0, result); 169 | ns.Write(buff, 0, buff.Length); 170 | ns.Flush(); 171 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0014] NotifyClientGameSetup"); 172 | } 173 | 174 | public static void NotifyPlayerJoining(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 175 | { 176 | uint t = Blaze.GetUnixTimeStamp(); 177 | List result = new List(); 178 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 179 | List PDAT = new List(); 180 | PDAT.Add(Blaze.TdfInteger.Create("EXID", pi.userId)); 181 | PDAT.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 182 | PDAT.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc)); 183 | PDAT.Add(Blaze.TdfString.Create("NAME", pi.profile.name)); 184 | PDAT.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 185 | PDAT.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET")); 186 | PDAT.Add(Blaze.TdfInteger.Create("SID\0", pi.slot)); 187 | PDAT.Add(Blaze.TdfInteger.Create("STAT", pi.stat)); 188 | PDAT.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF)); 189 | PDAT.Add(Blaze.TdfInteger.Create("TIME", t)); 190 | PDAT.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); 191 | result.Add(Blaze.TdfStruct.Create("PDAT", PDAT)); 192 | byte[] buff = Blaze.CreatePacket(0x4, 0x15, 0, 0x2000, 0, result); 193 | ns.Write(buff, 0, buff.Length); 194 | ns.Flush(); 195 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0015] NotifyPlayerJoining"); 196 | } 197 | 198 | public static void NotifyGamePlayerStateChange(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns, long stat) 199 | { 200 | List result = new List(); 201 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 202 | result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 203 | result.Add(Blaze.TdfInteger.Create("STAT", stat)); 204 | byte[] buff = Blaze.CreatePacket(0x4, 0x74, 0, 0x2000, 0, result); 205 | ns.Write(buff, 0, buff.Length); 206 | ns.Flush(); 207 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0074] NotifyGamePlayerStateChange"); 208 | } 209 | 210 | public static void NotifyPlayerJoinCompleted(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 211 | { 212 | List result = new List(); 213 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 214 | result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 215 | byte[] buff = Blaze.CreatePacket(0x4, 0x1E, 0, 0x2000, 0, result); 216 | ns.Write(buff, 0, buff.Length); 217 | ns.Flush(); 218 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:001E] NotifyPlayerJoinCompleted"); 219 | } 220 | 221 | public static void NotifyPlayerRemoved(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns, long pid, long cntx, long reas) 222 | { 223 | List result = new List(); 224 | result.Add(Blaze.TdfInteger.Create("CNTX", cntx)); 225 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 226 | result.Add(Blaze.TdfInteger.Create("PID\0", pid)); 227 | result.Add(Blaze.TdfInteger.Create("REAS", reas)); 228 | byte[] buff = Blaze.CreatePacket(4, 0x28, 0, 0x2000, 0, result); 229 | ns.Write(buff, 0, buff.Length); 230 | ns.Flush(); 231 | BlazeServer.Log("[CLNT] #" + src.userId + " [0004:001E] NotifyPlayerRemoved"); 232 | } 233 | 234 | } 235 | } 236 | -------------------------------------------------------------------------------- /CNCEmu/Components/AsyncNotification/AsyncStats.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class AsyncStats 12 | { 13 | public static void GetStatsAsyncNotification(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 14 | { 15 | List input = Blaze.ReadPacketContent(p); 16 | string statSpace = ((Blaze.TdfString)input[2]).Value; 17 | long vid = ((Blaze.TdfInteger)input[7]).Value; 18 | long eid = ((List)((Blaze.TdfList)input[1]).List)[0]; 19 | List Result = new List(); 20 | Result.Add(Blaze.TdfString.Create("GRNM", statSpace)); 21 | Result.Add(Blaze.TdfString.Create("KEY\0", "No_Scope_Defined")); 22 | Result.Add(Blaze.TdfInteger.Create("LAST", 1)); 23 | List STS = new List(); 24 | List STAT = new List(); 25 | List e0 = new List(); 26 | e0.Add(Blaze.TdfInteger.Create("EID\0", eid)); 27 | e0.Add(Blaze.TdfDoubleVal.Create("ETYP", new Blaze.DoubleVal(30722, 1))); 28 | e0.Add(Blaze.TdfInteger.Create("POFF", 0)); 29 | List values = new List(); 30 | //if (statSpace == "crit") 31 | // values.AddRange(new string[] { pi.profile.level.ToString(), 32 | // pi.profile.xp.ToString(), 33 | // "10000" }); 34 | //else 35 | // values.AddRange(new string[] { pi.profile.kit.ToString(), 36 | // pi.profile.head.ToString(), 37 | // pi.profile.face.ToString(), 38 | // pi.profile.shirt.ToString()}); 39 | e0.Add(Blaze.TdfList.Create("STAT", 1, values.Count, values)); 40 | STAT.Add(Blaze.TdfStruct.Create("0", e0)); 41 | STS.Add(Blaze.TdfList.Create("STAT", 3, STAT.Count, STAT)); 42 | Result.Add(Blaze.TdfStruct.Create("STS\0", STS)); 43 | Result.Add(Blaze.TdfInteger.Create("VID\0", vid)); 44 | byte[] buff = Blaze.CreatePacket(7, 0x32, 0, 0x2000, 0, Result); 45 | ns.Write(buff, 0, buff.Length); 46 | ns.Flush(); 47 | BlazeServer.Log("[CLNT] #" + pi.userId + " [0007:0032] GetStatsAsyncNotification"); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CNCEmu/Components/AsyncNotification/AsyncUserSessions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class AsyncUserSessions 12 | { 13 | public static void UserSessionExtendedDataUpdateNotification(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 14 | { 15 | List Result = new List(); 16 | Result.Add(BlazeHelper.CreateUserDataStruct(pi)); 17 | Result.Add(Blaze.TdfInteger.Create("USID", pi.userId)); 18 | byte[] buff = Blaze.CreatePacket(0x7802, 1, 0, 0x2000, 0, Result); 19 | ns.Write(buff, 0, buff.Length); 20 | ns.Flush(); 21 | BlazeServer.Log("[CLNT] #" + src.userId + " [7802:0001] UserSessionExtendedDataUpdateNotification"); 22 | } 23 | 24 | public static void NotifyUserAdded(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 25 | { 26 | List result = new List(); 27 | result.Add(BlazeHelper.CreateUserDataStruct(pi)); 28 | result.Add(BlazeHelper.CreateUserStruct(pi)); 29 | byte[] buff = Blaze.CreatePacket(0x7802, 0x2, 0, 0x2000, 0, result); 30 | ns.Write(buff, 0, buff.Length); 31 | ns.Flush(); 32 | BlazeServer.Log("[CLNT] #" + src.userId + " [7802:0001] NotifyUserAdded"); 33 | } 34 | 35 | public static void NotifyUserRemoved(PlayerInfo src, Blaze.Packet p, long pid, NetworkStream ns) 36 | { 37 | List result = new List(); 38 | result.Add(Blaze.TdfInteger.Create("BUID", pid)); 39 | byte[] buff = Blaze.CreatePacket(0x7802, 0x3, 0, 0x2000, 0, result); 40 | ns.Write(buff, 0, buff.Length); 41 | ns.Flush(); 42 | BlazeServer.Log("[CLNT] #" + src.userId + " [7802:0001] NotifyUserRemoved"); 43 | } 44 | 45 | public static void NotifyUserStatus(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 46 | { 47 | List result = new List(); 48 | result.Add(Blaze.TdfInteger.Create("FLGS", 3)); 49 | result.Add(Blaze.TdfInteger.Create("ID\0\0", pi.userId)); 50 | byte[] buff = Blaze.CreatePacket(0x7802, 0x5, 0, 0x2000, 0, result); 51 | ns.Write(buff, 0, buff.Length); 52 | ns.Flush(); 53 | BlazeServer.Log("[CLNT] #" + src.userId + " [7802:0001] NotifyUserStatus"); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /CNCEmu/Components/AuthenticationComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using static BlazeLibWV.Blaze; 8 | using System.Net.Sockets; 9 | 10 | namespace CNCEmu 11 | { 12 | public static class AuthenticationComponent 13 | { 14 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 15 | { 16 | switch (p.Command) 17 | { 18 | case 0x00: 19 | break; 20 | case 0x3C: 21 | ExpressLogin(p, pi, ns); 22 | break; 23 | case 0x28: 24 | Login(p, pi, ns); 25 | break; 26 | case 0x64: 27 | ListPersonas(p, pi, ns); 28 | break; 29 | case 0x6E: 30 | LoginPersona(p, pi, ns); 31 | break; 32 | case 0x78: 33 | LogoutPersona(p, pi, ns); 34 | break; 35 | case 0x46: 36 | logout(p, pi, ns); 37 | break; 38 | default: 39 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [AUTHENTICATIONCOMP] " + " not found.", System.Drawing.Color.Red); 40 | break; 41 | } 42 | } 43 | 44 | public static void ExpressLogin(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 45 | { 46 | uint t = GetUnixTimeStamp(); 47 | 48 | List Result = new List 49 | { 50 | TdfInteger.Create("AGUP", 0), // Can Age Up 51 | TdfInteger.Create("ANON", 0), // Is Anonymous 52 | TdfInteger.Create("NTOS", 0), // Needs Legal Docs (TOS) 53 | TdfString.Create("PCTK", "PlayerTicket_1337") // PCLogin Token 54 | }; 55 | 56 | List SESS = new List(); 57 | 58 | SESS.Add(Blaze.TdfInteger.Create("BUID", pi.userId)); //BlazeUserID 59 | SESS.Add(Blaze.TdfString.Create("KEY", "SessionKey_1337")); 60 | SESS.Add(Blaze.TdfString.Create("MAIL", "cnc-2013-pc@ea.com")); 61 | SESS.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); 62 | SESS.Add(Blaze.TdfInteger.Create("FRSC", 0)); 63 | SESS.Add(Blaze.TdfInteger.Create("FRST", 0)); 64 | SESS.Add(Blaze.TdfInteger.Create("LLOG", 1403663841)); 65 | 66 | Result.Add(Blaze.TdfStruct.Create("SESS", SESS)); 67 | 68 | List PDTL = new List(); 69 | PDTL.Add(Blaze.TdfString.Create("DSNM", pi.profile.name)); 70 | PDTL.Add(Blaze.TdfInteger.Create("LAST", t)); 71 | PDTL.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 72 | PDTL.Add(Blaze.TdfInteger.Create("PLAT", 4)); //#1 XBL2 #2 PS3 #3 WII #4 PC 73 | PDTL.Add(Blaze.TdfInteger.Create("STAS", 2)); 74 | PDTL.Add(Blaze.TdfInteger.Create("XREF", 0)); 75 | Result.Add(Blaze.TdfStruct.Create("PDTL", PDTL)); 76 | Result.Add(Blaze.TdfInteger.Create("SPAM", 0)); 77 | Result.Add(Blaze.TdfInteger.Create("UNDR", 0)); 78 | 79 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); 80 | Logger.LogPacket("ExpressLog", Convert.ToInt32(pi.userId), buff); //TestLog 81 | ns.Write(buff, 0, buff.Length); 82 | 83 | // Send UserAuthenticated Packet 84 | List Result2 = UserAuthenticatedCommand.UserAuthenticated(pi); 85 | byte[] buff2 = Blaze.CreatePacket(0x7802, 8, 0, 0x2000, p.ID, Result2); 86 | Logger.LogPacket("UserAuthenticated", Convert.ToInt32(pi.userId), buff2); //TestLog 87 | ns.Write(buff2, 0, buff2.Length); 88 | 89 | //Send UserUpdated Packet 90 | List Result3 = UserUpdatedCommand.UserUpdated(pi); 91 | byte[] buff3 = Blaze.CreatePacket(0x7802, 5, 0, 0x2000, p.ID, Result3); 92 | Logger.LogPacket("UserUpdated", Convert.ToInt32(pi.userId), buff3); //TestLog 93 | ns.Write(buff3, 0, buff3.Length); 94 | 95 | //Send UserAdded Packet 96 | List Result4 = UserAddedCommand.UserAdded(pi); 97 | byte[] buff4 = Blaze.CreatePacket(0x7802, 2, 0, 0x2000, p.ID, Result4); 98 | Logger.LogPacket("UserAdded", Convert.ToInt32(pi.userId), buff4); //TestLog 99 | ns.Write(buff4, 0, buff4.Length); 100 | 101 | ns.Flush(); 102 | } 103 | 104 | public static void Login(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 105 | { 106 | if (!pi.isServer) 107 | { 108 | List input = Blaze.ReadPacketContent(p); 109 | Blaze.TdfString MAIL = (Blaze.TdfString)input[0]; 110 | string mail = MAIL.Value; 111 | long id = 0; 112 | 113 | foreach (Profile profile in Profiles.profiles) 114 | if (profile.mail == mail) 115 | { 116 | pi.profile = profile; 117 | id = profile.id; 118 | break; 119 | } 120 | if (pi.profile == null) 121 | { 122 | BlazeServer.Log("[CLNT] #" + pi.userId + " Could not find player profile for mail: " + mail + " !", System.Drawing.Color.Red); 123 | pi.userId = 0; 124 | return; 125 | } 126 | else 127 | { 128 | for (int i = 0; i < BlazeServer.allClients.Count; i++) 129 | if (BlazeServer.allClients[i].userId == id) 130 | { 131 | BlazeServer.allClients.RemoveAt(i); 132 | i--; 133 | } 134 | pi.userId = id; 135 | BlazeServer.Log("[CLNT] New ID #" + pi.userId + " Client Playername = \"" + pi.profile.name + "\"", System.Drawing.Color.Blue); 136 | } 137 | } 138 | 139 | 140 | List Result = new List(); 141 | //List List = new List(); 142 | 143 | Result.Add(Blaze.TdfInteger.Create("ANON", 0)); 144 | Result.Add(Blaze.TdfInteger.Create("NTOS", 0)); 145 | Result.Add(Blaze.TdfString.Create("PCTK", "")); 146 | 147 | List playerentries = new List(); 148 | List PlayerEntry = new List(); 149 | PlayerEntry.Add(Blaze.TdfString.Create("DSNM", pi.profile.name)); 150 | PlayerEntry.Add(Blaze.TdfInteger.Create("LAST", 0)); 151 | PlayerEntry.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 152 | PlayerEntry.Add(Blaze.TdfInteger.Create("STAS", 2)); 153 | PlayerEntry.Add(Blaze.TdfInteger.Create("XREF", 0)); 154 | PlayerEntry.Add(Blaze.TdfInteger.Create("XTYP", 0)); 155 | playerentries.Add(Blaze.TdfStruct.Create("0", PlayerEntry)); 156 | Result.Add(Blaze.TdfList.Create("PLST", 3, 1, playerentries)); 157 | 158 | Result.Add(Blaze.TdfString.Create("SKEY", "123456")); 159 | Result.Add(Blaze.TdfInteger.Create("SPAM", 0)); 160 | Result.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); 161 | Result.Add(Blaze.TdfInteger.Create("UNDR", 0)); 162 | 163 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); 164 | Logger.LogPacket("Log", Convert.ToInt32(pi.userId), buff); //TestLog 165 | 166 | ns.Write(buff, 0, buff.Length); 167 | ns.Flush(); 168 | } 169 | 170 | public static void LoginPersona(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 171 | { 172 | uint t = Blaze.GetUnixTimeStamp(); 173 | List SESS = new List(); 174 | SESS.Add(Blaze.TdfInteger.Create("BUID", pi.userId)); 175 | SESS.Add(Blaze.TdfInteger.Create("FRST", 0)); 176 | SESS.Add(Blaze.TdfString.Create("KEY\0", "some_client_key")); 177 | SESS.Add(Blaze.TdfInteger.Create("LLOG", t)); 178 | SESS.Add(Blaze.TdfString.Create("MAIL", "")); 179 | List PDTL = new List(); 180 | PDTL.Add(Blaze.TdfString.Create("DSNM", pi.profile.name)); 181 | PDTL.Add(Blaze.TdfInteger.Create("LAST", t)); 182 | PDTL.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 183 | PDTL.Add(Blaze.TdfInteger.Create("STAS", 0)); 184 | PDTL.Add(Blaze.TdfInteger.Create("XREF", 0)); 185 | PDTL.Add(Blaze.TdfInteger.Create("XTYP", 0)); 186 | SESS.Add(Blaze.TdfStruct.Create("PDTL", PDTL)); 187 | SESS.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); 188 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, SESS); 189 | ns.Write(buff, 0, buff.Length); 190 | ns.Flush(); 191 | 192 | AsyncUserSessions.NotifyUserAdded(pi, p, pi, ns); 193 | AsyncUserSessions.NotifyUserStatus(pi, p, pi, ns); 194 | 195 | // Send UserAuthenticated Packet 196 | List Result2 = UserAuthenticatedCommand.UserAuthenticated(pi); 197 | byte[] buff2 = Blaze.CreatePacket(0x7802, 8, 0, 0x2000, p.ID, Result2); 198 | Logger.LogPacket("UserAuthenticated", Convert.ToInt32(pi.userId), buff2); //TestLog 199 | ns.Write(buff2, 0, buff2.Length); 200 | 201 | //Send UserUpdated Packet 202 | List Result3 = UserUpdatedCommand.UserUpdated(pi); 203 | byte[] buff3 = Blaze.CreatePacket(0x7802, 5, 0, 0x2000, p.ID, Result3); 204 | Logger.LogPacket("UserUpdated", Convert.ToInt32(pi.userId), buff3); //TestLog 205 | ns.Write(buff3, 0, buff3.Length); 206 | 207 | //Send UserAdded Packet 208 | List Result4 = UserAddedCommand.UserAdded(pi); 209 | byte[] buff4 = Blaze.CreatePacket(0x7802, 2, 0, 0x2000, p.ID, Result4); 210 | Logger.LogPacket("UserAdded", Convert.ToInt32(pi.userId), buff4); //TestLog 211 | ns.Write(buff4, 0, buff4.Length); 212 | } 213 | 214 | public static void LogoutPersona(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 215 | { 216 | List result = new List(); 217 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, result); 218 | ns.Write(buff, 0, buff.Length); 219 | ns.Flush(); 220 | 221 | AsyncUserSessions.NotifyUserRemoved(pi, p, pi.userId, ns); 222 | AsyncUserSessions.NotifyUserStatus(pi, p, pi, ns); 223 | } 224 | 225 | public static void logout(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 226 | { 227 | //Send logout Packet 228 | List Result = UserAddedCommand.UserAdded(pi); 229 | byte[] buff = Blaze.CreatePacket(1, 46, 0, 0x2000, p.ID, Result); 230 | Logger.LogPacket("logout", Convert.ToInt32(pi.userId), buff); //TestLog 231 | ns.Write(buff, 0, buff.Length); 232 | } 233 | 234 | public static void ListPersonas(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 235 | { 236 | List result = new List(); 237 | List entries = new List(); 238 | List e = new List(); 239 | e.Add(Blaze.TdfString.Create("DSNM", pi.profile.name)); 240 | e.Add(Blaze.TdfInteger.Create("LAST", Blaze.GetUnixTimeStamp())); 241 | e.Add(Blaze.TdfInteger.Create("PID\0", pi.profile.id)); 242 | e.Add(Blaze.TdfInteger.Create("STAS", 2)); 243 | e.Add(Blaze.TdfInteger.Create("XREF", 0)); 244 | e.Add(Blaze.TdfInteger.Create("XTYP", 0)); 245 | entries.Add(Blaze.TdfStruct.Create("0", e)); 246 | result.Add(Blaze.TdfList.Create("PINF", 3, 1, entries)); 247 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, result); 248 | ns.Write(buff, 0, buff.Length); 249 | ns.Flush(); 250 | } 251 | 252 | } 253 | } -------------------------------------------------------------------------------- /CNCEmu/Components/BlazeHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | 10 | namespace CNCEmu 11 | { 12 | public static class BlazeHelper 13 | { 14 | public static Blaze.TdfStruct MakeStatGroupEntry(int idx, string catg, string dflt, string ldsc, string name, string sdsc) 15 | { 16 | List result = new List(); 17 | result.Add(Blaze.TdfString.Create("CATG", catg)); 18 | result.Add(Blaze.TdfString.Create("DFLT", dflt)); 19 | result.Add(Blaze.TdfInteger.Create("DRVD", 0)); 20 | result.Add(Blaze.TdfString.Create("FRMT", "%d")); 21 | result.Add(Blaze.TdfString.Create("KIND", "")); 22 | result.Add(Blaze.TdfString.Create("LDSC", ldsc)); 23 | result.Add(Blaze.TdfString.Create("META", "")); 24 | result.Add(Blaze.TdfString.Create("NAME", name)); 25 | result.Add(Blaze.TdfString.Create("SDSC", sdsc)); 26 | result.Add(Blaze.TdfInteger.Create("TYPE", 0)); 27 | return Blaze.TdfStruct.Create(idx.ToString(), result); 28 | } 29 | 30 | public static Blaze.TdfStruct MakePROSEntry(int idx, PlayerInfo pi) 31 | { 32 | uint t = Blaze.GetUnixTimeStamp(); 33 | List result = new List(); 34 | result.Add(Blaze.TdfInteger.Create("EXID", pi.userId)); 35 | result.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); 36 | result.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc)); 37 | result.Add(Blaze.TdfString.Create("NAME", pi.profile.name)); 38 | result.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); 39 | result.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET")); 40 | result.Add(Blaze.TdfInteger.Create("SID\0", pi.slot)); 41 | result.Add(Blaze.TdfInteger.Create("STAT", pi.stat)); 42 | result.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF)); 43 | result.Add(Blaze.TdfInteger.Create("TIME", t)); 44 | result.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); 45 | return Blaze.TdfStruct.Create(idx.ToString(), result); 46 | } 47 | 48 | public static Blaze.Tdf CreateNETField(PlayerInfo pi, string label) 49 | { 50 | List list = new List(); 51 | List e0 = new List(); 52 | List EXIP = new List(); 53 | EXIP.Add(Blaze.TdfInteger.Create("IP\0\0", pi.exIp)); 54 | EXIP.Add(Blaze.TdfInteger.Create("PORT", pi.exPort)); 55 | e0.Add(Blaze.TdfStruct.Create("EXIP", EXIP)); 56 | List INIP = new List(); 57 | INIP.Add(Blaze.TdfInteger.Create("IP\0\0", pi.inIp)); 58 | INIP.Add(Blaze.TdfInteger.Create("PORT", pi.inPort)); 59 | e0.Add(Blaze.TdfStruct.Create("INIP", INIP)); 60 | list.Add(Blaze.TdfStruct.Create("0", e0, true)); 61 | return Blaze.TdfList.Create(label, 3, 1, list); 62 | } 63 | 64 | public static Blaze.Tdf CreateNETFieldUnion(PlayerInfo pi, string label) 65 | { 66 | List VALU = new List(); 67 | List EXIP = new List(); 68 | EXIP.Add(Blaze.TdfInteger.Create("IP", pi.exIp)); 69 | EXIP.Add(Blaze.TdfInteger.Create("PORT", pi.exPort)); 70 | VALU.Add(Blaze.TdfStruct.Create("EXIP", EXIP)); 71 | List INIP = new List(); 72 | INIP.Add(Blaze.TdfInteger.Create("IP", pi.inIp)); 73 | INIP.Add(Blaze.TdfInteger.Create("PORT", pi.inPort)); 74 | VALU.Add(Blaze.TdfStruct.Create("INIP", INIP)); 75 | return Blaze.TdfUnion.Create(label, 2, Blaze.TdfStruct.Create("VALU", VALU)); 76 | } 77 | 78 | public static Blaze.Tdf CreateADDRField(PlayerInfo pi) 79 | { 80 | List ADDR = new List(); 81 | List EXIP = new List(); 82 | EXIP.Add(Blaze.TdfInteger.Create("IP", pi.exIp)); 83 | EXIP.Add(Blaze.TdfInteger.Create("PORT", pi.exPort)); 84 | ADDR.Add(Blaze.TdfStruct.Create("EXIP", EXIP)); 85 | List INIP = new List(); 86 | INIP.Add(Blaze.TdfInteger.Create("IP", pi.inIp)); 87 | INIP.Add(Blaze.TdfInteger.Create("PORT", pi.inPort)); 88 | ADDR.Add(Blaze.TdfStruct.Create("INIP", INIP)); 89 | return Blaze.TdfStruct.Create("ADDR", ADDR, true); 90 | } 91 | 92 | public static Blaze.Tdf CreateNQOSField(PlayerInfo pi, string label) 93 | { 94 | List NQOS = new List(); 95 | NQOS.Add(Blaze.TdfInteger.Create("DBPS", 0)); 96 | NQOS.Add(Blaze.TdfInteger.Create("NATT", pi.nat)); 97 | NQOS.Add(Blaze.TdfInteger.Create("UBPS", 0)); 98 | return Blaze.TdfStruct.Create(label, NQOS); 99 | } 100 | 101 | public static Blaze.TdfStruct CreateUserStruct(PlayerInfo pi) 102 | { 103 | List USER = new List(); 104 | USER.Add(Blaze.TdfInteger.Create("AID\0", pi.userId)); 105 | USER.Add(Blaze.TdfInteger.Create("ALOC", pi.loc)); 106 | USER.Add(Blaze.TdfInteger.Create("EXID\0", pi.userId)); 107 | USER.Add(Blaze.TdfInteger.Create("ID\0\0", pi.userId)); 108 | USER.Add(Blaze.TdfString.Create("NAME", pi.profile.name)); 109 | return Blaze.TdfStruct.Create("USER", USER); 110 | } 111 | 112 | public static Blaze.Tdf CreateUserDataStruct(PlayerInfo pi, string name = "DATA") 113 | { 114 | List DATA = new List(); 115 | DATA.Add(BlazeHelper.CreateNETFieldUnion(pi, "ADDR")); 116 | DATA.Add(BlazeHelper.CreateNQOSField(pi, "QDAT")); 117 | return Blaze.TdfStruct.Create(name, DATA); 118 | } 119 | 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /CNCEmu/Components/InventoryComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using BlazeLibWV; 8 | using System.Net.Sockets; 9 | 10 | namespace CNCEmu 11 | { 12 | public static class InventoryComponent 13 | { 14 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 15 | { 16 | switch (p.Command) 17 | { 18 | case 0x00: 19 | break; 20 | case 0x01: 21 | GetItems(p, pi, ns); 22 | break; 23 | case 0x06: 24 | GetTemplate(p, pi, ns); 25 | break; 26 | default: 27 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [INVENTORY] " + " not found.", System.Drawing.Color.Red); 28 | break; 29 | } 30 | } 31 | 32 | public static void GetItems(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 33 | { 34 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List()); 35 | ns.Write(buff, 0, buff.Length); 36 | ns.Flush(); 37 | } 38 | 39 | public static void GetTemplate(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 40 | { 41 | List Result = new List(); 42 | List t = Helper.ConvertStringList("{aek971_acog} {aek971_eotech}"); 43 | Result.Add(Blaze.TdfList.Create("ILST", 1, t.Count, t)); 44 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); 45 | ns.Write(buff, 0, buff.Length); 46 | ns.Flush(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CNCEmu/Components/RSPComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class RSPComponent 12 | { 13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 14 | { 15 | switch (p.Command) 16 | { 17 | case 0x00: 18 | break; 19 | default: 20 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [RSPComp] " + " not found.", System.Drawing.Color.Red); 21 | break; 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CNCEmu/Components/StatsComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class StatsComponent 12 | { 13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 14 | { 15 | switch (p.Command) 16 | { 17 | case 0x00: 18 | break; 19 | default: 20 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [STATS] " + " not found.", System.Drawing.Color.Red); 21 | break; 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CNCEmu/Components/UserSessionsComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class UserSessionsComponent 12 | { 13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 14 | { 15 | switch (p.Command) 16 | { 17 | case 0x00: 18 | break; 19 | case 0x14: 20 | UpdateNetworkInfo(p, pi, ns); 21 | break; 22 | default: 23 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [USERSESSION] " + " not found.", System.Drawing.Color.Red); 24 | break; 25 | } 26 | } 27 | 28 | public static void UpdateNetworkInfo(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 29 | { 30 | List input = Blaze.ReadPacketContent(p); 31 | Blaze.TdfUnion addr = (Blaze.TdfUnion)input[0]; 32 | Blaze.TdfStruct valu = (Blaze.TdfStruct)addr.UnionContent; 33 | Blaze.TdfStruct exip = (Blaze.TdfStruct)valu.Values[0]; 34 | Blaze.TdfStruct inip = (Blaze.TdfStruct)valu.Values[1]; 35 | pi.inIp = ((Blaze.TdfInteger)inip.Values[0]).Value; 36 | pi.exIp = ((Blaze.TdfInteger)exip.Values[0]).Value; 37 | pi.exPort = pi.inPort = (uint)((Blaze.TdfInteger)inip.Values[1]).Value; 38 | Blaze.TdfStruct nqos = (Blaze.TdfStruct)input[2]; 39 | pi.nat = ((Blaze.TdfInteger)nqos.Values[1]).Value; 40 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List()); 41 | ns.Write(buff, 0, buff.Length); 42 | 43 | // Send UserSessionExtendedDataUpdateNotification Packet 44 | List Result2 = UserSessionExtendedDataUpdateNotificationCommand.UserSessionExtendedDataUpdateNotification(pi); 45 | byte[] buff2 = Blaze.CreatePacket(0x7802, 1, 0, 0x2000, p.ID, Result2); 46 | Logger.LogPacket("UserSessionExtendedDataUpdateNotification", Convert.ToInt32(pi.userId), buff2); //TestLog 47 | ns.Write(buff2, 0, buff2.Length); 48 | 49 | ns.Flush(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /CNCEmu/Components/UtilComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | using System.Net.Sockets; 8 | 9 | namespace CNCEmu 10 | { 11 | public static class UtilComponent 12 | { 13 | public static void HandlePacket(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 14 | { 15 | switch (p.Command) 16 | { 17 | case 0x02: 18 | Ping(p, pi, ns); 19 | break; 20 | case 0x05: 21 | getTelemetryServer(p, pi,ns); 22 | break; 23 | case 0x07: 24 | PreAuth(p, pi, ns); 25 | break; 26 | case 0x08: 27 | PostAuth(p,pi,ns); 28 | break; 29 | case 0x16: 30 | SetClientMetrics(p, pi,ns); 31 | break; 32 | default: 33 | Logger.Log("[CLNT] #" + pi.userId + " Component: [" + p.Component + "] # Command: " + p.Command + " [at] " + " [UTIL] " + " not found.", System.Drawing.Color.Red); 34 | break; 35 | } 36 | } 37 | 38 | public static void Ping(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 39 | { 40 | pi.timeout.Restart(); 41 | List Result = new List(); 42 | Result.Add(Blaze.TdfInteger.Create("STIM", Blaze.GetUnixTimeStamp())); 43 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); 44 | ns.Write(buff, 0, buff.Length); 45 | ns.Flush(); 46 | } 47 | 48 | public static void getTelemetryServer(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 49 | { 50 | List Result = new List(); 51 | List TELE = new List(); 52 | 53 | TELE.Add(Blaze.TdfString.Create("ADRS", "http://river.data.ea.com")); 54 | TELE.Add(Blaze.TdfInteger.Create("ANON", 0)); 55 | TELE.Add(Blaze.TdfString.Create("DISA", "AD,AF,AG,AI,AL,AM,AN,AO,AQ,AR,AS,AW,AX,AZ,BA,BB,BD,BF,BH,BI,BJ,BM,BN,BO,BR,BS,BT,BV,BW,BY,BZ,CC,CD,CF,CG,CI,CK,CL,CM,CN,CO,CR,CU,CV,CX,DJ,DM,DO,DZ,EC,EG,EH,ER,ET,FJ,FK,FM,FO,GA,GD,GE,GF,GG,GH,GI,GL,GM,GN,GP,GQ,GS,GT,GU,GW,GY,HM,HN,HT,ID,IL,IM,IN,IO,IQ,IR,IS,JE,JM,JO,KE,KG,KH,KI,KM,KN,KP,KR,KW,KY,KZ,LA,LB,LC,LI,LK,LR,LS,LY,MA,MC,MD,ME,MG,MH,ML,MM,MN,MO,MP,MQ,MR,MS,MU,MV,MW,MY,MZ,NA,NC,NE,NF,NG,NI,NP,NR,NU,OM,PA,PE,PF,PG,PH,PK,PM,PN,PS,PW,PY,QA,RE,RS,RW,SA,SB,SC,SD,SG,SH,SJ,SL,SM,SN,SO,SR,ST,SV,SY,SZ,TC,TD,TF,TG,TH,TJ,TK,TL,TM,TN,TO,TT,TV,TZ,UA,UG,UM,UY,UZ,VA,VC,VE,VG,VN,VU,WF,WS,YE,YT,ZM,ZW,ZZ")); 56 | TELE.Add(Blaze.TdfInteger.Create("EDCT", 1)); 57 | TELE.Add(Blaze.TdfString.Create("FILT", "-GAME/COMM/EXPD")); 58 | TELE.Add(Blaze.TdfInteger.Create("LOC", 1701729619)); 59 | TELE.Add(Blaze.TdfInteger.Create("MINR", 0)); 60 | TELE.Add(Blaze.TdfString.Create("NOOK", "US, CA, MX")); 61 | TELE.Add(Blaze.TdfInteger.Create("PORT", 0x1BB)); 62 | TELE.Add(Blaze.TdfInteger.Create("SDLY", 15000)); 63 | TELE.Add(Blaze.TdfString.Create("SESS", "session_key_telemetry")); 64 | TELE.Add(Blaze.TdfString.Create("SKEY", "")); 65 | TELE.Add(Blaze.TdfInteger.Create("SPCT", 0)); 66 | TELE.Add(Blaze.TdfString.Create("STIM", "Default")); 67 | TELE.Add(Blaze.TdfString.Create("SVNM", "telemetry - 3 - common")); 68 | 69 | Result.Add(Blaze.TdfStruct.Create("TELE", TELE)); 70 | 71 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); 72 | ns.Write(buff, 0, buff.Length); 73 | ns.Flush(); 74 | } 75 | 76 | public static void PreAuth(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 77 | { 78 | uint utime = Blaze.GetUnixTimeStamp(); 79 | 80 | List input = Blaze.ReadPacketContent(p); 81 | Blaze.TdfStruct CDAT = (Blaze.TdfStruct)input[0]; 82 | Blaze.TdfInteger TYPE = (Blaze.TdfInteger)CDAT.Values[3]; 83 | pi.isServer = TYPE.Value != 0; 84 | 85 | if (pi.isServer) //Make as a Server ! 86 | { 87 | pi.game = new GameInfo(); 88 | pi.profile = Profiles.Create("rts.server", 999, "rts.server.pc@ea.com"); 89 | pi.userId = 999; 90 | } 91 | 92 | Blaze.TdfStruct CINF = (Blaze.TdfStruct)input[1]; 93 | Blaze.TdfString CVER = (Blaze.TdfString)CINF.Values[5]; 94 | Blaze.TdfInteger LOC = (Blaze.TdfInteger)CINF.Values[8]; 95 | pi.loc = LOC.Value; 96 | pi.version = CVER.Value; 97 | BlazeServer.Log("[CLNT] #" + pi.userId + " is a " + (pi.isServer ? "server" : "client"), System.Drawing.Color.Blue); 98 | 99 | List Result = new List(); 100 | Result.Add(Blaze.TdfString.Create("ASRC", "302123")); //Authentication Source 300294 101 | List t = Helper.ConvertStringList("{30728} {1} {30729} {25} {30730} {27} {4} {28} {6} {7} {9} {10} {63490} {35} {15} {30720} {30722} {30723} {30724} {30726} {2000} {30727}"); // Component ID's 102 | List t2 = new List(); 103 | foreach (string v in t) 104 | t2.Add(Convert.ToInt64(v)); 105 | Result.Add(Blaze.TdfList.Create("CIDS", 0, t2.Count, t2)); 106 | t = new List(); 107 | List t3 = new List(); 108 | Helper.ConvertDoubleStringList("{associationListSkipInitialSet ; 1} {blazeServerClientId ; GOS-BlazeServer-CNC-PC} {bytevaultHostname ; bytevault.gameservices.ea.com} {bytevaultPort ; 42210} {bytevaultSecure ; true} {capsStringValidationUri ; client-strings.xboxlive.com} {connIdleTimeout ; 90s} {defaultRequestTimeout ; 60s} {identityDisplayUri ; console2/welcome} {identityRedirectUri ; http://127.0.0.1/success} {nucleusConnect ; https://accounts.ea.com} {nucleusProxy ; https://gateway.ea.com} {pingPeriod ; 30s} {userManagerMaxCachedUsers ; 0} {voipHeadsetUpdateRate ; 1000} {xblTokenUrn ; accounts.ea.com} {xlspConnectionIdleTimeout ; 300}", out t, out t3); 109 | Blaze.TdfDoubleList conf2 = Blaze.TdfDoubleList.Create("CONF", 1, 1, t, t3, t.Count); 110 | List t4 = new List(); 111 | t4.Add(conf2); 112 | Result.Add(Blaze.TdfStruct.Create("CONF", t4)); 113 | Result.Add(Blaze.TdfString.Create("ESRC", "302123")); 114 | Result.Add(Blaze.TdfString.Create("INST", "rts-client-pc")); 115 | Result.Add(Blaze.TdfInteger.Create("MINR", 0)); 116 | Result.Add(Blaze.TdfString.Create("NASP", "cem_ea_id")); 117 | Result.Add(Blaze.TdfString.Create("PILD", "")); 118 | Result.Add(Blaze.TdfString.Create("PLAT", "pc")); 119 | 120 | 121 | List QOSS = new List(); 122 | List BWPS = new List(); 123 | BWPS.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.ams_psa)); 124 | BWPS.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.ams_psp)); 125 | BWPS.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.ams_sna)); 126 | QOSS.Add(Blaze.TdfStruct.Create("BWPS", BWPS)); 127 | QOSS.Add(Blaze.TdfInteger.Create("LNP\0", 0xA)); 128 | 129 | List LTPS = new List(); 130 | 131 | List LTPS1 = new List(); 132 | LTPS1.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.ams_psa)); 133 | LTPS1.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.ams_psp)); 134 | LTPS1.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.ams_sna)); 135 | LTPS.Add(Blaze.CreateStructStub(LTPS1)); 136 | 137 | List LTPS2 = new List(); 138 | LTPS2.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.gru_psa)); 139 | LTPS2.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.gru_psp)); 140 | LTPS2.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.gru_sna)); 141 | LTPS.Add(Blaze.CreateStructStub(LTPS2)); 142 | 143 | List LTPS3 = new List(); 144 | LTPS3.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.iad_psa)); 145 | LTPS3.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.iad_psp)); 146 | LTPS3.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.iad_sna)); 147 | LTPS.Add(Blaze.CreateStructStub(LTPS3)); 148 | 149 | List LTPS4 = new List(); 150 | LTPS4.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.lax_psa)); 151 | LTPS4.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.lax_psp)); 152 | LTPS4.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.lax_sna)); 153 | LTPS.Add(Blaze.CreateStructStub(LTPS4)); 154 | 155 | List LTPS5 = new List(); 156 | LTPS5.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.nrt_psa)); 157 | LTPS5.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.nrt_psp)); 158 | LTPS5.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.nrt_sna)); 159 | LTPS.Add(Blaze.CreateStructStub(LTPS5)); 160 | 161 | List LTPS6 = new List(); 162 | LTPS6.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.syd_psa)); 163 | LTPS6.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.syd_psp)); 164 | LTPS6.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.syd_sna)); 165 | LTPS.Add(Blaze.CreateStructStub(LTPS6)); 166 | 167 | t = Helper.ConvertStringList("{" + ProviderInfo.ams + "}" + "{" + ProviderInfo.gru + "}" + "{" + ProviderInfo.iad + "}" + "{" + ProviderInfo.lax + "}" + "{" + ProviderInfo.nrt + "}" + "{" + ProviderInfo.syd + "}"); 168 | QOSS.Add(Blaze.TdfDoubleList.Create("LTPS", 1, 3, t, LTPS, LTPS.Count)); 169 | 170 | QOSS.Add(Blaze.TdfInteger.Create("SVID", 0x45410805)); // ServerID 171 | QOSS.Add(Blaze.TdfInteger.Create("TIME", utime)); 172 | 173 | Result.Add(Blaze.TdfStruct.Create("QOSS", QOSS)); 174 | Result.Add(Blaze.TdfString.Create("RSRC", "302123")); 175 | Result.Add(Blaze.TdfString.Create("SVER", "Blaze 13.3.1.8.0 (CL# 1148269)")); // Blaze Server Version 13.15.08.0 (CL# 9442625) 176 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); 177 | 178 | Logger.LogPacket("PreAuth", Convert.ToInt32(pi.userId), buff); //Test 179 | ns.Write(buff, 0, buff.Length); 180 | ns.Flush(); 181 | } 182 | 183 | public static void PostAuth(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 184 | { 185 | List Result = new List(); 186 | List PSSList = new List(); 187 | PSSList.Add(Blaze.TdfString.Create("ADRS", "127.0.0.1")); //playersyncservice.ea.com 188 | PSSList.Add(Blaze.TdfString.Create("PJID", "123071")); 189 | PSSList.Add(Blaze.TdfInteger.Create("PORT", 80)); 190 | PSSList.Add(Blaze.TdfInteger.Create("RPRT", 9)); 191 | Result.Add(Blaze.TdfStruct.Create("PSS\0", PSSList)); 192 | List TELEList = new List(); 193 | TELEList.Add(Blaze.TdfString.Create("ADRS", "127.0.0.1")); //river.data.ea.com 194 | TELEList.Add(Blaze.TdfInteger.Create("ANON", 0)); 195 | TELEList.Add(Blaze.TdfString.Create("DISA", "AD,AF,AG,AI,AL,AM,AN,AO,AQ,AR,AS,AW,AX,AZ,BA,BB,BD,BF,BH,BI,BJ,BM,BN,BO,BR,BS,BT,BV,BW,BY,BZ,CC,CD,CF,CG,CI,CK,CL,CM,CN,CO,CR,CU,CV,CX,DJ,DM,DO,DZ,EC,EG,EH,ER,ET,FJ,FK,FM,FO,GA,GD,GE,GF,GG,GH,GI,GL,GM,GN,GP,GQ,GS,GT,GU,GW,GY,HM,HN,HT,ID,IL,IM,IN,IO,IQ,IR,IS,JE,JM,JO,KE,KG,KH,KI,KM,KN,KP,KR,KW,KY,KZ,LA,LB,LC,LI,LK,LR,LS,LY,MA,MC,MD,ME,MG,MH,ML,MM,MN,MO,MP,MQ,MR,MS,MU,MV,MW,MY,MZ,NA,NC,NE,NF,NG,NI,NP,NR,NU,OM,PA,PE,PF,PG,PH,PK,PM,PN,PS,PW,PY,QA,RE,RS,RW,SA,SB,SC,SD,SG,SH,SJ,SL,SM,SN,SO,SR,ST,SV,SY,SZ,TC,TD,TF,TG,TH,TJ,TK,TL,TM,TN,TO,TT,TV,TZ,UA,UG,UM,UY,UZ,VA,VC,VE,VG,VN,VU,WF,WS,YE,YT,ZM,ZW,ZZ")); 196 | TELEList.Add(Blaze.TdfString.Create("FILT", "-GAME/COMM/EXPD")); 197 | TELEList.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc)); 198 | TELEList.Add(Blaze.TdfString.Create("NOOK", "US, CA, MX")); 199 | TELEList.Add(Blaze.TdfInteger.Create("PORT", 80)); 200 | TELEList.Add(Blaze.TdfInteger.Create("SDLY", 0x3A98)); 201 | TELEList.Add(Blaze.TdfString.Create("SESS", "tele_sess")); 202 | TELEList.Add(Blaze.TdfString.Create("SKEY", "some_tele_key")); 203 | TELEList.Add(Blaze.TdfInteger.Create("SPCT", 0x4B)); 204 | TELEList.Add(Blaze.TdfString.Create("STIM", "Default")); 205 | Result.Add(Blaze.TdfStruct.Create("TELE", TELEList)); 206 | List TICKList = new List(); 207 | TICKList.Add(Blaze.TdfString.Create("ADRS", "127.0.0.1")); //ticker.ea.com 208 | TICKList.Add(Blaze.TdfInteger.Create("PORT", 8999)); 209 | TICKList.Add(Blaze.TdfString.Create("SKEY", pi.userId + ",127.0.0.1:80,rts-client-pc,10,50,50,50,50,0,0")); 210 | Result.Add(Blaze.TdfStruct.Create("TICK", TICKList)); 211 | List UROPList = new List(); 212 | UROPList.Add(Blaze.TdfInteger.Create("TMOP", 1)); 213 | UROPList.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); 214 | Result.Add(Blaze.TdfStruct.Create("UROP", UROPList)); 215 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); 216 | ns.Write(buff, 0, buff.Length); 217 | ns.Flush(); 218 | } 219 | 220 | public static void SetClientMetrics(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) 221 | { 222 | byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List()); 223 | ns.Write(buff, 0, buff.Length); 224 | ns.Flush(); 225 | } 226 | 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /CNCEmu/Config.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | using System.Windows.Forms; 8 | using System.Threading; 9 | 10 | 11 | namespace CNCEmu 12 | { 13 | public static class Config 14 | { 15 | private static readonly object _sub = new object(); 16 | private static string loc = Path.GetDirectoryName(Application.ExecutablePath) + "\\"; 17 | public static string ConfigFile = loc + "conf\\conf.txt"; 18 | 19 | private static readonly object _sync = new object(); 20 | public static List Entries; 21 | 22 | public static string LogLevel; 23 | public static string MakePacket; 24 | 25 | public static void Credits() 26 | { 27 | Logger.Log("-- CNC Emulator by Xevrac --"); 28 | Logger.Log("-----------------------------------------------"); 29 | Logger.Log("-- Credits: --"); 30 | Logger.Log("-----------------------------------------------"); 31 | Logger.Log("The1Domo for initial work.."); 32 | Logger.Log("Warranty Voider for their framework."); 33 | Logger.Log("Manu157 for their framework."); 34 | Logger.Log("Zlofenix for their Help."); 35 | Logger.Log("Aim4Kill for their Help."); 36 | Logger.Log("Eisbaer for their Help."); 37 | Logger.Log("Nemo for their Help."); 38 | Logger.Log("Tecno14 for their Help."); 39 | Logger.Log("-----------------------------------------------"); 40 | } 41 | 42 | 43 | public static void Init() 44 | { 45 | if (!Directory.Exists("conf")) 46 | { 47 | Directory.CreateDirectory("conf"); 48 | } 49 | 50 | if (!File.Exists(ConfigFile)) 51 | { 52 | Write("LogLevel = Low"); 53 | Write("MakePacket = true"); 54 | } 55 | 56 | } 57 | 58 | public static void InitialConfig() 59 | { 60 | try 61 | { 62 | if (File.Exists(loc + "conf\\conf.txt")) 63 | { 64 | Entries = new List(File.ReadAllLines(loc + "conf\\conf.txt")); 65 | 66 | LogLevel = Config.FindEntry("LogLevel"); 67 | Logger.Log("LogLevel = " + LogLevel); 68 | 69 | MakePacket = Config.FindEntry("MakePacket"); 70 | Logger.Log("MakePacket's = " + MakePacket); 71 | 72 | } 73 | else 74 | { 75 | Logger.Log("[CONF]" + loc + " conf\\conf.txt loading failed"); 76 | } 77 | } 78 | catch(Exception Ex) 79 | { 80 | Logger.Log("InitialConfig Error: ", Ex); 81 | } 82 | } 83 | 84 | public static string FindEntry(string name) 85 | { 86 | string s = ""; 87 | lock (_sync) 88 | { 89 | for (int i = 0; i < Entries.Count; i++) 90 | { 91 | string line = Entries[i]; 92 | if (line.Trim().StartsWith("#")) 93 | continue; 94 | string[] parts = line.Split('='); 95 | if (parts.Length != 2) 96 | continue; 97 | if (parts[0].Trim().ToLower() == name.ToLower()) 98 | return parts[1].Trim(); 99 | } 100 | } 101 | return s; 102 | } 103 | 104 | public static string RemoveControlCharacters(string inString) 105 | { 106 | if (inString == null) return null; 107 | StringBuilder newString = new StringBuilder(); 108 | char ch; 109 | for (int i = 0; i < inString.Length; i++) 110 | { 111 | ch = inString[i]; 112 | if (!char.IsControl(ch)) 113 | { 114 | newString.Append(ch); 115 | } 116 | } 117 | return newString.ToString(); 118 | } 119 | 120 | public static void Write(string s) 121 | { 122 | File.AppendAllText(ConfigFile, s); 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /CNCEmu/Form1.cs: -------------------------------------------------------------------------------- 1 | using BlazeLibWV; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Windows.Forms; 8 | 9 | namespace CNCEmu 10 | { 11 | public partial class Form1 : Form 12 | { 13 | public readonly object _sync = new object(); 14 | public List packets = new List(); 15 | public int packetCount = 0; 16 | public List inlist; 17 | public int inlistcount; 18 | public int clientcount; 19 | 20 | public Form1() 21 | { 22 | InitializeComponent(); 23 | } 24 | 25 | private void Form1_Load(object sender, EventArgs e) 26 | { 27 | BackendLog.Clear(); 28 | CleanPackets.Clean(); 29 | GenFiles.CreatePackets(); 30 | Logger.box = rtb1; 31 | BlazeServer.box = rtb1; 32 | RedirectorServer.box = rtb1; 33 | 34 | onlyHighToolStripMenuItem.Checked = 35 | highAndMediumToolStripMenuItem.Checked = 36 | allToolStripMenuItem.Checked = false; 37 | 38 | Config.Credits(); 39 | Config.Init(); 40 | Config.InitialConfig(); 41 | 42 | switch (Logger.LogLevel) 43 | { 44 | case LogPriority.high: 45 | onlyHighToolStripMenuItem.Checked = true; 46 | break; 47 | case LogPriority.medium: 48 | highAndMediumToolStripMenuItem.Checked = true; 49 | break; 50 | case LogPriority.low: 51 | allToolStripMenuItem.Checked = true; 52 | break; 53 | } 54 | 55 | LabelVersion.Text = Assembly 56 | .GetExecutingAssembly() 57 | .GetCustomAttribute() 58 | .Version; 59 | } 60 | 61 | private void Form1_FormClosing(object sender, FormClosingEventArgs e) 62 | { 63 | if (RedirectorServer._exit) RedirectorServer.Stop(); 64 | if (BlazeServer._exit) BlazeServer.Stop(); 65 | Application.Exit(); 66 | } 67 | 68 | private void exitToolStripMenuItem_Click(object sender, EventArgs e) 69 | { 70 | if (RedirectorServer._exit) RedirectorServer.Stop(); 71 | if (BlazeServer._exit) BlazeServer.Stop(); 72 | Application.Exit(); 73 | } 74 | 75 | private void onlyHighToolStripMenuItem_Click(object sender, EventArgs e) 76 | { 77 | allToolStripMenuItem.Checked = 78 | highAndMediumToolStripMenuItem.Checked = false; 79 | onlyHighToolStripMenuItem.Checked = true; 80 | Logger.LogLevel = LogPriority.high; 81 | } 82 | 83 | private void highAndMediumToolStripMenuItem_Click(object sender, EventArgs e) 84 | { 85 | onlyHighToolStripMenuItem.Checked = 86 | allToolStripMenuItem.Checked = false; 87 | highAndMediumToolStripMenuItem.Checked = true; 88 | Logger.LogLevel = LogPriority.medium; 89 | } 90 | 91 | private void allToolStripMenuItem_Click(object sender, EventArgs e) 92 | { 93 | onlyHighToolStripMenuItem.Checked = 94 | highAndMediumToolStripMenuItem.Checked = false; 95 | allToolStripMenuItem.Checked = true; 96 | Logger.LogLevel = LogPriority.low; 97 | } 98 | 99 | private void generateProviderIDdatToolStripMenuItem_Click(object sender, EventArgs e) 100 | { 101 | SaveFileDialog d = new SaveFileDialog(); 102 | d.Filter = "ProviderID.dat|ProviderID.dat"; 103 | if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) 104 | { 105 | Random rnd = new Random(); 106 | uint[] values = new uint[5]; 107 | long sum = 0; 108 | for (int i = 0; i < 4; i++) 109 | sum += (values[i] = (uint)rnd.Next()); 110 | sum = (uint)(sum & 0xFFFFFFFF); 111 | if (sum < 0xC18E65EF) 112 | values[4] = (uint)(0xC18E65EF - sum); 113 | else 114 | values[4] = (uint)(0x1C18E65EF - sum); 115 | MemoryStream m = new MemoryStream(); 116 | for (int i = 0; i < 5; i++) 117 | m.Write(BitConverter.GetBytes(values[i]), 0, 4); 118 | File.WriteAllBytes(d.FileName, m.ToArray()); 119 | 120 | MessageBox.Show("Done."); 121 | } 122 | } 123 | 124 | private void toolStripButton1_Click(object sender, EventArgs e) 125 | { 126 | SearchInLog(); 127 | } 128 | 129 | private void SearchInLog() 130 | { 131 | int pos = rtb1.SelectionStart + 1; 132 | if (pos < 0 || pos >= rtb1.Text.Length) 133 | pos = 0; 134 | int next = rtb1.Text.IndexOf(toolStripTextBox1.Text, pos); 135 | if (next != -1) 136 | { 137 | rtb1.SelectionStart = next; 138 | rtb1.SelectionLength = toolStripTextBox1.Text.Length; 139 | rtb1.ScrollToCaret(); 140 | } 141 | } 142 | 143 | private void toolStripTextBox1_KeyUp(object sender, KeyEventArgs e) 144 | { 145 | if (e.KeyCode == Keys.Enter) 146 | { 147 | rtb1.Focus(); 148 | SearchInLog(); 149 | } 150 | } 151 | 152 | private void toolStripButton2_Click(object sender, EventArgs e) 153 | { 154 | RefreshPackets(); 155 | } 156 | 157 | public void RefreshPackets() 158 | { 159 | listBox1.Items.Clear(); 160 | string[] files = Directory.GetFiles("logs\\packets\\", "*.bin"); 161 | foreach (string file in files) 162 | { 163 | listBox1.Items.Add(Path.GetFileName(file)); 164 | AddPacket(FileToByteArray(file)); 165 | } 166 | } 167 | 168 | private void listBox1_SelectedIndexChanged(object sender, EventArgs e) 169 | { 170 | int n = listBox1.SelectedIndex; 171 | if (n == -1 || n >= packets.Count) 172 | return; 173 | 174 | Blaze.Packet p; 175 | 176 | lock (_sync) 177 | { 178 | if (packets == null || n >= packets.Count) 179 | return; 180 | 181 | p = packets[n]; 182 | } 183 | 184 | tv1.Nodes.Clear(); 185 | inlistcount = 0; 186 | inlist = new List(); 187 | 188 | if (p != null) 189 | { 190 | List Fields = Blaze.ReadPacketContent(p); 191 | foreach (Blaze.Tdf tdf in Fields) 192 | { 193 | tv1.Nodes.Add(TdfToTree(tdf)); 194 | } 195 | } 196 | } 197 | 198 | public byte[] FileToByteArray(string fileName) 199 | { 200 | byte[] fileData = null; 201 | 202 | using (FileStream fs = File.OpenRead(fileName)) 203 | { 204 | using (BinaryReader binaryReader = new BinaryReader(fs)) 205 | { 206 | fileData = binaryReader.ReadBytes((int)fs.Length); 207 | } 208 | } 209 | return fileData; 210 | } 211 | 212 | public void AddPacket(byte[] data) 213 | { 214 | MemoryStream m = new MemoryStream(data); 215 | m.Seek(0, 0); 216 | List result = Blaze.FetchAllBlazePackets(m); 217 | lock (_sync) 218 | { 219 | packets.AddRange(result); 220 | } 221 | } 222 | 223 | private TreeNode TdfToTree(Blaze.Tdf tdf) 224 | { 225 | TreeNode t, t2, t3; 226 | switch (tdf.Type) 227 | { 228 | case 3: 229 | t = tdf.ToTree(); 230 | Blaze.TdfStruct str = (Blaze.TdfStruct)tdf; 231 | if (str.startswith2) 232 | t.Text += " (Starts with 2)"; 233 | foreach (Blaze.Tdf td in str.Values) 234 | t.Nodes.Add(TdfToTree(td)); 235 | t.Name = (inlistcount++).ToString(); 236 | inlist.Add(tdf); 237 | return t; 238 | case 4: 239 | t = tdf.ToTree(); 240 | Blaze.TdfList l = (Blaze.TdfList)tdf; 241 | if (l.SubType == 3) 242 | { 243 | List l2 = (List)l.List; 244 | for (int i = 0; i < l2.Count; i++) 245 | { 246 | t2 = new TreeNode("Entry #" + i); 247 | if (l2[i].startswith2) 248 | t2.Text += " (Starts with 2)"; 249 | List l3 = l2[i].Values; 250 | for (int j = 0; j < l3.Count; j++) 251 | t2.Nodes.Add(TdfToTree(l3[j])); 252 | t.Nodes.Add(t2); 253 | } 254 | } 255 | t.Name = (inlistcount++).ToString(); 256 | inlist.Add(tdf); 257 | return t; 258 | case 5: 259 | t = tdf.ToTree(); 260 | Blaze.TdfDoubleList ll = (Blaze.TdfDoubleList)tdf; 261 | t2 = new TreeNode("List 1"); 262 | if (ll.SubType1 == 3) 263 | { 264 | List l2 = (List)ll.List1; 265 | for (int i = 0; i < l2.Count; i++) 266 | { 267 | t3 = new TreeNode("Entry #" + i); 268 | if (l2[i].startswith2) 269 | t2.Text += " (Starts with 2)"; 270 | List l3 = l2[i].Values; 271 | for (int j = 0; j < l3.Count; j++) 272 | t3.Nodes.Add(TdfToTree(l3[j])); 273 | t2.Nodes.Add(t3); 274 | } 275 | t.Nodes.Add(t2); 276 | } 277 | t2 = new TreeNode("List 2"); 278 | if (ll.SubType2 == 3) 279 | { 280 | List l2 = (List)ll.List2; 281 | for (int i = 0; i < l2.Count; i++) 282 | { 283 | t3 = new TreeNode("Entry #" + i); 284 | if (l2[i].startswith2) 285 | t2.Text += " (Starts with 2)"; 286 | List l3 = l2[i].Values; 287 | for (int j = 0; j < l3.Count; j++) 288 | t3.Nodes.Add(TdfToTree(l3[j])); 289 | t2.Nodes.Add(t3); 290 | } 291 | t.Nodes.Add(t2); 292 | } 293 | t.Name = (inlistcount++).ToString(); 294 | inlist.Add(tdf); 295 | return t; 296 | case 6: 297 | t = tdf.ToTree(); 298 | Blaze.TdfUnion tu = (Blaze.TdfUnion)tdf; 299 | if (tu.UnionType != 0x7F) 300 | { 301 | t.Nodes.Add(TdfToTree(tu.UnionContent)); 302 | } 303 | t.Name = (inlistcount++).ToString(); 304 | inlist.Add(tdf); 305 | return t; 306 | default: 307 | t = tdf.ToTree(); 308 | t.Name = (inlistcount++).ToString(); 309 | inlist.Add(tdf); 310 | return t; 311 | } 312 | } 313 | 314 | private void toolStripButton3_Click(object sender, EventArgs e) 315 | { 316 | FolderBrowserDialog d = new FolderBrowserDialog(); 317 | if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) 318 | { 319 | string[] files = Directory.GetFiles(d.SelectedPath, "*.bin"); 320 | foreach (string file in files) 321 | File.Copy(file, "logs\\packets\\" + Path.GetFileName(file), true); 322 | RefreshPackets(); 323 | } 324 | } 325 | 326 | private void toolStripButton4_Click(object sender, EventArgs e) 327 | { 328 | try 329 | { 330 | string text = toolStripTextBox2.Text; 331 | byte[] buff = Helper.LabelToBytes(text); 332 | StringBuilder sb = new StringBuilder(); 333 | foreach (byte b in buff) 334 | sb.Append(b.ToString("X2")); 335 | toolStripTextBox3.Text = sb.ToString(); 336 | } 337 | catch (Exception) 338 | { 339 | } 340 | } 341 | 342 | private void toolStripButton5_Click(object sender, EventArgs e) 343 | { 344 | try 345 | { 346 | string text = toolStripTextBox3.Text.Replace(" ", "").ToUpper(); 347 | MemoryStream m = new MemoryStream(); 348 | for (int i = 0; i < text.Length / 2; i++) 349 | m.WriteByte(Convert.ToByte(text.Substring(i * 2, 2), 16)); 350 | toolStripTextBox2.Text = Helper.BytesToLabel(m.ToArray()); 351 | } 352 | catch (Exception) 353 | { 354 | } 355 | } 356 | 357 | private void toolStripButton6_Click(object sender, EventArgs e) 358 | { 359 | try 360 | { 361 | string text = toolStripTextBox4.Text.Replace(" ", "").ToUpper(); 362 | long l = Convert.ToInt64(text, 16); 363 | MemoryStream m = new MemoryStream(); 364 | Helper.WriteCompressedInteger(m, l); 365 | toolStripTextBox5.Text = Helper.ByteArrayToHexString(m.ToArray()); 366 | } 367 | catch (Exception) 368 | { 369 | } 370 | } 371 | 372 | private void toolStripButton7_Click(object sender, EventArgs e) 373 | { 374 | try 375 | { 376 | string text = toolStripTextBox5.Text.Replace(" ", "").ToUpper(); 377 | MemoryStream m = new MemoryStream(Helper.HexStringToByteArray(text)); 378 | m.Seek(0, 0); 379 | toolStripTextBox4.Text = Helper.ReadCompressedInteger(m).ToString("X"); 380 | } 381 | catch (Exception) 382 | { 383 | } 384 | } 385 | 386 | private void playerProfileToolStripMenuItem_Click(object sender, EventArgs e) 387 | { 388 | Form2 f = new Form2(); 389 | f.ShowDialog(); 390 | } 391 | 392 | private void editConfigToolStripMenuItem_Click(object sender, EventArgs e) 393 | { 394 | Helper.RunShell("notepad.exe",Config.ConfigFile); 395 | } 396 | 397 | private void tv1_AfterSelect(object sender, TreeViewEventArgs e) 398 | { 399 | TreeNode t = e.Node; 400 | if (t != null && t.Name != "") 401 | { 402 | int n = Convert.ToInt32(t.Name); 403 | Blaze.Tdf tdf = inlist[n]; 404 | string s; 405 | switch (tdf.Type) 406 | { 407 | case 0: 408 | Blaze.TdfInteger ti = (Blaze.TdfInteger)tdf; 409 | rtb2.Text = "0x" + ti.Value.ToString("X"); 410 | if (ti.Label == "IP ") 411 | { 412 | rtb2.Text += Environment.NewLine + "(" + Blaze.GetStringFromIP(ti.Value) + ")"; 413 | } 414 | break; 415 | case 1: 416 | rtb2.Text = ((Blaze.TdfString)tdf).Value.ToString(); 417 | break; 418 | case 2: 419 | rtb2.Text = "Length: " + ((Blaze.TdfBlob)tdf).Data.Length.ToString(); 420 | rtb2.Text += Environment.NewLine + Blaze.HexDump(((Blaze.TdfBlob)tdf).Data); 421 | break; 422 | case 4: 423 | Blaze.TdfList l = (Blaze.TdfList)tdf; 424 | s = ""; 425 | for (int i = 0; i < l.Count; i++) 426 | { 427 | switch (l.SubType) 428 | { 429 | case 0: 430 | s += "{" + ((List)l.List)[i] + "} "; 431 | break; 432 | case 1: 433 | s += "{" + ((List)l.List)[i] + "} "; 434 | break; 435 | case 9: 436 | Blaze.TrippleVal t2 = ((List)l.List)[i]; 437 | s += "{" + t2.v1.ToString("X") + "; " + t2.v2.ToString("X") + "; " + t2.v3.ToString("X") + "} "; 438 | break; 439 | } 440 | } 441 | rtb2.Text = s; 442 | break; 443 | case 5: 444 | s = ""; 445 | Blaze.TdfDoubleList ll = (Blaze.TdfDoubleList)tdf; 446 | for (int i = 0; i < ll.Count; i++) 447 | { 448 | s += "{"; 449 | switch (ll.SubType1) 450 | { 451 | case 0: 452 | List l1 = (List)ll.List1; 453 | s += l1[i].ToString("X"); 454 | break; 455 | case 1: 456 | List l2 = (List)ll.List1; 457 | s += l2[i]; 458 | break; 459 | case 0xA: 460 | List lf1 = (List)ll.List1; 461 | s += lf1[i].ToString(); 462 | break; 463 | default: 464 | s += "(see List1[" + i + "])"; 465 | break; 466 | } 467 | s += " ; "; 468 | switch (ll.SubType2) 469 | { 470 | case 0: 471 | List l1 = (List)ll.List2; 472 | s += l1[i].ToString("X"); 473 | break; 474 | case 1: 475 | List l2 = (List)ll.List2; 476 | s += l2[i]; 477 | break; 478 | case 0xA: 479 | List lf1 = (List)ll.List2; 480 | s += lf1[i].ToString(); 481 | break; 482 | default: 483 | s += "(see List2[" + i + "])"; 484 | break; 485 | } 486 | s += "}\n"; 487 | } 488 | rtb2.Text = s; 489 | break; 490 | case 6: 491 | rtb2.Text = "Type: 0x" + ((Blaze.TdfUnion)tdf).UnionType.ToString("X2"); 492 | break; 493 | case 7: 494 | Blaze.TdfIntegerList til = (Blaze.TdfIntegerList)tdf; 495 | s = ""; 496 | for (int i = 0; i < til.Count; i++) 497 | { 498 | s += til.List[i].ToString("X"); 499 | if (i < til.Count - 1) 500 | s += "; "; 501 | } 502 | rtb2.Text = s; 503 | break; 504 | case 8: 505 | Blaze.TdfDoubleVal dval = (Blaze.TdfDoubleVal)tdf; 506 | rtb2.Text = "0x" + dval.Value.v1.ToString("X") + " 0x" + dval.Value.v2.ToString("X"); 507 | break; 508 | case 9: 509 | Blaze.TdfTrippleVal tval = (Blaze.TdfTrippleVal)tdf; 510 | rtb2.Text = "0x" + tval.Value.v1.ToString("X") + " 0x" + tval.Value.v2.ToString("X") + " 0x" + tval.Value.v3.ToString("X"); 511 | break; 512 | default: 513 | rtb2.Text = ""; 514 | break; 515 | } 516 | } 517 | } 518 | 519 | private void BtnStartBlazeServer_Click(object sender, EventArgs e) 520 | { 521 | if (!BlazeServer._exit) BlazeServer.Start(); 522 | } 523 | 524 | private void BtnStartRedirectorServer_Click(object sender, EventArgs e) 525 | { 526 | if (!RedirectorServer._exit) RedirectorServer.Start(); 527 | } 528 | 529 | private void SIHelp_Click(object sender, EventArgs e) 530 | { 531 | Utils.OpenUrl("https://github.com/Xevrac/cnc_backend/wiki"); 532 | } 533 | 534 | private void SIAbout_Click(object sender, EventArgs e) 535 | { 536 | Utils.OpenUrl("https://github.com/Xevrac/cnc_backend/wiki/About"); 537 | } 538 | 539 | public void DeletePackets() 540 | { 541 | string[] files = Directory.GetFiles("logs\\packets\\", "*.bin"); 542 | foreach (string file in files) 543 | { 544 | File.Delete(file); 545 | } 546 | 547 | } 548 | 549 | private void toolStripButton8_Click(object sender, EventArgs e) 550 | { 551 | DeletePackets(); 552 | } 553 | } 554 | } 555 | -------------------------------------------------------------------------------- /CNCEmu/Form2.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace CNCEmu 2 | { 3 | partial class Form2 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form2)); 32 | this.toolStrip1 = new System.Windows.Forms.ToolStrip(); 33 | this.toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox(); 34 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 35 | this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); 36 | this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); 37 | this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); 38 | this.listBox1 = new System.Windows.Forms.ListBox(); 39 | this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); 40 | this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); 41 | this.toolStripTextBox2 = new System.Windows.Forms.ToolStripTextBox(); 42 | this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); 43 | this.toolStrip1.SuspendLayout(); 44 | this.SuspendLayout(); 45 | // 46 | // toolStrip1 47 | // 48 | this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; 49 | this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 50 | this.toolStripLabel2, 51 | this.toolStripTextBox1, 52 | this.toolStripSeparator2, 53 | this.toolStripLabel1, 54 | this.toolStripTextBox2, 55 | this.toolStripSeparator1, 56 | this.toolStripButton1, 57 | this.toolStripButton2, 58 | this.toolStripButton3}); 59 | this.toolStrip1.Location = new System.Drawing.Point(0, 0); 60 | this.toolStrip1.Name = "toolStrip1"; 61 | this.toolStrip1.Size = new System.Drawing.Size(514, 25); 62 | this.toolStrip1.TabIndex = 0; 63 | this.toolStrip1.Text = "toolStrip1"; 64 | this.toolStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStrip1_ItemClicked); 65 | // 66 | // toolStripTextBox1 67 | // 68 | this.toolStripTextBox1.Font = new System.Drawing.Font("Segoe UI", 9F); 69 | this.toolStripTextBox1.Name = "toolStripTextBox1"; 70 | this.toolStripTextBox1.Size = new System.Drawing.Size(100, 25); 71 | // 72 | // toolStripSeparator1 73 | // 74 | this.toolStripSeparator1.Name = "toolStripSeparator1"; 75 | this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); 76 | // 77 | // toolStripButton1 78 | // 79 | this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; 80 | this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); 81 | this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; 82 | this.toolStripButton1.Name = "toolStripButton1"; 83 | this.toolStripButton1.Size = new System.Drawing.Size(33, 22); 84 | this.toolStripButton1.Text = "Add"; 85 | this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click); 86 | // 87 | // toolStripButton2 88 | // 89 | this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; 90 | this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image"))); 91 | this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; 92 | this.toolStripButton2.Name = "toolStripButton2"; 93 | this.toolStripButton2.Size = new System.Drawing.Size(54, 22); 94 | this.toolStripButton2.Text = "Remove"; 95 | this.toolStripButton2.Click += new System.EventHandler(this.toolStripButton2_Click); 96 | // 97 | // toolStripButton3 98 | // 99 | this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; 100 | this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image"))); 101 | this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; 102 | this.toolStripButton3.Name = "toolStripButton3"; 103 | this.toolStripButton3.Size = new System.Drawing.Size(50, 22); 104 | this.toolStripButton3.Text = "Refresh"; 105 | this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click); 106 | // 107 | // listBox1 108 | // 109 | this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill; 110 | this.listBox1.FormattingEnabled = true; 111 | this.listBox1.Location = new System.Drawing.Point(0, 25); 112 | this.listBox1.Name = "listBox1"; 113 | this.listBox1.Size = new System.Drawing.Size(514, 355); 114 | this.listBox1.TabIndex = 1; 115 | // 116 | // toolStripLabel1 117 | // 118 | this.toolStripLabel1.Name = "toolStripLabel1"; 119 | this.toolStripLabel1.Size = new System.Drawing.Size(39, 22); 120 | this.toolStripLabel1.Text = "Email:"; 121 | this.toolStripLabel1.Click += new System.EventHandler(this.toolStripLabel1_Click); 122 | // 123 | // toolStripSeparator2 124 | // 125 | this.toolStripSeparator2.Name = "toolStripSeparator2"; 126 | this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); 127 | // 128 | // toolStripTextBox2 129 | // 130 | this.toolStripTextBox2.Font = new System.Drawing.Font("Segoe UI", 9F); 131 | this.toolStripTextBox2.Name = "toolStripTextBox2"; 132 | this.toolStripTextBox2.Size = new System.Drawing.Size(100, 25); 133 | // 134 | // toolStripLabel2 135 | // 136 | this.toolStripLabel2.Name = "toolStripLabel2"; 137 | this.toolStripLabel2.Size = new System.Drawing.Size(63, 22); 138 | this.toolStripLabel2.Text = "Username:"; 139 | // 140 | // Form2 141 | // 142 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 143 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 144 | this.ClientSize = new System.Drawing.Size(514, 380); 145 | this.Controls.Add(this.listBox1); 146 | this.Controls.Add(this.toolStrip1); 147 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 148 | this.Name = "Form2"; 149 | this.Text = "Player Profile Tool"; 150 | this.Load += new System.EventHandler(this.Form2_Load); 151 | this.toolStrip1.ResumeLayout(false); 152 | this.toolStrip1.PerformLayout(); 153 | this.ResumeLayout(false); 154 | this.PerformLayout(); 155 | 156 | } 157 | 158 | #endregion 159 | 160 | private System.Windows.Forms.ToolStrip toolStrip1; 161 | private System.Windows.Forms.ToolStripTextBox toolStripTextBox1; 162 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 163 | private System.Windows.Forms.ToolStripButton toolStripButton1; 164 | private System.Windows.Forms.ToolStripButton toolStripButton2; 165 | private System.Windows.Forms.ToolStripButton toolStripButton3; 166 | private System.Windows.Forms.ListBox listBox1; 167 | private System.Windows.Forms.ToolStripLabel toolStripLabel1; 168 | private System.Windows.Forms.ToolStripLabel toolStripLabel2; 169 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; 170 | private System.Windows.Forms.ToolStripTextBox toolStripTextBox2; 171 | } 172 | } -------------------------------------------------------------------------------- /CNCEmu/Form2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace CNCEmu 13 | { 14 | public partial class Form2 : Form 15 | { 16 | public Form2() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | private void Form2_Load(object sender, EventArgs e) 22 | { 23 | RefreshProfiles(); 24 | } 25 | 26 | private void RefreshProfiles() 27 | { 28 | Profiles.Refresh(); 29 | listBox1.Items.Clear(); 30 | foreach (Profile p in Profiles.profiles) 31 | listBox1.Items.Add(p.ToString()); 32 | } 33 | 34 | private void toolStripButton1_Click(object sender, EventArgs e) 35 | { 36 | string name = toolStripTextBox1.Text; 37 | string mail = toolStripTextBox2.Text; 38 | Profiles.Refresh(); 39 | Profiles.Create(name, mail); 40 | Profiles.Refresh(); 41 | RefreshProfiles(); 42 | } 43 | 44 | private void toolStripButton2_Click(object sender, EventArgs e) 45 | { 46 | int n = listBox1.SelectedIndex; 47 | if (n == -1) 48 | return; 49 | Profile p = Profiles.profiles[n]; 50 | string path = Profiles.getProfilePath(p.id); 51 | if (File.Exists(path)) 52 | File.Delete(path); 53 | Profiles.Refresh(); 54 | RefreshProfiles(); 55 | } 56 | 57 | private void toolStripButton3_Click(object sender, EventArgs e) 58 | { 59 | RefreshProfiles(); 60 | } 61 | 62 | private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) 63 | { 64 | 65 | } 66 | 67 | private void toolStripLabel1_Click(object sender, EventArgs e) 68 | { 69 | 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /CNCEmu/GameInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BlazeLibWV; 7 | 8 | namespace CNCEmu 9 | { 10 | public class GameInfo 11 | { 12 | public int id; 13 | public bool isRunning; 14 | 15 | public Blaze.TdfDoubleList ATTR; 16 | public uint GSTA; 17 | public long GSET; 18 | public long VOIP; 19 | public string VSTR; 20 | public string GNAM; 21 | public int[] slotUse; 22 | public PlayerInfo[] players; 23 | 24 | public GameInfo() 25 | { 26 | players = new PlayerInfo[32]; 27 | slotUse = new int[32]; 28 | for (int i = 0; i < 32; i++) 29 | slotUse[i] = -1; 30 | } 31 | 32 | public byte getNextSlot() 33 | { 34 | for (byte i = 0; i < 32; i++) 35 | if (slotUse[i] == -1) 36 | return i; 37 | return 255; 38 | } 39 | 40 | public void setNextSlot(int id) 41 | { 42 | for (byte i = 0; i < 32; i++) 43 | if (slotUse[i] == -1) 44 | { 45 | slotUse[i] = id; 46 | return; 47 | } 48 | } 49 | 50 | public void removePlayer(int id) 51 | { 52 | for (byte i = 0; i < 32; i++) 53 | if (slotUse[i] == id) 54 | { 55 | slotUse[i] = -1; 56 | players[i] = null; 57 | return; 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /CNCEmu/GenFiles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | 9 | namespace CNCEmu 10 | { 11 | public static class GenFiles 12 | { 13 | public static void CreatePackets() 14 | { 15 | if (!Directory.Exists("logs")) 16 | Directory.CreateDirectory("logs"); 17 | if (!Directory.Exists("logs\\packets")) 18 | Directory.CreateDirectory("logs\\packets"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CNCEmu/Helper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net.Security; 6 | using System.Net.Sockets; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Diagnostics; 10 | using System.Windows.Forms; 11 | 12 | namespace CNCEmu 13 | { 14 | public static class Helper 15 | { 16 | public static List ConvertStringList(string data) 17 | { 18 | List res = new List(); 19 | string t = data.Replace("{", ""); 20 | string[] t2 = t.Split('}'); 21 | foreach (string line in t2) 22 | if (line.Trim() != "") 23 | res.Add(line.Trim()); 24 | return res; 25 | } 26 | public static void ConvertDoubleStringList(string data, out List list1, out List list2) 27 | { 28 | List res1 = new List(); 29 | List res2 = new List(); 30 | string t = data.Replace("{", ""); 31 | string[] t2 = t.Split('}'); 32 | foreach (string line in t2) 33 | if (line.Trim() != "") 34 | { 35 | string[] t3 = line.Trim().Split(';'); 36 | res1.Add(t3[0].Trim()); 37 | res2.Add(t3[1].Trim()); 38 | } 39 | list1 = res1; 40 | list2 = res2; 41 | } 42 | public static byte[] ReadContentSSL(SslStream sslStream) 43 | { 44 | MemoryStream res = new MemoryStream(); 45 | byte[] buff = new byte[0x10000]; 46 | sslStream.ReadTimeout = 100; 47 | int bytesRead; 48 | try 49 | { 50 | while ((bytesRead = sslStream.Read(buff, 0, 0x10000)) > 0) 51 | res.Write(buff, 0, bytesRead); 52 | } 53 | catch { } 54 | sslStream.Flush(); 55 | return res.ToArray(); 56 | } 57 | public static byte[] ReadContentTCP(NetworkStream Stream) 58 | { 59 | MemoryStream res = new MemoryStream(); 60 | byte[] buff = new byte[0x10000]; 61 | Stream.ReadTimeout = 100; 62 | int bytesRead; 63 | try 64 | { 65 | while ((bytesRead = Stream.Read(buff, 0, 0x10000)) > 0) 66 | res.Write(buff, 0, bytesRead); 67 | } 68 | catch { } 69 | Stream.Flush(); 70 | return res.ToArray(); 71 | } 72 | public static void RunShell(string file, string command) 73 | { 74 | Process process = new System.Diagnostics.Process(); 75 | ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); 76 | startInfo.FileName = file; 77 | startInfo.Arguments = command; 78 | process.StartInfo = startInfo; 79 | process.Start(); 80 | } 81 | 82 | public static string BytesToLabel(byte[] data) 83 | { 84 | byte[] result = new byte[4]; 85 | result[3] = (byte)((data[2] & 0x3F) + 0x20); 86 | result[2] = (byte)(((data[2] & 0xC0) >> 6) + ((data[1] & 0x0F) << 2) + 0x20); 87 | result[1] = (byte)(((data[1] & 0xF0) >> 4) + ((data[0] & 0x03) << 4) + 0x20); 88 | result[0] = (byte)(((data[0] & 0xFC) >> 2) + 0x20); 89 | return Encoding.UTF8.GetString(result); 90 | } 91 | 92 | public static byte[] LabelToBytes(string Label) 93 | { 94 | byte[] result = new byte[3]; 95 | byte[] buff = Encoding.UTF8.GetBytes(Label); 96 | for (int i = 0; i < 4; i++) 97 | buff[i] -= 0x20; 98 | result[0] = (byte)(((buff[0] & 0x3F) << 2) | ((buff[1] & 0x30) >> 4)); 99 | result[1] = (byte)(((buff[1] & 0x0F) << 4) | ((buff[2] & 0x3C) >> 2)); 100 | result[2] = (byte)(((buff[2] & 0x03) << 6) | (buff[3] & 0x3F)); 101 | return result; 102 | } 103 | 104 | public static long ReadCompressedInteger(Stream s) 105 | { 106 | long result = 0; 107 | byte b = (byte)s.ReadByte(); 108 | result += (b & 0x3F); 109 | int currshift = 6; 110 | while ((b & 0x80) != 0) 111 | { 112 | b = (byte)s.ReadByte(); 113 | result |= ((long)(b & 0x7F) << currshift); 114 | currshift += 7; 115 | } 116 | return result; 117 | } 118 | 119 | public static void WriteCompressedInteger(Stream s, long l) 120 | { 121 | if (l < 0x40) 122 | s.WriteByte((byte)l); 123 | else 124 | { 125 | byte curbyte = (byte)((l & 0x3F) | 0x80); 126 | s.WriteByte(curbyte); 127 | long currshift = l >> 6; 128 | while (currshift >= 0x80) 129 | { 130 | curbyte = (byte)((currshift & 0x7F) | 0x80); 131 | currshift >>= 7; 132 | s.WriteByte(curbyte); 133 | } 134 | s.WriteByte((byte)currshift); 135 | } 136 | } 137 | 138 | public static byte[] HexStringToByteArray(string hex) 139 | { 140 | return Enumerable.Range(0, hex.Length) 141 | .Where(x => x % 2 == 0) 142 | .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) 143 | .ToArray(); 144 | } 145 | 146 | public static string ByteArrayToHexString(byte[] buff) 147 | { 148 | StringBuilder sb = new StringBuilder(); 149 | foreach (byte b in buff) 150 | sb.Append(b.ToString("X2")); 151 | return sb.ToString(); 152 | } 153 | 154 | 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /CNCEmu/Logger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | using System.Drawing; 9 | 10 | namespace CNCEmu 11 | { 12 | public enum LogPriority 13 | { 14 | high = 0, 15 | medium = 1, 16 | low = 2 17 | } 18 | 19 | public static class Logger 20 | { 21 | public static readonly object _sync = new object(); 22 | public static int PacketCounter = 0; 23 | public static RichTextBox box = null; 24 | public static LogPriority LogLevel = LogPriority.low; 25 | 26 | 27 | public static string LevelToString(LogPriority level) 28 | { 29 | switch (level) 30 | { 31 | case LogPriority.high: 32 | return " [HIGH]"; 33 | case LogPriority.medium: 34 | return " [MED ]"; 35 | case LogPriority.low: 36 | return " [LOW ]"; 37 | } 38 | return ""; 39 | } 40 | 41 | 42 | public static void Log(string s, object color = null) 43 | { 44 | if (box == null) return; 45 | try 46 | { 47 | box.Invoke(new Action(delegate 48 | { 49 | string stamp = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " : "; 50 | Color c; 51 | if (color != null) 52 | c = (Color)color; 53 | else 54 | c = Color.Black; 55 | box.SelectionStart = box.TextLength; 56 | box.SelectionLength = 0; 57 | box.SelectionColor = c; 58 | box.AppendText(stamp + s + "\n"); 59 | BackendLog.Write(stamp + s + "\n"); 60 | box.SelectionColor = box.ForeColor; 61 | box.ScrollToCaret(); 62 | })); 63 | } 64 | catch { } 65 | } 66 | 67 | public static void LogError(string who, Exception e, string cName = "") 68 | { 69 | string result = ""; 70 | if (who != "") result = "[" + who + "] " + cName + " ERROR: "; 71 | result += e.Message; 72 | if (e.InnerException != null) 73 | result += " - " + e.InnerException.Message; 74 | Log(result); 75 | } 76 | 77 | public static void LogPacket(string source, int handlerID, byte[] data) 78 | { 79 | lock (_sync) 80 | { 81 | File.WriteAllBytes("logs\\packets\\Packet_" + (PacketCounter++).ToString("d6") + "_Handler" + handlerID + "_" + UnixTimeNow().ToString() + "_" + source + ".bin", data); 82 | } 83 | } 84 | 85 | public static long UnixTimeNow() 86 | { 87 | var timeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)); 88 | return (long)timeSpan.TotalSeconds; 89 | } 90 | 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /CNCEmu/PlayerInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Net.Sockets; 7 | using System.Diagnostics; 8 | 9 | namespace CNCEmu 10 | { 11 | public class PlayerInfo 12 | { 13 | public string version; 14 | public long userId; 15 | public long exIp, exPort; 16 | public long inIp, inPort; 17 | public long nat = 0; 18 | public long loc; 19 | public long slot; 20 | public long stat; 21 | public long cntx; 22 | public bool isServer; 23 | public GameInfo game; 24 | public NetworkStream ns; 25 | public Profile profile; 26 | public Stopwatch timeout; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CNCEmu/Profile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace CNCEmu 9 | { 10 | public class Profile 11 | { 12 | public string _raw; 13 | public string name; 14 | public long id; 15 | public string mail; 16 | 17 | public static Profile Load(string filename) 18 | { 19 | string[] lines = File.ReadAllLines(filename); 20 | Profile p = new Profile(); 21 | p._raw = File.ReadAllText(filename); 22 | foreach (string line in lines) 23 | { 24 | string[] parts = line.Split('='); 25 | if (parts.Length != 2) continue; 26 | string what = parts[0].Trim().ToLower(); 27 | switch (what) 28 | { 29 | case "name": 30 | p.name = parts[1].Trim(); 31 | break; 32 | case "id": 33 | p.id = Convert.ToInt32(parts[1].Trim()); 34 | break; 35 | case "mail": 36 | p.mail = parts[1].Trim(); 37 | break; 38 | } 39 | } 40 | if (p.name == null || p.id == 0) 41 | return null; 42 | return p; 43 | } 44 | 45 | public override string ToString() 46 | { 47 | StringBuilder sb = new StringBuilder(); 48 | sb.Append("ID = " + id + ", "); 49 | sb.Append("Name = " + name + ", "); 50 | sb.Append("Mail = " + mail); 51 | return sb.ToString(); 52 | } 53 | } 54 | 55 | public static class Profiles 56 | { 57 | public static List profiles = new List(); 58 | public static void Refresh() 59 | { 60 | profiles = new List(); 61 | if (!Directory.Exists("backend")) 62 | Directory.CreateDirectory("backend"); 63 | if (!Directory.Exists("backend\\profiles")) 64 | Directory.CreateDirectory("backend\\profiles"); 65 | string[] files = Directory.GetFiles("backend\\profiles\\", "*.txt"); 66 | foreach (string file in files) 67 | { 68 | Profile p = Profile.Load(file); 69 | if (p != null) 70 | profiles.Add(p); 71 | } 72 | BlazeServer.Log("[MAIN] Loaded " + profiles.Count + " player profiles"); 73 | } 74 | 75 | public static string getProfilePath(long id) 76 | { 77 | return "backend\\profiles\\" + id.ToString("X8") + "_profile.txt"; 78 | } 79 | 80 | public static Profile Create(string name, string mail) 81 | { 82 | long id = 1000; 83 | while (File.Exists(getProfilePath(id))) 84 | id++; 85 | return Create(name, id, mail); 86 | } 87 | 88 | public static Profile Create(string name, long id, string mail) 89 | { 90 | string profileContent = "name=" + name + "\nid=" + id + "\nmail=" + mail; 91 | string filename = getProfilePath(id); 92 | File.WriteAllText(filename, profileContent, Encoding.Unicode); 93 | return Profile.Load(filename); 94 | } 95 | } 96 | } -------------------------------------------------------------------------------- /CNCEmu/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace CNCEmu 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// Der Haupteinstiegspunkt für die Anwendung. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CNCEmu/Properties/AssemblyInfo.tt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xevrac/cnc_backend/cc7b8b2c47b92152262b2e4db15528d493702966/CNCEmu/Properties/AssemblyInfo.tt -------------------------------------------------------------------------------- /CNCEmu/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CNCEmu.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CNCEmu.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap external { 67 | get { 68 | object obj = ResourceManager.GetObject("external", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /CNCEmu/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\external.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | -------------------------------------------------------------------------------- /CNCEmu/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CNCEmu.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /CNCEmu/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CNCEmu/ProviderInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CNCEmu 8 | { 9 | public static class ProviderInfo 10 | { 11 | public static string backendIP = "0.0.0.0"; 12 | public static string serverIP = "10.20.102.99"; 13 | 14 | public static string ams_psa = "qos-prod-bio-dub-common-common.gos.ea.com"; 15 | public static int ams_psp = 17502; 16 | public static string ams_sna = "bio-prod-ams-bf4"; 17 | public static string ams = "ams"; 18 | 19 | public static string gru_psa = "qos-prod-m3d-brz-common-common.gos.ea.com"; 20 | public static int gru_psp = 17502; 21 | public static string gru_sna = "ea-prod-ams-bf4"; 22 | public static string gru = "gru"; 23 | 24 | public static string iad_psa = "qos-prod-bio-iad-common-common.gos.ea.com"; 25 | public static int iad_psp = 17502; 26 | public static string iad_sna = "bio-prod-iad-bf4"; 27 | public static string iad = "iad"; 28 | 29 | public static string lax_psa = "qos-prod-bio-sjc-common-common.gos.ea.com"; 30 | public static int lax_psp = 17502; 31 | public static string lax_sna = "bio-prod-lax-bf4"; 32 | public static string lax = "lax"; 33 | 34 | public static string nrt_psa = "qos-prod-m3d-nrt-common-common.gos.ea.com"; 35 | public static int nrt_psp = 17502; 36 | public static string nrt_sna = "i3d-prod-nrt-bf4"; 37 | public static string nrt = "nrt"; 38 | 39 | public static string syd_psa = "qos-prod-bio-syd-common-common.gos.ea.com"; 40 | public static int syd_psp = 17502; 41 | public static string syd_sna = "bio-prod-syd-bf4"; 42 | public static string syd = "syd"; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /CNCEmu/RedirectorServer.cs: -------------------------------------------------------------------------------- 1 | using BlazeLibWV; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Net; 6 | using System.Net.Security; 7 | using System.Net.Sockets; 8 | using System.Security.Authentication; 9 | using System.Security.Cryptography.X509Certificates; 10 | using System.Threading; 11 | using System.Windows.Forms; 12 | 13 | namespace CNCEmu 14 | { 15 | public static class RedirectorServer 16 | { 17 | public static readonly object _sync = new object(); 18 | public static bool _exit; 19 | public static bool _isRunning = false; 20 | public static bool useSSL = false; 21 | public static RichTextBox box = null; 22 | public static TcpListener lRedirector = null; 23 | public static int targetPort = 3659; 24 | public static string redi = "redirector.pfx"; 25 | 26 | public static void Start() 27 | { 28 | SetExit(false); 29 | _isRunning = true; 30 | Log("Starting Redirector..."); 31 | new Thread(tRedirectorMain) { IsBackground = true }.Start(); 32 | for (int i = 0; i < 10; i++) 33 | { 34 | Thread.Sleep(10); 35 | Application.DoEvents(); 36 | } 37 | } 38 | 39 | public static void Stop() 40 | { 41 | Log("Backend stopping..."); 42 | if (lRedirector != null) lRedirector.Stop(); 43 | SetExit(true); 44 | Log("Done."); 45 | } 46 | 47 | public static void tRedirectorMain(object obj) 48 | { 49 | X509Certificate2 cert = null; 50 | try 51 | { 52 | Log("[REDI] Redirector starting..."); 53 | lRedirector = new TcpListener(IPAddress.Parse(ProviderInfo.backendIP), 42127); 54 | Log("[REDI] Redirector bound to port: 42127"); 55 | lRedirector.Start(); 56 | if (useSSL) 57 | { 58 | Log("[REDI] Loading Cert..."); 59 | cert = new X509Certificate2(redi, "123456"); 60 | } 61 | Log("[REDI] Redirector listening..."); 62 | TcpClient client; 63 | while (!GetExit()) 64 | { 65 | client = lRedirector.AcceptTcpClient(); 66 | Log("[REDI] Client connected"); 67 | if (useSSL) 68 | { 69 | SslStream sslStream = new SslStream(client.GetStream(), false); 70 | sslStream.AuthenticateAsServer(cert, false, SslProtocols.Default | SslProtocols.None | SslProtocols.Ssl2 | SslProtocols.Ssl3 | SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12, false); 71 | byte[] data = Helper.ReadContentSSL(sslStream); 72 | MemoryStream m = new MemoryStream(); 73 | m.Write(data, 0, data.Length); 74 | data = CreateRedirectorPacket(); 75 | m.Write(data, 0, data.Length); 76 | sslStream.Write(data); 77 | sslStream.Flush(); 78 | client.Close(); 79 | } 80 | else 81 | { 82 | NetworkStream stream = client.GetStream(); 83 | byte[] data = Helper.ReadContentTCP(stream); 84 | MemoryStream m = new MemoryStream(); 85 | m.Write(data, 0, data.Length); 86 | data = CreateRedirectorPacket(); 87 | m.Write(data, 0, data.Length); 88 | stream.Write(data, 0, data.Length); 89 | stream.Flush(); 90 | client.Close(); 91 | } 92 | } 93 | } 94 | catch (Exception ex) 95 | { 96 | LogError("REDI", ex); 97 | } 98 | } 99 | 100 | public static byte[] CreateRedirectorPacket() 101 | { 102 | List Result = new List(); 103 | List VALU = new List(); 104 | VALU.Add(Blaze.TdfString.Create("HOST", ProviderInfo.serverIP)); 105 | VALU.Add(Blaze.TdfInteger.Create("IP\0\0", Blaze.GetIPfromString(ProviderInfo.serverIP))); 106 | VALU.Add(Blaze.TdfInteger.Create("PORT", targetPort)); 107 | Blaze.TdfUnion ADDR = Blaze.TdfUnion.Create("ADDR", 0, Blaze.TdfStruct.Create("VALU", VALU)); 108 | Result.Add(ADDR); 109 | Result.Add(Blaze.TdfInteger.Create("SECU", 0)); //Change to 1 for SSL 110 | Result.Add(Blaze.TdfInteger.Create("XDNS", 0)); 111 | return Blaze.CreatePacket(5, 1, 0, 0x1000, 0, Result); 112 | } 113 | 114 | public static void SetExit(bool state) 115 | { 116 | lock (_sync) 117 | { 118 | _exit = state; 119 | } 120 | } 121 | 122 | public static bool GetExit() 123 | { 124 | bool result; 125 | lock (_sync) 126 | { 127 | result = _exit; 128 | } 129 | return result; 130 | } 131 | 132 | public static void Log(string s) 133 | { 134 | if (box == null) return; 135 | try 136 | { 137 | box.Invoke(new Action(delegate 138 | { 139 | string stamp = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " : "; 140 | box.AppendText(stamp + s + "\n"); 141 | BackendLog.Write(stamp + s + "\n"); 142 | box.SelectionStart = box.Text.Length; 143 | box.ScrollToCaret(); 144 | })); 145 | } 146 | catch { } 147 | } 148 | 149 | public static void LogError(string who, Exception e, string cName = "") 150 | { 151 | string result = ""; 152 | if (who != "") result = "[" + who + "] " + cName + " ERROR: "; 153 | result += e.Message; 154 | if (e.InnerException != null) 155 | result += " - " + e.InnerException.Message; 156 | Log(result); 157 | } 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /CNCEmu/Resources/external.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xevrac/cnc_backend/cc7b8b2c47b92152262b2e4db15528d493702966/CNCEmu/Resources/external.png -------------------------------------------------------------------------------- /CNCEmu/Utils.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace CNCEmu 4 | { 5 | internal static class Utils 6 | { 7 | public static void OpenUrl(string url) 8 | { 9 | Process.Start(new ProcessStartInfo 10 | { 11 | FileName = url, 12 | UseShellExecute = true // This is necessary to use the default browser 13 | }); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CNCEmu/blaze.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xevrac/cnc_backend/cc7b8b2c47b92152262b2e4db15528d493702966/CNCEmu/blaze.ico -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # cnc_backend 4 | Goal is to fully emulate Command and Conquer™ backend and have functioning client. 5 | 6 | Codebase originate from this repo. 7 | > Credit: Eisbaer, Warranty Voider, the1Domo 8 | 9 | # Build 10 | Open solution with VS2022 and compile build. Run `CNCEmu.exe`. 11 | > .NET Framework 4.6.1 is required 12 | 13 | # Learn 14 | Want to contribute? There is a [Docs](https://github.com/Xevrac/cnc_backend/wiki) page where you can learn. 15 | 16 | # Media 17 | Latest updates can be followed on my YouTube channel. 18 | 19 | Latest video: PoC #6 20 | 21 | ![image](https://github.com/user-attachments/assets/6029b259-bd41-4d70-bf64-8b4601b2bfd5) 22 | 23 | ![image](https://github.com/user-attachments/assets/ac055e97-cfb5-4eaa-b266-e527ae466a3d) 24 | 25 | ![image](https://github.com/user-attachments/assets/fc118c93-4c70-4755-9a68-c5d6cb57bd37) 26 | 27 | # Tracker 28 | 29 | ✅ - Done 30 | 31 | 🏗️ - Work in progress 32 | 33 | ❌ - Not Implemented 34 | 35 | ⛔ - No plans to implement / _Fork_ yourself to implement and merge 36 | 37 |
38 | 39 | * Blaze - 🏗️ 40 | * Authentication Layer - 🏗️ 41 | * ✅ Authentication is successful, some components missing 42 | * Game Manager Layer - 🏗️ 43 | * User Profile Unlocks - ❌ 44 | * User Profile Stats - ❌ 45 | 46 | * Web - 🏗️ 47 | * **Temporary**: External webserver - ✅ 48 | * Internal webserver - ❌ 49 | * ShellUI - 🏗️ 50 | 51 | * Client State - 🏗️ 52 | > * No playable functions yet 53 | > * Basic menu for development purposes 54 | * Landing Page - ❌ 55 | * Development Page - 🏗️ 56 | * Game Creation - 🏗️ 57 | * Level Generation - ❌ 58 | * Player presence - ✅ 59 | * Can load in game - ❌ 60 | -------------------------------------------------------------------------------- /cnc_shellui_wwwroot-1.2.2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xevrac/cnc_backend/cc7b8b2c47b92152262b2e4db15528d493702966/cnc_shellui_wwwroot-1.2.2.zip --------------------------------------------------------------------------------