Add FTagData tool so QuickTime movies use the same FS format as everything else

This commit is contained in:
elasota
2019-12-12 23:36:45 -05:00
parent e368cf7235
commit f7335a2c8b
5 changed files with 277 additions and 1 deletions

View File

@@ -21,5 +21,21 @@ x64\Release\hqx2gp.exe "GpApp2\Houses\SpacePods.binhex" "Packaged\Houses\SpacePo
x64\Release\hqx2gp.exe "GpApp2\Houses\Teddy World.binhex" "Packaged\Houses\Teddy World"
x64\Release\hqx2gp.exe "GpApp2\Houses\The Asylum Pro.binhex" "Packaged\Houses\The Asylum Pro"
x64\Release\hqx2gp.exe "GpApp2\Houses\Titanic.binhex" "Packaged\Houses\Titanic"
copy /Y "GpApp2\Houses\*.mov" "Packaged\Houses"
x64\Release\FTagData.exe "GpApp2\Houses\Art Museum.mov", "Packaged\Houses\Art Museum.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Castle o' the Air.mov", "Packaged\Houses\Castle o' the Air.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\CD Demo House.mov", "Packaged\Houses\CD Demo House.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Davis Station.mov", "Packaged\Houses\Davis Station.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Demo House.mov", "Packaged\Houses\Demo House.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Grand Prix.mov", "Packaged\Houses\Grand Prix.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\ImagineHouse PRO II.mov", "Packaged\Houses\ImagineHouse PRO II.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Land of Illusion.mov", "Packaged\Houses\Land of Illusion.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Leviathan.mov", "Packaged\Houses\Leviathan.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Nemo's Market.mov", "Packaged\Houses\Nemo's Market.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Rainbow's End.mov", "Packaged\Houses\Rainbow's End.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Slumberland.mov", "Packaged\Houses\Slumberland.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\SpacePods.mov", "Packaged\Houses\SpacePods.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Teddy World.mov", "Packaged\Houses\Teddy World.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GpApp2\Houses\Titanic.mov", "Packaged\Houses\Titanic.mov" MooV ozm5 0 0 locked
pause

96
FTagData/FTagData.cpp Normal file
View File

@@ -0,0 +1,96 @@
#include <stdio.h>
#include <string>
#include <Windows.h>
#include "MacFileInfo.h"
int main(int argc, const char **argv)
{
if (argc < 7)
{
fprintf(stderr, "FTagData <input> <output> <file type ID> <file creator ID> <x pos> <y pos> [flags]");
return -1;
}
std::string inPath = argv[1];
std::string outPath = argv[2];
if (strlen(argv[3]) != 4)
{
fprintf(stderr, "File type ID must be 4 characters");
return -2;
}
if (strlen(argv[4]) != 4)
{
fprintf(stderr, "File creator ID must be 4 characters");
return -3;
}
FILETIME currentTime;
GetSystemTimeAsFileTime(&currentTime);
SYSTEMTIME epochStart;
epochStart.wYear = 1904;
epochStart.wMonth = 1;
epochStart.wDayOfWeek = 5;
epochStart.wDay = 1;
epochStart.wHour = 0;
epochStart.wMinute = 0;
epochStart.wSecond = 0;
epochStart.wMilliseconds = 0;
FILETIME epochStartFT;
SystemTimeToFileTime(&epochStart, &epochStartFT);
int64_t epochStart64 = (static_cast<int64_t>(epochStartFT.dwLowDateTime) & 0xffffffff) | (static_cast<int64_t>(epochStartFT.dwHighDateTime) << 32);
int64_t currentTime64 = (static_cast<int64_t>(currentTime.dwLowDateTime) & 0xffffffff) | (static_cast<int64_t>(currentTime.dwHighDateTime) << 32);
int64_t timeDelta = (currentTime64 - epochStart64) / 10000000;
PortabilityLayer::MacFileProperties mfp;
memcpy(mfp.m_fileType, argv[3], 4);
memcpy(mfp.m_fileCreator, argv[4], 4);
mfp.m_xPos = atoi(argv[5]);
mfp.m_yPos = atoi(argv[6]);
mfp.m_finderFlags = 0;
mfp.m_protected = 0;
mfp.m_modifiedDate = mfp.m_creationDate = static_cast<uint32_t>(timeDelta & 0xffffffff);
for (int i = 7; i < argc; i++)
{
const char *arg = argv[i];
if (!strcmp(arg, "locked"))
mfp.m_finderFlags |= PortabilityLayer::FINDER_FILE_FLAG_LOCKED;
else if (!strcmp(arg, "invisible"))
mfp.m_finderFlags |= PortabilityLayer::FINDER_FILE_FLAG_INVISIBLE;
else if (!strcmp(arg, "bundle"))
mfp.m_finderFlags |= PortabilityLayer::FINDER_FILE_FLAG_BUNDLE;
else if (!strcmp(arg, "system"))
mfp.m_finderFlags |= PortabilityLayer::FINDER_FILE_FLAG_SYSTEM;
else if (!strcmp(arg, "copyprotected"))
mfp.m_finderFlags |= PortabilityLayer::FINDER_FILE_FLAG_COPY_PROTECTED;
else if (!strcmp(arg, "busy"))
mfp.m_finderFlags |= PortabilityLayer::FINDER_FILE_FLAG_BUSY;
else if (!strcmp(arg, "changed"))
mfp.m_finderFlags |= PortabilityLayer::FINDER_FILE_FLAG_CHANGED;
else if (!strcmp(arg, "inited"))
mfp.m_finderFlags |= PortabilityLayer::FINDER_FILE_FLAG_INITED;
}
std::string gpdPath = outPath + ".gpd";
CopyFile(inPath.c_str(), gpdPath.c_str(), 0);
PortabilityLayer::MacFilePropertiesSerialized mps;
mps.Serialize(mfp);
std::string gpfPath = outPath + ".gpf";
FILE *file = nullptr;
errno_t err = fopen_s(&file, gpfPath.c_str(), "wb");
if (!err)
{
fwrite(mps.m_data, PortabilityLayer::MacFilePropertiesSerialized::kSize, 1, file);
fclose(file);
}
return 0;
}

132
FTagData/FTagData.vcxproj Normal file
View File

@@ -0,0 +1,132 @@
<?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="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}</ProjectGuid>
<RootNamespace>FTagData</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\PortabilityLayer\PortabilityLayer.vcxproj">
<Project>{6ec62b0f-9353-40a4-a510-3788f1368b33}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="FTagData.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="FTagData.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -19,6 +19,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PictChecker", "PictChecker\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GpAudioDriver_XAudio2", "GpAudioDriver_XAudio2\GpAudioDriver_XAudio2.vcxproj", "{E3BDC783-8646-433E-ADF0-8B6390D36669}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FTagData", "FTagData\FTagData.vcxproj", "{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -91,6 +93,14 @@ Global
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Release|x64.Build.0 = Release|x64
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Release|x86.ActiveCfg = Release|Win32
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Release|x86.Build.0 = Release|Win32
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Debug|x64.ActiveCfg = Debug|x64
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Debug|x64.Build.0 = Debug|x64
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Debug|x86.ActiveCfg = Debug|Win32
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Debug|x86.Build.0 = Debug|Win32
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Release|x64.ActiveCfg = Release|x64
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Release|x64.Build.0 = Release|x64
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Release|x86.ActiveCfg = Release|Win32
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE