This commit is contained in:
FluorescentCIAAfricanAmerican
2020-04-22 12:56:21 -04:00
commit 3bf9df6b27
15370 changed files with 5489726 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
char* szHeaderFile=
"//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========\n"\
"//\n"\
"// The copyright to the contents herein is the property of Valve, L.L.C.\n"\
"// The contents may be used and/or copied only with the written permission of\n"\
"// Valve, L.L.C., or in accordance with the terms and conditions stipulated in\n"\
"// the agreement/contract under which the contents have been supplied.\n"\
"//\n"\
"// Purpose: \n"\
"//\n"\
"// $Workfile: $\n"\
"// $Date: $\n"\
"//\n"\
"//------------------------------------------------------------------------------------------------------\n"\
"// $Log: $\n"\
"//\n"\
"// $NoKeywords: $\n"\
"//=============================================================================\n"\
"#ifndef BINARYRESOURCE_H\n"\
"#define BINARYRESOURCE_H\n"\
"#ifdef WIN32\n"\
"#pragma once\n"\
"#endif\n"\
"#include <string>\n"\
"#include <stdio.h>\n"\
"\n"\
"class CBinaryResource\n"\
"{\n"\
"private:\n"\
" std::string filename;\n"\
" size_t numBytes;\n"\
" unsigned char* pData;\n"\
"public:\n"\
" CBinaryResource(char* name, size_t bytes,unsigned char* data)\n"\
" :filename(name),numBytes(bytes),pData(data)\n"\
" {}\n"\
" \n"\
" bool writeOut()\n"\
" {\n"\
" FILE* f=fopen(filename.c_str(),\"wb\");\n"\
" if (!f)\n"\
" return false;\n"\
" fwrite(pData,1,numBytes,f);\n"\
" fclose(f);\n"\
" return true;\n"\
" }\n"\
"};\n"\
"\n"\
"#endif // BINARYRESOURCE_H\n"\
"\n";
+111
View File
@@ -0,0 +1,111 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define NUM_PER_LINE 40
extern char* szHeaderFile;
void printUsage()
{
printf("res2c <res file name> <c file name> <object name>\n");
}
char* id4filename(const char* filename)
{
static char id[500];
const char* read=filename;
char *write=id;
for (read;*read;read++)
{
//if first char
if (read==filename)
{
if (isalpha(*read) || *read=='_')
*write++=*read;
}
else if (isalnum(*read))
*write++=*read;
}
*write++='s';
*write++='r';
*write++='c';
*write++='\0';
return id;
}
void main(int argc, const char* argv[])
{
if (argc < 4)
{
printUsage();
return;
}
char cppname[200];
sprintf(cppname,"%s.cpp",argv[2]);
char hname[200];
sprintf(hname,"%s.h",argv[2]);
FILE* f=fopen(argv[1],"rb");
FILE* cppout=fopen(cppname,"at");
FILE* hout=fopen(hname,"at");
FILE* brheader=fopen("BinaryResource.h","wt");
if (!brheader){printf("couldn't open %s to write\n","BinaryResource.h");exit(-1);}
if (!f){printf("couldn't read %s\n",argv[1]);exit(-1);}
if (!cppout){printf("couldn't open %s to write\n",argv[2]);exit(-1);}
if (!hout){printf("couldn't open %s to write\n",argv[2]);exit(-1);}
fprintf(brheader,szHeaderFile);
fclose(brheader);
fprintf(cppout,"\nunsigned char %s[]={\n",id4filename(argv[1]));
int numLeft4Line=NUM_PER_LINE;
unsigned char c;
int result=fread(&c,sizeof(unsigned char),1,f);
int numbytes=0;
while (result)
{
//int longc=(*c)&0x000000ff;
fprintf(cppout,"0x%02.2x,",c);
numbytes++;
if(--numLeft4Line==0)
{
numLeft4Line=NUM_PER_LINE;
fprintf(cppout,"\n");
}
result=fread(&c,sizeof(unsigned char),1,f);
}
fprintf(cppout,"\n};\n\n");
char* coloncolon=strstr(argv[3],"::");
if (coloncolon!=NULL)
{
coloncolon+=2;
fprintf(hout,"static CBinaryResource %s;\n",coloncolon);
fprintf(cppout,"CBinaryResource %s(\"%s\",%li,%s);\n\n\n",argv[3],argv[1],numbytes,id4filename(argv[1]));
}
else
{
fprintf(hout,"//extern CBinaryResource g_%s;\n",argv[3]);
fprintf(cppout,"CBinaryResource g_%s;\n",argv[3]);
}
fclose(cppout);
fclose(hout);
fclose(f);
}
+152
View File
@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="res2c"
ProjectGUID="{3245AFA2-1569-4ED7-B378-3B6461B3F5BA}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/res2c.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Release/res2c.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/res2c.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/res2c.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/res2c.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Debug/res2c.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/res2c.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/res2c.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="main.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>