installer
authorTerri00 <thrustmediaproductions@gmail.com>
Sat, 16 Mar 2019 23:13:03 +0000 (23:13 +0000)
committerTerri00 <thrustmediaproductions@gmail.com>
Sat, 16 Mar 2019 23:13:03 +0000 (23:13 +0000)
12 files changed:
.gitignore
AutoRadar_installer/AutoRadar_installer.vcxproj [new file with mode: 0644]
AutoRadar_installer/AutoRadar_installer.vcxproj.filters [new file with mode: 0644]
AutoRadar_installer/ConColor.h [new file with mode: 0644]
AutoRadar_installer/FileSystemHelper.h [new file with mode: 0644]
AutoRadar_installer/main.cpp [new file with mode: 0644]
MCDV.sln
MCDV/CmdSeq.wc
MCDV/main2.cpp
MCDV/sample_stuff/de_tavr_test.vmx
MCDV/vdf.hpp
MCDV/wc.hpp

index 6ab737550087f13831adb1a2dd198746f003655a..c204c513ec7be3d3c287eff7ca05b3e998890779 100644 (file)
@@ -6,6 +6,7 @@ MCDV_Lib/
 MCDV_Lib_Sharp/
 MCDV_Processor/
 MCDV_Web/
+installer/
 
 # User-specific files
 *.suo
@@ -38,6 +39,7 @@ bld/
 [Bb]in/
 [Oo]bj/
 [Ll]og/
+[Dd]eploy/
 
 # Visual Studio 2015 cache/options directory
 .vs/
diff --git a/AutoRadar_installer/AutoRadar_installer.vcxproj b/AutoRadar_installer/AutoRadar_installer.vcxproj
new file mode 100644 (file)
index 0000000..4952a2b
--- /dev/null
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>15.0</VCProjectVersion>
+    <ProjectGuid>{D73B6BD7-47B5-4426-BC6B-26B69F47CACA}</ProjectGuid>
+    <RootNamespace>AutoRadarinstaller</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <OutDir>$(SolutionDir)\installer\$(Configuration)\</OutDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(SolutionDir)\installer\$(Configuration)\</OutDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="main.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="ConColor.h" />
+    <ClInclude Include="FileSystemHelper.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/AutoRadar_installer/AutoRadar_installer.vcxproj.filters b/AutoRadar_installer/AutoRadar_installer.vcxproj.filters
new file mode 100644 (file)
index 0000000..7ef2532
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="main.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="ConColor.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="FileSystemHelper.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/AutoRadar_installer/ConColor.h b/AutoRadar_installer/ConColor.h
new file mode 100644 (file)
index 0000000..ca97e0f
--- /dev/null
@@ -0,0 +1,42 @@
+#pragma once
+#include <Windows.h>
+#include <stdint.h>
+
+HANDLE hConsole;
+uint16_t consoleColorDefault;
+
+namespace cc {
+
+       void setup() {
+               hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
+
+               CONSOLE_SCREEN_BUFFER_INFO info;
+               GetConsoleScreenBufferInfo(hConsole, &info);
+
+               consoleColorDefault = info.wAttributes;
+       }
+
+       void reset() {
+               SetConsoleTextAttribute(hConsole, consoleColorDefault);
+       }
+
+       void error() {
+               SetConsoleTextAttribute(hConsole, 12);
+       }
+
+       void warning() {
+               SetConsoleTextAttribute(hConsole, 14);
+       }
+
+       void info() {
+               SetConsoleTextAttribute(hConsole, 8);
+       }
+
+       void success() {
+               SetConsoleTextAttribute(hConsole, 10);
+       }
+
+       void fancy() {
+               SetConsoleTextAttribute(hConsole, 13);
+       }
+}
\ No newline at end of file
diff --git a/AutoRadar_installer/FileSystemHelper.h b/AutoRadar_installer/FileSystemHelper.h
new file mode 100644 (file)
index 0000000..951e62e
--- /dev/null
@@ -0,0 +1,75 @@
+#include <Windows.h>
+#include <vector>
+#include <string>
+
+namespace fs
+{
+       std::vector<std::string> getFilesInDirectory(std::string folder) {
+               std::vector<std::string> names;
+               std::string search_path = folder + "/*.*";
+               WIN32_FIND_DATA fd;
+               HANDLE hFind = ::FindFirstFile(search_path.c_str(), &fd);
+               if (hFind != INVALID_HANDLE_VALUE) {
+                       do {
+                               if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+                                       names.push_back(folder + "\\" + fd.cFileName);
+                               }
+                       } while (::FindNextFile(hFind, &fd));
+                       ::FindClose(hFind);
+               }
+               for (auto && s : names) s = s.substr(s.size());
+
+               return names;
+       }
+
+       std::vector<std::string> getFilesInDirectoryRecursive(std::string folder, std::vector<std::string>* vec = NULL) {
+               std::vector<std::string>* v = vec;
+
+               std::vector<std::string> names;
+               if (v == NULL) // First iteration
+                       v = &names;
+
+               std::string search_path = folder + "/*.*";
+               WIN32_FIND_DATA fd;
+               HANDLE hFind = ::FindFirstFile(search_path.c_str(), &fd);
+               if (hFind != INVALID_HANDLE_VALUE) {
+                       do {
+                               if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+                                       v->push_back(folder + "\\" + fd.cFileName);
+                               }
+                               else {
+                                       if ((std::string(fd.cFileName) != ".") && (std::string(fd.cFileName) != ".."))
+                                               getFilesInDirectoryRecursive(folder + "\\" + fd.cFileName, v);
+                               }
+                       } while (::FindNextFile(hFind, &fd));
+                       ::FindClose(hFind);
+               }
+
+               for (auto && s : names) s = s.substr(folder.size());
+
+               return *v;
+       }
+
+       void copyFile(std::string src, std::string dst) {
+               std::ifstream _src(src, std::ios::binary);
+               std::ofstream _dst(dst, std::ios::binary);
+
+               _dst << _src.rdbuf();
+       }
+
+
+       bool dirExists(const std::string& dirName_in) {
+               DWORD ftyp = GetFileAttributesA(dirName_in.c_str());
+               if (ftyp == INVALID_FILE_ATTRIBUTES)
+                       return false;  //something is wrong with your path!
+
+               if (ftyp & FILE_ATTRIBUTE_DIRECTORY)
+                       return true;   // this is a directory!
+
+               return false;    // this is not a directory!
+       }
+
+       std::string getDirName(std::string f) {
+               return f.substr(0, f.size() - split(sutil::ReplaceAll(f, "/", "\\"), '\\').back().size());
+       }
+}
\ No newline at end of file
diff --git a/AutoRadar_installer/main.cpp b/AutoRadar_installer/main.cpp
new file mode 100644 (file)
index 0000000..12ac9ba
--- /dev/null
@@ -0,0 +1,224 @@
+#include "../MCDV/vdf.hpp"
+#include "../MCDV/wc.hpp"
+#include "../MCDV/util.h"
+
+#include <windows.h>
+#include <iostream>
+#include <io.h>
+#include <fstream>
+
+#include "ConColor.h"
+
+#include "FileSystemHelper.h"
+
+std::string steam_install_path = "C:\\Program Files (x86)\\Steam\\";
+std::string csgo_sdk_bin_path = "";
+
+int exit() {
+       cc::reset();
+       system("PAUSE");
+       return -1;
+}
+
+int main(){
+       cc::setup();
+
+       /* Load install configuration */
+       std::ifstream ifs_vinfo("versioninfo.vdf");
+       if (!ifs_vinfo) {
+               cc::error();
+               std::cout << "versioninfo.vdf not found!!!" << std::endl;
+               return exit();
+       }
+
+       cc::info();
+       
+       std::string vinfo_str((std::istreambuf_iterator<char>(ifs_vinfo)), std::istreambuf_iterator<char>());
+       kv::FileData vinfo(vinfo_str);
+       kv::DataBlock vinfodata = vinfo.headNode.SubBlocks[0];
+
+       cc::fancy(); std::cout << "Installing version: " << vinfodata.Values["version"] << "\n";
+
+#pragma region sdk_detect
+       /* Get steam installation path */
+
+       cc::info(); std::cout << "Getting steam installation path from windows registry\n";
+
+       HKEY hKey = NULL;
+       char buffer[1024];
+
+       bool regReadSuccess = true;
+
+       if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Valve\\Steam", NULL, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS){
+               DWORD size;
+               if (RegQueryValueEx(hKey, "SteamPath", NULL, NULL, (LPBYTE)buffer, &size) == ERROR_SUCCESS){
+                       steam_install_path = buffer;
+                       steam_install_path += "\\";
+               }
+               else regReadSuccess = false;
+       }
+       else regReadSuccess = false;
+
+       RegCloseKey(hKey);
+
+       if (!regReadSuccess) {
+               cc::warning();
+               std::cout << "Failed to read registry key: 'Software\\Valve\\Steam\\SteamPath'\nDefaulting to C:\\Program Files (x86)\\Steam\\ installation...\n";
+       }
+
+       cc::info();
+       std::cout << "Reading steam library folders\n";
+
+       /* Read library folders file */
+
+       std::vector<std::string> libraryFolders;
+       libraryFolders.push_back(steam_install_path + "steammapps\\common\\");
+
+       std::ifstream ifs(steam_install_path + "steamapps\\libraryfolders.vdf");
+       if (!ifs) {
+               std::cout << "Libraryfolders.vdf not found. Skipping search...\n" << std::endl;
+       }
+       else {
+               std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
+               kv::FileData libFolders(str);
+
+               kv::DataBlock* libFoldersDB = libFolders.headNode.GetFirstByName("\"LibraryFolders\"");
+
+               if (libFoldersDB != NULL) {
+                       int index = 0;
+                       while (libFoldersDB->Values.count(std::to_string(++index))) libraryFolders.push_back(libFoldersDB->Values[std::to_string(index)] + "\\steamapps\\common\\");
+               }
+       }
+
+       if (libraryFolders.size() == 0) std::cout << "No library folders found, defaulting to steamapps common folder...\n";
+
+       /* Scan for csgo sdk installations */
+
+       std::cout << "Scanning for SDK installation\n";
+
+       for (auto && folder : libraryFolders) {
+               if (_access_s((folder + "Counter-Strike Global Offensive\\bin\\SDKLauncher.exe").c_str(), 0) == 0) {
+                       csgo_sdk_bin_path = folder + "Counter-Strike Global Offensive\\bin\\";
+               }
+       }
+
+       if (csgo_sdk_bin_path == "") {
+               cc::error();
+               std::cout << "Failed to find CS:GO SDK bin.\n";
+               return exit();
+       }
+
+#pragma endregion
+
+       /* Start doing the heavy work */
+       std::cout << "Copying files\n________________________________________________________\n\n";
+       
+       // Copy folders
+       for (auto && folder : vinfodata.GetAllByName("folder")){
+               std::string source_folder = kv::tryGetStringValue(folder.Values, "path");
+               std::string target_folder = kv::tryGetStringValue(folder.Values, "target");
+
+               if ((source_folder == "") || (target_folder == "")) {
+                       cc::warning(); std::cout << "Missing source/destination paths. Skipping...\n";
+                       continue;
+               }
+
+               cc::info();
+               std::cout << "Copying folder: " << source_folder << "\n";
+
+               source_folder = source_folder + "\\";
+               target_folder = csgo_sdk_bin_path + target_folder + "\\";
+
+               std::vector<std::string> files = fs::getFilesInDirectoryRecursive(source_folder);
+
+               for (auto && f : files) {
+                       std::string fDstFolder = target_folder + fs::getDirName(f);
+
+                       if (_access_s(fDstFolder.c_str(), 0)) {
+                               std::cout << "mkdr  " << fs::getDirName(f) << "\n";
+                               CreateDirectory(fDstFolder.c_str(), NULL);
+                       }
+
+                       std::cout <<     "copy  " << f << "\n";
+
+                       fs::copyFile(source_folder + f, target_folder + f);
+               }
+       }
+
+       std::cout << "\n";
+
+       // Install command sequences
+       std::cout << "Installing command sequences\n________________________________________________________\n\n";
+
+       for (auto && seqH : vinfodata.GetAllByName("CommandSequenceFile")) {
+               std::string target_file = kv::tryGetStringValue(seqH.Values, "target");
+
+               if (target_file == "") {
+                       cc::warning(); std::cout << "Missing target file. Skipping CommandSeq...\n";
+                       continue;
+               }
+
+               cc::info();
+
+               target_file = csgo_sdk_bin_path + target_file;
+
+               fs::copyFile(target_file, target_file + ".bak");
+
+               wc::filedata WcFile(target_file);
+
+               std::cout << "Writing to: " << kv::tryGetStringValue(seqH.Values, "target") << "\n";
+
+               for (auto && seqS : seqH.GetAllByName("Sequence")) {
+                       std::cout << "Installing sequence:  " << kv::tryGetStringValue(seqS.Values, "name", "error-name") << "\n";
+                       std::string name = kv::tryGetStringValue(seqS.Values, "name", "error-name");
+
+                       for (auto && seq : WcFile.sequences) {
+                               if (strstr(seq.name, name.c_str()) != NULL) {
+                                       seq.write_enable = false;
+                               }
+                       }
+
+                       wc::Sequence seq_new = wc::Sequence();
+                       strcpy_s(seq_new.name, name.c_str());
+
+                       for (auto && cmd : seqS.GetAllByName("Command"))
+                       {
+                               wc::Command command_build = wc::Command();
+                               command_build.is_enabled = kv::tryGetValue(cmd.Values, "is_enabled", 0);
+                               command_build.special = kv::tryGetValue(cmd.Values, "special", 0);
+                               command_build.is_long_filename = kv::tryGetValue(cmd.Values, "is_long_filename", 0);
+                               command_build.ensure_check = kv::tryGetValue(cmd.Values, "ensure_check", 0);
+                               command_build.use_proc_win = kv::tryGetValue(cmd.Values, "use_proc_win", 0);
+                               command_build.no_wait = kv::tryGetValue(cmd.Values, "no_wait", 0);;
+
+                               std::string executable = kv::tryGetStringValue(cmd.Values, "executable", "error-executable");
+
+                               strcpy_s(command_build.executable, executable.c_str());
+
+                               std::string args = kv::tryGetStringValue(cmd.Values, "args", "error-args");
+                               strcpy_s(command_build.args, args.c_str());
+
+                               seq_new.commands.push_back(command_build);
+                       }
+
+                       WcFile.sequences.push_back(seq_new);
+               }
+
+               WcFile.serialize(target_file);
+       }
+
+       // Install custom entities
+       
+       cc::success(); std::cout << "Completed setup!\n";
+       
+       /* Small wait to auto close */
+       for (int i = 10; i > 0; i--) {
+               cc::info();
+               std::cout << "Closing in " << i << " seconds...\r";
+               Sleep(1000);
+       }
+
+       cc::reset();
+       std::cout << "\n";
+       return 0;
+}
\ No newline at end of file
index b1be4ed09a6a80806f14eb79a16c4ad902277a6e..90d2097fdfe859c87e8dc7b068ca3a6838ed72d1 100644 (file)
--- a/MCDV.sln
+++ b/MCDV.sln
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 15
 VisualStudioVersion = 15.0.27004.2006
 MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MCDV", "MCDV\MCDV.vcxproj", "{3F5631FE-0F0C-4285-B301-66DA219121EC}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AutoRadar", "MCDV\MCDV.vcxproj", "{3F5631FE-0F0C-4285-B301-66DA219121EC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AutoRadar_installer", "AutoRadar_installer\AutoRadar_installer.vcxproj", "{D73B6BD7-47B5-4426-BC6B-26B69F47CACA}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -25,6 +27,16 @@ Global
                {3F5631FE-0F0C-4285-B301-66DA219121EC}.Release|x64.Build.0 = Release|x64
                {3F5631FE-0F0C-4285-B301-66DA219121EC}.Release|x86.ActiveCfg = Release|Win32
                {3F5631FE-0F0C-4285-B301-66DA219121EC}.Release|x86.Build.0 = Release|Win32
+               {D73B6BD7-47B5-4426-BC6B-26B69F47CACA}.Debug|Any CPU.ActiveCfg = Debug|Win32
+               {D73B6BD7-47B5-4426-BC6B-26B69F47CACA}.Debug|x64.ActiveCfg = Debug|x64
+               {D73B6BD7-47B5-4426-BC6B-26B69F47CACA}.Debug|x64.Build.0 = Debug|x64
+               {D73B6BD7-47B5-4426-BC6B-26B69F47CACA}.Debug|x86.ActiveCfg = Debug|Win32
+               {D73B6BD7-47B5-4426-BC6B-26B69F47CACA}.Debug|x86.Build.0 = Debug|Win32
+               {D73B6BD7-47B5-4426-BC6B-26B69F47CACA}.Release|Any CPU.ActiveCfg = Release|Win32
+               {D73B6BD7-47B5-4426-BC6B-26B69F47CACA}.Release|x64.ActiveCfg = Release|x64
+               {D73B6BD7-47B5-4426-BC6B-26B69F47CACA}.Release|x64.Build.0 = Release|x64
+               {D73B6BD7-47B5-4426-BC6B-26B69F47CACA}.Release|x86.ActiveCfg = Release|Win32
+               {D73B6BD7-47B5-4426-BC6B-26B69F47CACA}.Release|x86.Build.0 = Release|Win32
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index 1129ba391a96820b720f13064717e86c091afa0d..0279d45b0e049f30a62a9482cba3a2404f667b72 100644 (file)
Binary files a/MCDV/CmdSeq.wc and b/MCDV/CmdSeq.wc differ
index 30d77209b543d5b0a4776bd4fdab8f9b36b317ab..a944c1f7b23be7f4d67605db7a4d0cbb18cbf243 100644 (file)
@@ -6,12 +6,33 @@
 
 int main()
 {
-       wc::filedata fileData("sample_stuff/CmdSeq.wc");
+       wc::filedata fileData("CmdSeq.wc");
+
+       for (auto && seq : fileData.sequences) {
+               if (strstr(seq.name, "[TAR] Generate Radar") != NULL){
+                       seq.write_enable = false;
+               }
+       }
 
        wc::Sequence seq_new = wc::Sequence();
-       char name_new[128] = "Testeroonie BAP";
+       char name_new[128] = "[TAR] Generate Radar";
        memcpy(&seq_new.name, &name_new, 128);
        
+       wc::Command command_build = wc::Command();
+       command_build.is_enabled = 1;
+       command_build.special = 0;
+       command_build.is_long_filename = 0;
+       command_build.ensure_check = 0;
+       command_build.use_proc_win = 0;
+       command_build.no_wait = 0;
+       
+       char executable[260] = "$exedir\\bin\\tar\\AutoRadar.exe";
+       memcpy(&command_build.executable, &executable, 260);
+
+       char args[260] = "-g $gamedir $path\\$file";
+       memcpy(&command_build.args, &args, 260);
+
+       seq_new.commands.push_back(command_build);
 
        fileData.sequences.push_back(seq_new);
        fileData.serialize("CmdSeq.wc");
index c388348ca7c714044d9d3aa5e9099a96556f000a..452afc2b776a294d0fb1dd2787be16afc1034fbc 100644 (file)
@@ -2,7 +2,7 @@ versioninfo
 {
        "editorversion" "400"
        "editorbuild" "8075"
-       "mapversion" "53"
+       "mapversion" "54"
        "formatversion" "100"
        "prefab" "0"
 }
@@ -44,7 +44,7 @@ viewsettings
 world
 {
        "id" "1"
-       "mapversion" "53"
+       "mapversion" "54"
        "classname" "worldspawn"
        "detailmaterial" "detail/detailsprites"
        "detailvbsp" "detail.vbsp"
index 527aa2b5c500b67e7e8b6eedb740d73143fa1399..10530015249a7ba4cdf20fd7701dba500da9cf71 100644 (file)
@@ -19,7 +19,12 @@ namespace kv
        template<typename T>
        T tryGetValue(std::map<std::string, std::string> map, const char* key, T defaultValue) {
                if (!map.count(key)) return defaultValue;
-               return static_cast<T>(::atof(key));
+               return static_cast<T>(::atof(map[key].c_str()));
+       }
+
+       std::string tryGetStringValue(std::map<std::string, std::string> map, const char* key, std::string defaultValue = "") {
+               if (!map.count(key)) return defaultValue;
+               return map[key];
        }
 
        class DataBlock
index c14591a3f0aa96b39f0d7bf0a8620de6dff0beb4..2dfbafacaee33b82c9d6787af2229fd2153ad221 100644 (file)
@@ -33,6 +33,7 @@ namespace wc
        {
                char name[128];
                std::vector<Command> commands;
+               bool write_enable = true;
        };
 
        struct Header {
@@ -92,12 +93,18 @@ namespace wc
 
                        // Write header
                        Header header = Header();
-                       header.seq_count = sequences.size();
+
+                       int count = sequences.size();
+                       for (auto && seq : this->sequences) if (!seq.write_enable) count--;
+
+                       header.seq_count = count;
                        writer.write((char*)&header, sizeof(header));
 
                        // Write Sequences
                        for (auto && sequence : this->sequences){
 
+                               if (!sequence.write_enable) continue;
+
                                writer.write((char*)&sequence.name, 128);
                                uint32_t cmdCount = sequence.commands.size();