diff --git a/.gitignore b/.gitignore index 7f4deee..05868d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# External libraries +lib/*/ + + # Compiled Object files *.slo *.lo diff --git a/AsciiArtist.sln b/AsciiArtist.sln index 0033075..f4fc036 100644 --- a/AsciiArtist.sln +++ b/AsciiArtist.sln @@ -1,8 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 +# Visual Studio 16 +VisualStudioVersion = 16.0.0 +MinimumVisualStudioVersion = 15.9.13 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AsciiArtist", "AsciiArtist\AsciiArtist.vcxproj", "{0CC0F0F4-8041-4F01-B186-A1071367BB3D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerConsoleLib", "PowerConsoleLib\PowerConsoleLib.vcxproj", "{B571C836-8F8A-4A07-B42B-B93C98690426}" diff --git a/AsciiArtist/AsciiArtist.vcxproj b/AsciiArtist/AsciiArtist.vcxproj index 10f5ce3..4f20b2c 100644 --- a/AsciiArtist/AsciiArtist.vcxproj +++ b/AsciiArtist/AsciiArtist.vcxproj @@ -22,32 +22,32 @@ {0CC0F0F4-8041-4F01-B186-A1071367BB3D} Win32Proj AsciiArtist - 10.0.14393.0 + 10.0 Application true - v140 + v142 Unicode Application false - v140 + v142 true Unicode Application true - v140 + v142 Unicode Application false - v140 + v142 true Unicode @@ -71,28 +71,38 @@ true + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(IncludePath) true + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(IncludePath) false + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(IncludePath) false + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(IncludePath) Use Level3 Disabled + true WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4996 true - true - Stdafx.h - /std:c++latest %(AdditionalOptions) + stdcpp17 Console @@ -105,7 +115,9 @@ Use Level3 Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4996 + stdcpp17 Console @@ -120,7 +132,8 @@ true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - /std:c++latest %(AdditionalOptions) + 4996 + stdcpp17 Console @@ -136,7 +149,9 @@ MaxSpeed true true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4996 + stdcpp17 Console diff --git a/AsciiTetris/AsciiTetris - Copy.vcxproj b/AsciiTetris/AsciiTetris - Copy.vcxproj deleted file mode 100644 index e5541d3..0000000 --- a/AsciiTetris/AsciiTetris - Copy.vcxproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {ADE6D921-7984-427B-86AD-01B6C07F1C18} - Win32Proj - AsciiTetris - 10.0.14393.0 - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;C:\Libraries\SFML-2.4.2\include\$(IncludePath) - - - - true - - - false - $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;C:\Libraries\SFML-2.4.2\include\;$(IncludePath) - - - false - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - /std:c++latest %(AdditionalOptions) - - - Console - true - - - - - Use - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;SFML_STATIC;%(PreprocessorDefinitions) - /std:c++latest %(AdditionalOptions) - - - Console - true - true - true - C:\Libraries\SFML-2.4.2\lib;%(AdditionalLibraryDirectories) - sfml-audio.lib;%(AdditionalDependencies) - - - - - Level3 - Use - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - - - {b571c836-8f8a-4a07-b42b-b93c98690426} - - - - - - - - - \ No newline at end of file diff --git a/AsciiTetris/AsciiTetris.vcxproj b/AsciiTetris/AsciiTetris.vcxproj index 6113d62..be38247 100644 --- a/AsciiTetris/AsciiTetris.vcxproj +++ b/AsciiTetris/AsciiTetris.vcxproj @@ -22,32 +22,32 @@ {ADE6D921-7984-427B-86AD-01B6C07F1C18} Win32Proj AsciiTetris - 10.0.14393.0 + 10.0 Application true - v140 + v142 Unicode Application false - v140 + v142 true Unicode Application true - v140 + v142 Unicode Application false - v140 + v142 true Unicode @@ -71,17 +71,31 @@ true - $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;C:\Libraries\SFML-2.4.2\include\;C:\Libraries\mpg123-1.24.0;$(IncludePath) + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(SolutionDir)lib\mpg123-1.25.4\;$(SolutionDir)lib\SFML-2.4.2\include\;$(IncludePath) + $(SolutionDir)lib\mpg123-1.25.4\x86-debug\;$(SolutionDir)lib\SFML-2.4.2\lib\x86\;$(LibraryPath) true + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(SolutionDir)lib\mpg123-1.25.4\;$(SolutionDir)lib\SFML-2.4.2\include\;$(IncludePath) + $(SolutionDir)lib\mpg123-1.25.4\x64-debug\;$(SolutionDir)lib\SFML-2.4.2\lib\x64\;$(LibraryPath) false - $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;C:\Libraries\SFML-2.4.2\include\;C:\Libraries\mpg123-1.24.0;$(IncludePath) + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(SolutionDir)lib\mpg123-1.25.4\;$(SolutionDir)lib\SFML-2.4.2\include\;$(IncludePath) + $(SolutionDir)lib\mpg123-1.25.4\x86\;$(SolutionDir)lib\SFML-2.4.2\lib\x86\;$(LibraryPath) false + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(SolutionDir)lib\mpg123-1.25.4\;$(SolutionDir)lib\SFML-2.4.2\include\;$(IncludePath) + $(SolutionDir)lib\mpg123-1.25.4\x64\;$(SolutionDir)lib\SFML-2.4.2\lib\x64\;$(LibraryPath) @@ -89,27 +103,52 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;SFML_STATIC;%(PreprocessorDefinitions) - /std:c++latest %(AdditionalOptions) + 4996 true + stdcpp17 Console true - C:\Libraries\SFML-2.4.2\lib;C:\Libraries\mpg123-1.24.0;%(AdditionalLibraryDirectories) - openal32.lib;flac.lib;vorbisenc.lib;vorbisfile.lib;vorbis.lib;ogg.lib;sfml-system-s-d.lib;sfml-audio-s-d.lib;libmpg123-0.lib;%(AdditionalDependencies) + libmpg123-0.lib;flac.lib;ogg.lib;openal32.lib;vorbis.lib;vorbisenc.lib;vorbisfile.lib;sfml-audio-s-d.lib;sfml-system-s-d.lib;%(AdditionalDependencies) + + copy /y "$(SolutionDir)lib\mpg123-1.25.4\x86-debug\libmpg123-0.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\SFML-2.4.2\bin\x86\openal32.dll" "$(OutDir)" +copy /y "$(ProjectDir)AIList.ini" "$(OutDir)" +copy /y "$(ProjectDir)GameModeList.ini" "$(OutDir)" +copy /y "$(ProjectDir)TetrominoList.ini" "$(OutDir)" +xcopy "$(ProjectDir)Resources\" "$(OutDir)Resources\" /e /y + + + Copy required Dlls and Resources + Use Level3 Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;SFML_STATIC;%(PreprocessorDefinitions) + 4996 + stdcpp17 Console true + libmpg123-0.lib;flac.lib;ogg.lib;openal32.lib;vorbis.lib;vorbisenc.lib;vorbisfile.lib;sfml-audio-s-d.lib;sfml-system-s-d.lib;%(AdditionalDependencies) + + copy /y "$(SolutionDir)lib\mpg123-1.25.4\x64-debug\libmpg123-0.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\SFML-2.4.2\bin\x64\openal32.dll" "$(OutDir)" +copy /y "$(ProjectDir)AIList.ini" "$(OutDir)" +copy /y "$(ProjectDir)GameModeList.ini" "$(OutDir)" +copy /y "$(ProjectDir)TetrominoList.ini" "$(OutDir)" +xcopy "$(ProjectDir)Resources\" "$(OutDir)Resources\" /e /y + + + Copy required Dlls and Resources + @@ -119,16 +158,27 @@ true true WIN32;NDEBUG;_CONSOLE;SFML_STATIC;%(PreprocessorDefinitions) - /std:c++latest %(AdditionalOptions) + 4996 + stdcpp17 Console true true true - C:\Libraries\SFML-2.4.2\lib;C:\Libraries\mpg123-1.24.0;%(AdditionalLibraryDirectories) - openal32.lib;flac.lib;vorbisenc.lib;vorbisfile.lib;vorbis.lib;ogg.lib;sfml-system-s.lib;sfml-audio-s.lib;libmpg123-0.lib;%(AdditionalDependencies) + libmpg123-0.lib;flac.lib;ogg.lib;openal32.lib;vorbis.lib;vorbisenc.lib;vorbisfile.lib;sfml-audio-s.lib;sfml-system-s.lib;%(AdditionalDependencies) + + copy /y "$(SolutionDir)lib\mpg123-1.25.4\x86\libmpg123-0.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\SFML-2.4.2\bin\x86\openal32.dll" "$(OutDir)" +copy /y "$(ProjectDir)AIList.ini" "$(OutDir)" +copy /y "$(ProjectDir)GameModeList.ini" "$(OutDir)" +copy /y "$(ProjectDir)TetrominoList.ini" "$(OutDir)" +xcopy "$(ProjectDir)Resources\" "$(OutDir)Resources\" /e /y + + + Copy required Dlls and Resources + @@ -137,14 +187,28 @@ MaxSpeed true true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;SFML_STATIC;%(PreprocessorDefinitions) + 4996 + stdcpp17 Console true true true + libmpg123-0.lib;flac.lib;ogg.lib;openal32.lib;vorbis.lib;vorbisenc.lib;vorbisfile.lib;sfml-audio-s.lib;sfml-system-s.lib;%(AdditionalDependencies) + + copy /y "$(SolutionDir)lib\mpg123-1.25.4\x64\libmpg123-0.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\SFML-2.4.2\bin\x64\openal32.dll" "$(OutDir)" +copy /y "$(ProjectDir)AIList.ini" "$(OutDir)" +copy /y "$(ProjectDir)GameModeList.ini" "$(OutDir)" +copy /y "$(ProjectDir)TetrominoList.ini" "$(OutDir)" +xcopy "$(ProjectDir)Resources\" "$(OutDir)Resources\" /e /y + + + Copy required Dlls and Resources + @@ -216,9 +280,6 @@ - - PreserveNewest - diff --git a/AsciiTetris/libmpg123-0.dll b/AsciiTetris/libmpg123-0.dll deleted file mode 100644 index b70b224..0000000 Binary files a/AsciiTetris/libmpg123-0.dll and /dev/null differ diff --git a/AsciiTetris/libout123-0.dll b/AsciiTetris/libout123-0.dll deleted file mode 100644 index ad2a805..0000000 Binary files a/AsciiTetris/libout123-0.dll and /dev/null differ diff --git a/AsciiTetris/openal32.dll b/AsciiTetris/openal32.dll deleted file mode 100644 index 40b2aa0..0000000 Binary files a/AsciiTetris/openal32.dll and /dev/null differ diff --git a/AsciiVis/AsciiVis.vcxproj b/AsciiVis/AsciiVis.vcxproj index f30a0ec..8ea0f95 100644 --- a/AsciiVis/AsciiVis.vcxproj +++ b/AsciiVis/AsciiVis.vcxproj @@ -22,32 +22,32 @@ {C2561822-F66F-4291-8B02-967EA22FA308} Win32Proj AsciiVis - 8.1 + 10.0 Application true - v140 + v142 Unicode Application false - v140 + v142 true Unicode Application true - v140 + v142 Unicode Application false - v140 + v142 true Unicode @@ -71,17 +71,31 @@ true - $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(ProjectDir)..\SFMLCustom\;C:\Libraries\mpg123-1.24.0;C:\Libraries\fftw-3.3.5;C:\Libraries\ffmpeg-3.2.4\include;$(IncludePath) + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(ProjectDir)..\SFMLCustom\;$(SolutionDir)lib\ffmpeg-3.2.4\include\;$(SolutionDir)lib\fftw-3.3.5\;$(SolutionDir)lib\mpg123-1.25.4\;$(IncludePath) + $(SolutionDir)lib\ffmpeg-3.2.4\lib\x86\;$(SolutionDir)lib\fftw-3.3.5\x86\;$(SolutionDir)lib\mpg123-1.25.4\x86-debug\;$(SolutionDir)lib\SFML-2.4.2\lib\x86\;$(LibraryPath) true + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(ProjectDir)..\SFMLCustom\;$(SolutionDir)lib\ffmpeg-3.2.4\include\;$(SolutionDir)lib\fftw-3.3.5\;$(SolutionDir)lib\mpg123-1.25.4\;$(IncludePath) + $(SolutionDir)lib\ffmpeg-3.2.4\lib\x64\;$(SolutionDir)lib\fftw-3.3.5\x64\;$(SolutionDir)lib\mpg123-1.25.4\x64-debug\;$(SolutionDir)lib\SFML-2.4.2\lib\x64\;$(LibraryPath) false - $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(ProjectDir)..\SFMLCustom\;C:\Libraries\mpg123-1.24.0;C:\Libraries\fftw-3.3.5;C:\Libraries\ffmpeg-3.2.4\include;$(IncludePath) + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(ProjectDir)..\SFMLCustom\;$(SolutionDir)lib\ffmpeg-3.2.4\include\;$(SolutionDir)lib\fftw-3.3.5\;$(SolutionDir)lib\mpg123-1.25.4\;$(IncludePath) + $(SolutionDir)lib\ffmpeg-3.2.4\lib\x86\;$(SolutionDir)lib\fftw-3.3.5\x86\;$(SolutionDir)lib\mpg123-1.25.4\x86\;$(SolutionDir)lib\SFML-2.4.2\lib\x86\;$(LibraryPath) false + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)..\PowerConsoleLib\;$(ProjectDir)..\SFMLCustom\;$(SolutionDir)lib\ffmpeg-3.2.4\include\;$(SolutionDir)lib\fftw-3.3.5\;$(SolutionDir)lib\mpg123-1.25.4\;$(IncludePath) + $(SolutionDir)lib\ffmpeg-3.2.4\lib\x64\;$(SolutionDir)lib\fftw-3.3.5\x64\;$(SolutionDir)lib\mpg123-1.25.4\x64\;$(SolutionDir)lib\SFML-2.4.2\lib\x64\;$(LibraryPath) @@ -89,26 +103,63 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - /std:c++latest %(AdditionalOptions) + 4996 + stdcpp17 Console true - openal32.lib;libmpg123-0.lib;libfftw3f-3.lib;%(AdditionalDependencies) - C:\Libraries\mpg123-1.24.0;C:\Libraries\fftw-3.3.5;C:\Libraries\ffmpeg-3.2.4\lib;%(AdditionalLibraryDirectories) + libfftw3f-3.lib;libmpg123-0.lib;openal32.lib;%(AdditionalDependencies) + + copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\avcodec-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\avdevice-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\avfilter-6.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\avformat-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\avutil-55.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\postproc-54.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\swresample-2.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\swscale-4.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\fftw-3.3.5\x86\libfftw3f-3.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\mpg123-1.25.4\x86-debug\libmpg123-0.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\SFML-2.4.2\bin\x86\openal32.dll" "$(OutDir)" +xcopy "$(ProjectDir)Resources\" "$(OutDir)Resources\" /e /y + + + Copy required Dlls and Resources + Use Level3 Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4996 + stdcpp17 Console true + libfftw3f-3.lib;libmpg123-0.lib;openal32.lib;%(AdditionalDependencies) + + copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\avcodec-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\avdevice-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\avfilter-6.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\avformat-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\avutil-55.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\postproc-54.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\swresample-2.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\swscale-4.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\fftw-3.3.5\x64\libfftw3f-3.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\mpg123-1.25.4\x64-debug\libmpg123-0.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\SFML-2.4.2\bin\x64\openal32.dll" "$(OutDir)" +xcopy "$(ProjectDir)Resources\" "$(OutDir)Resources\" /e /y + + + Copy required Dlls and Resources + @@ -118,17 +169,34 @@ true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - /std:c++latest %(AdditionalOptions) + 4996 + stdcpp17 Console true true true - openal32.lib;libmpg123-0.lib;libfftw3f-3.lib;%(AdditionalDependencies) - C:\Libraries\mpg123-1.24.0;C:\Libraries\fftw-3.3.5;C:\Libraries\ffmpeg-3.2.4\lib;%(AdditionalLibraryDirectories) + libfftw3f-3.lib;libmpg123-0.lib;openal32.lib;%(AdditionalDependencies) false + + copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\avcodec-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\avdevice-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\avfilter-6.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\avformat-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\avutil-55.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\postproc-54.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\swresample-2.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x86\swscale-4.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\fftw-3.3.5\x86\libfftw3f-3.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\mpg123-1.25.4\x86\libmpg123-0.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\SFML-2.4.2\bin\x86\openal32.dll" "$(OutDir)" +xcopy "$(ProjectDir)Resources\" "$(OutDir)Resources\" /e /y + + + Copy required Dlls and Resources + @@ -137,14 +205,34 @@ MaxSpeed true true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4996 + stdcpp17 Console true true true + libfftw3f-3.lib;libmpg123-0.lib;openal32.lib;%(AdditionalDependencies) + + copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\avcodec-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\avdevice-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\avfilter-6.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\avformat-57.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\avutil-55.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\postproc-54.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\swresample-2.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\ffmpeg-3.2.4\bin\x64\swscale-4.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\fftw-3.3.5\x64\libfftw3f-3.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\mpg123-1.25.4\x64\libmpg123-0.dll" "$(OutDir)" +copy /y "$(SolutionDir)lib\SFML-2.4.2\bin\x64\openal32.dll" "$(OutDir)" +xcopy "$(ProjectDir)Resources\" "$(OutDir)Resources\" /e /y + + + Copy required Dlls and Resources + @@ -201,7 +289,7 @@ - + diff --git a/AsciiVis/AsciiVis.vcxproj.filters b/AsciiVis/AsciiVis.vcxproj.filters index 0cf7960..4ea812b 100644 --- a/AsciiVis/AsciiVis.vcxproj.filters +++ b/AsciiVis/AsciiVis.vcxproj.filters @@ -129,9 +129,6 @@ - - Resource Files - diff --git a/AsciiVis/avcodec-57.dll b/AsciiVis/avcodec-57.dll deleted file mode 100644 index 7578343..0000000 Binary files a/AsciiVis/avcodec-57.dll and /dev/null differ diff --git a/AsciiVis/avdevice-57.dll b/AsciiVis/avdevice-57.dll deleted file mode 100644 index 0b4d04a..0000000 Binary files a/AsciiVis/avdevice-57.dll and /dev/null differ diff --git a/AsciiVis/avfilter-6.dll b/AsciiVis/avfilter-6.dll deleted file mode 100644 index b5e7164..0000000 Binary files a/AsciiVis/avfilter-6.dll and /dev/null differ diff --git a/AsciiVis/avformat-57.dll b/AsciiVis/avformat-57.dll deleted file mode 100644 index 15da6e6..0000000 Binary files a/AsciiVis/avformat-57.dll and /dev/null differ diff --git a/AsciiVis/avutil-55.dll b/AsciiVis/avutil-55.dll deleted file mode 100644 index 94dcf4a..0000000 Binary files a/AsciiVis/avutil-55.dll and /dev/null differ diff --git a/AsciiVis/libfftw3f-3.dll b/AsciiVis/libfftw3f-3.dll deleted file mode 100644 index b0a053a..0000000 Binary files a/AsciiVis/libfftw3f-3.dll and /dev/null differ diff --git a/AsciiVis/libmpg123-0.dll b/AsciiVis/libmpg123-0.dll deleted file mode 100644 index b70b224..0000000 Binary files a/AsciiVis/libmpg123-0.dll and /dev/null differ diff --git a/AsciiVis/libout123-0.dll b/AsciiVis/libout123-0.dll deleted file mode 100644 index ad2a805..0000000 Binary files a/AsciiVis/libout123-0.dll and /dev/null differ diff --git a/AsciiVis/openal32.dll b/AsciiVis/openal32.dll deleted file mode 100644 index 40b2aa0..0000000 Binary files a/AsciiVis/openal32.dll and /dev/null differ diff --git a/AsciiVis/postproc-54.dll b/AsciiVis/postproc-54.dll deleted file mode 100644 index a7febce..0000000 Binary files a/AsciiVis/postproc-54.dll and /dev/null differ diff --git a/AsciiVis/swresample-2.dll b/AsciiVis/swresample-2.dll deleted file mode 100644 index c9343bb..0000000 Binary files a/AsciiVis/swresample-2.dll and /dev/null differ diff --git a/AsciiVis/swscale-4.dll b/AsciiVis/swscale-4.dll deleted file mode 100644 index d3a9c89..0000000 Binary files a/AsciiVis/swscale-4.dll and /dev/null differ diff --git a/Asciifier.cpp b/Asciifier.cpp deleted file mode 100644 index b8a068f..0000000 --- a/Asciifier.cpp +++ /dev/null @@ -1,652 +0,0 @@ -/*=================================================================| -|* File: Asciifier.cpp *| -|* Author: Robert Jordan *| -|* *| -|=================================================================*/ - -#include "stdafx.h" -#include "Asciifier.h" -#include "resources.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace PowerConsole; -using namespace PowerConsole::IO; -using namespace AsciiArtist::Editing; -using namespace AsciiArtist::COM; -//=================================================================| -// CLASSES | -//=================================================================/ - -//http://www.csie.ntu.edu.tw/~b92069/HWs/rgb2lab.c -float H(float q) { - float value; - if (q > 0.008856f) { - value = std::pow(q, 0.333333f); - return value; - } - else { - value = 7.787f * q + 0.137931f; - return value; - } -} -ColorF RGB2LAB(ColorI color) { - float RGB[3]; - float XYZ[3]; - float adapt[3]; - - adapt[0] = 0.950467f; - adapt[1] = 1.000000f; - adapt[2] = 1.088969f; - - RGB[0] = color.r * 0.003922f; - RGB[1] = color.g * 0.003922f; - RGB[2] = color.b * 0.003922f; - - XYZ[0] = 0.412424f * RGB[0] + 0.357579f * RGB[1] + 0.180464f * RGB[2]; - XYZ[1] = 0.212656f * RGB[0] + 0.715158f * RGB[1] + 0.0721856f * RGB[2]; - XYZ[2] = 0.0193324f * RGB[0] + 0.119193f * RGB[1] + 0.950444f * RGB[2]; - - return ColorF( - 116 * H(XYZ[1] / adapt[1]) - 16, - 500 * (H(XYZ[0] / adapt[0]) - H(XYZ[1] / adapt[1])), - 200 * (H(XYZ[1] / adapt[1]) - H(XYZ[2] / adapt[2])) - ); -} -float LAB2Value(ColorF color, ColorF color2) { - return std::pow((color.r - color2.r), 2) + std::pow((color.g - color2.g), 2) + std::pow((color.b - color2.b), 2); -} - -#define TOTAL_CHARACTER_VALUE 96 -#define cint int - -#define xyToIndex(x, y, width) ((x) + ((y) * (width))) - -AsciiAnimationSPtr Asciifier::asciifyImage(const std::string& path, ColorMetrics metric, ProgressDialogSPtr progressDialog) { - #pragma region Init A - int totalTime = clock(); - progressDialog->setActionMessage("Reading console font..."); - if (progressDialog->update()) { - return nullptr; - } - CoInitialize(nullptr); - auto bmp = WIC::readBitmapFromResource(PNG_FONT, "PNG"); - #pragma endregion - - cint characterValues[256] = { 0 }; - for (int x = 0; x < bmp->size.x; x++) { - for (int y = 0; y < bmp->size.y; y++) { - if (bmp->pixels[xyToIndex(x, y, bmp->size.x)].r == 255) { - int charIndex = (x / 8) + (y / 12) * 16; - characterValues[charIndex]++; - } - } - } - bmp = nullptr; - - #pragma region Init B - progressDialog->setActionMessage("Reading image..."); - if (progressDialog->update()) { - return nullptr; - } - - bmp = WIC::readBitmapFromFile(path); - - Point2I imageSize = (Point2I)GMath::ceil((Point2F)bmp->size / Point2F(8.0f, 12.0f)); - int totalImageSize = imageSize.x * imageSize.y; - auto image = std::make_shared(imageSize, ImageFormats::Basic, Pixel()); - - image->resize(imageSize); - auto graphics = image->createGraphics(); - - ColorI palette[16] = { - ColorI(0, 0, 0), - ColorI(0, 0, 128), - ColorI(0, 128, 0), - ColorI(0, 128, 128), - ColorI(128, 0, 0), - ColorI(128, 0, 128), - ColorI(128, 128, 0), - ColorI(192, 192, 192), - ColorI(128, 128, 128), - ColorI(0, 0, 255), - ColorI(0, 255, 0), - ColorI(0, 255, 255), - ColorI(255, 0, 0), - ColorI(255, 0, 255), - ColorI(255, 255, 0), - ColorI(255, 255, 255) - }; - #pragma endregion - - #pragma region Init C - progressDialog->setActionMessage("Calculating character LABs..."); - if (progressDialog->update()) { - return nullptr; - } - ColorF characterLABs[USHRT_MAX]; - - for (int col = 1; col < 255; col++) { - unsigned char f = getFColor(col); - unsigned char b = getBColor(col); - if (f == b) - continue; - ColorI fcolor = palette[f]; - ColorI bcolor = palette[b]; - for (int ch = 1; ch < 255; ch++) { - if (ch == 8 || ch == 10 || ch == 219 || ch == 222 || ch == 223) - continue; - - ColorI characterValue = ( - fcolor * characterValues[ch] + - bcolor * (TOTAL_CHARACTER_VALUE - characterValues[ch]) - ) / TOTAL_CHARACTER_VALUE; - characterLABs[col + (ch << 8)] = RGB2LAB(characterValue); - } - } - #pragma endregion - - - updateAsciifierProgress(-1, imageSize.x, clock() - totalTime, progressDialog); - if (progressDialog->update()) { - return nullptr; - } - for (int imgx = 0; imgx < imageSize.x; imgx++) { - for (int imgy = 0; imgy < imageSize.y; imgy++) { - - #pragma region Read Image Values - ColorI imageValue; - cint r = 0, g = 0, b = 0; - cint totalRead = 0; - int ix = imgx * 8; - int iy = imgy * 12; - for (int px = 0; px < 8; px++) { - int p_x = ix + px; - if (p_x >= bmp->size.x) - continue; - for (int py = 0; py < 12; py++) { - int p_y = iy + py; - if (p_y >= bmp->size.y) - continue; - int index = xyToIndex(p_x, p_y, bmp->size.x); - r += bmp->pixels[index].r; - g += bmp->pixels[index].g; - b += bmp->pixels[index].b; - totalRead++; - } - } - imageValue = ColorI( - r / totalRead, - g / totalRead, - b / totalRead - ); - ColorF imageLAB = RGB2LAB(imageValue); - #pragma endregion - - Pixel closestPixel = Pixel(); - float closestScore = std::numeric_limits().max(); - for (int col = 1; col < 255; col++) { - unsigned char f = getFColor(col); - unsigned char b = getBColor(col); - if (f == b) - continue; - ColorI fcolor = palette[f]; - ColorI bcolor = palette[b]; - for (int ch = 1; ch < 255; ch++) { - if (ch == 8 || ch == 10 || ch == 219 || ch == 222 || ch == 223) - continue; - - #pragma region Calc Font Values - /*ColorI fvalue = fcolor * characterValues[ch]; - ColorI bvalue = bcolor * (TOTAL_CHARACTER_VALUE - characterValues[ch]); - ColorI value = (fvalue + bvalue) / TOTAL_CHARACTER_VALUE; - fvalue /= TOTAL_CHARACTER_VALUE; - bvalue /= TOTAL_CHARACTER_VALUE;*/ - #pragma endregion - - #pragma region Calc Score - float score; - /*if (metric == ColorMetrics::Euclidean) { - score = - std::pow( - float((value.r - imageValue.r) * (value.r - imageValue.r)) + - float((value.g - imageValue.g) * (value.g - imageValue.g)) + - float((value.b - imageValue.b) * (value.b - imageValue.b)), - 2) + - std::pow( - float((fvalue.r - imageValue.r) * (fvalue.r - imageValue.r)) + - float((fvalue.g - imageValue.g) * (fvalue.g - imageValue.g)) + - float((fvalue.b - imageValue.b) * (fvalue.b - imageValue.b)), - 2) + - std::pow( - float((bcolor.r - imageValue.r) * (bcolor.r - imageValue.r)) + - float((bcolor.g - imageValue.g) * (bcolor.g - imageValue.g)) + - float((bcolor.b - imageValue.b) * (bcolor.b - imageValue.b)), - 2); - } - else {*/ - //score = RGB2LAB(value.r, value.g, value.b, imageValue.r, imageValue.g, imageValue.b); - score = LAB2Value(imageLAB, characterLABs[col + (ch << 8)]); - //} - - #pragma endregion - - if (score < closestScore) { - closestPixel = Pixel((unsigned char)ch, (unsigned char)col); - closestScore = score; - } - } - } - graphics->setPixel(Point2I(imgx, imgy), closestPixel); - } - - updateAsciifierProgress(imgx, imageSize.x, clock() - totalTime, progressDialog); - if (progressDialog->update()) { - return nullptr; - } - } - - #pragma region Cleanup - progressDialog->setPercentage(100); - progressDialog->setActionMessage("Completed"); - if (progressDialog->update()) { - return nullptr; - } - else { - progressDialog->console().sleep(200); - progressDialog->close(); - - return image; - } - #pragma endregion -}; - -#undef TOTAL_CHARACTER_VALUE - -#define init2DArray(name, type, width, height) \ - name = new type*[width]; \ - for (int _i = 0; _i < width; _i++) {\ - name[_i] = new type[height]; \ - for (int _j = 0; _j < height; _j++) \ - name[_i][_j] = type(); \ - } -#define init1DArray(name, type, size) \ - name = new type[size]; \ - for (int _i = 0; _i < size; _i++) \ - name[_i] = type(); - -#define cleanupVar(name) if (name != nullptr) {delete name; name = nullptr;} -#define cleanup1DArray(name) if (name != nullptr) {delete[] name; name = nullptr;} -#define cleanup2DArray(name, width) \ - if (name != nullptr) { \ - for (int _i = 0; _i < width; _i++) \ - delete[] name[_i]; \ - delete[] name; name = nullptr; \ - } -#define cleanup() \ - cleanup2DArray(characterCounts, NUM_CHARACTERS); \ - cleanup2DArray(characterCounts, NUM_CHARACTERS); \ - cleanup2DArray(characterValues, NUM_CHARACTERS * NUM_COLORS); \ - cleanup2DArray(characterFValues, NUM_CHARACTERS * NUM_COLORS); \ - cleanup2DArray(characterBValues, NUM_CHARACTERS * NUM_COLORS); \ - cleanup2DArray(characterLABs, NUM_CHARACTERS * NUM_COLORS); \ - cleanup1DArray(imageValues); \ - cleanup1DArray(imageLABs); - -#define updateProgress() \ - if (progressDialog->update()) { \ - cleanup(); \ - return nullptr; \ - } - -#define SPLIT_X split.x -#define SPLIT_Y split.y -#define SPLIT_MAG (SPLIT_X * SPLIT_Y) -#define TOTAL_CHARACTER_VALUE (96 / SPLIT_MAG) -#define NUM_CHARACTERS 256 -#define NUM_COLORS 256 - -AsciiAnimationSPtr Asciifier::asciifyImagePrecision(const std::string& path, Point2I split, float scale, ColorMetrics metric, ProgressDialogSPtr progressDialog) { - #pragma region Declarations - int totalTime = clock(); - BitmapFrameSPtr bmp = nullptr; - - int** characterCounts = nullptr; - ColorI** characterValues = nullptr; - ColorI** characterFValues = nullptr; - ColorI** characterBValues = nullptr; - ColorF** characterLABs = nullptr; - ColorI* imageValues = nullptr; - ColorF* imageLABs = nullptr; - - init2DArray(characterCounts, int, NUM_CHARACTERS, SPLIT_MAG); - if (metric == ColorMetrics::Euclidean) { - init2DArray( characterValues, ColorI, NUM_CHARACTERS * NUM_COLORS, SPLIT_MAG); - init2DArray(characterFValues, ColorI, NUM_CHARACTERS * NUM_COLORS, SPLIT_MAG); - init2DArray(characterBValues, ColorI, NUM_CHARACTERS * NUM_COLORS, SPLIT_MAG); - init1DArray(imageValues, ColorI, SPLIT_MAG); - } - else { - init2DArray(characterLABs, ColorF, NUM_CHARACTERS * NUM_COLORS, SPLIT_MAG); - init1DArray(imageLABs, ColorF, SPLIT_MAG); - } - #pragma endregion - - #pragma region Init A - progressDialog->setActionMessage("Reading console font..."); - updateProgress(); - - bmp = WIC::readBitmapFromResource(PNG_FONT, "PNG"); - #pragma endregion - - #pragma region Read Character Values - progressDialog->setActionMessage("Reading image..."); - if (progressDialog->update()) { - return nullptr; - } - for (int x = 0; x < bmp->size.x; x++) { - for (int y = 0; y < bmp->size.y; y++) { - if (bmp->pixels[xyToIndex(x, y, bmp->size.x)].r == 255) { - int charIndex = (x / 8) + (y / 12) * 16; - int subIndex = (x % 8 * SPLIT_X / 8) + (y % 12 * SPLIT_Y / 12) * SPLIT_X; - characterCounts[charIndex][subIndex]++; - } - } - } - bmp = nullptr; - #pragma endregion - - #pragma region Init B - if (scale != 1.0f) { - auto source = WIC::readSourceFromFile(path); - source = WIC::scaleSource(source, Point2F(scale), BitmapScaleModes::Fant); - bmp = WIC::readBitmapFromSource(source); - } - else { - bmp = WIC::readBitmapFromFile(path); - } - - Point2I imageSize = (Point2I)GMath::ceil((Point2F)bmp->size / Point2F(8.0f, 12.0f)); - int totalImageSize = imageSize.x * imageSize.y; - auto image = std::make_shared(imageSize, ImageFormats::Basic, Pixel()); - - image->resize(imageSize); - auto graphics = image->createGraphics(); - - AsciiPalette palette = progressDialog->console().getPalette(); - /*ColorI palette[16]; - for (int i = 0; i < 16; i++) { - PowerConsole::Drawing::ColorB color = progressDialog->console().getPaletteColor(i); - palette[i] = ColorI(color.r, color.g, color.b); - }*/ - #pragma endregion - - #pragma region Init C - progressDialog->setActionMessage("Calculating character LABs..."); - updateProgress(); - - for (int col = 1; col < 255; col++) { - unsigned char f = getFColor(col); - unsigned char b = getBColor(col); - if (f == b) - continue; - ColorI fcolor = palette[f]; - ColorI bcolor = palette[b]; - for (int ch = 1; ch < 255; ch++) { - if (ch == 8 || ch == 10 || ch == 219 || ch == 222 || ch == 223) - continue; - for (int s = 0; s < SPLIT_MAG; s++) { - if (metric == ColorMetrics::Euclidean) { - ColorI fvalue = fcolor * characterCounts[ch][s]; - ColorI bvalue = bcolor * (TOTAL_CHARACTER_VALUE - characterCounts[ch][s]); - ColorI value = (fvalue + bvalue) / TOTAL_CHARACTER_VALUE; - fvalue /= TOTAL_CHARACTER_VALUE; - bvalue /= TOTAL_CHARACTER_VALUE; - int charIndex = col + (ch << 8); - characterValues [charIndex][s] = value; - characterFValues[charIndex][s] = fvalue; - characterBValues[charIndex][s] = bvalue; - } - else { - ColorI characterValue = ( - fcolor * characterCounts[ch][s] + - bcolor * (TOTAL_CHARACTER_VALUE - characterCounts[ch][s]) - ) / TOTAL_CHARACTER_VALUE; - characterLABs[col + (ch << 8)][s] = RGB2LAB(characterValue); - } - } - } - } - #pragma endregion - - updateAsciifierProgress(-1, imageSize.x, clock() - totalTime, progressDialog); - updateProgress(); - for (int imgx = 0; imgx < imageSize.x; imgx++) { - for (int imgy = 0; imgy < imageSize.y; imgy++) { - - #pragma region Read Image Values - int ix = imgx * 8; - int iy = imgy * 12; - for (int s = 0; s < SPLIT_MAG; s++) { - ColorI imageValue; - cint totalRead = 0; - int sx = ix + (s % SPLIT_X * 8 / SPLIT_X); - int sy = iy + (s / SPLIT_X * 12 / SPLIT_Y); - for (int px = 0; px < 8 / SPLIT_X; px++) { - int p_x = sx + px; - if (p_x >= bmp->size.x) - continue; - for (int py = 0; py < 12 / SPLIT_Y; py++) { - int p_y = sy + py; - if (p_y >= bmp->size.y) - continue; - imageValue += bmp->pixels[xyToIndex(p_x, p_y, bmp->size.x)]; - totalRead++; - } - } - if (totalRead > 0) { - if (metric == ColorMetrics::Euclidean) - imageValues[s] = imageValue / totalRead; - else - imageLABs[s] = RGB2LAB(imageValue / totalRead); - } - else { - if (metric == ColorMetrics::Euclidean) - imageValues[s] = ColorI(); - else - imageLABs[s] = ColorF(); - } - } - #pragma endregion - - Pixel closestPixel = Pixel(); - float closestScore = std::numeric_limits().max(); - for (int col = 1; col < 255; col++) { - unsigned char f = getFColor(col); - unsigned char b = getBColor(col); - if (f == b) - continue; - ColorI fcolor = palette[f]; - ColorI bcolor = palette[b]; - for (int ch = 1; ch < 255; ch++) { - if (ch == 8 || ch == 10 || ch == 219 || ch == 222 || ch == 223) - continue; - float score = 0.0f; - - for (int s = 0; s < SPLIT_MAG; s++) { - #pragma region Euclidean - if (metric == ColorMetrics::Euclidean) { - int charIndex = col + (ch << 8); - ColorI imageValue = imageValues[s]; - ColorI value = characterValues[charIndex][s] - imageValue; - ColorI fvalue = characterFValues[charIndex][s] - imageValue; - ColorI bvalue = characterBValues[charIndex][s] - imageValue; - - #pragma region Calc Score - score += - std::pow( - std::pow( - float(value.r * value.r) + - float(value.g * value.g) + - float(value.b * value.b), - 2) + - std::pow( - float(fvalue.r * fvalue.r) + - float(fvalue.g * fvalue.g) + - float(fvalue.b * fvalue.b), - 2) + - std::pow( - float(bvalue.r * bvalue.r) + - float(bvalue.g * bvalue.g) + - float(bvalue.b * bvalue.b), - 2), - 2); - #pragma endregion - } - #pragma endregion - #pragma region LAB Delta E - else { - score += std::pow(LAB2Value(imageLABs[s], characterLABs[col + (ch << 8)][s]), 2); - } - #pragma endregion - } - - if (score < closestScore) { - closestPixel = Pixel((unsigned char)ch, (unsigned char)col); - closestScore = score; - } - } - } - graphics->setPixel(Point2I(imgx, imgy), closestPixel); - } - updateAsciifierProgress(imgx, imageSize.x, clock() - totalTime, progressDialog); - updateProgress(); - } - - #pragma region Cleanup - progressDialog->setPercentage(100); - progressDialog->setActionMessage("Completed"); - updateProgress(); - - progressDialog->console().sleep(200); - progressDialog->close(); - cleanup(); - return image; - #pragma endregion -}; - -void Asciifier::updateAsciifierProgress(int x, int width, int time, ProgressDialogSPtr progressDialog) { - progressDialog->setActionMessage( - (std::string)"Asciifying image... [" + - (time / 1000 < 10 ? "0" : "") + std::to_string(time / 1000 / 60) + ":" + - (time / 1000 < 10 ? "0" : "") + std::to_string(time / 1000) + - "]" - ); - progressDialog->setPercentage(1 + (x + 1) * 99 / width); -} - -void Asciifier::writeBitmap(const std::string& path, const AsciiImageFrame& frame) { - AsciiPalette palette = Console::getPalette(); - BitmapFrameSPtr fontBmp = WIC::readBitmapFromResource(PNG_FONT, "PNG"); - IWICImagingFactory* ipFactory = NULL; - UINT stride; - UINT bufferSize; - IWICBitmapEncoder* ipEncoder; - IWICBitmapFrameEncode* ipFrame; - WICPixelFormatGUID formatGUID = GUID_WICPixelFormat24bppRGB; - - COMStreamSPtr stream = nullptr; - - Point2I fontSize = Point2I(8, 12); - Point2I imageSize = frame.size(); - Point2I size = frame.size() * fontSize; - BitmapFrameSPtr bmp = std::make_shared(); - bmp->size = size; - bmp->pixels = new ColorB[size.x * size.y]; - - CoInitialize(nullptr); - - // Create the factory - if (FAILED(CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&ipFactory)))) - goto Return; - - stream = WIC::createStreamFromFile(path, false, true, true); - if (isCOMObjectNull(stream)) - goto ReleaseFactory; - - if (FAILED(ipFactory->CreateEncoder(GUID_ContainerFormatPng, nullptr, &ipEncoder))) - goto ReleaseFactory; - - if (FAILED(ipEncoder->Initialize(stream->ipObject, WICBitmapEncoderNoCache))) - goto ReleaseEncoder; - - if (FAILED(ipEncoder->CreateNewFrame(&ipFrame, nullptr))) - goto ReleaseEncoder; - - if (FAILED(ipFrame->Initialize(nullptr))) - goto ReleaseFrame; - - if (FAILED(ipFrame->SetSize((UINT)size.x, (UINT)size.y))) - goto ReleaseFrame; - - if (FAILED(ipFrame->SetPixelFormat(&formatGUID))) - goto ReleaseFrame; - - if (!IsEqualGUID(formatGUID, GUID_WICPixelFormat24bppBGR)) - goto ReleaseFrame; - - - for (int imgx = 0; imgx < imageSize.x; imgx++) { - for (int imgy = 0; imgy < imageSize.y; imgy++) { - - Pixel pixel = frame.getPixel(Point2I(imgx, imgy)); - ColorB fcolor = palette[getFColor(pixel.color)]; - ColorB bcolor = palette[getBColor(pixel.color)]; - int cx = (pixel.character % 16) * fontSize.x; - int cy = (pixel.character / 16) * fontSize.y; - int ix = imgx * fontSize.x; - int iy = imgy * fontSize.y; - for (int px = 0; px < fontSize.x; px++) { - int p_x = ix + px; - int c_x = cx + px; - for (int py = 0; py < fontSize.y; py++) { - int p_y = iy + py; - int c_y = cy + py; - if (fontBmp->pixels[xyToIndex(c_x, c_y, fontSize.x * 16)].r == 0) - bmp->pixels[xyToIndex(p_x, p_y, size.x)] = bcolor; - else - bmp->pixels[xyToIndex(p_x, p_y, size.x)] = fcolor; - } - } - } - } - - stride = size.x * 3; - bufferSize = stride * size.y; - if (FAILED(ipFrame->WritePixels((UINT)size.y, stride, bufferSize, (BYTE*)bmp->pixels))) - goto ReleaseFrame; - - if (FAILED(ipFrame->Commit())) - goto ReleaseFrame; - - if (SUCCEEDED(ipEncoder->Commit())) - OutputDebugStringA("Success!"); - -ReleaseFrame: - ipFrame->Release(); -ReleaseEncoder: - ipEncoder->Release(); -ReleaseFactory: - ipFactory->Release(); -Return: - CoUninitialize(); -} - -//=================================================================| diff --git a/Asciifier.h b/Asciifier.h deleted file mode 100644 index 5f2ed35..0000000 --- a/Asciifier.h +++ /dev/null @@ -1,42 +0,0 @@ -/*=================================================================| -|* File: Asciifier.h *| -|* Author: Robert Jordan *| -|* *| -|=================================================================*/ - -#pragma once -#ifndef ASCIIFIER_H -#define ASCIIFIER_H - -#include -#include -#include -#include - -using namespace PowerConsole::Drawing; -using namespace PowerConsole::Geometry; -using namespace PowerConsole::Controls; -using namespace PowerConsole::Controls::Toolbox; - -namespace AsciiArtist::Editing { -//=================================================================| -// CLASSES | -//=================================================================/ - -enum class ColorMetrics { - Euclidean, - LABDeltaE -}; - -class Asciifier { -public: - static AsciiAnimationSPtr asciifyImage(const std::string& path, ColorMetrics metric, ProgressDialogSPtr progressDialog); - static AsciiAnimationSPtr asciifyImagePrecision(const std::string& path, Point2I split, ColorMetrics metric, ProgressDialogSPtr progressDialog); -private: - static void updateAsciifierProgress(int x, int width, int time, ProgressDialogSPtr progressDialog); -}; - -//=================================================================| -} /* End namespace */ -#endif /* End include guard */ -//=================================================================| diff --git a/BUILDING.md b/BUILDING.md index 52b006d..325dfe9 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -1,104 +1,261 @@ # Build Instructions -*because ~~you'll~~ I'll need them...* -**IDE:** VS 2019 (built in VS 2015, but upgrading seems to work without a hitch) +**Required IDE:** Visual Studio 2019 -**Configuration:** Release, x86 +**Configurations:** *all combinations of Debug/Release and Win32/x64* -## Libraries +Building requires first obtaining external libraries used, the chart below shows what libraries are required by what programs. Goto [Setup instructions](#setup-instructions) for settings up external libraries. Once setup is complete, building normally in Visual Studio should work. -* [ffmpeg-3.2.4-win32-dev](https://web.archive.org/web/20170419055315/https://ffmpeg.zeranoe.com/builds/win32/dev/ffmpeg-3.2.4-win32-dev.zip) (webarchive, [landing page](https://web.archive.org/web/20170419055315/https://ffmpeg.zeranoe.com/builds/win32/dev/)) -* [fftw-3.3.5-dll32](ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll32.zip) ([landing page](http://fftw.org/install/windows.html)) -* [mpg123-1.24.0-x86](https://www.mpg123.de/download/win32/1.24.0/mpg123-1.24.0-x86.zip) ([landing page](https://www.mpg123.de/download/win32/1.24.0/)) -* [SFML-2.4.2-windows-vc14-32-bit](https://www.sfml-dev.org/files/SFML-2.4.2-windows-vc14-32-bit.zip) ([landing page](https://www.sfml-dev.org/download/sfml/2.4.2/)) +### External library usage -### Library folder structure +| |PowerCon.|AsciiArtist|AsciiTetris|AsciiVis|SFMLCust.| +|:----------------|:-------:|:---------:|:---------:|:------:|:--------:| +|[FFmpeg](#ffmpeg)| |✓¹| |✓ |✓ | +|[FFTW](#fftw) | | | |✓ | | +|[mpg123](#mpg123)| | |✓ |✓ | | +|[SFML](#sfml) | | |✓ |✓²|✓| -Create the following folder structure, and place the 3 libraries listed above in each. +\[1\] : (optional) FFmpeg main binary used at runtime for optional feature
+\[2\] : SFML borrowed only for openal32 `.dll` and `.lib` files -``` -+ C:/ -+-+ Libraries/ - +-- ffmpeg-3.2.4/ - +-- fftw-3.3.5/ - +-- mpg123-1.24.0/ - +-- SFML-2.4.2/ -``` -### Creating `.lib` files +*** -For `mpg123-1.24.0/`, you'll need to create a `.lib` file, which can be generated with the `.def` and `.dll` file *(as described in [this answer](https://stackoverflow.com/a/15226566/7517185))*. +## Setup instructions + +Library dependencies can either be set up manually, or automatically by running `setup.ps1` *then* `makelibs.bat`. + +### Automatic setup + +To make any changes the dependencies setup *(including only using x86 or x64, etc.)*, open `setup.ps1` in a text editor and change the desired settings in the **Configuration** section near the top. Changes to library output directories will also need to be reflected in `makelibs.bat`'s **Configuration** section. + +1. Search for and open **Developer Command Prompt for VS 20xx** (*replacing **xx** with your VS year*) +2. `cd ""` +3. `powershell ./setup.ps1` +4. `makelibs.bat` + +These scripts will download all dependencies from existing URLs, unpack them, and then reorganize all folder structures. Running `makelibs.bat` will then create essential `.lib` files for libraries that don't already supply them. + +### Manual setup + +Follow this chart below for creating the folder structure, and including the architectures/configurations you wish to use. All libraries have links to their downloads provided in the [Library dependencies](#library-dependencies) section. + +#### Folder structure + +`lib/` +* `ffmpeg-3.2.4/` + * `bin/` + * `x86/`   (*from [ffmpeg-3.2.4-win32-shared.zip][]*) + * `x64/`   (*from [ffmpeg-3.2.4-win64-shared.zip][]*) + * `include/`   (*from [ffmpeg-3.2.4-win32-dev.zip][] or [ffmpeg-3.2.4-win64-dev.zip][]*) + * `lib/` + * `x86/`   (*from [ffmpeg-3.2.4-win32-dev.zip][]*) + * `x64/`   (*from [ffmpeg-3.2.4-win64-dev.zip][]*) +* `fftw-3.3.5/` + * `x86/` + * `libfftw3f-3.dll` + * `libfftw3f-3.def` + * `libfftw3f-3.lib`   (*created: LIB /MACHINE:X86 /DEF:libfftw3f-3.def in VS dev console*) + * `x64/` + * `libfftw3f-3.dll` + * `libfftw3f-3.def` + * `libfftw3f-3.lib`   (*created: LIB /MACHINE:X64 /DEF:libfftw3f-3.def in VS dev console*) + * `fftw3.h` +* `mpg123-1.25.4/` + * `x86/` + * `libmpg123-0.dll` + * `libmpg123-0.def`   (*renamed: rename libmpg123-0.dll.def libmpg123-0.def*) + * `libmpg123-0.lib`   (*created: LIB /MACHINE:X86 /DEF:libmpg123-0.def in VS dev console*) + * `x64/` + * `libmpg123-0.dll` + * `libmpg123-0.def`   (*renamed: rename libmpg123-0.dll.def libmpg123-0.def*) + * `libmpg123-0.lib`   (*created: LIB /MACHINE:X64 /DEF:libmpg123-0.def in VS dev console*) + * `fmt123.h` + * `mpg123.h` +* `SFML-2.4.2/` + * `bin/` + * `x86/`   (*from [SFML-2.4.2-windows-vc14-32-bit.zip][]*) + * `x64/`   (*from [SFML-2.4.2-windows-vc14-64-bit.zip][]*) + * `include/` + * `lib/` + * `x86/`   (*from [SFML-2.4.2-windows-vc14-32-bit.zip][]*) + * `x64/`   (*from [SFML-2.4.2-windows-vc14-64-bit.zip][]*) + +#### Creating lib files + +1. Search for and open **Developer Command Prompt for VS 20xx** (*replacing **xx** with your VS year*) +2. `cd "/lib/mpg123-1.25.4/"`   (*replace **ARCH** with x86 or x64*) +3. `rename libmpg123-0.dll.def libmpg123-0.def` +4. `lib /MACHINE: /DEF:libmpg123-0.def`   (*replace **ARCH** with x86 or x64*) +5. `cd "/lib/fftw-3.3.5/"`   (*replace **ARCH** with x86 or x64*) +6. `lib /MACHINE: /DEF:libfftw3f-3.def`   (*replace **ARCH** with x86 or x64*) -First create copies of the files `libmpg123-0.dll.def` and `libout123-0.dll.def` files with the `.dll` part of the names removed. (I'm not sure if this is required, but the generated files will all contain that same `.dll` name part, so better be safe) -Search `Developer Command Prompt for VS 2019` in Windows and open. Then run the following commands. +*** -```bat -cd "C:\Libraries\mpg123-1.24.0" -lib /def:libmpg123-0.def -lib /def:libout123-0.def +## Library dependencies -cd "C:\Libraries\fftw-3.3.5" -lib /def:libfftw3-3.def -lib /def:libfftw3f-3.def -lib /def:libfftw3l-3.def -``` -The output will look something like this for each file. -```bat -Microsoft (R) Library Manager Version 14.21.27702.2 -Copyright (C) Microsoft Corporation. All rights reserved. +### FFmpeg -LINK : warning LNK4068: /MACHINE not specified; defaulting to X86 - Creating library libout123-0.lib and object libout123-0.exp -``` +[Homepage][FFmpeg Homepage] **\|** [GitHub][FFmpeg GitHub] -*** +C library (and tools) for all kinds of audio handling and manipulation. + +**All links for FFmpeg below are web-archived.** +Zeranoe FFmpeg Builds, which had been an essential hub for prebuilt Windows binaries, shutdown on September 18th, 2020. +Thankfully everything of importance was heavily scraped and web-archived beforehand. + +> ffmpeg.zeranoe.com will close on Sep 18, 2020, and all builds will be removed. +> If you're using Zeranoe FFmpeg Builds in your product, please ensure that you have a hosting strategy in place by the 18th. +> Thank you to everyone who supported the project along the way! +> ([source][Zeranoe FFmpeg Builds shutdown]) + +* [Builds][FFmpeg builds] **>** [Windows x86][FFmpeg Windows x86 builds] **>** [dev][FFmpeg Windows x86 dev builds] \| [shared][FFmpeg Windows x86 shared builds] \| [static][FFmpeg Windows x86 static builds] + * [ffmpeg-3.2.4-win32-dev.zip][] .lib + * [ffmpeg-3.2.4-win32-shared.zip][] .dll + * [ffmpeg-3.2.4-win32-static.zip][] .exe (not required) +* [Builds][FFmpeg builds] **>** [Windows x64][FFmpeg Windows x64 builds] **>** [dev][FFmpeg Windows x64 dev builds] \| [shared][FFmpeg Windows x64 shared builds] \| [static][FFmpeg Windows x64 static builds] + * [ffmpeg-3.2.4-win64-dev.zip][] .lib + * [ffmpeg-3.2.4-win64-shared.zip][] .dll + * [ffmpeg-3.2.4-win64-static.zip][] .exe (not required) + + +### FFTW + +[Homepage][FFTW Homepage] **\|** [GitHub][FFTW GitHub] + +C library for computing the Discrete Fourier Transform, which is used in audio visualization. + +* [Builds][FFTW Builds] **>** [Windows][FFTW Windows builds] + * [fftw-3.3.5-dll32.zip][] .dll .def + * [fftw-3.3.5-dll64.zip][] .dll .def + + +### mpg123 + +[Homepage][mpg123 Homepage] + +C library for reading MPEG-3 (`.mp3`) audio files. + +* [Windows x86 builds][mpg123 Windows x86 builds] **>** [v1.25.4][mpg123 Windows x86 builds, v1.25.4] + * [mpg123-1.25.4-x86.zip][] .dll .def + * [mpg123-1.25.4-x86-debug.zip][] .dll .def +* [Windows x64 builds][mpg123 Windows x64 builds] **>** [v1.25.4][mpg123 Windows x64 builds, v1.25.4] + * [mpg123-1.25.4-x86-64.zip][] .dll .def + * [mpg123-1.25.4-x86-64-debug.zip][] .dll .def + + + + + +### SFML + +[Homepage][SFML Homepage] **\|** [GitHub][SFML GitHub] + +C++ library for easy use of audio in games and applications. Used for sound effect and music playback. + +* [Builds][SFML Builds] **>** [v2.4.2][SFML Builds, v2.4.2] + * [SFML-2.4.2-windows-vc14-32-bit.zip][] .dll .lib + * [SFML-2.4.2-windows-vc14-64-bit.zip][] .dll .lib + + + + + + + +[FFmpeg Homepage]: +[FFmpeg GitHub]: + +[Zeranoe FFmpeg Builds shutdown]: + +[FFmpeg builds]: +[FFmpeg Windows x86 builds]: +[FFmpeg Windows x64 builds]: + +[FFmpeg Windows x86 dev builds]: +[FFmpeg Windows x86 shared builds]: +[FFmpeg Windows x86 static builds]: +[FFmpeg Windows x64 dev builds]: +[FFmpeg Windows x64 shared builds]: +[FFmpeg Windows x64 static builds]: + + + +[ffmpeg-3.2.4-win32-dev.zip]: +[ffmpeg-3.2.4-win32-shared.zip]: +[ffmpeg-3.2.4-win32-static.zip]: +[ffmpeg-3.2.4-win64-dev.zip]: +[ffmpeg-3.2.4-win64-shared.zip]: +[ffmpeg-3.2.4-win64-static.zip]: -## Programs -### AsciiTetris + -**Required libraries:** +[FFTW Homepage]: +[FFTW GitHub]: -* `C:/Libraries/mpg123-1.24.0/` -* `C:/Libraries/SFML-2.4.2/` +[FFTW Builds]: +[FFTW Windows builds]: -**Files/folders to place in `Release/` after building:** +[fftw-3.3.5-dll32.zip]: +[fftw-3.3.5-dll64.zip]: -All files and folders are present in the `AsciiTetris/` project directory. -* `Resources/` folder (Otherwise you'll get an error claiming `libgcc_s_sjlj-1.dll` is missing) -* `libmpg123-0.dll` -* `libout123-0.dll` -* `openal32.dll` + +[mpg123 Homepage]: + -### AsciiVis +[mpg123 Windows x86 builds]: +[mpg123 Windows x64 builds]: +[mpg123 Windows x86 builds, v1.25.4]: +[mpg123 Windows x64 builds, v1.25.4]: -**Note:** There's likely a lot of hardcoded filepaths in here that'll need changing. +[mpg123-1.25.4-x86.zip]: +[mpg123-1.25.4-x86-debug.zip]: +[mpg123-1.25.4-static-x86.zip]: +[mpg123-1.25.4-x86-64.zip]: +[mpg123-1.25.4-x86-64-debug.zip]: +[mpg123-1.25.4-static-x86-64.zip]: -**Required libraries:** -* `C:/Libraries/ffmpeg-3.2.4/` -* `C:/Libraries/fftw-3.3.5/` -* `C:/Libraries/mpg123-1.24.0/` -* `openal32.*` (see notes below) + -For OpenAL32, there are no folders linked that would normally contain it... *whoops*. To fix this, take the following files: +[mpg123 Windows x86 builds, v1.24.0]: +[mpg123 Windows x64 builds, v1.24.0]: -* `C:/Libraries/SFML-2.4.2/bin/openal32.dll` -* `C:/Libraries/SFML-2.4.2/lib/openal32.lib` +[mpg123-1.24.0-x86.zip]: +[mpg123-1.24.0-x86-debug.zip]: +[mpg123-1.24.0-static-x86.zip]: +[mpg123-1.24.0-x86-64.zip]: +[mpg123-1.24.0-x86-64-debug.zip]: +[mpg123-1.24.0-static-x86-64.zip]: -And copy these to a library folder the AsciiVis project actually scans for *(or fix it the proper way by adding a new search path)*. -For example, place both these files in `fftw-3.3.5/`. + +[SFML Homepage]: +[SFML GitHub]: -**Files/folders to place in `Release/` after building:** +[SFML Builds]: +[SFML Builds, v2.4.2]: -All files and folders are present in the `AsciiTetris/` project directory. +[SFML-2.4.2-windows-vc14-32-bit.zip]: +[SFML-2.4.2-windows-vc14-64-bit.zip]: -* `Resources/` folder -* *probably more, TODO...* diff --git a/PowerConsoleLib/PowerConsoleLib.vcxproj b/PowerConsoleLib/PowerConsoleLib.vcxproj index d1cfd02..95e3a1d 100644 --- a/PowerConsoleLib/PowerConsoleLib.vcxproj +++ b/PowerConsoleLib/PowerConsoleLib.vcxproj @@ -22,32 +22,32 @@ {B571C836-8F8A-4A07-B42B-B93C98690426} Win32Proj PowerConsoleLib - 10.0.14393.0 + 10.0
StaticLibrary true - v140 + v142 Unicode StaticLibrary false - v140 + v142 true Unicode StaticLibrary true - v140 + v142 Unicode StaticLibrary false - v140 + v142 true Unicode @@ -70,9 +70,23 @@ + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ $(ProjectDir);$(ProjectDir)PowerConsole\;$(IncludePath) + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)PowerConsole\;$(IncludePath) + + + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(ProjectDir)PowerConsole\;$(IncludePath) + + + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ $(ProjectDir);$(ProjectDir)PowerConsole\;$(IncludePath) @@ -82,7 +96,9 @@ Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) true - /std:c++latest -D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions) + -D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions) + 4996 + stdcpp17 Windows @@ -93,8 +109,11 @@ Use Level3 Disabled - _DEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) true + -D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions) + 4996 + stdcpp17 Windows @@ -109,7 +128,9 @@ true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) true - /std:c++latest %(AdditionalOptions) + -D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions) + 4996 + stdcpp17 Windows @@ -124,8 +145,11 @@ MaxSpeed true true - NDEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) true + -D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions) + 4996 + stdcpp17 Windows @@ -312,13 +336,13 @@ + Create Create Create Create - diff --git a/README.md b/README.md index c87d18d..fc0ad78 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,15 @@ The console paint program. Ascii Artist has been a long time project. It's gone This project isn't well documented yet. Everything should be able to run but not everything is explained outside of looking through the code. I'll get back to fixing this up later. -### [Build Instructions](BUILDING.md) \(WIP\) + +*** + +See **[Build Instructions](BUILDING.md)** for the completed steps to get everything running. The build process is now *mostly harmless~* 🎉 + +**Required IDE:** Visual Studio 2019 + +**Configurations:** *all combinations of Debug/Release and Win32/x64* + *** diff --git a/SFMLCustom/SFMLCustom.vcxproj b/SFMLCustom/SFMLCustom.vcxproj index 44d4549..45e3bd3 100644 --- a/SFMLCustom/SFMLCustom.vcxproj +++ b/SFMLCustom/SFMLCustom.vcxproj @@ -22,32 +22,32 @@ {DCAAFD73-FEA8-4DBE-8600-86EE3D15B01F} Win32Proj SFMLCustom - 8.1 + 10.0 StaticLibrary true - v140 + v142 Unicode StaticLibrary false - v140 + v142 true Unicode - Application + StaticLibrary true - v140 + v142 Unicode - Application + StaticLibrary false - v140 + v142 true Unicode @@ -71,19 +71,31 @@ true - $(ProjectDir);$(IncludePath) - $(ProjectDir);C:\Libraries\ffmpeg-3.2.4\lib;$(LibraryPath) + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(SolutionDir)lib\ffmpeg-3.2.4\include\;$(IncludePath) + $(SolutionDir)lib\ffmpeg-3.2.4\lib\x86\;$(SolutionDir)lib\SFML-2.4.2\lib\x86\;$(LibraryPath) true + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(SolutionDir)lib\ffmpeg-3.2.4\include\;$(IncludePath) + $(SolutionDir)lib\ffmpeg-3.2.4\lib\x64\;$(SolutionDir)lib\SFML-2.4.2\lib\x64\;$(LibraryPath) false - $(ProjectDir);$(IncludePath) - $(ProjectDir);C:\Libraries\ffmpeg-3.2.4\lib;$(LibraryPath) + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(SolutionDir)lib\ffmpeg-3.2.4\include\;$(IncludePath) + $(SolutionDir)lib\ffmpeg-3.2.4\lib\x86\;$(SolutionDir)lib\SFML-2.4.2\lib\x86\;$(LibraryPath) false + $(ProjectDir)bin\$(Configuration)-$(Platform)\ + $(ProjectDir)obj\$(Configuration)-$(Platform)\ + $(ProjectDir);$(SolutionDir)lib\ffmpeg-3.2.4\include\;$(IncludePath) + $(SolutionDir)lib\ffmpeg-3.2.4\lib\x64\;$(SolutionDir)lib\SFML-2.4.2\lib\x64\;$(LibraryPath) @@ -92,13 +104,13 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - C:\Libraries\ffmpeg-3.2.4\include;%(AdditionalIncludeDirectories) + 4996 + Default Console true - openal32.lib;Winmm.lib;avcodec.lib;avformat.lib;avutil.lib;avdevice.lib;avfilter.lib;postproc.lib;swresample.lib;swscale.lib;%(AdditionalDependencies) - C:\Libraries\ffmpeg-3.2.4\lib;%(AdditionalLibraryDirectories) + Winmm.lib;openal32.lib;avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;postproc.lib;swresample.lib;swscale.lib;%(AdditionalDependencies) @@ -107,11 +119,14 @@ Level3 Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4996 + Default Console true + Winmm.lib;openal32.lib;avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;postproc.lib;swresample.lib;swscale.lib;%(AdditionalDependencies) @@ -123,15 +138,15 @@ true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - C:\Libraries\ffmpeg-3.2.4\include;%(AdditionalIncludeDirectories) + 4996 + Default Console true true true - openal32.lib;Winmm.lib;avcodec.lib;avformat.lib;avutil.lib;avdevice.lib;avfilter.lib;postproc.lib;swresample.lib;swscale.lib;%(AdditionalDependencies) - C:\Libraries\ffmpeg-3.2.4\lib;%(AdditionalLibraryDirectories) + Winmm.lib;openal32.lib;avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;postproc.lib;swresample.lib;swscale.lib;%(AdditionalDependencies) false @@ -143,13 +158,16 @@ MaxSpeed true true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + 4996 + Default Console true true true + Winmm.lib;openal32.lib;avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;postproc.lib;swresample.lib;swscale.lib;%(AdditionalDependencies) diff --git a/SFMLCustom/avcodec-57.dll b/SFMLCustom/avcodec-57.dll deleted file mode 100644 index 7578343..0000000 Binary files a/SFMLCustom/avcodec-57.dll and /dev/null differ diff --git a/SFMLCustom/avdevice-57.dll b/SFMLCustom/avdevice-57.dll deleted file mode 100644 index 0b4d04a..0000000 Binary files a/SFMLCustom/avdevice-57.dll and /dev/null differ diff --git a/SFMLCustom/avfilter-6.dll b/SFMLCustom/avfilter-6.dll deleted file mode 100644 index b5e7164..0000000 Binary files a/SFMLCustom/avfilter-6.dll and /dev/null differ diff --git a/SFMLCustom/avformat-57.dll b/SFMLCustom/avformat-57.dll deleted file mode 100644 index 15da6e6..0000000 Binary files a/SFMLCustom/avformat-57.dll and /dev/null differ diff --git a/SFMLCustom/avutil-55.dll b/SFMLCustom/avutil-55.dll deleted file mode 100644 index 94dcf4a..0000000 Binary files a/SFMLCustom/avutil-55.dll and /dev/null differ diff --git a/SFMLCustom/openal32.dll b/SFMLCustom/openal32.dll deleted file mode 100644 index 40b2aa0..0000000 Binary files a/SFMLCustom/openal32.dll and /dev/null differ diff --git a/SFMLCustom/postproc-54.dll b/SFMLCustom/postproc-54.dll deleted file mode 100644 index a7febce..0000000 Binary files a/SFMLCustom/postproc-54.dll and /dev/null differ diff --git a/SFMLCustom/swresample-2.dll b/SFMLCustom/swresample-2.dll deleted file mode 100644 index c9343bb..0000000 Binary files a/SFMLCustom/swresample-2.dll and /dev/null differ diff --git a/SFMLCustom/swscale-4.dll b/SFMLCustom/swscale-4.dll deleted file mode 100644 index d3a9c89..0000000 Binary files a/SFMLCustom/swscale-4.dll and /dev/null differ diff --git a/assets/AsciiArtist/preview_v1-alpha-2010.png b/assets/AsciiArtist/preview_v1-alpha-2010.png new file mode 100644 index 0000000..6591497 Binary files /dev/null and b/assets/AsciiArtist/preview_v1-alpha-2010.png differ diff --git a/assets/AsciiTetris/preview_gameover.png b/assets/AsciiTetris/preview_gameover.png new file mode 100644 index 0000000..7246cb4 Binary files /dev/null and b/assets/AsciiTetris/preview_gameover.png differ diff --git a/assets/AsciiTetris/preview_giant-world.png b/assets/AsciiTetris/preview_giant-world.png new file mode 100644 index 0000000..ca7509b Binary files /dev/null and b/assets/AsciiTetris/preview_giant-world.png differ diff --git a/assets/AsciiTetris/preview_tinyblocks.png b/assets/AsciiTetris/preview_tinyblocks.png new file mode 100644 index 0000000..1b8075b Binary files /dev/null and b/assets/AsciiTetris/preview_tinyblocks.png differ diff --git a/assets/AsciiTetris/preview_title.png b/assets/AsciiTetris/preview_title.png new file mode 100644 index 0000000..ecf21a9 Binary files /dev/null and b/assets/AsciiTetris/preview_title.png differ diff --git a/assets/AsciiVis/preview1.png b/assets/AsciiVis/preview1.png new file mode 100644 index 0000000..2e00e94 Binary files /dev/null and b/assets/AsciiVis/preview1.png differ diff --git a/assets/AsciiVis/preview2.png b/assets/AsciiVis/preview2.png new file mode 100644 index 0000000..c378649 Binary files /dev/null and b/assets/AsciiVis/preview2.png differ diff --git a/lib/README.md b/lib/README.md deleted file mode 100644 index 0053350..0000000 --- a/lib/README.md +++ /dev/null @@ -1,244 +0,0 @@ -# External libraries - -This page is a work in-progress, and **does not yet reflect** changes made to the project library loading. - -### External library usage - -| |PowerCon.|AsciiArtist|AsciiTetris|AsciiVis|SFMLCust.| -|:----------------|:-------:|:---------:|:---------:|:------:|:--------:| -|[FFmpeg](#ffmpeg)| |✓¹| |✓ |✓ | -|[FFTW](#fftw) | | | |✓ | | -|[mpg123](#mpg123)| | |✓ |✓ | | -|[SFML](#sfml) | | |✓ |✓²|✓| - -\[1\] : (optional) FFmpeg main binary used at runtime for optional feature
-\[2\] : SFML borrowed only for openal32 `.dll` and `.lib` files - - -*** - -## Folder structure - -#### x86 platform folder structure - -`lib/` -* `ffmpeg-3.2.4-win32/` - * `bin/`   (*from [ffmpeg-3.2.4-win32-shared.zip][]*) - * `include/`   (*from [ffmpeg-3.2.4-win32-dev.zip][]*) - * `lib/`   (*from [ffmpeg-3.2.4-win32-dev.zip][]*) -* `fftw-3.3.5-dll32/` - * `fftw3.h` - * `libfftw3f-3.dll` - * `libfftw3f-3.def` - * `libfftw3f-3.lib`   (*created: LIB /MACHINE:X86 /DEF:libfftw3f-3.def in VS dev console*) -* `mpg123-1.24.0-x86/` *and* `mpg123-1.24.0-x86-debug/` - * `fmt123.h` - * `mpg123.h` - * `libmpg123-0.dll` - * `libmpg123-0.def`   (*renamed: rename libmpg123-0.dll.def libmpg123-0.def*) - * `libmpg123-0.lib`   (*created: LIB /MACHINE:X86 /DEF:libmpg123-0.def in VS dev console*) -* `SFML-2.4.2-windows-vc14-32-bit/` - * `bin/` - * `include/` - * `lib/` - -#### x64 platform folder structure - -`lib/` -* `ffmpeg-3.2.4-win64/` - * `bin/`   (*from [ffmpeg-3.2.4-win64-shared.zip][]*) - * `include/`   (*from [ffmpeg-3.2.4-win64-dev.zip][]*) - * `lib/`   (*from [ffmpeg-3.2.4-win64-dev.zip][]*) -* `fftw-3.3.5-dll64/` - * `fftw3.h` - * `libfftw3f-3.dll` - * `libfftw3f-3.def` - * `libfftw3f-3.lib`   (*created: LIB /MACHINE:X64 /DEF:libfftw3f-3.def in VS dev console*) -* `mpg123-1.24.0-x86-64/` *and* `mpg123-1.24.0-x86-64-debug/` - * `fmt123.h` - * `mpg123.h` - * `libmpg123-0.dll` - * `libmpg123-0.def`   (*renamed: rename libmpg123-0.dll.def libmpg123-0.def*) - * `libmpg123-0.lib`   (*created: LIB /MACHINE:X64 /DEF:libmpg123-0.def in VS dev console*) -* `SFML-2.4.2-windows-vc14-64-bit/` - * `bin/` - * `include/` - * `lib/` - - -*** - - - - -## FFmpeg - -[Homepage][FFmpeg Homepage] **\|** [GitHub][FFmpeg GitHub] - -C library (and tools) for all kinds of audio handling and manipulation. - -**All links for FFmpeg below are web-archived.** -Zeranoe FFmpeg Builds, which had been an essential hub for prebuilt Windows binaries, shutdown on September 18th, 2020. -Thankfully everything of importance was heavily scraped and web-archived beforehand. - -> ffmpeg.zeranoe.com will close on Sep 18, 2020, and all builds will be removed. -> If you're using Zeranoe FFmpeg Builds in your product, please ensure that you have a hosting strategy in place by the 18th. -> Thank you to everyone who supported the project along the way! -> ([source][Zeranoe FFmpeg Builds shutdown]) - -* [Builds][FFmpeg builds] **>** [Windows x86][FFmpeg Windows x86 builds] **>** [dev][FFmpeg Windows x86 dev builds] \| [shared][FFmpeg Windows x86 shared builds] \| [static][FFmpeg Windows x86 static builds] - * [ffmpeg-3.2.4-win32-dev.zip][] .lib - * [ffmpeg-3.2.4-win32-shared.zip][] .dll - * [ffmpeg-3.2.4-win32-static.zip][] .exe (not required) -* [Builds][FFmpeg builds] **>** [Windows x64][FFmpeg Windows x64 builds] **>** [dev][FFmpeg Windows x64 dev builds] \| [shared][FFmpeg Windows x64 shared builds] \| [static][FFmpeg Windows x64 static builds] - * [ffmpeg-3.2.4-win64-dev.zip][] .lib - * [ffmpeg-3.2.4-win64-shared.zip][] .dll - * [ffmpeg-3.2.4-win64-static.zip][] .exe (not required) - - - - - -## FFTW - -[Homepage][FFTW Homepage] **\|** [GitHub][FFTW GitHub] - -C library for computing the Discrete Fourier Transform, which is used in audio visualization. - -* [Builds][FFTW Builds] **>** [Windows][FFTW Windows builds] - * [fftw-3.3.5-dll32.zip][] .dll .def - * [fftw-3.3.5-dll64.zip][] .dll .def - - -## mpg123 - -[Homepage][mpg123 Homepage] - -C library for reading MPEG-3 (`.mp3`) audio files. - - - - -* [Windows x86 builds][mpg123 Windows x86 builds] **>** [v1.24.0][mpg123 Windows x86 builds, v1.24.0] - * [mpg123-1.24.0-x86.zip][] .dll .def - * [mpg123-1.24.0-x86-debug.zip][] .dll .def -* [Windows x64 builds][mpg123 Windows x64 builds] **>** [v1.24.0][mpg123 Windows x64 builds, v1.24.0] - * [mpg123-1.24.0-x86-64.zip][] .dll .def - * [mpg123-1.24.0-x86-64-debug.zip][] .dll .def - - - - -## SFML - -[Homepage][SFML Homepage] **\|** [GitHub][SFML GitHub] - -C++ library for easy use of audio in games and applications. Used for sound effect and music playback. - -* [Builds][SFML Builds] **>** [v2.4.2][SFML Builds, v2.4.2] - * [SFML-2.4.2-windows-vc14-32-bit.zip][] .dll .lib - * [SFML-2.4.2-windows-vc14-64-bit.zip][] .dll .lib - - - - - - - -[FFmpeg Homepage]: -[FFmpeg GitHub]: - -[Zeranoe FFmpeg Builds shutdown]: - -[FFmpeg builds]: -[FFmpeg Windows x86 builds]: -[FFmpeg Windows x64 builds]: - -[FFmpeg Windows x86 dev builds]: -[FFmpeg Windows x86 shared builds]: -[FFmpeg Windows x86 static builds]: -[FFmpeg Windows x64 dev builds]: -[FFmpeg Windows x64 shared builds]: -[FFmpeg Windows x64 static builds]: - -[ffmpeg-3.2.4-win32-dev.zip]: -[ffmpeg-3.2.4-win32-shared.zip]: -[ffmpeg-3.2.4-win32-static.zip]: -[ffmpeg-3.2.4-win64-dev.zip]: -[ffmpeg-3.2.4-win64-shared.zip]: -[ffmpeg-3.2.4-win64-static.zip]: - - - - -[FFTW Homepage]: -[FFTW GitHub]: - -[FFTW Builds]: - -[FFTW Windows builds]: - -[fftw-3.3.5-dll32.zip]: -[fftw-3.3.5-dll64.zip]: - - - - -[mpg123 Homepage]: - -[mpg123 Windows x86 builds]: -[mpg123 Windows x64 builds]: -[mpg123 Windows x86 builds, v1.24.0]: -[mpg123 Windows x64 builds, v1.24.0]: - -[mpg123-1.24.0-x86.zip]: -[mpg123-1.24.0-x86-debug.zip]: -[mpg123-1.24.0-static-x86.zip]: -[mpg123-1.24.0-x86-64.zip]: -[mpg123-1.24.0-x86-64-debug.zip]: -[mpg123-1.24.0-static-x86-64.zip]: - - - - -[SFML Homepage]: -[SFML GitHub]: - -[SFML Builds]: -[SFML Builds, v2.4.2]: - -[SFML-2.4.2-windows-vc14-32-bit.zip]: -[SFML-2.4.2-windows-vc14-64-bit.zip]: - diff --git a/makelibs.bat b/makelibs.bat new file mode 100644 index 0000000..592b0ff --- /dev/null +++ b/makelibs.bat @@ -0,0 +1,71 @@ +@echo off +setlocal EnableExtensions +:::: makelibs.bat +:: +:: Create .lib files from .dll + .def files (for libraries that do not provide their own lib files) + +:::: INSTRUCTIONS :::: +:: First read instructions to run and then run "setup.ps1", which downloads +:: and sets up the library folder structures. +:: Next ensure any settings changes to output directories are also reflected in this batch file +:: +:: Search for and open "Developer Command Prompt for VS 20xx" (replacing xx with your VS year) +:: +:: >cd "" +:: >powershell ./setup.ps1 +:: >makelibs.bat +:: + + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: CONFIGURATION :: + +:: output directories for libraries (should be the same as in setup.ps1, if this was used) +set "FFmpeg=ffmpeg-3.2.4" +set "FFTW=fftw-3.3.5" +set "Mpg123=mpg123-1.25.4" +set "SFML=SFML-2.4.2" +REM set "FFmpeg=ffmpeg" +REM set "FFTW=fftw" +REM set "Mpg123=mpg123" +REM set "SFML=SFML" + + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: RUN LIB SETUP :: + +:: libs are only built if their directories are found + +call :makelibs_arch "lib\%FFTW%" "x86" +call :makelibs_arch "lib\%FFTW%" "x64" +call :makelibs_arch "lib\%Mpg123%" "x86" +call :makelibs_arch "lib\%Mpg123%" "x64" +call :makelibs_arch "lib\%Mpg123%" "x86" "-debug" +call :makelibs_arch "lib\%Mpg123%" "x64" "-debug" + +echo Finished! + +endlocal +goto :eof + + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: LIB SETUP :: + +:: usage: call :makelibs_arch [ArchPostfix] +:makelibs_arch + setlocal EnableExtensions EnableDelayedExpansion + if exist "%~1\%~2%~3" ( + for /r %%f in ("%~1\%~2%~3\*.dll.def") do ( + :: change any extensions from ".dll.def" to just ".def" + set "file_=%%f" + REM set "file_=!file_:~0,-8!.def" + REM rename "%~1\%~2%~3\%%~nxf" "%~1\%~2%~3\!file_!" + rename "%~1\%~2%~3\%%~nxf" "%~1\%~2%~3\!file_:~0,-8!.def" + ) + + for /r %%f in ("%~1\%~2%~3\*.def") do lib /NOLOGO /MACHINE:%~2 "/DEF:%~1\%~2%~3\%%~nxf" "/OUT:%~1\%~2%~3\%%~nf.lib" + ) + endlocal + goto :eof + diff --git a/setup.ps1 b/setup.ps1 new file mode 100644 index 0000000..b2f42fd --- /dev/null +++ b/setup.ps1 @@ -0,0 +1,271 @@ +## setup.ps1 +# +# Download and prepare dependency libraries used by projects in this repository + +## INSTRUCTIONS ## +# First choose any configuration options you want changed in the section +# below labeled CONFIGURATION. Next ensure any settings changes to output +# directories are also reflected in makelibs.bat +# +# Search for and open "Developer Command Prompt for VS 20xx" (replacing xx with your VS year) +# +# >cd "" +# >powershell ./setup.ps1 +# >makelibs.bat +# + + +################################################################################ +## CONFIGURATION + +# destination for output libraries +# current directory should be: "" +$Dest = ".\lib"; +$DestTemp = "\_tmp"; # appending to $Dest + +# architectures to prepare +$x86 = $true; +$x64 = $true; + +# copy over and merge all contents of downloaded libraries (even unused files) +$OptionalExtras = $false; + +# output directories for libraries +$FFmpeg = "ffmpeg-3.2.4"; +$FFTW = "fftw-3.3.5"; +$Mpg123 = "mpg123-1.25.4"; +$SFML = "SFML-2.4.2"; +#$FFmpeg = "ffmpeg"; +#$FFTW = "fftw"; +#$Mpg123 = "mpg123"; +#$SFML = "SFML"; + + +################################################################################ +## SETUP FUNCTIONS + + +## LIBRARY ACQUIRE ## + +# specify -Subdir $true if the downloaded archive has no root folder within +# [string] parameter type excluded from $Name to allow passing $null +function Acquire([string]$Path, [boolean]$Subdir, $Name, [string]$Url) { + Add-Type -assembly "System.IO.Compression.Filesystem"; + + # download zip file to extract dir (before adding subdir) + $ExtractPath = "$Path$DestTemp"; + New-Item -ItemType directory -Path "$ExtractPath" -Force | Out-Null; + $ZipFile = "$ExtractPath\" + $(Split-Path -Path $Url -Leaf); + Write-Host "Downloading $(Split-Path -Path $Url -Leaf)"; + Invoke-WebRequest -Uri $Url -OutFile "$ZipFile"; + + # extract zip file to extract dir (after adding subdir) + if ($Name -ne $null) { + $OutputPath = "$ExtractPath\$Name"; + } else { + $OutputPath = "$ExtractPath\" + (Get-Item $ZipFile).BaseName; + } + if ($Subdir) { + $ExtractPath = "$ExtractPath\" + (Get-Item $ZipFile).BaseName; + New-Item -ItemType directory -Path "$ExtractPath" -Force | Out-Null; + } + if (Test-Path -Path "$OutputPath") { + # cleanup extracted dir ahead of time (because ZipFile::ExtractToDirectory wants you to suffer) + Get-ChildItem -Path "$OutputPath" -Recurse | Remove-Item -Force -Recurse; + } + [IO.Compression.Zipfile]::ExtractToDirectory("$ZipFile", "$ExtractPath"); + + # cleanup zip file, now that it's extracted + Remove-Item "$ZipFile" -Force; + return "$OutputPath"; +} + +## LIBRARY-SPECIFIC SETUP ## + +function Setup-FFmpeg-Dev([string]$Path, [string]$Name, [string]$Arch, [string]$Url) { + $Dev = $(Acquire "$Path" $false $null "$Url"); + $Path = "$Path\$Name"; + # required items + New-Item -ItemType directory -Path "$Path\lib\$Arch" -Force | Out-Null + New-Item -ItemType directory -Path "$Path\include" -Force | Out-Null + New-Item -ItemType directory -Path "$Path\licenses" -Force | Out-Null + Copy-Item -Path "$Dev\lib\*.def" -Destination "$Path\lib\$Arch" -Force -Recurse + Copy-Item -Path "$Dev\lib\*.lib" -Destination "$Path\lib\$Arch" -Force -Recurse + Copy-Item -Path "$Dev\include\*" -Destination "$Path\include" -Force -Recurse + Copy-Item -Path "$Dev\licenses\*" -Destination "$Path\licenses" -Force -Recurse + Copy-Item -Path "$Dev\README.txt" -Destination "$Path" -Force + + # optional items + if ($OptionalExtras) { + New-Item -ItemType directory -Path "$Path\doc" -Force | Out-Null + Copy-Item -Path "$Dev\lib\*.a" -Destination "$Path\lib\$Arch" -Force -Recurse + Copy-Item -Path "$Dev\doc\*" -Destination "$Path\doc" -Force -Recurse + } + # cleanup + Get-ChildItem -Path "$Dev" -Recurse | Remove-Item -Force -Recurse + Remove-Item "$Dev" -Force +} + +function Setup-FFmpeg-Shared([string]$Path, [string]$Name, [string]$Arch, [string]$Url) { + $Shared = $(Acquire "$Path" $false $null "$Url"); + $Path = "$Path\$Name"; + # required items + New-Item -ItemType directory -Path "$Path\bin\$Arch" -Force | Out-Null + Copy-Item -Path "$Shared\bin\*.dll" -Destination "$Path\bin\$Arch" -Force -Recurse + + # optional items + if ($OptionalExtras) { + New-Item -ItemType directory -Path "$Path\presets" -Force | Out-Null + Copy-Item -Path "$Shared\bin\*.exe" -Destination "$Path\bin\$Arch" -Force -Recurse + Copy-Item -Path "$Shared\presets\*" -Destination "$Path\presets" -Force -Recurse + } + # cleanup + Get-ChildItem -Path "$Shared" -Recurse | Remove-Item -Force -Recurse + Remove-Item "$Shared" -Force +} + +function Setup-FFmpeg-Static([string]$Path, [string]$Name, [string]$Arch, [string]$Url) { + # not used for build process + if (-Not $OptionalExtras) { return; } + + $Static = $(Acquire "$Path" $false $null "$Url"); + $Path = "$Path\$Name"; + # required items + New-Item -ItemType directory -Path "$Path\bin\$Arch" -Force | Out-Null + Copy-Item -Path "$Static\bin\*.exe" -Destination "$Path\bin\$Arch" -Force -Recurse + + # cleanup + Get-ChildItem -Path "$Static" -Recurse | Remove-Item -Force -Recurse + Remove-Item "$Static" -Force +} + +function Setup-FFTW([string]$Path, [string]$Name, [string]$Arch, [string]$Url) { + $Source = $(Acquire "$Path" $true $null "$Url"); + $Path = "$Path\$Name"; + # required items + New-Item -ItemType directory -Path "$Path\$Arch" -Force | Out-Null + Copy-Item -Path "$Source\*.dll" -Destination "$Path\$Arch" -Force + Copy-Item -Path "$Source\*.def" -Destination "$Path\$Arch" -Force + Copy-Item -Path "$Source\*.h" -Destination "$Path" -Force + Copy-Item -Path "$Source\README" -Destination "$Path" -Force + Copy-Item -Path "$Source\COPYING" -Destination "$Path" -Force + Copy-Item -Path "$Source\COPYRIGHT" -Destination "$Path" -Force + + # optional items + if ($OptionalExtras) { + Copy-Item -Path "$Source\*.exe" -Destination "$Path\$Arch" -Force + Copy-Item -Path "$Source\README-WINDOWS" -Destination "$Path\$Arch" -Force + Copy-Item -Path "$Source\README-bench" -Destination "$Path" -Force + Copy-Item -Path "$Source\NEWS" -Destination "$Path" -Force + } + # cleanup + Get-ChildItem -Path "$Source" -Recurse | Remove-Item -Force -Recurse + Remove-Item "$Source" -Force +} + +function Setup-Mpg123([string]$Path, [string]$Name, [string]$Arch, [string]$Url) { + $Source = $(Acquire "$Path" $false $null "$Url"); + $Path = "$Path\$Name"; + # required items + New-Item -ItemType directory -Path "$Path\$Arch" -Force | Out-Null + Copy-Item -Path "$Source\*.dll" -Destination "$Path\$Arch" -Force + Copy-Item -Path "$Source\*.def" -Destination "$Path\$Arch" -Force + Copy-Item -Path "$Source\*.h" -Destination "$Path" -Force + Copy-Item -Path "$Source\README.txt" -Destination "$Path" -Force + Copy-Item -Path "$Source\COPYING.txt" -Destination "$Path" -Force + + # correct ".dll.def" extensions to ".def" + # + Get-ChildItem -Path "$Path\$Arch\*.dll.def" | %{ + # extra handling because Rename-Item will fail when the file already exists. more headaches... + $NewName = $_.Name -Replace ".dll.def", ".def" + $NewDestination = Join-Path -Path $_.Directory.FullName -ChildPath $NewName + Move-Item -Path $_.FullName -Destination $NewDestination -Force + } + + # optional items + if ($OptionalExtras) { + New-Item -ItemType directory -Path "$Path\$Arch\plugins" -Force | Out-Null + Copy-Item -Path "$Source\plugins\*" -Destination "$Path\$Arch\plugins" -Force -Recurse + Copy-Item -Path "$Source\*.exe" -Destination "$Path\$Arch" -Force + Copy-Item -Path "$Source\NEWS.txt" -Destination "$Path" -Force + } + # cleanup + Get-ChildItem -Path "$Source" -Recurse | Remove-Item -Force -Recurse + Remove-Item "$Source" -Force +} + +function Setup-SFML([string]$Path, [string]$Name, [string]$Arch, [string]$ExtractName, [string]$Url) { + $Source = $(Acquire "$Path" $false "$ExtractName" "$Url"); + $Path = "$Path\$Name"; + # required items + New-Item -ItemType directory -Path "$Path\bin\$Arch" -Force | Out-Null + New-Item -ItemType directory -Path "$Path\lib\$Arch" -Force | Out-Null + New-Item -ItemType directory -Path "$Path\include" -Force | Out-Null + Copy-Item -Path "$Source\bin\*" -Destination "$Path\bin\$Arch" -Force -Recurse + Copy-Item -Path "$Source\lib\*" -Destination "$Path\lib\$Arch" -Force -Recurse + Copy-Item -Path "$Source\include\*" -Destination "$Path\include" -Force -Recurse + Copy-Item -Path "$Source\license.txt" -Destination "$Path" -Force + Copy-Item -Path "$Source\readme.txt" -Destination "$Path" -Force + + # optional items + if ($OptionalExtras) { + New-Item -ItemType directory -Path "$Path\examples\$Arch" -Force | Out-Null + New-Item -ItemType directory -Path "$Path\cmake" -Force | Out-Null + New-Item -ItemType directory -Path "$Path\doc" -Force | Out-Null + Copy-Item -Path "$Source\examples\*" -Destination "$Path\examples\$Arch" -Force -Recurse + Copy-Item -Path "$Source\cmake\*" -Destination "$Path\cmake" -Force -Recurse + Copy-Item -Path "$Source\doc\*" -Destination "$Path\doc" -Force -Recurse + } + # cleanup + Get-ChildItem -Path "$Source" -Recurse | Remove-Item -Force -Recurse + Remove-Item "$Source" -Force +} + + +################################################################################ +## SETUP LIBRARIES + +New-Item -ItemType directory -Path "$Dest$DestTemp" -Force | Out-Null; + +Write-Host "Preparing FFmpeg libraries..." +# 3rd commented-out item: optional full-featured ffmpeg executables +if ($x86) { Setup-FFmpeg-Dev "$Dest" "$FFmpeg" "x86" "https://web.archive.org/web/20200819162211if_/https://ffmpeg.zeranoe.com/builds/win32/dev/ffmpeg-3.2.4-win32-dev.zip" + Setup-FFmpeg-Shared "$Dest" "$FFmpeg" "x86" "https://web.archive.org/web/20200305154853if_/https://ffmpeg.zeranoe.com/builds/win32/shared/ffmpeg-3.2.4-win32-shared.zip" + Setup-FFmpeg-Static "$Dest" "$FFmpeg" "x86" "https://web.archive.org/web/20170419055331if_/https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-3.2.4-win32-static.zip" +} +if ($x64) { Setup-FFmpeg-Dev "$Dest" "$FFmpeg" "x64" "https://web.archive.org/web/20200819182628if_/https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-3.2.4-win64-dev.zip" + Setup-FFmpeg-Shared "$Dest" "$FFmpeg" "x64" "https://web.archive.org/web/20200414063958if_/https://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-3.2.4-win64-shared.zip" + Setup-FFmpeg-Static "$Dest" "$FFmpeg" "x64" "https://web.archive.org/web/20180408233456if_/https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-3.2.4-win64-static.zip" +} + +Write-Host "" +Write-Host "Preparing FFTW libraries..." +if ($x86) { Setup-FFTW "$Dest" "$FFTW" "x86" "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll32.zip" +} +if ($x64) { Setup-FFTW "$Dest" "$FFTW" "x64" "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll64.zip" +} + +Write-Host "" +Write-Host "Preparing mpg123 libraries..." +# 2nd commented-out item: optional debug libraries +if ($x86) { Setup-Mpg123 "$Dest" "$Mpg123" "x86" "https://www.mpg123.de/download/win32/1.25.4/mpg123-1.25.4-x86.zip" + Setup-Mpg123 "$Dest" "$Mpg123" "x86-debug" "https://www.mpg123.de/download/win32/1.25.4/mpg123-1.25.4-x86-debug.zip" +} +if ($x64) { Setup-Mpg123 "$Dest" "$Mpg123" "x64" "https://www.mpg123.de/download/win64/1.25.4/mpg123-1.25.4-x86-64.zip" + Setup-Mpg123 "$Dest" "$Mpg123" "x64-debug" "https://www.mpg123.de/download/win64/1.25.4/mpg123-1.25.4-x86-64-debug.zip" +} + +Write-Host "" +Write-Host "Preparing SFML libraries..." +# SFML extracted folder is named "SFML-", not the same as the zip +if ($x86) { Setup-SFML "$Dest" "$SFML" "x86" "SFML-2.4.2" "https://www.sfml-dev.org/files/SFML-2.4.2-windows-vc14-32-bit.zip" +} +if ($x64) { Setup-SFML "$Dest" "$SFML" "x64" "SFML-2.4.2" "https://www.sfml-dev.org/files/SFML-2.4.2-windows-vc14-64-bit.zip" +} + +Remove-Item "$Dest$DestTemp" -Force +Write-Host "" +Write-Host "Complete!" + +################################################################################