Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit f2d940131e
16886 changed files with 4659320 additions and 2 deletions

127
Src/gif/GIFLoader.cpp Normal file
View File

@ -0,0 +1,127 @@
#include "GIFLoader.h"
#include "api__gif.h"
#include <wchar.h>
#include <bfc/platform/strcmp.h>
extern "C" {
#include "../giflib/gif_lib.h"
};
static bool StringEnds(const wchar_t *a, const wchar_t *b)
{
size_t aLen = wcslen(a);
size_t bLen = wcslen(b);
if (aLen < bLen) return false; // too short
return !_wcsicmp(a + aLen - bLen, b);
}
int GIFLoader::isMine(const wchar_t *filename)
{
return (filename && StringEnds(filename, L".GIF"));
}
int GIFLoader::getHeaderSize()
{
return 3;
}
const wchar_t *GIFLoader::mimeType()
{
return L"image/gif";
}
int GIFLoader::testData(const void *data, int datalen)
{
if(datalen >= 3 && strncmp((const char*)data,"GIF",3)==0) return 1;
return 0;
}
typedef struct {
BYTE * data;
int len;
} readStruct;
extern "C" int myreader(GifFileType *gif, GifByteType *data, int len) {
readStruct* r = (readStruct*)gif->UserData;
int l = min(len,r->len);
if(l == 0) return 0;
memcpy(data,r->data,l);
r->len -= l;
r->data += l;
return l;
}
ARGB32 *GIFLoader::loadImage(const void *datain, int datalen, int *w, int *h, ifc_xmlreaderparams *params)
{
readStruct read = {(BYTE*)datain,datalen};
int* l_error = NULL;
GifFileType * gif = DGifOpen(&read, myreader, l_error);
if(!gif) return 0;
if(!DGifSlurp(gif) || !gif->ImageCount) { DGifCloseFile(gif, l_error); return 0; }
ColorMapObject *map = gif->SColorMap;
if(!map) map = gif->SavedImages[0].ImageDesc.ColorMap;
if(!map) { DGifCloseFile(gif, l_error); return 0; }
int iw = gif->SavedImages[0].ImageDesc.Width;
int ih = gif->SavedImages[0].ImageDesc.Height;
if(w) *w = iw;
if(h) *h = ih;
ARGB32 * data = (ARGB32 *)WASABI_API_MEMMGR->sysMalloc(iw * ih * sizeof(ARGB32));
ARGB32 * p = data;
ARGB32 * end = data + (iw * ih);
GifPixelType *line = gif->SavedImages[0].RasterBits;
if(gif->SavedImages[0].ImageDesc.Interlace)
{
// The way Interlaced image should be read - offsets and jumps...
const int InterlacedOffset[] = { 0, 4, 2, 1 };
const int InterlacedJumps[] = { 8, 8, 4, 2 };
for(int i = 0; i < 4; i++)
{
for(int j = InterlacedOffset[i]; j < ih; j += InterlacedJumps[i])
{
p = &data[j*iw];
for(int k = 0; k<iw; k++)
{
int px = *(line++);
if(px < map->ColorCount && (px != gif->SBackGroundColor || px == 0)) {
GifColorType& color = map->Colors[px];
*(p++) = 0xff000000 | color.Blue | (color.Green << 8) | (color.Red << 16);
} else
*(p++) = 0;
}
}
}
}
else
{
while(p < end) {
int px = *(line++);
if(px < map->ColorCount && (px != gif->SBackGroundColor || px == 0)) {
GifColorType& color = map->Colors[px];
*(p++) = 0xff000000 | color.Blue | (color.Green << 8) | (color.Red << 16);
} else
*(p++) = 0;
}
}
DGifCloseFile(gif, l_error);
return data;
}
#define CBCLASS GIFLoader
START_DISPATCH;
CB(ISMINE, isMine);
CB(MIMETYPE, mimeType);
CB(TESTDATA, testData);
CB(GETHEADERSIZE, getHeaderSize);
CB(GETDIMENSIONS, getDimensions);
CB(LOADIMAGE, loadImage);
CB(LOADIMAGEDATA, loadImageData);
END_DISPATCH;
#undef CBCLASS

23
Src/gif/GIFLoader.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef NULLSOFT_PNG_PNGLOADER_H
#define NULLSOFT_PNG_PNGLOADER_H
#include <api/service/svcs/svc_imgload.h>
class ifc_xmlreaderparams;
class GIFLoader : public svc_imageLoader
{
public:
// service
static const char *getServiceName() { return "GIF loader"; }
virtual int isMine(const wchar_t *filename);
virtual const wchar_t *mimeType();
virtual int getHeaderSize();
virtual int testData(const void *data, int datalen);
virtual ARGB32 *loadImage(const void *data, int datalen, int *w, int *h, ifc_xmlreaderparams *params=NULL);
protected:
RECVS_DISPATCH;
};
#endif

127
Src/gif/GIFWriter.cpp Normal file
View File

@ -0,0 +1,127 @@
#include "GIFWriter.h"
#include "api__gif.h"
#include <wchar.h>
#include <bfc/platform/strcmp.h>
extern "C" {
#include "gif_lib.h"
};
// valid items include "quality" for jpeg files with value "0" to "100"
// return value is 1 if the config item is supported, 0 if it is not.
int GIFWriter::setConfig(const wchar_t * item, const wchar_t * value) {
return 0; // no config yet
}
// valid items include "quality" for jpeg files with value "0" to "100", "lossless" returns "1" if it is "0" otherwise
// return value is 1 if the config item is supported, 0 if it is not.
int GIFWriter::getConfig(const wchar_t * item, wchar_t * value, int valuelen) {
if(!_wcsicmp(item,L"lossless")) lstrcpynW(value,L"0",valuelen);
else return 0;
return 1;
}
// returns 1 if the bit depth is supported (eg 32 for ARGB32, 24 for RGB24)
// ARGB32 MUST be supported
int GIFWriter::bitDepthSupported(int depth) {
if(depth == 32 || depth == 24) return 1;
return 0;
}
typedef struct {
BYTE * data;
unsigned int len;
unsigned int alloc;
} writeStruct;
extern "C" int MyOutputFunc(GifFileType * gif, const GifByteType * data, int len) {
writeStruct * p = (writeStruct *)gif->UserData;
while (len + p->len > p->alloc) { // allocate more memory
int d = ((p->alloc / 4) & 0xffffff00) + 0x100;
if(d < 4096) d = 4096;
p->alloc+=d;
p->data = (BYTE*)WASABI_API_MEMMGR->sysRealloc(p->data,p->alloc);
}
memcpy(p->data+p->len,data,len);
p->len += len;
return len;
}
// returns the image in our format, free the returned buffer with api_memmgr::sysFree()
void * GIFWriter::convert(const void *pixels, int bitDepth, int w, int h, int *length) {
// split into planes
BYTE *redplane, *blueplane, *greenplane;
redplane = (BYTE *)malloc(w*h*sizeof(BYTE));
greenplane = (BYTE *)malloc(w*h*sizeof(BYTE));
blueplane = (BYTE *)malloc(w*h*sizeof(BYTE));
BYTE * px = (BYTE *)pixels;
BYTE * end = px + (w * h * (bitDepth/8));
int i=0;
if(bitDepth == 24) {
while(px < end) {
blueplane[i] = *(px++);
greenplane[i] = *(px++);
redplane[i] = *(px++);
i++;
}
} else if(bitDepth == 32) {
while(px < end) {
blueplane[i] = *(px++);
greenplane[i] = *(px++);
redplane[i] = *(px++);
px++;
i++;
}
}
// make a color map
int colormapsize = 256;
ColorMapObject * OutputColorMap = GifMakeMapObject(colormapsize, NULL);
BYTE* OutputBuffer = (GifByteType *) malloc(w * h * sizeof(GifByteType));
// this is actually kinda crappy
GifQuantizeBuffer(w,h,&colormapsize,redplane,greenplane,blueplane,OutputBuffer,OutputColorMap->Colors);
unsigned int alloc = ((w*h / 3) & 0xffffff00) + 0x100; // guess at output file size
if(alloc < 4096) alloc = 4096;
writeStruct write = {(BYTE*)WASABI_API_MEMMGR->sysMalloc(alloc),0,alloc};
bool succeeded=false;
// write the file out
int* l_error = NULL;
GifFileType *gif = EGifOpen(&write,MyOutputFunc, l_error);
if(gif) {
if(EGifPutScreenDesc(gif,w, h, 8, 0, OutputColorMap)) {
if(EGifPutImageDesc(gif, 0, 0, w, h, FALSE, NULL)) {
BYTE * p = OutputBuffer;
succeeded=true;
for (int i = 0; i < h; i++) {
if(!EGifPutLine(gif, p, w)) {succeeded=false; break;}
p+=w;
}
}
}
EGifCloseFile(gif, l_error);
}
// done!
free(OutputBuffer);
free(redplane);
free(greenplane);
free(blueplane);
if(succeeded) {
*length = write.len;
return write.data;
} else return 0;
}
#define CBCLASS GIFWriter
START_DISPATCH;
CB(GETIMAGETYPENAME, getImageTypeName);
CB(GETEXTENSIONS, getExtensions);
CB(SETCONFIG, setConfig);
CB(GETCONFIG, getConfig);
CB(BITDEPTHSUPPORTED, bitDepthSupported);
CB(CONVERT, convert);
END_DISPATCH;
#undef CBCLASS

21
Src/gif/GIFWriter.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef NULLSOFT_BMP_BMPWRITER_H
#define NULLSOFT_BMP_BMPWRITER_H
#include <api/service/svcs/svc_imgwrite.h>
class ifc_xmlreaderparams;
class GIFWriter : public svc_imageWriter
{
public:
static const char *getServiceName() { return "GIF loader"; }
const wchar_t * getImageTypeName() { return L"GIF"; }
const wchar_t * getExtensions() { return L"gif"; }
int setConfig(const wchar_t * item, const wchar_t * value);
int getConfig(const wchar_t * item, wchar_t * value, int valuelen);
int bitDepthSupported(int depth);
void * convert(const void *pixels, int bitDepth, int w, int h, int *length);
protected:
RECVS_DISPATCH;
};
#endif

39
Src/gif/MyFactory.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef _MYFACTORY_H_
#define _MYFACTORY_H_
#include "api__gif.h"
#include <api/service/waservicefactory.h>
#include <api/service/services.h>
template <class T, class Base>
class MyFactory : public waServiceFactory
{
public:
MyFactory(GUID guid) : guid(guid) {}
FOURCC GetServiceType() { return T::getServiceType(); }
const char *GetServiceName() { return T::getServiceName(); }
GUID GetGUID() { return guid; }
void *GetInterface(int global_lock) { return (Base*)new T; }
int SupportNonLockingInterface() {return 1;}
int ReleaseInterface(void *ifc) { delete static_cast<T *>(static_cast<Base *>(ifc)); return 1; }
const char *GetTestString() {return 0;}
int ServiceNotify(int msg, int param1, int param2) {return 1;}
private:
GUID guid;
protected:
#define CBCLASS MyFactory
START_DISPATCH_INLINE;
CB(WASERVICEFACTORY_GETSERVICETYPE, GetServiceType)
CB(WASERVICEFACTORY_GETSERVICENAME, GetServiceName)
CB(WASERVICEFACTORY_GETGUID, GetGUID)
CB(WASERVICEFACTORY_GETINTERFACE, GetInterface)
CB(WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, SupportNonLockingInterface)
CB(WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface)
CB(WASERVICEFACTORY_GETTESTSTRING, GetTestString)
CB(WASERVICEFACTORY_SERVICENOTIFY, ServiceNotify)
END_DISPATCH;
#undef CBCLASS
//RECVS_DISPATCH;
};
#endif

12
Src/gif/api__gif.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef NULLSOFT_APIH
#define NULLSOFT_APIH
#include <api/service/api_service.h>
extern api_service *serviceManager;
#define WASABI_API_SVC serviceManager
#include <api/memmgr/api_memmgr.h>
extern api_memmgr *memoryManager;
#define WASABI_API_MEMMGR memoryManager
#endif

76
Src/gif/gif.rc Normal file
View File

@ -0,0 +1,76 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#include ""version.rc2""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "version.rc2"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

44
Src/gif/gif.sln Normal file
View File

