sn4k3 / UVtools

MSLA/DLP, file analysis, calibration, repair, conversion and manipulation
GNU Affero General Public License v3.0
1.2k stars 104 forks source link

[BUG] Unable to open CTBv4 files generated from Lychee #354

Closed bgyarfas closed 2 years ago

bgyarfas commented 2 years ago

System

1. Go to "UVtools -> Help -> About"
2. Click on "Copy information"
3. Paste that infomation bellow this line:
UVtools v2.25.2
Operative system: Darwin 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 X64
Processor: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Processor cores: 16
Memory RAM: 15.90 / 31.47 GB
Runtime: osx.11.0-x64
Framework: .NET 5.0.12
AvaloniaUI: 0.10.8
OpenCV: 4.5.4-235

Sreens, resolution, working area, usable area:
1: 2560 x 1440 @ 200% (Primary)
    WA: 2560 x 1415    UA: 1280 x 708
2: 1280 x 800 @ 200%
    WA: 1280 x 775    UA: 640 x 388
3: 1440 x 2560 @ 200%
    WA: 1440 x 2535    UA: 720 x 1268

Path: /Applications/UVtools.app/Contents/MacOS

General configuration for OpenCV 4.5.4 =====================================
  Version control:               4.5.4-235-g27567928d7

  Extra modules:
    Location (extra):            /Users/tiago/Desktop/emgucv/opencv_contrib/modules
    Version control (extra):     4.5.4-61-gc33e5b60

  Platform:
    Timestamp:                   2021-11-01T19:19:02Z
    Host:                        Darwin 18.7.0 x86_64
    CMake:                       3.21.4
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               Release

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3 SSSE3 SSE4_1
      requested:                 DETECT
    Dispatched code generation:  SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_2 (1 files):          + POPCNT SSE4_2
      FP16 (0 files):            + POPCNT SSE4_2 FP16 AVX
      AVX (4 files):             + POPCNT SSE4_2 AVX
      AVX2 (30 files):           + POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (5 files):      + POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

  C/C++:
    Built as dynamic libs?:      NO
    C++ standard:                11
    C++ Compiler:                /Library/Developer/CommandLineTools/usr/bin/c++  (ver 10.0.1.10010046)
    C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /Library/Developer/CommandLineTools/usr/bin/cc
    C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      -Wl,-dead_strip  
    Linker flags (Debug):        -Wl,-dead_strip  
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          -framework OpenCL -framework Cocoa -framework AppKit /Users/tiago/Desktop/emgucv/platforms/macos/build/install/lib/libhdf5.a Iconv::Iconv
    3rdparty dependencies:       libprotobuf ade ittnotify libjpeg-turbo libpng libtiff libopenjp2 IlmImf zlib quirc

  OpenCV modules:
    To be built:                 alphamat aruco barcode bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    python2 world
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype java julia matlab ovis python3 sfm ts viz
    Applications:                -
    Documentation:               NO
    Non-free algorithms:         NO

  GUI:                           COCOA
    Cocoa:                       YES
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.11)
    JPEG:                        build-libjpeg-turbo (ver 2.1.0-62)
    PNG:                         build (ver 1.6.37)
    TIFF:                        build (ver 42 - 4.2.0)
    JPEG 2000:                   build (ver 2.4.0)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      NO
      avcodec:                   NO
      avformat:                  NO
      avutil:                    NO
      swscale:                   NO
      avresample:                NO
    GStreamer:                   NO
    AVFoundation:                YES

  Parallel framework:            GCD

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Eigen:                       YES (ver 3.3.7)
    Custom HAL:                  NO
    Protobuf:                    build (3.5.1)

  OpenCL:                        YES (no extra features)
    Include path:                NO
    Link libraries:              -framework OpenCL

  Python (for build):            /usr/bin/python2.7

  Java:                          
    ant:                         NO
    JNI:                         /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/JavaVM.framework/Headers /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/JavaVM.framework/Headers /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/JavaVM.framework/Headers
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /Users/tiago/Desktop/emgucv/platforms/macos/build/install
-----------------------------------------------------------------

Loaded Assemblies:
001: System.Private.CoreLib, Version=5.0.0.0
002: UVtools, Version=2.25.2.0
003: System.Runtime, Version=5.0.0.0
004: Avalonia.DesktopRuntime, Version=0.10.8.0
005: Avalonia.Controls, Version=0.10.8.0
006: netstandard, Version=2.1.0.0
007: Avalonia.Base, Version=0.10.8.0
008: System.ObjectModel, Version=5.0.0.0
009: Avalonia.Styling, Version=0.10.8.0
010: Avalonia.Input, Version=0.10.8.0
011: Avalonia.Interactivity, Version=0.10.8.0
012: Avalonia.Layout, Version=0.10.8.0
013: Avalonia.Visuals, Version=0.10.8.0
014: Avalonia.Animation, Version=0.10.8.0
015: System.ComponentModel.Primitives, Version=5.0.0.0
016: System.Collections, Version=5.0.0.0
017: System.Console, Version=5.0.0.0
018: UVtools.Core, Version=2.25.2.0
019: System.Drawing.Primitives, Version=5.0.0.0
020: System.IO.FileSystem, Version=5.0.0.0
021: MoreLinq, Version=3.3.2.0
022: System.Data.Common, Version=5.0.0.0
023: System.ComponentModel.TypeConverter, Version=5.0.0.0
024: System.ComponentModel, Version=5.0.0.0
025: System.Xml.ReaderWriter, Version=5.0.0.0
026: System.Private.Xml, Version=5.0.0.0
027: Avalonia.Desktop, Version=0.10.8.0
028: Avalonia.Win32, Version=0.10.8.0
029: Avalonia.MicroCom, Version=0.10.8.0
030: System.Runtime.InteropServices, Version=5.0.0.0
031: System.Collections.Concurrent, Version=5.0.0.0
032: System.Numerics.Vectors, Version=5.0.0.0
033: Avalonia.X11, Version=0.10.8.0
034: Avalonia.Native, Version=0.10.8.0
035: Avalonia.Skia, Version=0.10.8.0
036: System.Runtime.InteropServices.RuntimeInformation, Version=5.0.0.0
037: Avalonia.OpenGL, Version=0.10.8.0
038: System.Reactive, Version=5.0.0.0
039: System.Threading, Version=5.0.0.0
040: System.Private.Uri, Version=5.0.0.0
041: System.Linq, Version=5.0.0.0
042: System.Runtime.Extensions, Version=5.0.0.0
043: System.Xml.XDocument, Version=5.0.0.0
044: System.Private.Xml.Linq, Version=5.0.0.0
045: System.Threading.Thread, Version=5.0.0.0
046: System.Memory, Version=5.0.0.0
047: System.Security.Cryptography.Algorithms, Version=5.0.0.0
048: System.Text.Encoding.Extensions, Version=5.0.0.0
049: SkiaSharp, Version=2.80.0.0
050: System.Threading.Timer, Version=5.0.0.0
051: Avalonia.Markup.Xaml, Version=0.10.8.0
052: Avalonia.Themes.Fluent, Version=0.10.8.0
053: Avalonia.Markup, Version=0.10.8.0
054: System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0
055: ThemeEditor.Controls.ColorPicker, Version=0.10.8.0
056: Avalonia.Controls.DataGrid, Version=0.10.8.0
057: Emgu.CV.Platform.NetStandard, Version=4.5.4.4788
058: MessageBox.Avalonia, Version=1.0.0.0
059: System.Xml.XmlSerializer, Version=5.0.0.0
060: System.Diagnostics.TraceSource, Version=5.0.0.0
061: UVtools.AvaloniaControls, Version=1.0.1.0
062: System.Diagnostics.Process, Version=5.0.0.0
063: System.Linq.Expressions, Version=5.0.0.0
064: System.ComponentModel.Annotations, Version=5.0.0.0
065: System.Reflection.Emit.ILGeneration, Version=5.0.0.0
066: System.Reflection.Primitives, Version=5.0.0.0
067: System.Reflection.Emit.Lightweight, Version=5.0.0.0
068: Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0
069: System.Buffers, Version=5.0.0.0
070: HarfBuzzSharp, Version=1.0.0.0
071: System.IO.Compression, Version=5.0.0.0
072: System.Net.Http, Version=5.0.0.0
073: System.Text.RegularExpressions, Version=5.0.0.0
074: Newtonsoft.Json, Version=13.0.0.0
075: System.Net.Primitives, Version=5.0.0.0
076: System.Diagnostics.Tracing, Version=5.0.0.0
077: System.Diagnostics.DiagnosticSource, Version=5.0.0.0
078: System.Net.Security, Version=5.0.0.0
079: BinarySerializer, Version=8.6.1.2
080: System.Security.Cryptography.X509Certificates, Version=5.0.0.0
081: System.Threading.Tasks, Version=5.0.0.0
082: System.Text.Encoding, Version=5.0.0.0
083: System.IO, Version=5.0.0.0
084: System.Reflection.TypeExtensions, Version=5.0.0.0
085: System.Reflection, Version=5.0.0.0
086: System.Net.Sockets, Version=5.0.0.0
087: Microsoft.Win32.Primitives, Version=5.0.0.0
088: System.Reflection.Extensions, Version=5.0.0.0
089: System.Threading.ThreadPool, Version=5.0.0.0
090: System.Net.NameResolution, Version=5.0.0.0
091: System.Collections.NonGeneric, Version=5.0.0.0
092: System.Threading.Tasks.Parallel, Version=5.0.0.0
093: System.Security.Cryptography.Encoding, Version=5.0.0.0
094: System.Formats.Asn1, Version=5.0.0.0
095: System.Runtime.Numerics, Version=5.0.0.0
096: System.Security.Cryptography.Primitives, Version=5.0.0.0
097: System.IO.FileSystem.DriveInfo, Version=5.0.0.0
098: System.Diagnostics.StackTrace, Version=5.0.0.0
099: System.Reflection.Metadata, Version=5.0.0.0
100: System.Collections.Immutable, Version=5.0.0.0
101: System.IO.MemoryMappedFiles, Version=5.0.0.0
102: Microsoft.Win32.Registry, Version=6.0.0.0

