aboutsummaryrefslogtreecommitdiff
path: root/Src/external_dependencies/openmpt-trunk/soundlib/UMXTools.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/external_dependencies/openmpt-trunk/soundlib/UMXTools.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/external_dependencies/openmpt-trunk/soundlib/UMXTools.h')
-rw-r--r--Src/external_dependencies/openmpt-trunk/soundlib/UMXTools.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/Src/external_dependencies/openmpt-trunk/soundlib/UMXTools.h b/Src/external_dependencies/openmpt-trunk/soundlib/UMXTools.h
new file mode 100644
index 00000000..65e24784
--- /dev/null
+++ b/Src/external_dependencies/openmpt-trunk/soundlib/UMXTools.h
@@ -0,0 +1,71 @@
+/*
+ * UMXTools.h
+ * ------------
+ * Purpose: UMX/UAX (Unreal) helper functions
+ * Notes : (currently none)
+ * Authors: OpenMPT Devs (inspired by code from http://wiki.beyondunreal.com/Legacy:Package_File_Format)
+ * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
+ */
+
+
+#pragma once
+
+#include "openmpt/all/BuildSettings.hpp"
+
+
+OPENMPT_NAMESPACE_BEGIN
+
+namespace UMX
+{
+
+// UMX File Header
+struct FileHeader
+{
+ char magic[4]; // C1 83 2A 9E
+ uint16le packageVersion;
+ uint16le licenseMode;
+ uint32le flags;
+ uint32le nameCount;
+ uint32le nameOffset;
+ uint32le exportCount;
+ uint32le exportOffset;
+ uint32le importCount;
+ uint32le importOffset;
+
+ bool IsValid() const;
+ uint32 GetMinimumAdditionalFileSize() const;
+};
+
+MPT_BINARY_STRUCT(FileHeader, 36)
+
+
+// Check validity of file header
+CSoundFile::ProbeResult ProbeFileHeader(MemoryFileReader file, const uint64* pfilesize, const char *requiredType);
+
+// Read compressed unreal integers - similar to MIDI integers, but signed values are possible.
+int32 ReadIndex(FileReader &chunk);
+
+// Returns true if the given nme exists in the name table.
+bool FindNameTableEntry(FileReader &file, const FileHeader &fileHeader, const char *name);
+
+// Returns true if the given nme exists in the name table.
+bool FindNameTableEntryMemory(MemoryFileReader &file, const FileHeader &fileHeader, const char *name);
+
+// Read an entry from the name table.
+std::string ReadNameTableEntry(FileReader &chunk, uint16 packageVersion);
+
+// Read complete name table.
+std::vector<std::string> ReadNameTable(FileReader &file, const FileHeader &fileHeader);
+
+// Read import table.
+std::vector<int32> ReadImportTable(FileReader &file, const FileHeader &fileHeader, const std::vector<std::string> &names);
+
+// Read an entry from the import table.
+int32 ReadImportTableEntry(FileReader &chunk, uint16 packageVersion);
+
+// Read an entry from the export table.
+std::pair<FileReader, int32> ReadExportTableEntry(FileReader &file, const FileHeader &fileHeader, const std::vector<int32> &classes, const std::vector<std::string> &names, const char *filterType);
+
+} // namespace UMX
+
+OPENMPT_NAMESPACE_END