View Issue Details

IDProjectCategoryView StatusLast Update
0000472OpenMPTFile Format Supportpublic2014-01-18 17:18
Reportersezero Assigned ToSaga Musix  
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product VersionOpenMPT 1.22.07.00 (upgrade first) 
Target VersionOpenMPT 1.23.01.00 (upgrade first)Fixed in VersionOpenMPT 1.23.01.00 (upgrade first) 
Summary0000472: add unreal 1997/98 beta support to umx loader
Description

The following patch that makes your umx loader to support .umx
and
.uax files from unreal 1997/98 beta version.

See https://github.com/sezero/umr .

I use the same code in mikmod/libmikmod (sf.net/projects/mikmod),
uhexen2 (sf.net/p/uhexen2), and quakespasm (sf.net/p/quakespasm)
with success.

Additional Information
Index: soundlib/Load_umx.cpp
===================================================================
--- soundlib/Load_umx.cpp   (revision 3569)
+++ soundlib/Load_umx.cpp   (working copy)
@@ -132,23 +132,33 @@

 // Read an entry from the import table.
-int32 ReadUMXImportTableEntry(FileReader &chunk)
+int32 ReadUMXImportTableEntry(FileReader &chunk, uint16 packageVersion)
 //----------------------------------------------
 {
    ReadUMXIndex(chunk);        // Class package
    ReadUMXIndex(chunk);        // Class name
-   chunk.Skip(4);              // Package
+   if(packageVersion >= 60)
+   {
+       chunk.Skip(4);          // Package
+   }
+   else
+   {
+       ReadUMXIndex(chunk);    // ??
+   }
    return ReadUMXIndex(chunk); // Object name (offset into the name table)
 }

 // Read an entry from the export table.
-void ReadUMXExportTableEntry(FileReader &chunk, int32 &objClass, int32 &objOffset, int32 &objSize, int32 &objName)
+void ReadUMXExportTableEntry(FileReader &chunk, int32 &objClass, int32 &objOffset, int32 &objSize, int32 &objName, uint16 packageVersion)
 //----------------------------------------------------------------------------------------------------------------
 {
    objClass = ReadUMXIndex(chunk); // Object class
    ReadUMXIndex(chunk);            // Object parent
-   chunk.Skip(4);                  // Internal package / group of the object
+   if(packageVersion >= 60)
+   {
+       chunk.Skip(4);              // Internal package / group of the object
+   }
    objName = ReadUMXIndex(chunk);  // Object name (offset into the name table)
    chunk.Skip(4);                  // Object flags
    objSize = ReadUMXIndex(chunk);
@@ -189,7 +199,7 @@ bool CSoundFile::ReadUMX(FileReader &fil
    classes.reserve(fileHeader.importCount);
    for(uint32 i = 0; i < fileHeader.importCount; i++)
    {
-       int32 objName = ReadUMXImportTableEntry(file);
+       int32 objName = ReadUMXImportTableEntry(file, fileHeader.packageVersion);
        if(static_cast<size_t>(objName) < names.size())
        {
            classes.push_back(objName);
@@ -209,7 +219,7 @@ bool CSoundFile::ReadUMX(FileReader &fil
    for(uint32 i = 0; i < fileHeader.exportCount; i++)
    {
        int32 objClass, objOffset, objSize, objName;
-       ReadUMXExportTableEntry(file, objClass, objOffset, objSize, objName);
+       ReadUMXExportTableEntry(file, objClass, objOffset, objSize, objName, fileHeader.packageVersion);

        if(objSize <= 0 || objClass >= 0)
        {
@@ -246,6 +256,14 @@ bool CSoundFile::ReadUMX(FileReader &fil

        if(chunk.IsValid())
        {
+           if(fileHeader.packageVersion < 40)
+           {
+               chunk.Skip(8);  // 00 00 00 00 00 00 00 00
+           }
+           if(fileHeader.packageVersion < 60)
+           {
+               chunk.Skip(16); // 81 00 00 00 00 00 FF FF FF FF FF FF FF FF 00 00
+           }
            // Read object properties
            size_t propertyName = static_cast<size_t>(ReadUMXIndex(chunk));
            if(propertyName >= names.size() || strcmp(names[propertyName].c_str(), "none"))
TagsNo tags attached.
Has the bug occurred in previous versions?
Tested code revision (in case you know it)

Activities

sezero

sezero

2014-01-12 21:53

reporter   ~0001440

#469, 470 and 471 are dups of this (they refused patch attachment but seem to have got submitted nonetheless?, so I had to inline my patch here), please close them.

Saga Musix

Saga Musix

2014-01-12 22:13

administrator   ~0001441

Thanks for the patch, can you provide some files of these versions to test the patch against?

sezero

sezero

2014-01-12 22:20

reporter   ~0001442

http://hyper.dnsalias.net/files-demos.htm provides a download

Saga Musix

Saga Musix

2014-01-12 22:55

administrator   ~0001443

I've incorporated the patch in rev. 3570 (and made some further small changes to make UAX files from that package load). New version is up at http://sagagames.de/stuff/mptrack.exe

Saga Musix

Saga Musix

2014-01-12 22:57

administrator   ~0001444

BTW, there's a typo in umr/unrealfmtdata.c, "Impluse Tracker" :)

sezero

sezero

2014-01-12 23:17

reporter   ~0001445

Fixed the typo just now, thanks :)

Re: mptrack.exe: Can't test this one, I'm on Linux now and won't be rebooting for some time (tested the patch using openmpt123 on Linux.)

Saga Musix

Saga Musix

2014-01-12 23:22

administrator   ~0001446

In that case, try the updated code package: http://buildbot.openmpt.org/builds/auto/src/libopenmpt-0.2.3570.tar.gz

sezero

sezero

2014-01-12 23:29

reporter   ~0001447

libopenmpt-0.2.3570.tar.gz compiles and works fine so far, thanks.

Issue History

Date Modified Username Field Change
2014-01-12 21:48 sezero New Issue
2014-01-12 21:53 sezero Note Added: 0001440
2014-01-12 22:12 Saga Musix Assigned To => Saga Musix
2014-01-12 22:12 Saga Musix Status new => assigned
2014-01-12 22:13 Saga Musix Note Added: 0001441
2014-01-12 22:20 sezero Note Added: 0001442
2014-01-12 22:55 Saga Musix Note Added: 0001443
2014-01-12 22:55 Saga Musix Status assigned => feedback
2014-01-12 22:57 Saga Musix Note Added: 0001444
2014-01-12 23:17 sezero Note Added: 0001445
2014-01-12 23:17 sezero Status feedback => assigned
2014-01-12 23:22 Saga Musix Note Added: 0001446
2014-01-12 23:29 sezero Note Added: 0001447
2014-01-12 23:31 Saga Musix Reproducibility have not tried => always
2014-01-12 23:31 Saga Musix Status assigned => resolved
2014-01-12 23:31 Saga Musix Resolution open => fixed
2014-01-12 23:31 Saga Musix Product Version => OpenMPT 1.22.07.00 (upgrade first)
2014-01-12 23:31 Saga Musix Fixed in Version => OpenMPT 1.22.07.* (old testing)
2014-01-12 23:31 Saga Musix Target Version => OpenMPT 1.22.07.* (old testing)
2014-01-18 17:17 Saga Musix Target Version OpenMPT 1.22.07.* (old testing) => OpenMPT 1.23.01.00 (upgrade first)
2014-01-18 17:18 Saga Musix Fixed in Version OpenMPT 1.22.07.* (old testing) => OpenMPT 1.23.01.00 (upgrade first)