port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

View File

@@ -0,0 +1 @@
pngopt *.png

Binary file not shown.

View File

@@ -0,0 +1 @@
Manifest resource last updated at 20:38:31,40 on 05.06.2009

View File

@@ -0,0 +1,3 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
</assembly>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,230 @@
/*
** Haaf's Game Engine 1.81
** Copyright (C) 2003-2008, Relish Games
** hge.relishgames.com
**
** PNG Images Optimizer
*/
#include "pngopt.h"
#include <fstream>
#include <vector>
HGE *hge = 0;
struct color
{
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char a;
};
struct filelist
{
char filename[256];
filelist* next;
};
filelist *files=0;
bool convert(char *filename);
int main(int argc, char* argv[])
{
HANDLE hSearch;
WIN32_FIND_DATA SearchData;
int nfiles=0;
bool done=false;
char *buf, filename[512];
filelist *newFile, *nextFile;
printf("\nBlaPic\nby TGGC\n\n");
if(argc!=2)
{
printf("Usage: Bla.EXE <wildcard>\n\n");
printf("makes datablocks...\n");
return 0;
}
else
{
hSearch=FindFirstFile(argv[1], &SearchData);
nextFile=0;
for(;;)
{
if(hSearch==INVALID_HANDLE_VALUE || done)
{
FindClose(hSearch);
break;
}
if(!(SearchData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
strcpy_s(filename, argv[1]);
buf=strrchr(filename, '\\');
if(!buf) buf=filename; else buf++;
strcpy_s(buf,256, SearchData.cFileName);
newFile=new filelist;
strcpy_s(newFile->filename,filename);
newFile->next=0;
if(nextFile) nextFile->next=newFile;
else files=newFile;
nextFile=newFile;
}
done=!FindNextFile(hSearch, &SearchData);
}
hge=hgeCreate(HGE_VERSION);
hge->System_SetState(HGE_USESOUND, false);
hge->System_SetState(HGE_WINDOWED, true);
hge->System_SetState(HGE_SCREENWIDTH, 320);
hge->System_SetState(HGE_SCREENHEIGHT, 200);
hge->System_SetState(HGE_SHOWSPLASH, false);
if(!hge->System_Initiate())
{
hge->Release();
printf("\nCan't initiate HGE.\n\n",nfiles);
return 0;
}
newFile=files;
while(newFile)
{
if(convert(newFile->filename)) nfiles++;
nextFile=newFile->next;
delete newFile;
newFile=nextFile;
}
hge->System_Shutdown();
hge->Release();
printf("\n%d image(s) successfully optimized.\n\n",nfiles);
return 0;
}
}
bool convert(char *filename)
{
HTEXTURE tex;
int width, height, pitch;
color *buf;
printf("%s - ", filename);
tex = hge->Texture_Load(filename);
if(!tex) { printf("Can't load texture.\n"); return false; }
width = hge->Texture_GetWidth(tex, true);
height = hge->Texture_GetHeight(tex, true);
pitch = hge->Texture_GetWidth(tex, false);
buf=(color *)hge->Texture_Lock(tex, false);
if(!buf) { printf("Can't lock texture.\n"); return false; }
std::vector< bool > vecData;
for( int i=0; i<height; i++)
{
for( int j=0; j<width; j++)
{
vecData.push_back( buf[i*pitch+j].r + buf[i*pitch+j].g + buf[i*pitch+j].b < 3 * 127 );
}
}
std::vector< int > vecPixelY;
std::vector< int > vecPixelX;
vecPixelY.resize( height );
vecPixelX.resize( width );
for( int i=0; i<height; i++)
{
for( int j=0; j<width; j++)
{
if( vecData[ i*width+j ] )
{
vecPixelY[ i ]++;
vecPixelX[ j ]++;
}
}
}
int iStartX= 0;
int iLastX= width - 1;
int iStartY= 0;
int iLastY= height - 1;
while( vecPixelX[ iStartX ] == 0 && iStartX <= iLastX )
{
iStartX++;
}
while( vecPixelX[ iLastX ] == 0 && iStartX <= iLastX )
{
iLastX--;
}
while( vecPixelY[ iStartY ] == 0 && iStartY <= iLastY )
{
iStartY++;
}
while( vecPixelY[ iLastY ] == 0 && iStartY <= iLastY )
{
iLastY--;
}
std::string str( filename );
str= str.substr( 0, str.length() - 4 );
std::string strFile= "..\\";
strFile+= str;
strFile+= ".h";
int iOutWidth= 1 + iLastX - iStartX;
int iOutHeight= 1 + iLastY - iStartY;
if( iOutWidth > 255 || iOutHeight > 255 )
{
printf("too large.\n");
return false;
}
std::ofstream ofs( strFile.c_str() );
ofs << "const unsigned char g_" << str.c_str() << "[]=\n";
ofs << "{\n";
ofs << "\t" << iOutWidth << "," << iOutHeight << ",\n";
int iBitted= 0;
int iCount= 0;
for( int i= iStartY; i <= iLastY; i++)
{
for( int j= iStartX; j<= iLastX; j++)
{
iBitted+= vecData[ i*width+j ] ? 1 : 0;
if( iCount % 8 == 7 || iCount + 1 == iOutWidth * iOutHeight )
{
while( iCount % 8 < 7 )
{
iBitted*= 2;
iCount++;
}
ofs << "\t" << iBitted << ",\n";
iBitted= 0;
}
iBitted*= 2;
iCount++;
}
}
ofs << "};\n";
hge->Texture_Unlock(tex);
printf("Ok\n");
return true;
}

Binary file not shown.

View File

@@ -0,0 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <hge.h>
extern HGE *hge;

View File

@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pngopt", "pngopt.vcproj", "{7A8D19F0-1D9B-40CB-8100-E5FA239B557B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7A8D19F0-1D9B-40CB-8100-E5FA239B557B}.Debug|Win32.ActiveCfg = Debug|Win32
{7A8D19F0-1D9B-40CB-8100-E5FA239B557B}.Debug|Win32.Build.0 = Debug|Win32
{7A8D19F0-1D9B-40CB-8100-E5FA239B557B}.Release|Win32.ActiveCfg = Release|Win32
{7A8D19F0-1D9B-40CB-8100-E5FA239B557B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,243 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="pngopt"
ProjectGUID="{7A8D19F0-1D9B-40CB-8100-E5FA239B557B}"
RootNamespace="pngopt"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/pngopt.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\hge181\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\Release/pngopt.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1049"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="hge.lib"
OutputFile="./pngopt.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\hge181\lib\vc"
ProgramDatabaseFile=".\Release/pngopt.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/pngopt.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/pngopt.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\hge181\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/pngopt.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1049"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="hge.lib"
OutputFile=".\pngopt_deb.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\hge181\lib\vc"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/pngopt.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/pngopt.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="pngopt.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="pngopt.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="8,00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="PM750"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments="*.png"
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="PM750"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor="0"
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB