From f7335a2c8b9dee7c8bf6abe767c75c19a494b2e8 Mon Sep 17 00:00:00 2001 From: elasota Date: Thu, 12 Dec 2019 23:36:45 -0500 Subject: [PATCH] Add FTagData tool so QuickTime movies use the same FS format as everything else --- ConvertResources.bat | 18 +++- FTagData/FTagData.cpp | 96 ++++++++++++++++++++++ FTagData/FTagData.vcxproj | 132 ++++++++++++++++++++++++++++++ FTagData/FTagData.vcxproj.filters | 22 +++++ GlidePort.sln | 10 +++ 5 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 FTagData/FTagData.cpp create mode 100644 FTagData/FTagData.vcxproj create mode 100644 FTagData/FTagData.vcxproj.filters diff --git a/ConvertResources.bat b/ConvertResources.bat index bf1c423..85ecee4 100644 --- a/ConvertResources.bat +++ b/ConvertResources.bat @@ -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 diff --git a/FTagData/FTagData.cpp b/FTagData/FTagData.cpp new file mode 100644 index 0000000..1e58408 --- /dev/null +++ b/FTagData/FTagData.cpp @@ -0,0 +1,96 @@ +#include +#include +#include +#include "MacFileInfo.h" + +int main(int argc, const char **argv) +{ + if (argc < 7) + { + fprintf(stderr, "FTagData [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(¤tTime); + + 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(epochStartFT.dwLowDateTime) & 0xffffffff) | (static_cast(epochStartFT.dwHighDateTime) << 32); + int64_t currentTime64 = (static_cast(currentTime.dwLowDateTime) & 0xffffffff) | (static_cast(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(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; +} diff --git a/FTagData/FTagData.vcxproj b/FTagData/FTagData.vcxproj new file mode 100644 index 0000000..de8497c --- /dev/null +++ b/FTagData/FTagData.vcxproj @@ -0,0 +1,132 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3} + FTagData + 10.0.17763.0 + + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + true + true + + + + + Level3 + Disabled + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + + + + + {6ec62b0f-9353-40a4-a510-3788f1368b33} + + + + + + + + + \ No newline at end of file diff --git a/FTagData/FTagData.vcxproj.filters b/FTagData/FTagData.vcxproj.filters new file mode 100644 index 0000000..7b92939 --- /dev/null +++ b/FTagData/FTagData.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/GlidePort.sln b/GlidePort.sln index 3ccb95f..9e484be 100644 --- a/GlidePort.sln +++ b/GlidePort.sln @@ -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