diff --git a/.gitignore b/.gitignore
index b7954c327..0e5de68d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,7 +71,6 @@ svn-revision.h
svn_revision
tests/*.json
tests/run
-tools/common-respack
tools/osx-bundle-restart-helper
tools/osx-bundle.sed
tools/repack-thes-dict
diff --git a/Aegisub.sln b/Aegisub.sln
index 954e5f447..c901568cc 100644
--- a/Aegisub.sln
+++ b/Aegisub.sln
@@ -24,17 +24,10 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresrc", "build\libresrc\libresrc.vcxproj", "{BD00D65F-24DA-4784-8860-3B972EA125FC}"
ProjectSection(ProjectDependencies) = postProject
{0518D6C0-7BF6-4FD1-91FB-191BD10DB2AC} = {0518D6C0-7BF6-4FD1-91FB-191BD10DB2AC}
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8} = {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "luabins", "build\luabins\luabins.vcxproj", "{A7A30702-8162-4E1A-A010-EF51B590C121}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "respack", "build\respack\respack.vcxproj", "{08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}"
- ProjectSection(ProjectDependencies) = postProject
- {FB8E8D19-A4D6-4181-943C-282075F49B41} = {FB8E8D19-A4D6-4181-943C-282075F49B41}
- {F934AB7B-186B-4E96-B20C-A58C38C1B818} = {F934AB7B-186B-4E96-B20C-A58C38C1B818}
- EndProjectSection
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "universalchardet", "build\universalchardet\universalchardet.vcxproj", "{7B56955D-5162-4698-AA5B-47484EDC8783}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fftw", "build\fftw\fftw.vcxproj", "{EA3DCC95-2423-4EA0-A508-7A427B4C0594}"
@@ -239,20 +232,6 @@ Global
{A7A30702-8162-4E1A-A010-EF51B590C121}.Release|x64.Build.0 = Release|x64
{A7A30702-8162-4E1A-A010-EF51B590C121}.Release-MinDep|Win32.ActiveCfg = Release|Win32
{A7A30702-8162-4E1A-A010-EF51B590C121}.Release-MinDep|x64.ActiveCfg = Release|x64
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Debug|Win32.ActiveCfg = Debug|Win32
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Debug|Win32.Build.0 = Debug|Win32
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Debug|x64.ActiveCfg = Debug|x64
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Debug|x64.Build.0 = Debug|x64
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Debug-MinDep|Win32.ActiveCfg = Debug|Win32
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Debug-MinDep|x64.ActiveCfg = Debug|Win32
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Debug-Tests|Win32.ActiveCfg = Debug|Win32
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Debug-Tests|x64.ActiveCfg = Debug|x64
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Release|Win32.ActiveCfg = Release|Win32
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Release|Win32.Build.0 = Release|Win32
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Release|x64.ActiveCfg = Release|x64
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Release|x64.Build.0 = Release|x64
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Release-MinDep|Win32.ActiveCfg = Release|Win32
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}.Release-MinDep|x64.ActiveCfg = Release|x64
{7B56955D-5162-4698-AA5B-47484EDC8783}.Debug|Win32.ActiveCfg = Debug|Win32
{7B56955D-5162-4698-AA5B-47484EDC8783}.Debug|Win32.Build.0 = Debug|Win32
{7B56955D-5162-4698-AA5B-47484EDC8783}.Debug|x64.ActiveCfg = Debug|x64
diff --git a/build/libresrc/libresrc.vcxproj b/build/libresrc/libresrc.vcxproj
index 05a57095e..29e326acc 100644
--- a/build/libresrc/libresrc.vcxproj
+++ b/build/libresrc/libresrc.vcxproj
@@ -8,7 +8,7 @@
lib
- ..\..\src\libresrc\
+ $(MSBuildThisFileDirectory)..\..\src\libresrc\
@@ -19,12 +19,9 @@
_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
-
- $(MSBuildThisFileDirectory)..\..\src\libresrc\
-
-
+
@@ -37,20 +34,29 @@
-
- default_config.cpp
- default_config.h
+
+ default_config
+ $(SrcDir)
-
- bitmap.cpp
- bitmap.h
+
+ bitmap
+ $(SrcDir)
+
+
+
+
+
+
+
+
+
diff --git a/build/libresrc/libresrc.vcxproj.filters b/build/libresrc/libresrc.vcxproj.filters
index 5a0cbde3f..dba47ece3 100644
--- a/build/libresrc/libresrc.vcxproj.filters
+++ b/build/libresrc/libresrc.vcxproj.filters
@@ -14,22 +14,37 @@
rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
- Resource Files
-
-
- Resource Files
-
-
Source Files
+
+ Source Files
+
+
+ Source Files
+
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
\ No newline at end of file
diff --git a/build/respack.targets b/build/respack.targets
new file mode 100644
index 000000000..ad68544cb
--- /dev/null
+++ b/build/respack.targets
@@ -0,0 +1,27 @@
+
+
+
+ $(AegisubBinaryDir)luajit-minilua$(AegisubPlatformSuffix)
+ $(AegisubSourceBase)tools\respack.lua
+
+
+
+
+
+
+
+
+
+
diff --git a/build/respack/Aegisub.ResPack.ProjectItems.xml b/build/respack/Aegisub.ResPack.ProjectItems.xml
deleted file mode 100644
index 58ea2591f..000000000
--- a/build/respack/Aegisub.ResPack.ProjectItems.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build/respack/Aegisub.ResPack.targets b/build/respack/Aegisub.ResPack.targets
deleted file mode 100644
index f2228e8a4..000000000
--- a/build/respack/Aegisub.ResPack.targets
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
- $(AegisubBinaryDir)respack$(AegisubPlatformSuffix).exe
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ResPack
-
-
-
-
diff --git a/build/respack/Aegisub.ResPack.xml b/build/respack/Aegisub.ResPack.xml
deleted file mode 100644
index dc11a9e99..000000000
--- a/build/respack/Aegisub.ResPack.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build/respack/respack.vcxproj b/build/respack/respack.vcxproj
deleted file mode 100644
index ed6fc0a96..000000000
--- a/build/respack/respack.vcxproj
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
- {08AF2BCC-FCDD-4F0E-8B41-59A6E634F2E8}
- respack
-
-
-
-
- exe
-
-
-
-
-
-
-
- $(ProjectDir)
- respack$(AegisubPlatformSuffix)
-
-
-
- _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
-
-
- $(AegisubLibraryDir);%(AdditionalLibraryDirectories)
- Console
-
-
-
-
-
-
-
-
diff --git a/build/respack/respack.vcxproj.filters b/build/respack/respack.vcxproj.filters
deleted file mode 100644
index 71cf87d25..000000000
--- a/build/respack/respack.vcxproj.filters
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/libresrc/Makefile.inc b/src/libresrc/Makefile.inc
index 8ef2dc8ec..7e78a3dc9 100644
--- a/src/libresrc/Makefile.inc
+++ b/src/libresrc/Makefile.inc
@@ -6,15 +6,15 @@ SRC += \
HEADER += \
libresrc/libresrc.h
-libresrc/bitmap.cpp libresrc/bitmap.h: ../tools/common-respack bitmaps/button/*
- ../tools/common-respack bitmaps/manifest.respack libresrc/bitmap.cpp libresrc/bitmap.h
+libresrc/bitmap.cpp libresrc/bitmap.h: ../tools/respack.lua bitmaps/button/*
+ ../tools/respack.lua bitmaps/manifest.respack libresrc/bitmap.cpp libresrc/bitmap.h
ifeq (yes, $(BUILD_DARWIN))
-libresrc/default_config.cpp libresrc/default_config.h: ../tools/common-respack libresrc/*.json libresrc/osx/*.json
- ../tools/common-respack libresrc/manifest_osx.respack libresrc/default_config.cpp libresrc/default_config.h
+libresrc/default_config.cpp libresrc/default_config.h: ../tools/respack.lua libresrc/*.json libresrc/osx/*.json
+ ../tools/respack.lua libresrc/manifest_osx.respack libresrc/default_config.cpp libresrc/default_config.h
else
-libresrc/default_config.cpp libresrc/default_config.h: ../tools/common-respack libresrc/*.json
- ../tools/common-respack libresrc/manifest.respack libresrc/default_config.cpp libresrc/default_config.h
+libresrc/default_config.cpp libresrc/default_config.h: ../tools/respack.lua libresrc/*.json
+ ../tools/respack.lua libresrc/manifest.respack libresrc/default_config.cpp libresrc/default_config.h
endif
CLEANFILES += \
diff --git a/tools/Makefile b/tools/Makefile
index 5fab3c9a7..a59789c88 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,9 +1,5 @@
include ../Makefile.inc
-PROGRAM = common-respack
-
-SRC += common-respack.cpp
-
ifeq (yes, $(BUILD_DARWIN))
osx-bundle-restart-helper: osx-bundle-restart-helper.c
$(BIN_CC) -o osx-bundle-restart-helper osx-bundle-restart-helper.c
diff --git a/tools/common-respack.cpp b/tools/common-respack.cpp
deleted file mode 100644
index ae2d7b196..000000000
--- a/tools/common-respack.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2010, Amar Takhar
-//
-// Permission to use, copy, modify, and distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-#include
-#include
-#include
-#include
-
-/// Clean a filename for use as an identity.
-/// @param str[in] String containing filename.
-void clean(std::string &str) {
- // Chop extension
- auto pos = str.rfind('.');
- if (pos != std::string::npos)
- str.erase(pos, str.size() - pos);
-
- // Remove path
- pos = str.rfind('/');
- if (pos != std::string::npos)
- str.erase(0, pos + 1);
-}
-
-int main(int argc, const char *argv[]) {
- // Needs 3 arguments
- if (argc != 4) {
- std::cout << "Usage: [in] [out] [out]" << std::endl;
- return 1;
- }
-
- std::cout << "Manifest: " << argv[1] << " CPP: " << argv[2] << " Header: " << argv[3] << std::endl;
-
- std::ifstream file_manifest(argv[1]);
- std::ofstream file_cpp(argv[2]);
- std::ofstream file_h(argv[3]);
-
- if (!file_manifest.good()) {
- std::cout << "Failed to open manifest" << std::endl;
- return 1;
- }
-
- if (!file_cpp.good()) {
- std::cout << "Failed to open output CPP file" << std::endl;
- return 1;
- }
-
- if (!file_h.good()) {
- std::cout << "Failed to open output H file" << std::endl;
- return 1;
- }
-
- // If the manifest has a path use that as the base for finding files.
- std::string manifest(argv[1]);
- std::string path_base;
- std::string::size_type pos = manifest.rfind('/');
- if (pos != std::string::npos) {
- path_base = manifest.substr(0, pos+1);
- }
-
- file_cpp << "#include \"libresrc.h\"\n";
-
- std::string file;
- while (std::getline(file_manifest, file)) {
- if (file.empty()) continue;
-
- std::ifstream ifp((path_base + file).c_str(), std::ios_base::binary);
-
- if (!ifp.is_open()) {
- std::cout << "Error opening file: " << file << std::endl;
- return 1;
- }
-
- clean(file);
- file_cpp << "const unsigned char " << file << "[] = {";
-
- size_t length = 0;
- for (std::istreambuf_iterator it(ifp), end; it != end; ++it) {
- if (length > 0) file_cpp << ",";
- file_cpp << (unsigned int)(unsigned char)*it;
- ++length;
- }
-
- file_cpp << "};\n";
-
- file_h << "extern const unsigned char " << file << "[" << length << "];\n";
- }
-
- return 0;
-}
diff --git a/tools/respack.lua b/tools/respack.lua
new file mode 100755
index 000000000..1e978e5c5
--- /dev/null
+++ b/tools/respack.lua
@@ -0,0 +1,64 @@
+#!../vendor/luajit/src/host/minilua
+-- Copyright (c) 2014, Thomas Goyne
+--
+-- Permission to use, copy, modify, and distribute this software for any
+-- purpose with or without fee is hereby granted, provided that the above
+-- copyright notice and this permission notice appear in all copies.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+--
+-- Aegisub Project http://www.aegisub.org/
+
+if not arg or #arg == 0 then arg = {...} end
+
+if #arg ~= 3 then
+ io.stdout:write('Usage: [in] [out] [out]\n')
+ os.exit(1)
+end
+
+local function try_open(filename, mode)
+ local file, err = io.open(filename, mode)
+ if not file then
+ io.stdout:write(string.format('Failed to open "%s": %s\n', filename, err))
+ os.exit(1)
+ end
+ return file
+end
+
+io.stdout:write("Manifest: " .. arg[1] .. " CPP: " .. arg[2] .. " Header: " .. arg[3] .. '\n')
+
+local manifest = try_open(arg[1], 'r')
+local out_cpp = try_open(arg[2], 'w')
+local out_h = try_open(arg[3], 'w')
+
+local pos = arg[1]:find('/')
+local path = pos and arg[1]:sub(1, pos) or ''
+
+out_cpp:write('#include "libresrc.h"\n')
+
+for line in manifest:lines() do
+ if line:find('.') then
+ local file = try_open(path..line, 'rb')
+ local id = line:gsub('^.*/', ''):gsub('\.[a-z]+$', '')
+ out_cpp:write("const unsigned char " .. id .. "[] = {")
+
+ local len = 0
+ while true do
+ local b = file:read(1)
+ if not b then break end
+
+ if len > 0 then out_cpp:write(',') end
+ out_cpp:write(string.format('%d', b:byte()))
+ len = len + 1
+ end
+ out_cpp:write('};\n')
+ out_h:write(string.format('extern const unsigned char %s[%d];\n', id, len))
+ file:close()
+ end
+end