mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
fix windows compile, it's possible the linux build broke and will need misc tweaks. you need a new GtkR-1.6-deps.zip
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@227 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
parent
ceb4f7d969
commit
94199c49dc
9 changed files with 2403 additions and 695 deletions
|
@ -34,40 +34,31 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// NOTE TTimo
|
||||
// this goes along with str.h and provides various utility classes
|
||||
// and portability defines
|
||||
// the filename is a legecy issue, it would be better to clean that up
|
||||
// the file name (missing.h) is a legacy issue, it would be better to clean that up
|
||||
// in a central 'portability' lib
|
||||
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define MyCopyFile(a,b) CopyFile(a,b,FALSE)
|
||||
|
||||
#define S_ISDIR(mode) (mode & _S_IFDIR)
|
||||
#define R_OK 04
|
||||
#define mymkdir(a,b) _mkdir(a)
|
||||
|
||||
#else
|
||||
|
||||
#define MyCopyFile CopyFile
|
||||
#define mymkdir(a,b) mkdir(a,b)
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#else // !_WIN32
|
||||
|
||||
// LZ: very ugly hacks
|
||||
inline int GetLastError () { return 0; };
|
||||
inline int GetLastError() { return 0; };
|
||||
|
||||
// temp stuff
|
||||
inline int GetPrivateProfileInt(char* a, char* b, int i, char* c) { return i; };
|
||||
#define VERIFY(a) a;
|
||||
int GetFullPathName(const char *lpFileName, int nBufferLength, char *lpBuffer, char **lpFilePart);
|
||||
bool CopyFile(const char *lpExistingFileName, const char *lpNewFileName);
|
||||
bool CopyTree( const char* source, const char* dest );
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
|
@ -210,4 +201,33 @@ protected:
|
|||
};
|
||||
};
|
||||
|
||||
class FindFiles {
|
||||
public:
|
||||
FindFiles( const char *directory );
|
||||
~FindFiles();
|
||||
|
||||
const char* NextFile();
|
||||
private:
|
||||
#ifdef _WIN32
|
||||
Str directory;
|
||||
HANDLE findHandle;
|
||||
WIN32_FIND_DATA findFileData;
|
||||
#else
|
||||
#endif
|
||||
};
|
||||
|
||||
bool CopyTree( const char* source, const char* dest );
|
||||
|
||||
typedef enum {
|
||||
PATH_FAIL, // stat call failed (does not exist is likely)
|
||||
PATH_DIRECTORY,
|
||||
PATH_FILE
|
||||
} EPathCheck;
|
||||
|
||||
// check a path for existence, return directory / file
|
||||
EPathCheck CheckFile( const char *path );
|
||||
|
||||
bool radCreateDirectory( const char *directory );
|
||||
bool radCopyFile( const char *lpExistingFileName, const char *lpNewFileName );
|
||||
|
||||
#endif // _MISSING_H_
|
||||
|
|
|
@ -29,10 +29,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#define BMP_SIGNATURE_WORD 0x4d42
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned short bfType; // signature - 'BM'
|
||||
unsigned long bfSize; // file size in bytes
|
||||
|
@ -96,6 +95,6 @@ void FreeBMP(bitmap_t *bitmap);
|
|||
void WriteBMP(char *filename, bitmap_t *bit);
|
||||
void NewBMP(int width, int height, int bpp, bitmap_t *bit);
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,79 +1,245 @@
|
|||
<?xml version="1.0" ?><VisualStudioProject Name="image" ProjectGUID="{1F9977F6-216F-4AE1-9928-59B72CF31C46}" ProjectType="Visual C++" RootNamespace="image" Version="8.00">
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="image"
|
||||
ProjectGUID="{1F9977F6-216F-4AE1-9928-59B72CF31C46}"
|
||||
RootNamespace="image"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform Name="Win32"/>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration CharacterSet="2" ConfigurationType="2" IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)" Name="Debug|Win32" OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)\modules">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool"/>
|
||||
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" BasicRuntimeChecks="3" DebugInformationFormat="4" Detect64BitPortabilityProblems="true" DisableSpecificWarnings="4996;4244;4267" MinimalRebuild="true" Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="3" WarningLevel="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool AdditionalDependencies="jpeg6.lib synapse.lib libxml2.lib glib-2.0.lib gobject-2.0.lib" AdditionalLibraryDirectories=""$(SolutionDir)\..\libxml2\lib";"$(SolutionDir)\..\gtk2\lib";"$(SolutionDir)\build\$(ConfigurationName)\libs"" GenerateDebugInformation="true" ModuleDefinitionFile="image.def" Name="VCLinkerTool" TargetMachine="1"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)\modules"
|
||||
IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include""
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4996;4244;4267"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=" synapse.lib libxml2.lib glib-2.0.lib gobject-2.0.lib libjpeg.lib"
|
||||
AdditionalLibraryDirectories=""$(SolutionDir)\..\libxml2\lib";"$(SolutionDir)\..\gtk2\lib";"$(SolutionDir)\build\$(ConfigurationName)\libs";"$(SolutionDir)\..\jpeg-6b""
|
||||
ModuleDefinitionFile="image.def"
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration CharacterSet="2" ConfigurationType="2" IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)" Name="Release|Win32" OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)\modules" WholeProgramOptimization="1">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool"/>
|
||||
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DebugInformationFormat="3" Detect64BitPortabilityProblems="true" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="2" WarningLevel="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool AdditionalDependencies="jpeg6.lib synapse.lib libxml2.lib glib-2.0.lib gobject-2.0.lib" AdditionalLibraryDirectories=""$(SolutionDir)\..\libxml2\lib";"$(SolutionDir)\..\gtk2\lib";"$(SolutionDir)\build\$(ConfigurationName)\libs"" EnableCOMDATFolding="2" GenerateDebugInformation="true" ModuleDefinitionFile="image.def" Name="VCLinkerTool" OptimizeReferences="2" TargetMachine="1"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)\modules"
|
||||
IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include""
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4996;4244;4267"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="synapse.lib libxml2.lib glib-2.0.lib gobject-2.0.lib libjpeg.lib"
|
||||
AdditionalLibraryDirectories=""$(SolutionDir)\..\libxml2\lib";"$(SolutionDir)\..\gtk2\lib";"$(SolutionDir)\build\$(ConfigurationName)\libs";"$(SolutionDir)\..\jpeg-6b""
|
||||
ModuleDefinitionFile="image.def"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;f90;for;f;fpp" Name="Source Files">
|
||||
<File RelativePath=".\bmp.cpp">
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;f90;for;f;fpp"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\bmp.cpp"
|
||||
>
|
||||
</File>
|
||||
<File RelativePath=".\image.cpp">
|
||||
<File
|
||||
RelativePath=".\image.cpp"
|
||||
>
|
||||
</File>
|
||||
<File RelativePath=".\image.def">
|
||||
<File
|
||||
RelativePath=".\image.def"
|
||||
>
|
||||
</File>
|
||||
<File RelativePath=".\jpeg.cpp">
|
||||
<File
|
||||
RelativePath=".\jpeg.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\..\jpeg-6b""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\..\jpeg-6b""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath=".\lbmlib.cpp">
|
||||
<File
|
||||
RelativePath=".\lbmlib.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter Filter="h;hpp;hxx;hm;inl;fi;fd" Name="Header Files">
|
||||
<File RelativePath=".\bmp.h">
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;fi;fd"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\bmp.h"
|
||||
>
|
||||
</File>
|
||||
<File RelativePath=".\image.h">
|
||||
<File
|
||||
RelativePath=".\image.h"
|
||||
>
|
||||
</File>
|
||||
<File RelativePath="..\..\libs\jpeglib.h">
|
||||
<File
|
||||
RelativePath="..\..\libs\jpeglib.h"
|
||||
>
|
||||
</File>
|
||||
<File RelativePath=".\lbmlib.h">
|
||||
<File
|
||||
RelativePath=".\lbmlib.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" Name="Resource Files">
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
</VisualStudioProject>
|
||||
|
|
|
@ -34,14 +34,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// Leonardo Zide (leo@lokigames.com)
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
extern "C" {
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
}
|
||||
|
||||
#include "image.h"
|
||||
|
||||
|
|
|
@ -34,7 +34,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// Leonardo Zide (leo@lokigames.com)
|
||||
//
|
||||
|
||||
// FIXME: compile on Windows as well
|
||||
#include "missing.h"
|
||||
#include "qsysprintf.h"
|
||||
|
||||
#if defined (__linux__) || defined (__APPLE__)
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -44,10 +46,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include "missing.h"
|
||||
#include "qsysprintf.h"
|
||||
|
||||
bool CopyFile(const char *lpExistingFileName, const char *lpNewFileName)
|
||||
bool radCopyFile(const char *lpExistingFileName, const char *lpNewFileName)
|
||||
{
|
||||
FILE *src, *dst;
|
||||
void* buf;
|
||||
|
@ -85,7 +85,7 @@ bool CopyFile(const char *lpExistingFileName, const char *lpNewFileName)
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool CreateDirectory( const char *directory ) {
|
||||
bool radCreateDirectory( const char *directory ) {
|
||||
if ( mkdir( directory, 0777 ) == -1 ) {
|
||||
Sys_Printf( "mkdir %s failed\n", directory );
|
||||
return false;
|
||||
|
@ -93,53 +93,6 @@ bool CreateDirectory( const char *directory ) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CopyTree( const char *source, const char *dest ) {
|
||||
DIR *dir;
|
||||
struct dirent *dirlist;
|
||||
struct stat sbuf;
|
||||
Str srcEntry;
|
||||
Str dstEntry;
|
||||
|
||||
dir = opendir( source );
|
||||
if ( dir != NULL ) {
|
||||
while ( ( dirlist = readdir( dir ) ) != NULL ) {
|
||||
if ( strcmp( dirlist->d_name, "." ) == 0 || strcmp( dirlist->d_name, ".." ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
if ( strcmp( dirlist->d_name, ".svn" ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
srcEntry = source;
|
||||
srcEntry += "/";
|
||||
srcEntry += dirlist->d_name;
|
||||
dstEntry = dest;
|
||||
dstEntry += "/";
|
||||
dstEntry += dirlist->d_name;
|
||||
if ( stat( srcEntry.GetBuffer(), &sbuf ) == -1 ) {
|
||||
Sys_Printf( "stat %s failed\n", srcEntry.GetBuffer() );
|
||||
}
|
||||
if ( S_ISDIR( sbuf.st_mode ) ) {
|
||||
bool ret;
|
||||
if ( stat( dstEntry.GetBuffer(), &sbuf ) == -1 ) {
|
||||
ret = CreateDirectory( dstEntry.GetBuffer() );
|
||||
}
|
||||
ret = CopyTree( srcEntry.GetBuffer(), dstEntry.GetBuffer() );
|
||||
if ( !ret ) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
Sys_Printf( "copy %s -> %s\n", srcEntry.GetBuffer(), dstEntry.GetBuffer() );
|
||||
bool ret = CopyFile( srcEntry.GetBuffer(), dstEntry.GetBuffer() );
|
||||
if ( !ret ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir( dir );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int GetFullPathName(const char *lpFileName, int nBufferLength, char *lpBuffer, char **lpFilePart)
|
||||
{
|
||||
if (lpFileName[0] == '/')
|
||||
|
@ -178,4 +131,106 @@ int GetFullPathName(const char *lpFileName, int nBufferLength, char *lpBuffer, c
|
|||
return strlen (lpBuffer);
|
||||
}
|
||||
|
||||
EPathCheck CheckFile( const char *path ) {
|
||||
struct stat sbuf;
|
||||
if ( stat( path, &sbuf ) == -1 ) {
|
||||
return PATH_FAIL;
|
||||
}
|
||||
if ( S_ISDIR( sbuf.st_mode ) ) {
|
||||
return PATH_DIRECTORY;
|
||||
}
|
||||
return PATH_FILE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
FindFiles::FindFiles( const char *_directory ) {
|
||||
directory = _directory;
|
||||
findHandle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
FindFiles::~FindFiles() {
|
||||
if ( findHandle != NULL ) {
|
||||
FindClose( findHandle );
|
||||
}
|
||||
}
|
||||
|
||||
const char* FindFiles::NextFile() {
|
||||
if ( findHandle == INVALID_HANDLE_VALUE ) {
|
||||
findHandle = FindFirstFile( directory.GetBuffer(), &findFileData );
|
||||
if ( findHandle == INVALID_HANDLE_VALUE ) {
|
||||
return NULL;
|
||||
}
|
||||
return findFileData.cFileName;
|
||||
}
|
||||
if ( FindNextFile( findHandle, &findFileData ) == 0 ) {
|
||||
FindClose( findHandle );
|
||||
return NULL;
|
||||
}
|
||||
return findFileData.cFileName;
|
||||
}
|
||||
|
||||
EPathCheck CheckFile( const char *path ) {
|
||||
struct _stat sbuf;
|
||||
if ( _stat( path, &sbuf ) == -1 ) {
|
||||
return PATH_FAIL;
|
||||
}
|
||||
if ( ( sbuf.st_mode & _S_IFDIR ) != 0 ) {
|
||||
return PATH_DIRECTORY;
|
||||
}
|
||||
return PATH_FILE;
|
||||
}
|
||||
|
||||
bool radCreateDirectory( const char *directory ) {
|
||||
return CreateDirectory( directory, NULL );
|
||||
}
|
||||
|
||||
bool radCopyFile( const char *lpExistingFileName, const char *lpNewFileName ) {
|
||||
return CopyFile( lpExistingFileName, lpNewFileName, FALSE );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool CopyTree( const char *source, const char *dest ) {
|
||||
Str srcEntry;
|
||||
Str dstEntry;
|
||||
const char *dirname;
|
||||
FindFiles fileScan( source );
|
||||
|
||||
while ( ( dirname = fileScan.NextFile() ) != NULL ) {
|
||||
if ( strcmp( dirname, "." ) == 0 || strcmp( dirname, ".." ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
if ( strcmp( dirname, ".svn" ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
srcEntry = source;
|
||||
srcEntry += "/";
|
||||
srcEntry += dirname;
|
||||
dstEntry = dest;
|
||||
dstEntry += "/";
|
||||
dstEntry += dirname;
|
||||
switch ( CheckFile( srcEntry.GetBuffer() ) ) {
|
||||
case PATH_DIRECTORY: {
|
||||
if ( CheckFile( dstEntry.GetBuffer() ) == PATH_FAIL ) {
|
||||
radCreateDirectory( dstEntry.GetBuffer() );
|
||||
}
|
||||
bool ret;
|
||||
ret = CopyTree( srcEntry.GetBuffer(), dstEntry.GetBuffer() );
|
||||
if ( !ret ) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PATH_FILE: {
|
||||
Sys_Printf( "copy %s -> %s\n", srcEntry.GetBuffer(), dstEntry.GetBuffer() );
|
||||
bool ret = radCopyFile( srcEntry.GetBuffer(), dstEntry.GetBuffer() );
|
||||
if ( !ret ) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3282,24 +3282,18 @@ scan for active games that can be installed, based on the presence
|
|||
*/
|
||||
void CGameInstall::ScanGames() {
|
||||
Str pakPaths = g_strAppPath.GetBuffer();
|
||||
DIR *dir;
|
||||
struct dirent *dirlist;
|
||||
int iGame = 0;
|
||||
const char *dirname;
|
||||
|
||||
pakPaths += "installs/";
|
||||
dir = opendir( pakPaths.GetBuffer() );
|
||||
if ( dir != NULL ) {
|
||||
while ( ( dirlist = readdir( dir ) ) != NULL ) {
|
||||
if ( stricmp( dirlist->d_name, Q3_PACK ) == 0 ) {
|
||||
m_availGames[ iGame++ ] = GAME_Q3;
|
||||
}
|
||||
if ( stricmp( dirlist->d_name, URT_PACK ) == 0 ) {
|
||||
m_availGames[ iGame++ ] = GAME_URT;
|
||||
}
|
||||
if ( stricmp( dirlist->d_name, UFOAI_PACK ) == 0 ) {
|
||||
m_availGames[ iGame++ ] = GAME_UFOAI;
|
||||
}
|
||||
FindFiles fileScan( pakPaths.GetBuffer() );
|
||||
while ( ( dirname = fileScan.NextFile() ) != NULL ) {
|
||||
if ( stricmp( dirname, Q3_PACK ) == 0 ) {
|
||||
m_availGames[ iGame++ ] = GAME_Q3;
|
||||
}
|
||||
closedir( dir );
|
||||
if ( stricmp( dirname, URT_PACK ) == 0 ) {
|
||||
m_availGames[ iGame++ ] = GAME_URT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -36,9 +36,9 @@ void Save256Image (const char *name, byte *pixels, byte *palette,
|
|||
int width, int height);
|
||||
|
||||
|
||||
void LoadTGA (const char *filename, byte **pixels, int *width, int *height);
|
||||
void LoadTGABuffer ( byte *buffer, byte **pic, int *width, int *height);
|
||||
void WriteTGA (const char *filename, byte *data, int width, int height);
|
||||
|
||||
void Load32BitImage (const char *name, unsigned **pixels, int *width, int *height);
|
||||
void LoadTGA( const char *filename, byte **pixels, int *width, int *height );
|
||||
void LoadTGABuffer( byte *buffer, byte **pic, int *width, int *height );
|
||||
void WriteTGA( const char *filename, byte *data, int width, int height );
|
||||
int LoadJPGBuff( void *src_buffer, int src_size, unsigned char **pic, int *width, int *height );
|
||||
|
||||
void Load32BitImage( const char *name, unsigned **pixels, int *width, int *height );
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
|
@ -62,6 +63,8 @@
|
|||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="md5lib.lib ddslib.lib l_net.lib mathlib.lib picomodel.lib libxml2.lib libpng.lib glib-2.0.lib gobject-2.0.lib Wsock32.lib libjpeg.lib"
|
||||
AdditionalLibraryDirectories=""$(SolutionDir)\..\libxml2\lib";"$(SolutionDir)\..\gtk2\lib";"$(SolutionDir)\build\$(ConfigurationName)\libs";"$(SolutionDir)\..\jpeg-6b""
|
||||
IgnoreAllDefaultLibraries="false"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue