The code for the L4D Gameconfig fixer.(You place it in the Left 4 Dead folder).
- Code: Select all
#include<iostream>
#include<fstream>
#include<windows.h>
using namespace std;
int main ()
{
//Init
SetConsoleTitle("L4D Gameconfig Fixer - By Corewarp");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
//Declarations
char Path[256];
ofstream File;
char Accept;
//Code
GetCurrentDirectory(256, Path);
//Write gameconfig.txt
File.open("GameConfig.txt");
File << "\"Configs\"" << endl << "{" << endl << "\"Games\"" << endl << "{" << endl << "\"Left 4 Dead\"" << endl << "{" << endl;
File << "\"GameDir\" \"" << Path << "\\Left4Dead\"" << endl;
File << "\"Hammer\"" << endl << "{" << endl;
File << "\"GameData0\" \"" << Path << "\\Bin\\Left4Dead.fgd\"" << endl;
File << "\"TextureFormat\" \"5\"" << endl << "\"MapFormat\" \"4\"" << endl << "\"DefaultTextureScale\" \"0.250000\"" << endl;
File << "\"DefaultLightmapScale\" \"16\"" << endl << "\"GameExe\" \"" << Path << "\\Left4Dead.exe\"" << endl;
File << "\"DefaultSolidEntity\" \"Func_detail\"" << endl << "\"DefaultPointEntity\" \"prop_static\"" << endl;
File << "\"BSP\" \"" << Path << "\\Bin\\vbsp.exe\"" << endl << "\"Vis\" \"" << Path << "\\Bin\\vvis.exe\"" << endl;
File << "\"Light\" \"" << Path << "\\Bin\\vrad.exe\"" << endl << "\"GameExeDir\" \"" << Path << "\"" << endl;
File << "\"MapDir\" \"" << Path << "\\sdk_content\\mapsrc\"" << endl << "\"BSPDir\" \"" << Path << "\\left4dead\\Maps\"" << endl;
File << "\"CordonTexture\" \"tools\\toolsskybox\"" << endl << "\"MaterialExcludeCount\" \"0\"" << endl;
File << "}" << endl << "}" << endl << "}" << endl << "\"SDKVersion\" \"4\"" << endl << "}";
File.close();
//Get user acceptance
system("more gameconfig.txt");
cout << endl << "Acceptable?[Y/N]: ";
cin >> Accept;
if(Accept == 'Y' || Accept == 'y')
{
system("move gameconfig.txt bin\\gameconfig.txt");
}
fflush(stdin);
cout << "Press Enter To Exit...";
cin.get();
return 0;
}
Also, if you have any ideas for suggestions for optimization of my code i would love to hear it.