Describe the bug

Lychee 3.6.0 now allows you to export different versions of CTB (v2-v4). UVTools errors when trying to open a v4 version of a file with the following error:

System.IO.FileLoadException: Malformed file, PrintParametersV4 found invalid validation values, expected (4, 4) but got (0, 0)
File name: '/Users/brett/elegoo_saturn/To Print/iC Dev Fixture v1.v4.ctb'
   at UVtools.Core.FileFormats.ChituboxFile.DecodeInternally(OperationProgress progress) in D:\Tiago\Dropbox\Programming\C#\UVtools\UVtools.Core\FileFormats\ChituboxFile.cs:line 2043
   at UVtools.Core.FileFormats.FileFormat.Decode(String fileFullPath, FileDecodeType fileDecodeType, OperationProgress progress) in D:\Tiago\Dropbox\Programming\C#\UVtools\UVtools.Core\FileFormats\FileFormat.cs:line 2625
   at UVtools.WPF.MainWindow.<>c__DisplayClass104_0.<ProcessFile>b__1() in D:\Tiago\Dropbox\Programming\C#\UVtools\UVtools.WPF\MainWindow.axaml.cs:line 1490

To Reproduce

Steps to reproduce the behavior:

  1. Change the version of the CTB file being export by lychee by modifying your printer settings in lychee (Under "Other Parameters")
  2. Export a v4 file
  3. Open in UVTools
  4. See error

Expected behavior

Since UVtools has support for v4 I thought it'd be able to open it. I did try to rename the file to .v4.ctb but it still reported the same error.

Additional context

UVTools is still able to open a CTB v3 file as exported by Lychee

Let me know if you need anymore information! Thanks for all the great work!

sn4k3 commented 2 years ago

Spotted on Atlas discord too, already addressed. Will be good on next release

sn4k3 commented 2 years ago

Fixed