@ -0,0 +1,44 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29424.173
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gif", "gif.vcxproj", "{6D9F176A-AA8B-45D1-B75D-F55F5D5BEA18}"
ProjectSection(ProjectDependencies) = postProject
{BD6EA0EE-C183-4240-BCE6-487FA2EE792D} = {BD6EA0EE-C183-4240-BCE6-487FA2EE792D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "giflib", "..\giflib\giflib.vcxproj", "{BD6EA0EE-C183-4240-BCE6-487FA2EE792D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6D9F176A-AA8B-45D1-B75D-F55F5D5BEA18}.Debug|Win32.ActiveCfg = Debug|Win32
{6D9F176A-AA8B-45D1-B75D-F55F5D5BEA18}.Debug|Win32.Build.0 = Debug|Win32
{6D9F176A-AA8B-45D1-B75D-F55F5D5BEA18}.Debug|x64.ActiveCfg = Debug|x64
{6D9F176A-AA8B-45D1-B75D-F55F5D5BEA18}.Debug|x64.Build.0 = Debug|x64
{6D9F176A-AA8B-45D1-B75D-F55F5D5BEA18}.Release|Win32.ActiveCfg = Release|Win32
{6D9F176A-AA8B-45D1-B75D-F55F5D5BEA18}.Release|Win32.Build.0 = Release|Win32
{6D9F176A-AA8B-45D1-B75D-F55F5D5BEA18}.Release|x64.ActiveCfg = Release|x64
{6D9F176A-AA8B-45D1-B75D-F55F5D5BEA18}.Release|x64.Build.0 = Release|x64
{BD6EA0EE-C183-4240-BCE6-487FA2EE792D}.Debug|Win32.ActiveCfg = Debug|Win32
{BD6EA0EE-C183-4240-BCE6-487FA2EE792D}.Debug|Win32.Build.0 = Debug|Win32
{BD6EA0EE-C183-4240-BCE6-487FA2EE792D}.Debug|x64.ActiveCfg = Debug|x64
{BD6EA0EE-C183-4240-BCE6-487FA2EE792D}.Debug|x64.Build.0 = Debug|x64
{BD6EA0EE-C183-4240-BCE6-487FA2EE792D}.Release|Win32.ActiveCfg = Release|Win32
{BD6EA0EE-C183-4240-BCE6-487FA2EE792D}.Release|Win32.Build.0 = Release|Win32
{BD6EA0EE-C183-4240-BCE6-487FA2EE792D}.Release|x64.ActiveCfg = Release|x64
{BD6EA0EE-C183-4240-BCE6-487FA2EE792D}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7BEDD2A3-796F-482E-A66C-A41DE18A1B90}
EndGlobalSection
EndGlobal

274
Src/gif/gif.vcxproj Normal file
View File

@ -0,0 +1,274 @@
<?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="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6D9F176A-AA8B-45D1-B75D-F55F5D5BEA18}</ProjectGuid>
<RootNamespace>gif</RootNamespace>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<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'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<TargetExt>.w5s</TargetExt>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<TargetExt>.w5s</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<TargetExt>.w5s</TargetExt>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<TargetExt>.w5s</TargetExt>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>false</VcpkgEnableManifest>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgConfiguration>Debug</VcpkgConfiguration>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
<VcpkgConfiguration>Debug</VcpkgConfiguration>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\Wasabi;..\external_dependencies\giflib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;GIF_EXPORTS;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(ProjectDir)x86_Debug\$(ProjectName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\Wasabi;..\external_dependencies\giflib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;GIF_EXPORTS;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(ProjectDir)x64_Debug\$(ProjectName).lib</ImportLibrary>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\
xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\Wasabi;..\external_dependencies\giflib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GIF_EXPORTS;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(ProjectDir)x86_Release\$(ProjectName).lib</ImportLibrary>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\Wasabi;..\external_dependencies\giflib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;GIF_EXPORTS;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(ProjectDir)x64_Release\$(ProjectName).lib</ImportLibrary>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ </Command>
<Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\'</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\external_dependencies\giflib\giflib.vcxproj">
<Project>{bd6ea0ee-c183-4240-bce6-487fa2ee792d}</Project>
</ProjectReference>
<ProjectReference Include="..\Wasabi\Wasabi.vcxproj">
<Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="GIFLoader.cpp" />
<ClCompile Include="GIFWriter.cpp" />
<ClCompile Include="wa5_gif.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Wasabi\api\service\svcs\svc_imgload.h" />
<ClInclude Include="..\Wasabi\api\service\svcs\svc_imgwrite.h" />
<ClInclude Include="api__gif.h" />
<ClInclude Include="GIFLoader.h" />
<ClInclude Include="GIFWriter.h" />
<ClInclude Include="MyFactory.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="wa5_gif.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="gif.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="GIFLoader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GIFWriter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="wa5_gif.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="api__gif.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GIFLoader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GIFWriter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MyFactory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Wasabi\api\service\svcs\svc_imgload.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Wasabi\api\service\svcs\svc_imgwrite.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="wa5_gif.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{b2bff060-80ed-4094-9c95-bc073a45bf10}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{b3c28696-444c-42f9-9a49-5edaeb056926}</UniqueIdentifier>
</Filter>
<Filter Include="Ressource Files">
<UniqueIdentifier>{ccc7110c-b952-4657-9d15-1887e625b6fe}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="gif.rc">
<Filter>Ressource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

14
Src/gif/resource.h Normal file
View File

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by gif.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

39
Src/gif/version.rc2 Normal file
View File

@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
#include "../Winamp/buildType.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION WINAMP_PRODUCTVER
PRODUCTVERSION WINAMP_PRODUCTVER
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Winamp SA"
VALUE "FileDescription", "Winamp 5.x System Component"
VALUE "FileVersion", STR_WINAMP_PRODUCTVER
VALUE "InternalName", "gif.w5s"
VALUE "LegalCopyright", "Copyright <20> 2005-2023 Winamp SA"
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
VALUE "OriginalFilename", "gif.w5s"
VALUE "ProductName", "Winamp GIF Image Service"
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

63
Src/gif/wa5_gif.cpp Normal file
View File

@ -0,0 +1,63 @@
#include "api__gif.h"
#include "wa5_gif.h"
#include <bfc/platform/export.h>
#include "MyFactory.h"
#include "GIFLoader.h"
#include "GIFWriter.h"
WA5_GIF wa5_gif;
// {1ED6714D-2478-45dd-A803-A193EE20B75D}
static const GUID gifWriterGUID =
{ 0x1ed6714d, 0x2478, 0x45dd, { 0xa8, 0x3, 0xa1, 0x93, 0xee, 0x20, 0xb7, 0x5d } };
// {4D724110-1E35-406f-8976-C1E9873E0C15}
static const GUID gifLoaderGUID =
{ 0x4d724110, 0x1e35, 0x406f, { 0x89, 0x76, 0xc1, 0xe9, 0x87, 0x3e, 0xc, 0x15 } };
MyFactory<GIFWriter, svc_imageWriter> gifWriteFactory(gifWriterGUID);
MyFactory<GIFLoader, svc_imageLoader> gifLoadFactory(gifLoaderGUID);
api_service *serviceManager=0;
api_memmgr *memoryManager=0;
void WA5_GIF::RegisterServices(api_service *service)
{
WASABI_API_SVC = service;
// get memory manager
waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(memMgrApiServiceGuid);
if (sf) memoryManager = reinterpret_cast<api_memmgr *>(sf->getInterface());
WASABI_API_SVC->service_register(&gifLoadFactory);
WASABI_API_SVC->service_register(&gifWriteFactory);
}
int WA5_GIF::RegisterServicesSafeModeOk()
{
return 1;
}
void WA5_GIF::DeregisterServices(api_service *service)
{
service->service_deregister(&gifWriteFactory);
service->service_deregister(&gifLoadFactory);
waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(memMgrApiServiceGuid);
if (sf) sf->releaseInterface(memoryManager);
}
extern "C" DLLEXPORT ifc_wa5component *GetWinamp5SystemComponent()
{
return &wa5_gif;
}
#define CBCLASS WA5_GIF
START_DISPATCH;
VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices)
CB(15, RegisterServicesSafeModeOk)
VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices)
END_DISPATCH;
#undef CBCLASS

15
Src/gif/wa5_gif.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef __WASABI_WA5_GIF_H
#define __WASABI_WA5_GIF_H
#include "../Agave/Component/ifc_wa5component.h"
class WA5_GIF : public ifc_wa5component
{
public:
void RegisterServices(api_service *service);
int RegisterServicesSafeModeOk();
void DeregisterServices(api_service *service);
protected:
RECVS_DISPATCH;
};
#endif