├── .editorconfig ├── .gitattributes ├── .github └── FUNDING.yml ├── .gitignore ├── .vs ├── CppProperties.json ├── launch.vs.json └── tasks.vs.json ├── .vscode ├── c_cpp_properties.json ├── launch.json ├── settings.json └── tasks.json ├── Core ├── Core.cpp ├── Core.h ├── CoreGL.cpp ├── CoreGL.h ├── CoreWin32.cpp ├── GL │ ├── consts.in │ ├── funcs.in │ └── make.pl ├── GLBind.cpp ├── GLBind.h ├── GLBindImpl.h ├── GLText.cpp ├── GLText.h ├── GlFont.h ├── GlWindow.cpp ├── GlWindow.h ├── Math3D.cpp ├── Math3D.h ├── MathSSE.h ├── Memory.cpp ├── Parallel.cpp ├── Parallel.h ├── TextContainer.cpp ├── TextContainer.h └── Win32Types.h ├── Docs ├── FAQ.md ├── SSE.txt ├── UE4Props.pl ├── UE4Version.pl ├── glsl.txt ├── material.txt ├── reversing.txt ├── todo.!!! ├── ue3flash.txt └── xpr.txt ├── Exporters ├── Export3D.cpp ├── ExportGLTF.cpp ├── ExportMaterial.cpp ├── ExportMd5.cpp ├── ExportPsk.cpp ├── ExportSound.cpp ├── ExportTexture.cpp ├── ExportThirdParty.cpp ├── Exporters.cpp ├── Exporters.h └── Psk.h ├── LICENSE.txt ├── MeshInstance ├── MeshInstance.cpp ├── MeshInstance.h ├── SkelMeshInstance.cpp ├── StatMeshInstance.cpp └── VertMeshInstance.cpp ├── README.md ├── Tools ├── CompatTable │ ├── developers.ini │ ├── filter.js │ ├── parse.pl │ ├── style.css │ └── table.ini ├── MaxActorXImport │ ├── ActorXImporter.ms │ ├── export_fbx.ms │ └── package.sh ├── PackageExtract │ ├── Build.h │ ├── Main.cpp │ ├── build.sh │ ├── extract.project │ └── t.bat ├── PackageTool │ ├── Build.h │ ├── Main.cpp │ ├── build.sh │ ├── pkgtool.project │ └── t.bat ├── PackageUnpack │ ├── Build.h │ ├── Main.cpp │ ├── build.sh │ ├── decompress.project │ └── t.bat ├── TypeInfo │ ├── Build.h │ ├── Main.cpp │ ├── build.sh │ ├── t.bat │ └── typeinfo.project ├── UITest │ ├── Build.h │ ├── Main.cpp │ ├── build.sh │ ├── t.bat │ ├── uitest.project │ └── vs │ │ ├── UI_Dev.sln │ │ ├── UI_Dev.vcxproj │ │ ├── UI_Dev.vcxproj.filters │ │ └── UI_Dev.vcxproj.user ├── UmdExtract │ ├── Build.h │ ├── Main.cpp │ ├── build.sh │ ├── t.bat │ └── unumd.project ├── genmake ├── umodel.natvis └── unpack_obb.pl ├── UI ├── BaseDialog.cpp ├── BaseDialog.h ├── FileControls.cpp ├── FileControls.h ├── LICENSE.txt ├── README.md ├── UILayout.cpp ├── UIMenu.cpp ├── UIPrivate.h ├── callback.h └── stl-stub │ ├── Core.h │ └── UnCore.h ├── UmodelTool ├── AboutDialog.h ├── Build.h ├── ErrorDialog.h ├── Main.cpp ├── MiscStrings.cpp ├── MiscStrings.h ├── PackageDialog.cpp ├── PackageDialog.h ├── PackageScanDialog.cpp ├── PackageScanDialog.h ├── ProgressDialog.cpp ├── ProgressDialog.h ├── SettingsDialog.cpp ├── SettingsDialog.h ├── StartupDialog.cpp ├── StartupDialog.h ├── UE4AesKeyDialog.h ├── UE4VersionDialog.h ├── UmodelApp.cpp ├── UmodelApp.h ├── UmodelCommands.cpp ├── UmodelCommands.h ├── UmodelSettings.cpp ├── UmodelSettings.h ├── res │ ├── resource.h │ ├── umodel.ico │ ├── umodel.manifest │ ├── umodel.rc │ └── umodel64.manifest └── umodel.project ├── Unreal ├── FileSystem │ ├── FileSystemUtils.cpp │ ├── FileSystemUtils.h │ ├── GameFileSystem.cpp │ ├── GameFileSystem.h │ ├── GameFileSystemGears4.cpp │ ├── IOStoreFileSystem.cpp │ ├── IOStoreFileSystem.h │ ├── UnArchiveObb.h │ ├── UnArchivePak.cpp │ └── UnArchivePak.h ├── GameDatabase.cpp ├── GameDatabase.h ├── GameDefines.h ├── GameSpecific │ ├── UnHavok.cpp │ ├── UnHavok.h │ ├── UnMeshBatman.cpp │ ├── UnMeshBioshock.cpp │ ├── UnMeshRune.cpp │ ├── UnUbisoft.cpp │ └── UnUbisoft.h ├── Mesh │ ├── MeshCommon.cpp │ ├── MeshCommon.h │ ├── SkeletalMesh.cpp │ ├── SkeletalMesh.h │ └── StaticMesh.h ├── Shaders │ ├── BloomBlend.ush │ ├── BloomGather.ush │ ├── BloomPass.ush │ ├── ColorFilter.ush │ ├── Generic.ush │ ├── Normal.ush │ └── make.pl ├── TypeConvert.h ├── TypeInfo.cpp ├── TypeInfo.h ├── UE4Version.h ├── UnCore.cpp ├── UnCore.h ├── UnCoreCompression.cpp ├── UnCoreDecrypt.cpp ├── UnCoreSerialize.cpp ├── UnObject.cpp ├── UnObject.h ├── UnObject4.cpp ├── UnRenderer.cpp ├── UnSound.h ├── UnThirdParty.h ├── UnTypeinfo.h ├── UnrealMaterial │ ├── UnMaterial.h │ ├── UnMaterial2.h │ ├── UnMaterial3.h │ ├── UnMaterialExpression.h │ ├── UnTexture.cpp │ ├── UnTexture2.cpp │ ├── UnTexture3.cpp │ └── UnTexture4.cpp ├── UnrealMesh │ ├── UnAnim2.cpp │ ├── UnAnim3.cpp │ ├── UnAnim4.cpp │ ├── UnAnimNotify.h │ ├── UnMathTools.h │ ├── UnMesh.h │ ├── UnMesh1.cpp │ ├── UnMesh2.cpp │ ├── UnMesh2.h │ ├── UnMesh3.cpp │ ├── UnMesh3.h │ ├── UnMesh4.cpp │ ├── UnMesh4.h │ └── UnMeshTypes.h ├── UnrealPackage │ ├── PackageUtils.cpp │ ├── PackageUtils.h │ ├── UnPackage.cpp │ ├── UnPackage.h │ ├── UnPackage2.cpp │ ├── UnPackage3.cpp │ ├── UnPackage4.cpp │ ├── UnPackageReader.cpp │ └── UnPackageUE3Reader.h └── Wrappers │ ├── TextureNVTT.cpp │ ├── TextureNVTT.h │ ├── TexturePNG.cpp │ └── TexturePNG.h ├── Viewers ├── MaterialViewer.cpp ├── MeshViewer.cpp ├── ObjectViewer.cpp ├── ObjectViewer.h ├── SkelMeshViewer.cpp ├── StatMeshViewer.cpp └── VertMeshViewer.cpp ├── build.sh ├── common.project ├── libs ├── PowerVR │ ├── PVRTDecompress.cpp │ ├── PVRTDecompress.h │ ├── PVRTGlobal.h │ └── PVRTTexture.h ├── SDL2 │ ├── SDL2.project │ ├── SDL2Loader.cpp │ ├── readme.txt │ ├── x64 │ │ ├── SDL2.dll │ │ └── SDL2.lib │ └── x86 │ │ ├── SDL2.dll │ │ └── SDL2.lib ├── astc │ ├── astc_block_sizes2.cpp │ ├── astc_codec_internals.h │ ├── astc_color_unquantize.cpp │ ├── astc_decompress_symbolic.cpp │ ├── astc_image_load_store.cpp │ ├── astc_integer_sequence.cpp │ ├── astc_misc.cpp │ ├── astc_partition_tables.cpp │ ├── astc_percentile_tables.cpp │ ├── astc_quantization.cpp │ ├── astc_symbolic_physical.cpp │ ├── astc_weight_quant_xfer_tables.cpp │ ├── mathlib.h │ ├── softfloat.cpp │ ├── softfloat.h │ └── vectypes.h ├── detex │ ├── bits.cpp │ ├── bits.h │ ├── bptc-tables.cpp │ ├── bptc-tables.h │ ├── clamp.cpp │ ├── convert.cpp │ ├── dds.cpp │ ├── decompress-bptc-float.cpp │ ├── decompress-bptc.cpp │ ├── decompress-eac.cpp │ ├── decompress-etc.cpp │ ├── detex.h │ ├── file-info.cpp │ ├── file-info.h │ ├── half-float.cpp │ ├── half-float.h │ ├── hdr.h │ ├── misc.cpp │ ├── misc.h │ └── texture.cpp ├── include │ ├── glslang │ │ ├── Include │ │ │ └── ResourceLimits.h │ │ └── Public │ │ │ └── ShaderLang.h │ └── lzo │ │ ├── lzo1x.h │ │ ├── lzoconf.h │ │ └── lzodefs.h ├── includewin32 │ ├── GL │ │ └── glext.h │ └── SDL2 │ │ ├── SDL.h │ │ ├── SDL_assert.h │ │ ├── SDL_atomic.h │ │ ├── SDL_audio.h │ │ ├── SDL_bits.h │ │ ├── SDL_blendmode.h │ │ ├── SDL_clipboard.h │ │ ├── SDL_config.h │ │ ├── SDL_config_android.h │ │ ├── SDL_config_iphoneos.h │ │ ├── SDL_config_macosx.h │ │ ├── SDL_config_minimal.h │ │ ├── SDL_config_pandora.h │ │ ├── SDL_config_psp.h │ │ ├── SDL_config_windows.h │ │ ├── SDL_config_winrt.h │ │ ├── SDL_config_wiz.h │ │ ├── SDL_copying.h │ │ ├── SDL_cpuinfo.h │ │ ├── SDL_egl.h │ │ ├── SDL_endian.h │ │ ├── SDL_error.h │ │ ├── SDL_events.h │ │ ├── SDL_filesystem.h │ │ ├── SDL_gamecontroller.h │ │ ├── SDL_gesture.h │ │ ├── SDL_haptic.h │ │ ├── SDL_hints.h │ │ ├── SDL_joystick.h │ │ ├── SDL_keyboard.h │ │ ├── SDL_keycode.h │ │ ├── SDL_loadso.h │ │ ├── SDL_log.h │ │ ├── SDL_main.h │ │ ├── SDL_messagebox.h │ │ ├── SDL_mouse.h │ │ ├── SDL_mutex.h │ │ ├── SDL_name.h │ │ ├── SDL_opengl.h │ │ ├── SDL_opengl_glext.h │ │ ├── SDL_opengles.h │ │ ├── SDL_opengles2.h │ │ ├── SDL_opengles2_gl2.h │ │ ├── SDL_opengles2_gl2ext.h │ │ ├── SDL_opengles2_gl2platform.h │ │ ├── SDL_opengles2_khrplatform.h │ │ ├── SDL_pixels.h │ │ ├── SDL_platform.h │ │ ├── SDL_power.h │ │ ├── SDL_quit.h │ │ ├── SDL_rect.h │ │ ├── SDL_render.h │ │ ├── SDL_revision.h │ │ ├── SDL_rwops.h │ │ ├── SDL_scancode.h │ │ ├── SDL_sensor.h │ │ ├── SDL_shape.h │ │ ├── SDL_stdinc.h │ │ ├── SDL_surface.h │ │ ├── SDL_system.h │ │ ├── SDL_syswm.h │ │ ├── SDL_test.h │ │ ├── SDL_test_assert.h │ │ ├── SDL_test_common.h │ │ ├── SDL_test_compare.h │ │ ├── SDL_test_crc32.h │ │ ├── SDL_test_font.h │ │ ├── SDL_test_fuzzer.h │ │ ├── SDL_test_harness.h │ │ ├── SDL_test_images.h │ │ ├── SDL_test_log.h │ │ ├── SDL_test_md5.h │ │ ├── SDL_test_memory.h │ │ ├── SDL_test_random.h │ │ ├── SDL_thread.h │ │ ├── SDL_timer.h │ │ ├── SDL_touch.h │ │ ├── SDL_types.h │ │ ├── SDL_version.h │ │ ├── SDL_video.h │ │ ├── SDL_vulkan.h │ │ ├── begin_code.h │ │ └── close_code.h ├── libpng │ ├── png.c │ ├── png.h │ ├── pngconf.h │ ├── pngdebug.h │ ├── pngerror.c │ ├── pngget.c │ ├── pnginfo.h │ ├── pnglibconf.h │ ├── pngmem.c │ ├── pngpread.c │ ├── pngprefix.h │ ├── pngpriv.h │ ├── pngread.c │ ├── pngrio.c │ ├── pngrtran.c │ ├── pngrutil.c │ ├── pngset.c │ ├── pngstruct.h │ ├── pngtrans.c │ ├── pngusr.h │ ├── pngwio.c │ ├── pngwrite.c │ ├── pngwtran.c │ └── pngwutil.c ├── lz4 │ ├── lz4.c │ └── lz4.h ├── lzo │ ├── config1x.h │ ├── lzo1_d.ch │ ├── lzo1x_d.ch │ ├── lzo1x_d1.c │ ├── lzo1x_d2.c │ ├── lzo_conf.h │ ├── lzo_dict.h │ ├── lzo_dll.ch │ ├── lzo_init.c │ ├── lzo_ptr.h │ └── miniacc.h ├── mspack │ ├── lzx.h │ ├── lzxd.c │ ├── mspack.h │ ├── readbits.h │ ├── readhuff.h │ └── system.h ├── nvtt │ ├── nvconfig.h │ ├── nvcore │ │ ├── Containers.h │ │ ├── Debug.h │ │ ├── DefsGnucDarwin.h │ │ ├── DefsGnucLinux.h │ │ ├── DefsGnucWin32.h │ │ ├── DefsVcWin32.h │ │ ├── Memory.h │ │ ├── Ptr.h │ │ ├── StdStream.h │ │ ├── Stream.h │ │ ├── TextWriter.h │ │ ├── nvcore.h │ │ └── poshlib │ │ │ ├── posh.c │ │ │ └── posh.h │ ├── nvimage │ │ ├── BlockDXT.cpp │ │ ├── BlockDXT.h │ │ ├── ColorBlock.cpp │ │ ├── ColorBlock.h │ │ ├── DirectDrawSurface.cpp │ │ ├── DirectDrawSurface.h │ │ ├── Image.cpp │ │ ├── Image.h │ │ ├── PixelFormat.h │ │ └── nvimage.h │ └── nvmath │ │ ├── Color.h │ │ ├── Matrix.h │ │ ├── Vector.h │ │ └── nvmath.h ├── oodle │ ├── README.md │ └── oodle.project ├── rijndael │ ├── readme.txt │ ├── rijndael.c │ └── rijndael.h ├── tracy │ ├── Tracy.hpp │ ├── TracyC.h │ ├── TracyClient.cpp │ ├── client │ │ ├── TracyArmCpuTable.hpp │ │ ├── TracyCallstack.cpp │ │ ├── TracyCallstack.h │ │ ├── TracyCallstack.hpp │ │ ├── TracyDxt1.cpp │ │ ├── TracyDxt1.hpp │ │ ├── TracyFastVector.hpp │ │ ├── TracyLock.hpp │ │ ├── TracyProfiler.cpp │ │ ├── TracyProfiler.hpp │ │ ├── TracyRingBuffer.hpp │ │ ├── TracyScoped.hpp │ │ ├── TracySysTime.cpp │ │ ├── TracySysTime.hpp │ │ ├── TracySysTrace.cpp │ │ ├── TracySysTrace.hpp │ │ ├── TracySysTracePayload.hpp │ │ ├── TracyThread.hpp │ │ ├── tracy_concurrentqueue.h │ │ ├── tracy_rpmalloc.cpp │ │ └── tracy_rpmalloc.hpp │ ├── common │ │ ├── TracyAlign.hpp │ │ ├── TracyAlloc.hpp │ │ ├── TracyApi.h │ │ ├── TracyColor.hpp │ │ ├── TracyForceInline.hpp │ │ ├── TracyMutex.hpp │ │ ├── TracyProtocol.hpp │ │ ├── TracyQueue.hpp │ │ ├── TracySocket.cpp │ │ ├── TracySocket.hpp │ │ ├── TracySystem.cpp │ │ ├── TracySystem.hpp │ │ ├── tracy_lz4.cpp │ │ ├── tracy_lz4.hpp │ │ ├── tracy_lz4hc.cpp │ │ └── tracy_lz4hc.hpp │ └── libbacktrace │ │ ├── LICENSE │ │ ├── alloc.cpp │ │ ├── backtrace.hpp │ │ ├── config.h │ │ ├── dwarf.cpp │ │ ├── elf.cpp │ │ ├── fileline.cpp │ │ ├── filenames.hpp │ │ ├── internal.hpp │ │ ├── macho.cpp │ │ ├── mmapio.cpp │ │ ├── posix.cpp │ │ ├── sort.cpp │ │ └── state.cpp └── zlib │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── zconf.h │ ├── zlib.h │ └── zutil.h ├── package_lnx.sh ├── package_win32.sh ├── readme.txt ├── t.bat ├── test.sh ├── umodel └── umodel.exe /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.*] 2 | indent_style=tab 3 | indent_size=4 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # This file contains rules that control how Git handles binary and text files, including line endings 3 | # 4 | 5 | 6 | *.bat eol=crlf 7 | *.sh eol=lf 8 | *.pl eol=lf 9 | 10 | # Setup Linguist attributes for correct language statistics on Github 11 | # See https://github.com/github/linguist/blob/master/README.md 12 | Docs/* linguist-documentation 13 | libs/* linguist-vendored 14 | *.h linguist-language=cpp 15 | # There's also a number of generated files, however it is not possible to mark them with special attribute 16 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # Project sponsorship links 2 | 3 | patreon: UGildor 4 | custom: https://www.gildor.org/en/donate 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Some temporaty directories and directories with data 2 | data 3 | data/ 4 | obj/ 5 | bak/ 6 | 7 | # Generated files 8 | Unreal/Shaders.h 9 | UmodelTool/Version.h 10 | 11 | # Ignore makefiles for tools 12 | Tools/**/makefile-* 13 | 14 | # Other ignores 15 | Docs/cmdline.cfg 16 | Docs/fortnite.txt 17 | Tools/MaxActorXImport/ActorXImporter.ini 18 | Tools/UT2down/ 19 | 20 | # Files produced by umodel 21 | UmodelExport/ 22 | UmodelSaved/ 23 | Screenshots/ 24 | notify.log 25 | umodel.cfg 26 | 27 | # Visual Studio files 28 | **/.vs/* 29 | !.vs/CppProperties.json 30 | !.vs/launch.vs.json 31 | !.vs/tasks.vs.json 32 | 33 | # Executable files and pdb 34 | umodel[-_]*.exe 35 | umodel*.pdb 36 | Tools/**/*.exe 37 | Tools/**/*.pdb 38 | *todo.md 39 | 40 | # UI_Dev 41 | Tools/UITest/vs/Debug/ 42 | Tools/UITest/vs/Release/ 43 | 44 | # oodle library 45 | libs/oodle/include 46 | libs/oodle/lib 47 | 48 | # oodle dll 49 | libs/oo2core*.dll 50 | Tools/PackageExtract/oo2core*.dll 51 | 52 | # PackageExtract - ignore all extracted stuff 53 | Tools/PackageExtract/**/ 54 | -------------------------------------------------------------------------------- /.vs/CppProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "inheritEnvironments": [ "msvc_x86" ], 5 | "name": "Win32-Release", 6 | "includePath": [ 7 | "${env.INCLUDE}", 8 | "${workspaceRoot}\\**" 9 | ], 10 | "defines": [ 11 | "WIN32", 12 | "HAS_UI", 13 | "RENDERING" 14 | ], 15 | "intelliSenseMode": "windows-msvc-x86", 16 | "environments": [ 17 | { 18 | "BuildOptions": "--exe umodel.exe" 19 | } 20 | ] 21 | }, 22 | { 23 | "inheritEnvironments": [ "msvc_x86" ], 24 | "name": "Win32-Debug", 25 | "includePath": [ 26 | "${env.INCLUDE}", 27 | "${workspaceRoot}\\**" 28 | ], 29 | "defines": [ 30 | "WIN32", 31 | "HAS_UI", 32 | "RENDERING", 33 | "MAX_DEBUG" 34 | ], 35 | "intelliSenseMode": "windows-msvc-x86", 36 | "environments": [ 37 | { 38 | "BuildOptions": "--debug --exe umodel.exe" 39 | } 40 | ] 41 | }, 42 | { 43 | "inheritEnvironments": [ "msvc_x64" ], 44 | "name": "Win64-Release", 45 | "includePath": [ 46 | "${env.INCLUDE}", 47 | "${workspaceRoot}\\**" 48 | ], 49 | "defines": [ 50 | "WIN32", 51 | "HAS_UI", 52 | "RENDERING" 53 | ], 54 | "intelliSenseMode": "windows-msvc-x64", 55 | "environments": [ 56 | { 57 | "BuildOptions": "--64 --exe umodel.exe" 58 | } 59 | ] 60 | }, 61 | { 62 | "inheritEnvironments": [ "msvc_x64" ], 63 | "name": "Win64-Debug", 64 | "includePath": [ 65 | "${env.INCLUDE}", 66 | "${workspaceRoot}\\**" 67 | ], 68 | "defines": [ 69 | "WIN32", 70 | "HAS_UI", 71 | "RENDERING", 72 | "MAX_DEBUG" 73 | ], 74 | "intelliSenseMode": "windows-msvc-x64", 75 | "environments": [ 76 | { 77 | "BuildOptions": "--64 --debug --exe umodel.exe" 78 | } 79 | ] 80 | } 81 | ] 82 | } 83 | -------------------------------------------------------------------------------- /.vs/launch.vs.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.1", 3 | "defaults": {}, 4 | "configurations": [ 5 | { 6 | "type": "native", 7 | "name": "No arguments", 8 | "project": "umodel.exe" 9 | }, 10 | { 11 | "type": "native", 12 | "name": "Use cmdline.cfg", 13 | "project": "umodel.exe", 14 | "args": [ "@docs/cmdline.cfg" ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /.vs/tasks.vs.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.1", 3 | "tasks": [ 4 | { 5 | "taskName": "Build", 6 | "taskLabel": "Build", 7 | "appliesTo": "*", 8 | "contextType": "build", 9 | "type": "launch", 10 | "command": "bash.exe", 11 | "args": [ "build.sh ${env.BuildOptions}" ], 12 | "workingDirectory": "${workspaceRoot}", 13 | "inheritEnvironments": [ "${cpp.activeConfiguration}" ] 14 | }, 15 | { 16 | "taskName": "Compile", 17 | "taskLabel": ": Compile", 18 | "appliesTo": "*.c,*.cpp", 19 | "contextType": "compile", 20 | "type": "launch", 21 | "command": "bash.exe", 22 | "args": [ "build.sh ${env.BuildOptions} --file ${relativeFile}" ], 23 | "workingDirectory": "${workspaceRoot}", 24 | "inheritEnvironments": [ "${cpp.activeConfiguration}" ] 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Win32-Release", 5 | "customConfigurationVariables": { 6 | "BuildOptions": "", 7 | "ExeName": "umodel.exe" 8 | } 9 | }, 10 | { 11 | "name": "Win32-Debug", 12 | "customConfigurationVariables": { 13 | "BuildOptions": "--debug", 14 | "ExeName": "umodel-debug.exe" 15 | } 16 | }, 17 | { 18 | "name": "Win64-Release", 19 | "customConfigurationVariables": { 20 | "BuildOptions": "--64", 21 | "ExeName": "umodel_64.exe" 22 | } 23 | }, 24 | { 25 | "name": "Win64-Debug", 26 | "customConfigurationVariables": { 27 | "BuildOptions": "--64 --debug", 28 | "ExeName": "umodel-debug_64.exe" 29 | } 30 | } 31 | ], 32 | "version": 4 33 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | // C/C++ options: https://github.com/Microsoft/vscode-cpptools/blob/master/launch.md 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "(No arguments)", 10 | "type": "cppvsdbg", 11 | "request": "launch", 12 | "program": "${workspaceFolder}/${input:ExeName}", 13 | "args": [], 14 | "stopAtEntry": false, 15 | "cwd": "${workspaceFolder}", 16 | "environment": [], 17 | "logging": { "moduleLoad": false }, 18 | "visualizerFile": "${workspaceFolder}/Tools/umodel.natvis" 19 | }, 20 | { 21 | "name": "Volatile (cmdline.cfg)", 22 | "type": "cppvsdbg", 23 | "request": "launch", 24 | "program": "${workspaceFolder}/${input:ExeName}", 25 | "args": [ "@${workspaceFolder}/docs/cmdline.cfg" ], 26 | "cwd": "${workspaceFolder}", 27 | "logging": { "moduleLoad": false }, 28 | "visualizerFile": "${workspaceFolder}/Tools/umodel.natvis" 29 | }, 30 | { 31 | "name": "UI Test", 32 | "type": "cppvsdbg", 33 | "request": "launch", 34 | "preLaunchTask": "Build UITest", 35 | "program": "${workspaceFolder}/Tools/UITest/uitest.exe", 36 | "args": [], 37 | "cwd": "${workspaceFolder}", 38 | "logging": { "moduleLoad": false }, 39 | "visualizerFile": "${workspaceFolder}/Tools/umodel.natvis" 40 | } 41 | ], 42 | "inputs": [ 43 | // Requesting a customConfigurationVariables from c_cpp_properties.json (undocumented, may be changed in a future_ 44 | // https://stackoverflow.com/a/62404215 45 | { 46 | "id": "ExeName", 47 | "type": "command", 48 | "command": "cpptools.activeConfigCustomVariable", 49 | "args": "ExeName" 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "umodel" : true, 4 | "*.exe": true, 5 | "*.bat": true, 6 | "*.{cfg,pdb,dll}": true, 7 | "package*.sh": true, 8 | "src-arc.sh": true, 9 | "**/.vs": true, 10 | "**/bak": true, 11 | "**/data": true, 12 | "**/Docs": true, 13 | "**/obj": true, 14 | "**/Tools/Max*": true, 15 | "**/Tools/Package*": true, 16 | "**/Tools/TypeInfo": true, 17 | "**/Tools/{UmdExtract,UT2down,unpack_obb.pl}": true, 18 | "**/UI/stl-stub": true, 19 | "**/UmodelExport": true, 20 | "**/UmodelSaved": true, 21 | "**/Screenshots": true 22 | }, 23 | "files.associations": { 24 | "*.ush": "hlsl", 25 | "*.project": "perl" 26 | }, 27 | "files.trimTrailingWhitespace": true, 28 | "C_Cpp.default.includePath": [ 29 | "${workspaceFolder}", 30 | "${workspaceFolder}/Core", 31 | "${workspaceFolder}/Unreal", 32 | "${workspaceFolder}/UmodelTool", 33 | "${workspaceFolder}/libs", 34 | "${workspaceFolder}/libs/include", 35 | "${workspaceFolder}/libs/includewin32", 36 | "${workspaceFolder}/UI" 37 | ], 38 | "C_Cpp.default.defines": [ 39 | "MAX_DEBUG", 40 | "RENDERING", 41 | "HAS_UI" 42 | ], 43 | "C_Cpp.default.forcedInclude": [ 44 | "${workspaceFolder}/Unreal/GameDefines.h" 45 | ], 46 | "C_Cpp.default.cStandard": "c11", 47 | "C_Cpp.default.cppStandard": "c++17", 48 | "C_Cpp.default.intelliSenseMode": "msvc-x64", 49 | "C_Cpp.default.browse.path": [ 50 | "${workspaceFolder}" 51 | ], 52 | "C_Cpp.default.browse.limitSymbolsToIncludedHeaders": true, 53 | "C_Cpp.default.browse.databaseFilename": "", 54 | "cSpell.words": [ 55 | "FCOLOR", 56 | "FGPU", 57 | "FQUAT", 58 | "FROTATOR", 59 | "FVECTOR", 60 | "LODs", 61 | "SKEL", 62 | "SKELMESH", 63 | "Strncpyz", 64 | "Tris", 65 | "UMODEL", 66 | "coord", 67 | "kdop", 68 | "maxs", 69 | "tex", 70 | "uasset", 71 | "ubulk", 72 | "uexp", 73 | "unguardf", 74 | "unversioned", 75 | "recurse", 76 | "uv", 77 | "retargeting", 78 | "retarget" 79 | ] 80 | } 81 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "Build", 8 | "type": "shell", 9 | "command": "./build.sh ${input:BuildOptions}", 10 | "group": { 11 | "kind": "build", 12 | "isDefault": true 13 | }, 14 | "presentation": { 15 | "reveal": "always", 16 | "showReuseMessage": false, 17 | "clear": true 18 | }, 19 | "problemMatcher": "$msCompile" 20 | }, 21 | { 22 | "label": "Compile", 23 | "type": "shell", 24 | "command": "./build.sh ${input:BuildOptions} --file \"${relativeFile}\"", 25 | "presentation": { 26 | "reveal": "always", 27 | "showReuseMessage": false, 28 | "clear": true 29 | }, 30 | "problemMatcher": "$msCompile" 31 | }, 32 | { 33 | "label": "Build UITest", 34 | "type": "shell", 35 | "command": "./build.sh --debug", 36 | "presentation": { 37 | "reveal": "always", 38 | "showReuseMessage": false, 39 | "clear": true 40 | }, 41 | "options": { 42 | "cwd": "Tools/UITest" 43 | }, 44 | "problemMatcher": "$msCompile" 45 | }, 46 | { 47 | "label": "Query UE4 Version Constant", 48 | "type": "shell", 49 | "command": "./UE4Version.pl ${input:ue4const}", 50 | "presentation": { 51 | "reveal": "always", 52 | "showReuseMessage": false, 53 | "clear": true 54 | }, 55 | "options": { 56 | "cwd": "Docs" 57 | }, 58 | "problemMatcher": "" 59 | } 60 | ], 61 | "inputs": [ 62 | // Requesting a customConfigurationVariables from c_cpp_properties.json (undocumented, may be changed in a future_ 63 | // https://stackoverflow.com/a/62404215 64 | { 65 | "id": "BuildOptions", 66 | "type": "command", 67 | "command": "cpptools.activeConfigCustomVariable", 68 | "args": "BuildOptions" 69 | }, 70 | { 71 | "id": "ue4const", 72 | "type": "promptString", 73 | "description": "UE4 C++ constant:", 74 | "default": "" 75 | }, 76 | ] 77 | } -------------------------------------------------------------------------------- /Core/GL/consts.in: -------------------------------------------------------------------------------- 1 | NEAREST 2 | LINEAR 3 | NEAREST_MIPMAP_NEAREST 4 | LINEAR_MIPMAP_NEAREST 5 | NEAREST_MIPMAP_LINEAR 6 | LINEAR_MIPMAP_LINEAR 7 | TEXTURE_MAG_FILTER 8 | TEXTURE_MIN_FILTER 9 | TEXTURE_WRAP_S 10 | TEXTURE_WRAP_T 11 | -------------------------------------------------------------------------------- /Core/TextContainer.cpp: -------------------------------------------------------------------------------- 1 | #include "Core.h" 2 | #include "TextContainer.h" 3 | 4 | 5 | CTextRec *CTextContainer::Add(const char *text) 6 | { 7 | if (!text || !*text) return NULL; // empty text 8 | 9 | if (!filled) 10 | { // 1st record - perform initialization 11 | lastRec = NULL; 12 | fillPos = 0; 13 | } 14 | 15 | CTextRec *rec = (CTextRec*) &textBuf[fillPos]; 16 | int len = strlen(text); 17 | if (!len) return NULL; 18 | 19 | int size = recSize + len + 1; 20 | if (fillPos + size > bufSize) return NULL; // out of buffer space 21 | 22 | memset(rec, 0, recSize); 23 | rec->text = (char*) OffsetPointer(rec, recSize); 24 | memcpy(rec->text, text, len+1); 25 | 26 | if (lastRec) lastRec->next = rec; 27 | lastRec = rec; 28 | fillPos += size; 29 | 30 | filled = true; 31 | 32 | return rec; 33 | } 34 | 35 | 36 | void CTextContainer::Enumerate(void (*func) (const CTextRec *rec)) 37 | { 38 | guard(CTextContainer::Enumerate); 39 | if (!filled) return; 40 | for (CTextRec *rec = (CTextRec*) textBuf; rec; rec = rec->next) 41 | func(rec); 42 | unguard; 43 | } 44 | -------------------------------------------------------------------------------- /Core/TextContainer.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEXT_CONTAINER_H__ 2 | #define __TEXT_CONTAINER_H__ 3 | 4 | struct CTextRec 5 | { 6 | char *text; 7 | CTextRec *next; 8 | }; 9 | 10 | 11 | class CTextContainer 12 | { 13 | protected: 14 | // static values 15 | int recSize; 16 | char *textBuf; 17 | int bufSize; 18 | // dynamic values 19 | bool filled; // !empty 20 | int fillPos; 21 | CTextRec *lastRec; 22 | public: 23 | inline void Clear() 24 | { 25 | filled = false; 26 | } 27 | CTextRec *Add(const char *text); 28 | void Enumerate(void (*func) (const CTextRec *rec)); 29 | }; 30 | 31 | 32 | // Type 'R' should be derived from CTextRec. 33 | template 34 | class TTextContainer : public CTextContainer 35 | { 36 | public: 37 | inline TTextContainer() 38 | { 39 | textBuf = new char [BufferSize]; 40 | bufSize = BufferSize; 41 | recSize = sizeof(R); 42 | } 43 | ~TTextContainer() 44 | { 45 | delete[] textBuf; 46 | } 47 | inline R *Add(const char *text) 48 | { 49 | return static_cast(CTextContainer::Add(text)); 50 | } 51 | inline void Enumerate(void (*func) (const R *rec)) 52 | { 53 | CTextContainer::Enumerate((void(*)(const CTextRec*)) func); 54 | } 55 | }; 56 | 57 | #endif // __TEXT_CONTAINER_H__ 58 | -------------------------------------------------------------------------------- /Core/Win32Types.h: -------------------------------------------------------------------------------- 1 | #ifndef __WIN32_TYPES_H__ 2 | #define __WIN32_TYPES_H__ 3 | 4 | // This file contains all Windows type definitions which are used in project headers. 5 | // It allows to avoid doing #include in all source files, that header should 6 | // be included only when needed. If some cpp file has #include for both windows.h and this 7 | // file, windows.h should be included first, so definitions in this header will be simply 8 | // ignored. Otherwise type conflicts would appear. 9 | 10 | // Good reference: UE4/Engine/Source/Runtime/Core/Public/Windows/MinimalWindowsApi.h 11 | 12 | #if _WIN32 13 | # ifndef APIENTRY 14 | # define APIENTRY __stdcall 15 | # endif 16 | # ifndef WINAPI 17 | # define WINAPI __stdcall 18 | # endif 19 | # ifndef CALLBACK 20 | # define CALLBACK __stdcall 21 | # endif 22 | # ifndef WINGDIAPI 23 | # define WINGDIAPI 24 | typedef void* HANDLE; 25 | #ifndef _WIN64 26 | typedef int INT_PTR; 27 | typedef unsigned int UINT_PTR; 28 | typedef long LONG_PTR; 29 | typedef unsigned long ULONG_PTR; 30 | #else 31 | typedef __int64 INT_PTR; 32 | typedef unsigned __int64 UINT_PTR; 33 | typedef __int64 LONG_PTR; 34 | typedef unsigned __int64 ULONG_PTR; 35 | #endif 36 | typedef unsigned HDC; 37 | typedef HANDLE HGLRC; 38 | typedef const char * LPCSTR; 39 | typedef int BOOL; 40 | typedef unsigned char BYTE; 41 | typedef unsigned short WORD; 42 | typedef unsigned int DWORD; 43 | typedef unsigned int UINT; 44 | typedef HANDLE HWND; 45 | typedef HANDLE HMENU; 46 | typedef UINT_PTR WPARAM; 47 | typedef LONG_PTR LPARAM; 48 | typedef int (APIENTRY *PROC)(); 49 | typedef void PIXELFORMATDESCRIPTOR; // structure 50 | typedef PIXELFORMATDESCRIPTOR * LPPIXELFORMATDESCRIPTOR; 51 | # endif // WINGDIAPI 52 | # ifndef CONST 53 | # define CONST const 54 | # endif 55 | #endif // _WIN32 56 | 57 | #endif // __WIN32_TYPES_H__ 58 | -------------------------------------------------------------------------------- /Docs/SSE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/Docs/SSE.txt -------------------------------------------------------------------------------- /Docs/glsl.txt: -------------------------------------------------------------------------------- 1 | Common: 2 | - gl_FrontMaterial diffuse and ambient are premultiplied by glColor() value when GL_COLOR_MATERIAL is enabled. 3 | But this will work with glColor() calls only, not with glColorPointer(). When lighting poly with color pointers, 4 | gl_FrontMaterial will be colorized by glColor() value (that's because gl_FrontMaterial is uniform, not attribute). 5 | 6 | ATI: 7 | - cannot handle "#if ", should use "#ifdef <...>" (that's GLSL standard). But NVidia handles "#if ..." 8 | correctly. 9 | - problems with nested "#if..." constructions 10 | - cannot compile shader when it has (write) access to a variable from other shader type; example: compiling vertex 11 | shader will be failed when there is a line with "gl_FragColor = ...", even when that line will never be executed. 12 | - cannot handle "#define WEIGHT (W1+W2+W3...)" - will try to compile macro as it has arguments 13 | - cannot handle "#version ..." when there is something before it (defines block cannot be before version difective) 14 | - the same valid for glsl_validate too 15 | - ATI GLSL compiler has info messages even when shader successfully compiled. More info: 16 | http://wine.git.sourceforge.net/git/gitweb.cgi?p=wine/wine;a=blob_plain;f=dlls/wined3d/glsl_shader.c;hb=HEAD 17 | (check "spam[]" in print_glsl_info_log()) 18 | http://www.nabble.com/-2-5--WineD3D:-Improve-the-GLSL-spam-filter-td23278426.html 19 | -------------------------------------------------------------------------------- /Docs/material.txt: -------------------------------------------------------------------------------- 1 | - UShader: 2 | - Opacity=Diffuse + OutputBlending=OB_Normal === Opacity=NULL + OutputBlending=OB_Masked 3 | - OB_Masked: alpha test is ON, else OFF 4 | - other modes (no opacity etc) - texture alpha-channel is ignored 5 | - UFinalBlend: when used from other material (UShader), all properties are ignored - simply pass Material 6 | 7 | When outer material has overridden properties, such as TwoSided, Masked etc, these properties are ignored 8 | in nested materials 9 | 10 | Shader -- BAD (SelfIllumination, Mask - works, Diffuse - NO) 11 | - Modifier (Diffuse, TexRotator) -- OK 12 | - Shader 13 | - Texture (Diffuse) 14 | - Modifier (Opacity, TexPanner) 15 | - Texture 16 | 17 | !!! CHECK !!! 18 | is it possible? 19 | 20 | Combiner 21 | - Combiner 22 | - Tex 23 | - Tex 24 | - Combiner 25 | - Tex 26 | - Tex 27 | (4TMU, ATI has 6) 28 | What's wrong: multitexturing does not allows to mix 2 subtrees; each node can mix only 1 texture leaf with 29 | a result of whole previous tree 30 | -------------------------------------------------------------------------------- /Docs/reversing.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/Docs/reversing.txt -------------------------------------------------------------------------------- /Docs/ue3flash.txt: -------------------------------------------------------------------------------- 1 | - content is stored in series of "FlashVFS/VFS_fileN_chunk0.con" files, each file corresponds to one of 2 | CookedFlash/... files 3 | - correspondance could be found in UDKGamePreloader.swf (binary view, not decompiler) - it has sequences 4 | of + strings 5 | - mapping .as file cound be found when decompiling UDKGamePreloader.swf with "Flash Decompiler Trillix" 6 | - each VFS file looks like zlib-compressed (most likely compression is performed at UDK level) 7 | - flash uses ATF (Adobe Texture Format), some details here: http://www.bytearray.org/?p=4472 8 | 9 | EpicCitadel demo download URLs: 10 | http://www.unrealengine.com/flash/ 11 | UDKGamePreloader.swf - contains all URLs for loading 12 | UDKGame.swf - contains game executable (ELF file) 13 | FlashVFS/ 14 | VFS_file0_chunk0.con 15 | ... 16 | VFS_file22_chunk0.con 17 | -------------------------------------------------------------------------------- /Docs/xpr.txt: -------------------------------------------------------------------------------- 1 | also: http://www.watto.org/extract/program/archives.txt 2 | 3 | +0 4 XPR1 4 | +4 4 file len 5 | +8 4 data start (special case when == file len, unknown format ...) 6 | +C 4 file count 7 | +10 4 ? 8 | +14 (file count * 2 dwords) 9 | +0 4 name offset (+12) 10 | +4 4 data offset (+12) -> file data (not mips) 11 | +?? 4 = 0 12 | 13 | File data: 14 | +0 4 data size 15 | +4 4 ? 16 | +8 4 data offset (+ data start) 17 | 18 | 19 | 07 01 00 00 (size in dwords) XX XX XX XX (offset) 20 | 21 | NN NN MM MM -- NNNN = size in dwords, MMMM - number of extra dwords 22 | 23 | N words: 24 | 2 25 | 4 - offset at [3] 26 | 5 - offset at [1] 27 | 28 | ------- 29 | Malcolm_pb.xpr - ?? large header (some, but not all *_pb.xpr files ??) 30 | Malcolm_Team_pb.xpr 31 | Lilith_Team_pb.xpr 32 | 33 | in this format Hdr.FileLen == Hdr.DataStart 34 | possibly, texture data goes immediately, Hdr[i].DataOffset -> texture (some hdr + short[], hi-byte of 35 | each short is 0,1,2) 36 | 37 | I was not found any UTX, which uses *_pb textures 38 | Used from Engine.u/LevelInfo.PrecacheMap.Function 39 | (pb contains external data for animations and meshes) -------------------------------------------------------------------------------- /Exporters/ExportThirdParty.cpp: -------------------------------------------------------------------------------- 1 | #include "Core.h" 2 | #include "UnCore.h" 3 | 4 | #include "UnObject.h" 5 | #include "UnThirdParty.h" 6 | 7 | #include "Exporters.h" 8 | 9 | 10 | #if UNREAL3 11 | 12 | void ExportGfx(const USwfMovie *Swf) 13 | { 14 | FArchive *Ar = CreateExportArchive(Swf, EFileArchiveOptions::Default, "%s.gfx", Swf->Name); 15 | if (Ar) 16 | { 17 | Ar->Serialize((void*)&Swf->RawData[0], Swf->RawData.Num()); 18 | delete Ar; 19 | } 20 | } 21 | 22 | void ExportFaceFXAnimSet(const UFaceFXAnimSet *Fx) 23 | { 24 | FArchive *Ar = CreateExportArchive(Fx, EFileArchiveOptions::Default, "%s.fxa", Fx->Name); 25 | if (Ar) 26 | { 27 | Ar->Serialize((void*)&Fx->RawFaceFXAnimSetBytes[0], Fx->RawFaceFXAnimSetBytes.Num()); 28 | delete Ar; 29 | } 30 | } 31 | 32 | void ExportFaceFXAsset(const UFaceFXAsset *Fx) 33 | { 34 | FArchive *Ar = CreateExportArchive(Fx, EFileArchiveOptions::Default, "%s.fxa", Fx->Name); 35 | if (Ar) 36 | { 37 | Ar->Serialize((void*)&Fx->RawFaceFXActorBytes[0], Fx->RawFaceFXActorBytes.Num()); 38 | delete Ar; 39 | } 40 | } 41 | 42 | #endif // UNREAL3 43 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2022, Konstantin Nosov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MeshInstance/MeshInstance.cpp: -------------------------------------------------------------------------------- 1 | #include "Core.h" 2 | #include "UnCore.h" 3 | #include "UnObject.h" 4 | #include "UnrealMaterial/UnMaterial.h" 5 | 6 | #if RENDERING 7 | 8 | #include "MeshInstance.h" 9 | #include "GlWindow.h" // for RGB macro 10 | 11 | 12 | bool CMeshInstance::bColorMaterials = false; 13 | 14 | 15 | unsigned CMeshInstance::GetMaterialDebugColor(int Index) 16 | { 17 | #if 0 18 | //!! This code is based on GetBoneInfColor(). Should place both in some place (utility functions) 19 | //!! and rename to "DebugColorByIndex()" etc. 2 versions: RGBA and float3. 20 | // Most of this code is targeted to make maximal color combinations 21 | // which are maximally different for adjacent BoneIndex values 22 | static const byte table[] = { byte(255*0.9f), byte(255*0.3f), byte(255*0.6f), byte(255*0.0f) }; 23 | static const int table2[] = { 0, 1, 2, 4, 7, 3, 5, 6 }; 24 | Index = (Index & 0xFFF8) | table2[Index & 7] ^ 7; 25 | #define C(x) ( (x) & 1 ) | ( ((x) >> 2) & 2 ) 26 | return RGB255(table[C(Index)], table[C(Index >> 1)], table[C(Index >> 2)]); 27 | #undef C 28 | #else 29 | // Use predefined color table 30 | // Macro for converting hex color code to RGBA (byte swapping, setting alpha to 255) 31 | #define C(x) ( (x >> 16) | ((x & 0xff) << 16) | (x & 0xff00) | 0xff000000 ) 32 | static const uint32 table[] = { 33 | C(0xCAB2D6), C(0xFFFF99), C(0x1F78B4), C(0x33A02C), C(0xE31A1C), C(0xFF7F00), 34 | C(0xFFFF33), C(0x6A3D9A), C(0xB15928), C(0xFDCDAC), C(0xB2DF8A), C(0xFDBF6F), 35 | C(0xCBD5E8), C(0xF4CAE4), C(0xE6F5C9), C(0xFFF2AE), C(0xF1E2CC), C(0xCCCCCC), 36 | C(0x8C564B), C(0xE377C2), C(0x7F7F7F), C(0xBCBD22), C(0x17BECF), C(0xC49C94), 37 | C(0xF7B6D2), C(0xC7C7C7), C(0xDBDB8D), C(0x9EDAE5), C(0xAF5500), C(0xB3E2CD), 38 | C(0xA6CEE3), C(0xFB9A99), 39 | }; 40 | #undef C 41 | return table[(Index ^ 2) % ARRAY_COUNT(table)]; 42 | #endif 43 | } 44 | 45 | 46 | void CMeshInstance::SetMaterial(UUnrealMaterial *Mat, int Index) 47 | { 48 | guard(CMeshInstance::SetMaterial); 49 | if (!bColorMaterials) 50 | { 51 | glColor3f(1, 1, 1); 52 | if (Mat) 53 | Mat->SetMaterial(); 54 | else 55 | BindDefaultMaterial(); 56 | } 57 | else 58 | { 59 | BindDefaultMaterial(true); 60 | glDisable(GL_CULL_FACE); 61 | #if 0 62 | if (Index == HighlightMaterialIndex) 63 | { 64 | // Some HDR color 65 | glColor4f(1.0f, 1.0f, 2.0f, 1.0f); 66 | } 67 | else 68 | { 69 | unsigned color = GetMaterialDebugColor(Index); 70 | glColor4ubv((GLubyte*)&color); 71 | } 72 | #else 73 | unsigned color = GetMaterialDebugColor(Index); 74 | if (HighlightMaterialIndex >= 0 && Index != HighlightMaterialIndex) 75 | { 76 | // Dim color 77 | color >>= 2; 78 | color &= 0x3f3f3f3f; 79 | // Fix alpha 80 | color |= 0xff000000; 81 | } 82 | glColor4ubv((GLubyte*)&color); 83 | #endif 84 | } 85 | unguard; 86 | } 87 | 88 | #endif // RENDERING 89 | -------------------------------------------------------------------------------- /Tools/MaxActorXImport/package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | archive="ActorXImporter.zip" 3 | filelist="*.ms" 4 | 5 | for i in $filelist; do 6 | if [ ! -f $i ]; then 7 | echo "ERROR: unable to find \"$i\"" 8 | exit 1 9 | fi 10 | done 11 | 12 | rm -f $archive 13 | pkzipc -add $archive -level=9 $filelist 14 | -------------------------------------------------------------------------------- /Tools/PackageExtract/Build.h: -------------------------------------------------------------------------------- 1 | #define DO_GUARD 1 2 | 3 | // Use all supported games 4 | #include "GameDefines.h" 5 | -------------------------------------------------------------------------------- /Tools/PackageExtract/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | project="extract" 4 | root="../.." 5 | render=0 6 | source $root/build.sh $* 7 | -------------------------------------------------------------------------------- /Tools/PackageExtract/extract.project: -------------------------------------------------------------------------------- 1 | # perl highlighting 2 | 3 | R = ../.. 4 | PRJ = extract 5 | !include ../../common.project 6 | 7 | sources(MAIN) = { 8 | Main.cpp 9 | $R/Unreal/UnCore.cpp 10 | $R/Unreal/UnCoreCompression.cpp 11 | $R/Unreal/UnCoreDecrypt.cpp 12 | $R/Unreal/UnCoreSerialize.cpp 13 | $R/Unreal/UnObject.cpp 14 | $R/Unreal/UnObject4.cpp 15 | $R/Unreal/UnrealPackage/UnPackage*.cpp 16 | $R/Unreal/GameDatabase.cpp 17 | $R/Unreal/FileSystem/*.cpp 18 | $R/Unreal/TypeInfo.cpp 19 | $R/Core/Core.cpp 20 | $R/Core/CoreWin32.cpp 21 | $R/Core/Memory.cpp 22 | } 23 | 24 | target(executable, $PRJ, MAIN + COMP_LIBS + UE4_LIBS, MAIN) 25 | -------------------------------------------------------------------------------- /Tools/PackageExtract/t.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rm extract.exe 4 | bash build.sh 5 | 6 | extract.exe %* 7 | -------------------------------------------------------------------------------- /Tools/PackageTool/Build.h: -------------------------------------------------------------------------------- 1 | #define DO_GUARD 1 2 | #define UNREAL3 1 3 | #define UNREAL4 1 4 | 5 | #include "GameDefines.h" 6 | -------------------------------------------------------------------------------- /Tools/PackageTool/Main.cpp: -------------------------------------------------------------------------------- 1 | #include "Core.h" 2 | #include "UnCore.h" 3 | #include "UnrealPackage/UnPackage.h" 4 | #include "UnrealPackage/PackageUtils.h" 5 | 6 | /*----------------------------------------------------------------------------- 7 | Main function 8 | -----------------------------------------------------------------------------*/ 9 | 10 | #if UNREAL4 11 | 12 | int UE4UnversionedPackage(int verMin, int verMax) 13 | { 14 | appErrorNoLog("Unversioned UE4 packages are not supported. Please restart UModel and select UE4 version in range %d-%d using UI or command line.", verMin, verMax); 15 | return -1; 16 | } 17 | 18 | bool UE4EncryptedPak() 19 | { 20 | return false; 21 | } 22 | 23 | #endif // UNREAL4 24 | 25 | 26 | int main(int argc, char **argv) 27 | { 28 | #if DO_GUARD 29 | TRY { 30 | #endif 31 | 32 | guard(Main); 33 | 34 | // display usage 35 | if (argc < 2) 36 | { 37 | help: 38 | printf( "Unreal package scanner\n" 39 | "https://www.gildor.org/\n" 40 | "Usage: pkgtool \n" 41 | ); 42 | exit(0); 43 | } 44 | 45 | // parse command line 46 | // bool dump = false, view = true, exprt = false, listOnly = false, noAnim = false, pkgInfo = false; 47 | int arg = 1; 48 | /* for (arg = 1; arg < argc; arg++) 49 | { 50 | if (argv[arg][0] == '-') 51 | { 52 | const char *opt = argv[arg]+1; 53 | if (!stricmp(opt, "dump")) 54 | { 55 | } 56 | else if (!stricmp(opt, "check")) 57 | { 58 | } 59 | else 60 | goto help; 61 | } 62 | else 63 | { 64 | break; 65 | } 66 | } */ 67 | const char *argPkgDir = argv[arg]; 68 | if (!argPkgDir) goto help; 69 | 70 | appSetRootDirectory(argPkgDir); 71 | 72 | // scan packages 73 | TArray PkgInfo; 74 | ScanPackageVersions(PkgInfo); 75 | 76 | printf("Version summary:\n" 77 | "%-9s %-9s %s %s\n", "Ver", "LicVer", "Count", "Filename"); 78 | for (int i = 0; i < PkgInfo.Num(); i++) 79 | { 80 | const FileInfo &Info = PkgInfo[i]; 81 | printf("%3d (%3X) %3d (%3X) %4d %s%s\n", 82 | Info.Ver, Info.Ver, Info.LicVer, Info.LicVer, Info.Count, Info.FileName, 83 | Info.Count > 1 && Info.FileName[0] ? "..." : ""); 84 | } 85 | 86 | unguard; 87 | 88 | #if DO_GUARD 89 | } CATCH { 90 | GError.StandardHandler(); 91 | exit(1); 92 | } 93 | #endif 94 | return 0; 95 | } 96 | -------------------------------------------------------------------------------- /Tools/PackageTool/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | project="pkgtool" 4 | root="../.." 5 | render=0 6 | source $root/build.sh $* 7 | -------------------------------------------------------------------------------- /Tools/PackageTool/pkgtool.project: -------------------------------------------------------------------------------- 1 | # perl highlighting 2 | 3 | R = ../.. 4 | PRJ = pkgtool 5 | !include ../../common.project 6 | 7 | sources(MAIN) = { 8 | Main.cpp 9 | $R/Unreal/UnCore.cpp 10 | $R/Unreal/UnCoreCompression.cpp 11 | $R/Unreal/UnCoreDecrypt.cpp 12 | $R/Unreal/UnCoreSerialize.cpp 13 | $R/Unreal/UnObject.cpp 14 | $R/Unreal/UnObject4.cpp 15 | $R/Unreal/UnrealPackage/*.cpp 16 | $R/Unreal/GameDatabase.cpp 17 | $R/Unreal/FileSystem/*.cpp 18 | $R/Unreal/TypeInfo.cpp 19 | $R/Core/Core.cpp 20 | $R/Core/CoreWin32.cpp 21 | $R/Core/Memory.cpp 22 | } 23 | 24 | target(executable, $PRJ, MAIN + COMP_LIBS + UE4_LIBS, MAIN) 25 | -------------------------------------------------------------------------------- /Tools/PackageTool/t.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rm pkgtool.exe 4 | bash build.sh 5 | 6 | pkgtool.exe C:\GAMES\Unreal\UT2004 7 | -------------------------------------------------------------------------------- /Tools/PackageUnpack/Build.h: -------------------------------------------------------------------------------- 1 | #define DO_GUARD 1 2 | 3 | // Use all supported games 4 | #include "GameDefines.h" 5 | #undef GEARS4 // it's packages are not packed anyway 6 | -------------------------------------------------------------------------------- /Tools/PackageUnpack/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | project="decompress" 4 | root="../.." 5 | render=0 6 | source $root/build.sh $* 7 | -------------------------------------------------------------------------------- /Tools/PackageUnpack/decompress.project: -------------------------------------------------------------------------------- 1 | # perl highlighting 2 | 3 | R = ../.. 4 | PRJ = decompress 5 | !include ../../common.project 6 | 7 | sources(MAIN) = { 8 | Main.cpp 9 | $R/Unreal/UnCore.cpp 10 | $R/Unreal/UnCoreCompression.cpp 11 | $R/Unreal/UnCoreDecrypt.cpp 12 | $R/Unreal/UnCoreSerialize.cpp 13 | $R/Unreal/UnObject.cpp 14 | $R/Unreal/UnObject4.cpp 15 | $R/Unreal/UnrealPackage/UnPackage*.cpp 16 | $R/Unreal/GameDatabase.cpp 17 | $R/Unreal/FileSystem/*.cpp 18 | $R/Unreal/TypeInfo.cpp 19 | $R/Core/Core.cpp 20 | $R/Core/CoreWin32.cpp 21 | $R/Core/Memory.cpp 22 | } 23 | 24 | target(executable, $PRJ, MAIN + COMP_LIBS + UE4_LIBS, MAIN) 25 | -------------------------------------------------------------------------------- /Tools/PackageUnpack/t.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rm decompress.exe 4 | bash build.sh 5 | 6 | decompress %* 7 | -------------------------------------------------------------------------------- /Tools/TypeInfo/Build.h: -------------------------------------------------------------------------------- 1 | #define DO_GUARD 1 2 | #define UNREAL4 0 3 | 4 | // Use all supported games 5 | #include "GameDefines.h" 6 | 7 | #undef ROCKET_LEAGUE // Rocket League, requires AES which we're providing only for UE4; anyway, I doubt typeinfo will work for this game 8 | -------------------------------------------------------------------------------- /Tools/TypeInfo/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | project="typeinfo" 4 | root="../.." 5 | render=0 6 | source $root/build.sh 7 | -------------------------------------------------------------------------------- /Tools/TypeInfo/t.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rm typeinfo.exe 4 | bash build.sh 5 | 6 | ::typeinfo.exe "C:\GAMES\Unreal Anthology\UT2004\System\Core.u" 7 | ::typeinfo.exe "C:\GAMES\Unreal Anthology\UT2004\System\Engine.u" 8 | ::typeinfo.exe C:\!umodel-data\UnrealChampionship2\System\Core.u 9 | ::typeinfo.exe C:\!umodel-data\GearsOfWar2_X360\Core.xxx 10 | ::typeinfo.exe "C:\GAMES\UT3\UTGame\CookedPC\Core.u" 11 | ::typeinfo.exe "C:\GAMES\UT3\UTGame\CookedPC\Engine.u" 12 | ::typeinfo.exe ..\..\data\3\Batman2\Engine.upk 13 | ::typeinfo.exe -text ..\..\data\3\Alice\AliceGame.u 14 | ::typeinfo.exe -lzo ..\..\data\3\Bioshock3\XCore.xxx 15 | typeinfo ..\..\data\3\Thief\Core.u 16 | -------------------------------------------------------------------------------- /Tools/TypeInfo/typeinfo.project: -------------------------------------------------------------------------------- 1 | # perl highlighting 2 | 3 | R = ../.. 4 | PRJ = typeinfo 5 | !include ../../common.project 6 | 7 | sources(MAIN) = { 8 | Main.cpp 9 | $R/Unreal/UnCore.cpp 10 | $R/Unreal/UnCoreCompression.cpp 11 | $R/Unreal/UnCoreDecrypt.cpp 12 | $R/Unreal/UnCoreSerialize.cpp 13 | $R/Unreal/UnObject.cpp 14 | $R/Unreal/UnObject4.cpp 15 | $R/Unreal/UnrealPackage/UnPackage*.cpp 16 | $R/Unreal/GameDatabase.cpp 17 | $R/Unreal/FileSystem/*.cpp 18 | $R/Unreal/TypeInfo.cpp 19 | $R/Core/Core.cpp 20 | $R/Core/CoreWin32.cpp 21 | $R/Core/Memory.cpp 22 | } 23 | 24 | target(executable, $PRJ, MAIN + COMP_LIBS, MAIN) 25 | -------------------------------------------------------------------------------- /Tools/UITest/Build.h: -------------------------------------------------------------------------------- 1 | #define MAX_DEBUG 1 2 | -------------------------------------------------------------------------------- /Tools/UITest/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | vc_ver=latest 4 | project="uitest" 5 | root="../.." 6 | render=0 7 | source $root/build.sh $* 8 | -------------------------------------------------------------------------------- /Tools/UITest/t.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rm uitest.exe 4 | bash build.sh 5 | 6 | uitest.exe 7 | -------------------------------------------------------------------------------- /Tools/UITest/uitest.project: -------------------------------------------------------------------------------- 1 | # perl highlighting 2 | 3 | #USE_STL = 1 4 | #OPTIMIZE = none 5 | 6 | !if !defined($USE_STL) 7 | USE_STL=0 8 | !endif 9 | 10 | !if "$USE_STL" eq "1" 11 | !message Building STL version 12 | OLDCRT = 0 13 | CPP_EXCEPT = 1 14 | !endif 15 | 16 | R = ../.. 17 | PRJ = uitest 18 | 19 | # Include common project file, it has settings like output directory etc 20 | !include ../../common.project 21 | 22 | !if "$USE_STL" ne "1" 23 | INCLUDES += $R/UI 24 | !else 25 | INCLUDES = $R/UI/stl-stub $INCLUDES $R/UI 26 | !endif 27 | 28 | sources(MAIN) = { 29 | Main.cpp 30 | !if "$USE_STL" ne "1" 31 | $R/Core/Core.cpp 32 | $R/Core/CoreWin32.cpp 33 | $R/Core/Memory.cpp 34 | $R/Unreal/UnCore.cpp 35 | !endif 36 | # $R/Unreal/GameDatabase.cpp 37 | $R/UI/*.cpp 38 | # include manifest - required for UIHyperLink 39 | $R/UmodelTool/res/umodel.rc 40 | } 41 | 42 | target(executable, $PRJ, MAIN, MAIN) 43 | -------------------------------------------------------------------------------- /Tools/UITest/vs/UI_Dev.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27703.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UI_Dev", "UI_Dev.vcxproj", "{5B9424F4-3008-4CBF-AC8F-5CADA1C4AE01}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {5B9424F4-3008-4CBF-AC8F-5CADA1C4AE01}.Debug|x64.ActiveCfg = Debug|Win32 17 | {5B9424F4-3008-4CBF-AC8F-5CADA1C4AE01}.Debug|x86.ActiveCfg = Debug|Win32 18 | {5B9424F4-3008-4CBF-AC8F-5CADA1C4AE01}.Debug|x86.Build.0 = Debug|Win32 19 | {5B9424F4-3008-4CBF-AC8F-5CADA1C4AE01}.Release|x64.ActiveCfg = Release|Win32 20 | {5B9424F4-3008-4CBF-AC8F-5CADA1C4AE01}.Release|x86.ActiveCfg = Release|Win32 21 | {5B9424F4-3008-4CBF-AC8F-5CADA1C4AE01}.Release|x86.Build.0 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | GlobalSection(ExtensibilityGlobals) = postSolution 27 | SolutionGuid = {9D77B943-8869-4F89-A39A-D6F0DE1B175C} 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /Tools/UITest/vs/UI_Dev.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {a7aa9123-d9fb-40cc-be89-f965bbd6291a} 18 | 19 | 20 | {1317c799-e39e-45e8-88de-fd57ab7929fc} 21 | 22 | 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | TestApp 38 | 39 | 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | STL_Stub 55 | 56 | 57 | STL_Stub 58 | 59 | 60 | 61 | 62 | Resource Files 63 | 64 | 65 | -------------------------------------------------------------------------------- /Tools/UITest/vs/UI_Dev.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Tools/UmdExtract/Build.h: -------------------------------------------------------------------------------- 1 | #define DO_GUARD 1 2 | 3 | //#define UNREAL1 1 4 | #define UNREAL25 1 5 | #define UNREAL3 1 // for compression functions only 6 | #define XBOX360 1 // XBox360 compression support 7 | 8 | #define LEAD 1 9 | -------------------------------------------------------------------------------- /Tools/UmdExtract/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | project="unumd" 4 | root="../.." 5 | render=0 6 | source $root/build.sh 7 | -------------------------------------------------------------------------------- /Tools/UmdExtract/t.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rm unumd.exe 4 | bash build.sh 5 | 6 | unumd.exe -path="E:\Projects\UModel\data\.possible\Splinter Cell Conviction" 7 | -------------------------------------------------------------------------------- /Tools/UmdExtract/unumd.project: -------------------------------------------------------------------------------- 1 | # perl highlighting 2 | 3 | R = ../.. 4 | PRJ = unumd 5 | !include ../../common.project 6 | 7 | sources(MAIN) = { 8 | Main.cpp 9 | $R/Unreal/UnCore.cpp 10 | $R/Unreal/UnCoreCompression.cpp 11 | $R/Unreal/UnCoreSerialize.cpp 12 | $R/Unreal/GameDatabase.cpp 13 | $R/Unreal/FileSystem/GameFileSystem.cpp 14 | $R/Unreal/GameSpecific/UnUbisoft.cpp 15 | $R/Core/Core.cpp 16 | $R/Core/CoreWin32.cpp 17 | $R/Core/Memory.cpp 18 | } 19 | 20 | target(executable, $PRJ, MAIN + COMP_LIBS, MAIN) 21 | -------------------------------------------------------------------------------- /Tools/umodel.natvis: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Empty 9 | Invalid 10 | Invalid 11 | {Data.DataPtr,s} 12 | Data.DataPtr,s 13 | 14 | 15 | 16 | 17 | Empty 18 | Invalid 19 | Invalid 20 | Num={DataCount} 21 | 22 | 23 | DataCount 24 | ($T1*)DataPtr 25 | 26 | 27 | 28 | 29 | 30 | (Name={Name}) 31 | 32 | 33 | 34 | (Name={Name}) 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Tools/unpack_obb.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | #------------------------------------------------------------------------------ 4 | # Unpacker for Unreal engine 3 Android OBB archives 5 | #------------------------------------------------------------------------------ 6 | 7 | 8 | sub ReadInt 9 | { 10 | my $data; 11 | sysread(IN, $data, 4) or die "Problem reading file\n"; 12 | return unpack("l", $data); 13 | } 14 | 15 | sub ReadInt64 16 | { 17 | my $i1 = ReadInt(); 18 | my $i2 = ReadInt(); 19 | die "Int64 with non-zero HIDWORD" if $i2 != 0; 20 | return $i1; 21 | } 22 | 23 | sub ReadString 24 | { 25 | my $data; 26 | my $len = ReadInt(); 27 | sysread(IN, $data, $len); 28 | return $data; 29 | } 30 | 31 | # recursive mkdir 32 | sub MakeDir 33 | { 34 | my $fulldir = $_[0]; 35 | my $dir = '.'; 36 | for my $d (split('/', $fulldir)) 37 | { 38 | $dir .= '/' . $d; 39 | mkdir($dir, '0777'); 40 | } 41 | } 42 | 43 | 44 | # open archive 45 | $filename = $ARGV[0]; 46 | open(IN, $filename) or die "Unable to open file \"$filename\"\n"; 47 | binmode(IN); 48 | 49 | # file ID 50 | sysread(IN, $id, 13); 51 | die "Wrong file format\n" if $id ne "UE3AndroidOBB"; 52 | 53 | # read archive directory 54 | $count = ReadInt(); 55 | 56 | @filenames = (); 57 | @positions = (); 58 | @lens = (); 59 | 60 | for ($i = 0; $i < $count; $i++) 61 | { 62 | $filename = ReadString(); 63 | $position = ReadInt64(); 64 | $len = ReadInt(); 65 | printf("%08X %8X %20s\n", $position, $len, $filename); 66 | push @filenames, $filename; 67 | push @positions, $position; 68 | push @lens, $len; 69 | } 70 | 71 | $totalLen = 0; 72 | for ($i = 0; $i < $count; $i++) 73 | { 74 | $totalLen += $lens[$i]; 75 | } 76 | 77 | printf("%d files total, %.1f MBytes\n", $count, $totalLen / (1024*1024)); 78 | 79 | 80 | # extract files 81 | $extractedLen = 0; 82 | for ($i = 0; $i < $count; $i++) 83 | { 84 | my $filename = $filenames[$i]; 85 | $filename =~ s/\\/\//g; # replace slashes 86 | $filename =~ s/^\.\.\///; # remove "../" at beginning 87 | 88 | # create a directory for file 89 | if ($filename =~ /.*\/.*/) 90 | { 91 | # has slashes inside, make a directory 92 | my ($dirname) = $filename =~ /(.*)\/[^\/]+/; 93 | MakeDir($dirname); 94 | } 95 | 96 | sysseek(IN, $positions[$i], 0); 97 | 98 | # write file 99 | open(F, ">$filename") or die "Unable to create file $filename\n"; 100 | binmode(F); 101 | 102 | $remainingLen = $lens[$i]; 103 | # copy streams in 64k chunks 104 | do 105 | { 106 | $len = $remainingLen; 107 | $len = 65536 if $len > 65536; 108 | sysread(IN, $data, $len); 109 | syswrite(F, $data); 110 | $remainingLen -= $len; 111 | # progress indicator 112 | $extractedLen += $len; 113 | printf("Extracting: %.1f%%\r", ($extractedLen / $totalLen) * 100); 114 | } while ($remainingLen > 0); # allow zero-sized files 115 | 116 | close(F); 117 | } 118 | 119 | printf("\n"); 120 | 121 | # close archive 122 | close(IN); 123 | -------------------------------------------------------------------------------- /UI/FileControls.h: -------------------------------------------------------------------------------- 1 | // Simple UI library. 2 | // Copyright (C) 2022 Konstantin Nosov 3 | // Licensed under the BSD license. See LICENSE.txt file in the project root for full license information. 4 | 5 | #ifndef __FILE_CONTROLS_H__ 6 | #define __FILE_CONTROLS_H__ 7 | 8 | 9 | class UIFilePathEditor : public UIGroup 10 | { 11 | DECLARE_UI_CLASS(UIFilePathEditor, UIGroup); 12 | public: 13 | UIFilePathEditor(FString* path); 14 | 15 | FORCEINLINE UIFilePathEditor& SetTitle(const char* InTitle) 16 | { 17 | Title = InTitle; 18 | return *this; 19 | } 20 | 21 | protected: 22 | UITextEdit* Editor; 23 | FString* Path; 24 | FString Title; 25 | HWND DlgWnd; 26 | 27 | virtual void Create(UICreateContext& ctx) override; 28 | virtual void AddCustomControls() override; 29 | void OnBrowseClicked(UIButton* sender); 30 | }; 31 | 32 | 33 | class UIFileNameEditor : public UIGroup 34 | { 35 | DECLARE_UI_CLASS(UIFileNameEditor, UIGroup); 36 | public: 37 | UIFileNameEditor(FString* path); 38 | 39 | FORCEINLINE UIFileNameEditor& SetTitle(const char* InTitle) 40 | { 41 | Title = InTitle; 42 | return *this; 43 | } 44 | 45 | FORCEINLINE UIFileNameEditor& SetInitialDirectory(const char* Directory) 46 | { 47 | InitialDirectory = Directory; 48 | return *this; 49 | } 50 | 51 | FORCEINLINE UIFileNameEditor& UseLoadDialog() 52 | { 53 | bIsSaveDialog = false; 54 | return *this; 55 | } 56 | 57 | FORCEINLINE UIFileNameEditor& UseSaveDialog() 58 | { 59 | bIsSaveDialog = true; 60 | return *this; 61 | } 62 | 63 | FORCEINLINE UIFileNameEditor& AddFilter(const char* Filter) 64 | { 65 | Filters.Add(Filter); 66 | return *this; 67 | } 68 | 69 | FORCEINLINE const FString& GetInitialDirectory() const 70 | { 71 | return InitialDirectory; 72 | } 73 | 74 | FORCEINLINE const FString& GetPath() const 75 | { 76 | return *Path; 77 | } 78 | 79 | protected: 80 | UITextEdit* Editor; 81 | FString* Path; 82 | HWND DlgWnd; 83 | bool bIsSaveDialog; 84 | FString Title; 85 | FString InitialDirectory; 86 | TArray Filters; 87 | 88 | virtual void Create(UICreateContext& ctx) override; 89 | virtual void AddCustomControls() override; 90 | void OnBrowseClicked(UIButton* sender); 91 | }; 92 | 93 | FString ShowFileSelectionDialog( 94 | bool bIsSaveDialog, 95 | UIBaseDialog* ParentDialog, 96 | const FString& InitialFilename, 97 | const FString& InitialDirectory, 98 | const FString& Title, 99 | const TArray& Filters); 100 | 101 | 102 | #endif // __FILE_CONTROLS_H__ 103 | -------------------------------------------------------------------------------- /UI/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2022, Konstantin Nosov 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /UI/README.md: -------------------------------------------------------------------------------- 1 | Simple UI Library 2 | ================= 3 | 4 | Summary 5 | ------- 6 | 7 | This is a small UI library. It was designed to create user interfaces without any use of "mouse work". 8 | Everything is created with use of simple declarative syntax looking like this: 9 | 10 | NewControl(UIGroup) 11 | .Expose(GroupVar) 12 | .SomeGroupFunc() 13 | [ 14 | NewControl(ControlType1, args1) 15 | .SomeControl1Func1() 16 | .SomeControl1Func2() 17 | + NewControl(ControlType2, args2) 18 | .Expose(Control2Var) 19 | ... 20 | ] 21 | 22 | Source code is [located on Github](https://github.com/gildor2/UModel/tree/master/UI). 23 | 24 | Supported platforms 25 | ------------------- 26 | 27 | At the moment this library supports only Windows platform, however it was designed in mind to make it cross-platform later. 28 | 29 | STL support 30 | ----------- 31 | 32 | The library was created specially for [UModel project](https://www.gildor.org/en/projects/umodel). Therefore it uses UModel internal structures 33 | to hold information, in particular - TArray and FString (these classes are inspired by Unreal engine API). To make library usable in other 34 | projects, we have created a special wrappers which could be found in [stl-stub](stl-stub) directory. Simply copy them to the main UI library 35 | folder, or set up compiler include paths to use these directories. 36 | 37 | Callback / delegate class 38 | ------------------------- 39 | 40 | This library shipped with [Callback class](callback.h) used for binding any function, class method or lambda as an action to UI event. This 41 | class is self-containing, doesn't depend on other UI library parts, on any other C++ library and/or STL. It could be used separately from UI 42 | library if you need the functionality it provides. The Callback class has been made with use of modern C++, so you will need C++11 supporting 43 | compiler. For more details please refer to [class' source code](callback.h) (read comments in file header). 44 | 45 | Sample code 46 | ----------- 47 | 48 | At the moment it could be located here - [UITest](../Tools/UITest). 49 | 50 | Other external files 51 | -------------------- 52 | - [Win32Types.h](../Core/Win32Types.h) Contains declarations stripped from Windows.h. Allows faster compilation of headers without use of heavy 53 | Windows headers. Library's cpp files still depends on Windows SDK. 54 | 55 | License 56 | ------- 57 | 58 | This library is licensed under the [BSD license](LICENSE.txt). 59 | -------------------------------------------------------------------------------- /UI/UIPrivate.h: -------------------------------------------------------------------------------- 1 | // Simple UI library. 2 | // Copyright (C) 2022 Konstantin Nosov 3 | // Licensed under the BSD license. See LICENSE.txt file in the project root for full license information. 4 | 5 | 6 | #define USE_EXPLORER_STYLE 1 // use modern control style whenever possible 7 | 8 | #define FIRST_DIALOG_ID 4000 9 | #define FIRST_MENU_ID 8000 10 | 11 | #define DEFAULT_MARGIN 6 12 | 13 | #define VERTICAL_SPACING DEFAULT_MARGIN 14 | #define HORIZONTAL_SPACING (DEFAULT_MARGIN*2) 15 | 16 | #define DEFAULT_HORZ_BORDER 7 17 | 18 | #define DEFAULT_LABEL_HEIGHT 14 19 | #define DEFAULT_PROGRESS_BAR_HEIGHT 18 20 | #define DEFAULT_BUTTON_HEIGHT 20 21 | #define DEFAULT_CHECKBOX_HEIGHT 18 22 | #define DEFAULT_EDIT_HEIGHT 20 23 | #define DEFAULT_COMBOBOX_HEIGHT 20 24 | #define DEFAULT_COMBOBOX_LIST_HEIGHT 200 // height of combobox dropdown list 25 | #define DEFAULT_LISTBOX_HEIGHT -1 26 | #define DEFAULT_TREEVIEW_HEIGHT -1 27 | #define DEFAULT_TREE_ITEM_HEIGHT 0 28 | 29 | #define MIN_CONTROL_WIDTH 80 30 | 31 | #define GROUP_INDENT 10 32 | #define GROUP_MARGIN_TOP 16 33 | #define GROUP_MARGIN_BOTTOM 7 34 | 35 | #define TAB_MARGIN_TOP 30 36 | #define TAB_MARGIN_OTHER 10 37 | 38 | #define MAX_TITLE_LEN 256 39 | -------------------------------------------------------------------------------- /UI/stl-stub/Core.h: -------------------------------------------------------------------------------- 1 | // Simple UI library. 2 | // Copyright (C) 2022 Konstantin Nosov 3 | // Licensed under the BSD license. See LICENSE.txt file in the project root for full license information. 4 | 5 | #ifndef __CORE_H__ 6 | #define __CORE_H__ 7 | 8 | //todo: should be defined before any include like windows.h etc - see BaseDialog.cpp 9 | #define _CRT_SECURE_NO_WARNINGS 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | #undef min 18 | #undef max 19 | 20 | #define min(a,b) ( ((a) < (b)) ? (a) : (b) ) 21 | #define max(a,b) ( ((a) > (b)) ? (a) : (b) ) 22 | #define bound(a,minval,maxval) ( ((a) > (minval)) ? ( ((a) < (maxval)) ? (a) : (maxval) ) : (minval) ) 23 | 24 | #undef ARRAY_COUNT 25 | 26 | #define ARRAY_ARG(array) array, sizeof(array)/sizeof(array[0]) 27 | #define ARRAY_COUNT(array) (sizeof(array)/sizeof(array[0])) 28 | 29 | #if _MSC_VER 30 | # define FORCEINLINE __forceinline 31 | # define stricmp _stricmp 32 | # define strnicmp _strnicmp 33 | #else 34 | # error Unsupported compiler 35 | #endif 36 | 37 | #define guard(x) 38 | #define unguard 39 | #define unguardf(...) 40 | 41 | #if defined(_WIN32) && defined(_DEBUG) 42 | 43 | extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); 44 | extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* lpOutputString); 45 | 46 | #endif // _WIN32 && _DEBUG 47 | 48 | 49 | static void appPrintf(const char* Format, ...) 50 | { 51 | va_list argptr; 52 | va_start(argptr, Format); 53 | char buffer[1024]; 54 | _vsnprintf_s(buffer, ARRAY_COUNT(buffer), Format, argptr); 55 | buffer[ARRAY_COUNT(buffer)-1] = 0; 56 | va_end(argptr); 57 | 58 | printf("%s", buffer); 59 | #ifdef _DEBUG 60 | if (IsDebuggerPresent()) 61 | OutputDebugStringA(buffer); 62 | #endif 63 | } 64 | 65 | static void appError(const char* Format, ...) 66 | { 67 | va_list argptr; 68 | va_start(argptr, Format); 69 | char buffer[1024]; 70 | _vsnprintf_s(buffer, ARRAY_COUNT(buffer), Format, argptr); 71 | va_end(argptr); 72 | 73 | appPrintf("%s", buffer); 74 | #ifdef _DEBUG 75 | if (IsDebuggerPresent()) 76 | __debugbreak(); 77 | #endif 78 | exit(1); 79 | } 80 | 81 | static int appSprintf(char *dest, int size, const char *Format, ...) 82 | { 83 | va_list argptr; 84 | va_start(argptr, Format); 85 | int len = _vsnprintf_s(dest, size, size, Format, argptr); 86 | va_end(argptr); 87 | return len; 88 | } 89 | 90 | static void appStrncpyz(char *dst, const char *src, int count) 91 | { 92 | int len = (int)strlen(src); 93 | if (len >= count) 94 | len = count-1; 95 | strncpy(dst, src, len); 96 | dst[len] = 0; 97 | } 98 | 99 | #ifndef assert 100 | #define assert(x) if (!(x)) { appError("Assert: %s", #x); } 101 | #endif 102 | 103 | #define appNotify(...) appPrintf("*** " __VA_ARGS__) 104 | 105 | #endif // __CORE_H__ 106 | -------------------------------------------------------------------------------- /UmodelTool/AboutDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef __ABOUT_DIALOG_H__ 2 | #define __ABOUT_DIALOG_H__ 3 | 4 | #include "MiscStrings.h" 5 | #include "res/resource.h" 6 | 7 | class UIAboutDialog : public UIBaseDialog 8 | { 9 | public: 10 | static void Show() 11 | { 12 | UIAboutDialog dialog; 13 | dialog.ShowModal("About UModel", 450, -1); 14 | } 15 | 16 | //!! - Add these lines: 17 | //!! Distributed under the license. 18 | virtual void InitUI() 19 | { 20 | (*this) 21 | [ 22 | // top part 23 | NewControl(UIGroup, GROUP_NO_BORDER|GROUP_HORIZONTAL_LAYOUT) 24 | .SetWidth(EncodeWidth(1.0f)) 25 | [ 26 | // icon 27 | NewControl(UIBitmap) 28 | .SetWidth(64) 29 | .SetHeight(64) 30 | .SetResourceIcon(IDC_MAIN_ICON) 31 | + NewControl(UISpacer, 8) 32 | // and text 33 | + NewControl(UIGroup, GROUP_NO_BORDER) 34 | .SetWidth(EncodeWidth(1.0f)) 35 | [ 36 | NewControl(UISpacer, 8) 37 | + NewControl(UILabel, "UE Viewer (UModel)") 38 | + NewControl(UISpacer) 39 | + NewControl(UILabel, GBuildString) 40 | + NewControl(UISpacer) 41 | + NewControl(UILabel, GCopyrightString) 42 | + NewControl(UILabel, GLicenseString) 43 | ] 44 | ] 45 | // bottom part 46 | + NewControl(UISpacer, 8) 47 | + NewControl(UIHorizontalLine) 48 | + NewControl(UISpacer, 8) 49 | + NewControl(UIHyperLink, "Visit our website", GUmodelHomepage) 50 | + NewControl(UISpacer) 51 | + NewControl(UIHyperLink, "Donate", "https://www.gildor.org/en/donate") 52 | + NewControl(UISpacer) 53 | // close button 54 | + NewControl(UIGroup, GROUP_NO_BORDER|GROUP_HORIZONTAL_LAYOUT) 55 | [ 56 | NewControl(UISpacer, -1) 57 | + NewControl(UIButton, "Close") 58 | .SetWidth(80) 59 | .SetOK() 60 | ] 61 | ]; 62 | } 63 | }; 64 | 65 | #endif // __ABOUT_DIALOG_H__ 66 | -------------------------------------------------------------------------------- /UmodelTool/Build.h: -------------------------------------------------------------------------------- 1 | #define DO_GUARD 1 2 | //#define MAX_DEBUG 1 // Maximal debugging level 3 | //#define DEBUG_MEMORY 1 4 | #define RENDERING 1 5 | #define THREADING 1 6 | #define PROFILE 1 7 | #define DECLARE_VIEWER_PROPS 1 8 | //#define VSTUDIO_INTEGRATION 1 // improved debugging with Visual Studio 9 | 10 | //#define PRIVATE_BUILD 1 11 | 12 | #include "GameDefines.h" 13 | 14 | #ifdef __APPLE__ 15 | #undef RENDERING //todo? 16 | #undef THREADING //todo? 17 | #endif 18 | 19 | // some private games 20 | #if PRIVATE_BUILD 21 | //-- none 22 | #endif 23 | -------------------------------------------------------------------------------- /UmodelTool/ErrorDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef __ERROR_DIALOG_H__ 2 | #define __ERROR_DIALOG_H__ 3 | 4 | class UIErrorDialog : public UIBaseDialog 5 | { 6 | public: 7 | void Show() 8 | { 9 | SetResizeable(); 10 | ShowModal("Fatal Error", 530, 200); 11 | } 12 | 13 | void InitUI() 14 | { 15 | #if DO_GUARD 16 | char message[256]; 17 | char* s = strchr(GError.History, '\n'); 18 | const char* log; 19 | if (s) 20 | { 21 | appStrncpyz(message, GError.History, min(s - GError.History + 1, ARRAY_COUNT(message))); 22 | log = s + 1; 23 | } 24 | else 25 | { 26 | appStrncpyz(message, GError.History, ARRAY_COUNT(message)); 27 | log = ""; 28 | } 29 | 30 | (*this) 31 | [ 32 | NewControl(UIGroup, GROUP_NO_BORDER|GROUP_HORIZONTAL_LAYOUT) 33 | .SetWidth(EncodeWidth(1.0f)) 34 | .SetHeight(EncodeWidth(1.0f)) // allow vertical resize of contents 35 | [ 36 | NewControl(UIBitmap) 37 | .SetWidth(48) 38 | .SetHeight(48) 39 | .SetResourceIcon(UIBitmap::BI_Error) 40 | + NewControl(UISpacer) 41 | + NewControl(UIGroup, GROUP_NO_BORDER) 42 | .SetWidth(EncodeWidth(1.0f)) 43 | [ 44 | NewControl(UILabel, message) 45 | // .SetHeight(-1) //!! auto-size label height; use AutoVSize API? 46 | .SetHeight(28) // two lines of text 47 | + NewControl(UISpacer, 16) 48 | + NewControl(UILabel, "Call stack:") 49 | + NewControl(UISpacer) 50 | + NewControl(UITextEdit, log) 51 | .SetHeight(-1) //?? old value: 100 52 | .SetMultiline() 53 | .SetReadOnly() 54 | .SetWantFocus(false) 55 | ] 56 | + NewControl(UIGroup, GROUP_NO_BORDER) 57 | .SetWidth(80) 58 | [ 59 | NewControl(UIButton, "Close") 60 | .SetWidth(80) 61 | .SetOK() 62 | + NewControl(UIButton, "Copy") 63 | .SetWidth(80) 64 | .SetCallback(BIND_STATIC(&UIErrorDialog::CopyToClipboard)) 65 | // .SetCallback(BIND_LAMBDA([]() { appCopyTextToClipboard(GError.History); })) - error in VS2013 66 | ] 67 | ] 68 | ]; 69 | #endif // DO_GUARD 70 | } 71 | 72 | static void CopyToClipboard() 73 | { 74 | #if DO_GUARD 75 | appCopyTextToClipboard(GError.History); 76 | #endif 77 | } 78 | }; 79 | 80 | #endif // __ERROR_DIALOG_H__ 81 | -------------------------------------------------------------------------------- /UmodelTool/MiscStrings.cpp: -------------------------------------------------------------------------------- 1 | #include "Core.h" 2 | #include "MiscStrings.h" 3 | 4 | #include "Version.h" 5 | 6 | const char* GUmodelHomepage = "https://www.gildor.org/en/projects/umodel"; 7 | 8 | const char* GBuildString = "Compiled " __DATE__ " (build " STR(GIT_REVISION) ")"; 9 | const char* GCopyrightString = "Copyright 2007-2022 Konstantin Nosov (Gildor). All rights reserved."; 10 | const char* GLicenseString = "Licensed under the MIT License, see LICENSE.txt for more information."; 11 | -------------------------------------------------------------------------------- /UmodelTool/MiscStrings.h: -------------------------------------------------------------------------------- 1 | #ifndef __MISC_STRINGS_H__ 2 | #define __MISC_STRINGS_H__ 3 | 4 | extern const char* GUmodelHomepage; 5 | 6 | extern const char* GBuildString; 7 | extern const char* GCopyrightString; 8 | extern const char* GLicenseString; 9 | 10 | #endif // __MISC_STRINGS_H__ 11 | -------------------------------------------------------------------------------- /UmodelTool/PackageDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef __PACKAGE_DIALOG_H__ 2 | #define __PACKAGE_DIALOG_H__ 3 | 4 | class UIPackageList; 5 | 6 | class UIPackageDialog : public UIBaseDialog 7 | { 8 | public: 9 | UIPackageDialog(); 10 | 11 | typedef TArray PackageList; 12 | 13 | enum EResult 14 | { 15 | OPEN, 16 | APPEND, 17 | EXPORT, 18 | CANCEL, 19 | }; 20 | 21 | EResult Show(); 22 | void SelectPackage(UnPackage* package); 23 | 24 | PackageList SelectedPackages; 25 | 26 | protected: 27 | UIPageControl* FlatViewPager; 28 | UITreeView* PackageTree; 29 | UIPackageList* PackageListbox; 30 | UIPackageList* FlatPackageList; 31 | UIMenuButton* OpenButton; 32 | UIButton* ExportButton; 33 | UIMenuItem* ScanContentMenu; 34 | UIMenuItem* SavePackagesMenu; 35 | UIMenu* TreeMenu; 36 | UIMenu* ListMenu; 37 | 38 | EResult ModalResult; 39 | bool UseFlatView; 40 | bool DirectorySelected; 41 | bool ContentScanned; 42 | // when true, CloseDialog will not reevaluate SelectedPackages 43 | bool DontGetSelectedPackages; 44 | FStaticString<64> PackageFilter; 45 | FStaticString<256> SelectedDir; 46 | 47 | int SortedColumn; 48 | bool ReverseSort; 49 | 50 | PackageList Packages; 51 | 52 | void CloseDialog(EResult Result, bool bDontGetSelectedPackages = false); 53 | 54 | void OnBeforeListMenuPopup(); 55 | void OnTreeItemSelected(UITreeView* sender, const char* text); 56 | void OnPackageSelected(UIMulticolumnListbox* sender); 57 | void OnFlatViewChanged(UICheckbox* sender, bool value); 58 | void OnPackageDblClick(UIMulticolumnListbox* sender, int value); 59 | void OnColumnClick(UIMulticolumnListbox* sender, int column); 60 | void OnOpenFolderClicked(); 61 | void OnOpenAppendFolderClicked(); 62 | void OnExportFolderClicked(); 63 | void OnFilterTextChanged(UITextEdit* sender, const char* text); 64 | 65 | bool ScanContent(const PackageList& packageList); 66 | void SavePackages(); 67 | void SaveFolderPackages(); 68 | void CopyPackagePaths(); 69 | 70 | void UpdateSelectedPackages(); 71 | void GetPackagesForSelectedFolder(PackageList& OutPackages); 72 | void RefreshPackageListbox(); 73 | 74 | // Package sort stuff 75 | void SortPackages(); 76 | // Sort helpers 77 | static void SortPackages(PackageList& List, int Column, bool Reverse); 78 | void UpdateUIAfterSort(); 79 | 80 | UIPackageList& CreatePackageListControl(bool StripPath); 81 | 82 | virtual void InitUI(); 83 | }; 84 | 85 | #endif // __PACKAGE_DIALOG_H__ 86 | -------------------------------------------------------------------------------- /UmodelTool/PackageScanDialog.cpp: -------------------------------------------------------------------------------- 1 | #if HAS_UI 2 | 3 | #include "BaseDialog.h" 4 | #include "ProgressDialog.h" 5 | 6 | class UIPackageScanDialog : public UIBaseDialog 7 | { 8 | public: 9 | void Show() 10 | { 11 | SetResizeable(); 12 | 13 | UIProgressDialog progress; 14 | progress.Show("Scanning packages"); 15 | progress.SetDescription("Scanning package"); 16 | 17 | bool done = ScanPackageVersions(PkgInfo, &progress); 18 | progress.CloseDialog(); 19 | 20 | if (done) 21 | ShowModal("Package version report", 475, 370); 22 | } 23 | 24 | virtual void InitUI() 25 | { 26 | UIMulticolumnListbox* listbox; 27 | 28 | // Create controls 29 | (*this) 30 | [ 31 | NewControl(UIMulticolumnListbox, 4) 32 | .SetHeight(-1) 33 | .Expose(listbox) 34 | .AddColumn("Ver", 60) 35 | .AddColumn("Lic", 60) 36 | .AddColumn("Count", 60) 37 | .AddColumn("Path") 38 | + NewControl(UIGroup, GROUP_HORIZONTAL_LAYOUT|GROUP_NO_BORDER) 39 | [ 40 | NewControl(UISpacer, -1) 41 | + NewControl(UIButton, "Copy") 42 | .SetWidth(80) 43 | .SetCallback(BIND_MEMBER(&UIPackageScanDialog::CopyToClipboard, this)) 44 | + NewControl(UIButton, "Close") 45 | .SetWidth(80) 46 | .SetOK() 47 | + NewControl(UISpacer, -1) 48 | ] 49 | ]; 50 | 51 | // Fill package information 52 | for (const FileInfo& Info : PkgInfo) 53 | { 54 | char buf[128]; 55 | 56 | appSprintf(ARRAY_ARG(buf), "%d (%X)", Info.Ver, Info.Ver); 57 | int index = listbox->AddItem(buf); 58 | 59 | appSprintf(ARRAY_ARG(buf), "%d (%X)", Info.LicVer, Info.LicVer); 60 | listbox->AddSubItem(index, 1, buf); 61 | 62 | appSprintf(ARRAY_ARG(buf), "%d", Info.Count); 63 | listbox->AddSubItem(index, 2, buf); 64 | 65 | appSprintf(ARRAY_ARG(buf), "%s%s", Info.FileName, (Info.Count > 1) ? "..." : ""); 66 | listbox->AddSubItem(index, 3, buf); 67 | } 68 | } 69 | 70 | protected: 71 | void CopyToClipboard() 72 | { 73 | FStaticString<1024> Report; 74 | for (const FileInfo& Info : PkgInfo) 75 | { 76 | char buf[256]; 77 | appSprintf(ARRAY_ARG(buf), "%3d (%3X) %3d (%3X) %4d %s%s\n", 78 | Info.Ver, Info.Ver, Info.LicVer, Info.LicVer, Info.Count, Info.FileName, 79 | Info.Count > 1 && Info.FileName[0] ? "..." : ""); 80 | Report += buf; 81 | } 82 | appCopyTextToClipboard(*Report); 83 | } 84 | 85 | TArray PkgInfo; 86 | }; 87 | 88 | 89 | void ShowPackageScanDialog() 90 | { 91 | UIPackageScanDialog dialog; 92 | dialog.Show(); 93 | } 94 | 95 | #endif // HAS_UI 96 | -------------------------------------------------------------------------------- /UmodelTool/PackageScanDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef __PACKAGE_SCAN_DIALOG_H__ 2 | #define __PACKAGE_SCAN_DIALOG_H__ 3 | 4 | 5 | void ShowPackageScanDialog(); 6 | 7 | 8 | #endif // __PACKAGE_SCAN_DIALOG_H__ 9 | -------------------------------------------------------------------------------- /UmodelTool/ProgressDialog.cpp: -------------------------------------------------------------------------------- 1 | #if HAS_UI 2 | 3 | #include "BaseDialog.h" 4 | #include "ProgressDialog.h" 5 | #include "UnObject.h" 6 | 7 | 8 | //!! Other possible statistics: 9 | //!! - elapsed time 10 | 11 | void UIProgressDialog::Show(const char* title) 12 | { 13 | CloseOnEsc(); 14 | ShowDialog(title, 375, -1); 15 | BeginModal(); 16 | 17 | lastTick = 0; 18 | } 19 | 20 | void UIProgressDialog::SetDescription(const char* text) 21 | { 22 | DescriptionText = text; 23 | } 24 | 25 | bool UIProgressDialog::Progress(const char* package, int index, int total) 26 | { 27 | // do not update UI too often 28 | int tick = appMilliseconds(); 29 | if (tick - lastTick < 50) 30 | return true; 31 | lastTick = tick; 32 | 33 | char buffer[512]; 34 | appSprintf(ARRAY_ARG(buffer), "%s %d/%d", DescriptionText, index+1, total); 35 | DescriptionLabel->SetText(buffer); 36 | 37 | PackageLabel->SetText(package); 38 | 39 | ProgressBar->SetValue((float)(index+1) / total); 40 | 41 | return Tick(); 42 | } 43 | 44 | bool UIProgressDialog::Tick() 45 | { 46 | char buffer[64]; 47 | appSprintf(ARRAY_ARG(buffer), "%d MBytes", (int)(GTotalAllocationSize >> 20)); 48 | MemoryLabel->SetText(buffer); 49 | appSprintf(ARRAY_ARG(buffer), "%d", UObject::GObjObjects.Num()); 50 | ObjectsLabel->SetText(buffer); 51 | return PumpMessages(); 52 | } 53 | 54 | void UIProgressDialog::InitUI() 55 | { 56 | (*this) 57 | [ 58 | NewControl(UIGroup) 59 | [ 60 | NewControl(UILabel, "") 61 | .Expose(DescriptionLabel) 62 | + NewControl(UISpacer) 63 | + NewControl(UILabel, "") 64 | .Expose(PackageLabel) 65 | + NewControl(UIProgressBar) 66 | .Expose(ProgressBar) 67 | ] 68 | + NewControl(UIGroup) 69 | [ 70 | NewControl(UIGroup, GROUP_HORIZONTAL_LAYOUT|GROUP_NO_BORDER) 71 | [ 72 | NewControl(UILabel, "Memory used:", TA_Right) 73 | + NewControl(UISpacer) 74 | + NewControl(UILabel, "") 75 | .Expose(MemoryLabel) 76 | ] 77 | + NewControl(UIGroup, GROUP_HORIZONTAL_LAYOUT|GROUP_NO_BORDER) 78 | [ 79 | NewControl(UILabel, "Objects loaded:", TA_Right) 80 | + NewControl(UISpacer) 81 | + NewControl(UILabel, "") 82 | .Expose(ObjectsLabel) 83 | ] 84 | ] 85 | + NewControl(UIGroup, GROUP_HORIZONTAL_LAYOUT|GROUP_NO_BORDER) 86 | [ 87 | NewControl(UISpacer, -1) 88 | + NewControl(UIButton, "Cancel") 89 | .SetWidth(100) 90 | .SetCancel() 91 | + NewControl(UISpacer, -1) 92 | ] 93 | ]; 94 | } 95 | 96 | #endif // HAS_UI 97 | -------------------------------------------------------------------------------- /UmodelTool/ProgressDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef __PROGRESS_DIALOG_H__ 2 | #define __PROGRESS_DIALOG_H__ 3 | 4 | #include "UnrealPackage/PackageUtils.h" // for IProgressCallback 5 | 6 | class UIProgressDialog : public UIBaseDialog, public IProgressCallback 7 | { 8 | public: 9 | void Show(const char* title); 10 | void SetDescription(const char* text); 11 | // IProgressCallback 12 | virtual bool Progress(const char* package, int index, int total); 13 | virtual bool Tick(); 14 | 15 | protected: 16 | const char* DescriptionText; 17 | UILabel* DescriptionLabel; 18 | UILabel* PackageLabel; 19 | UILabel* MemoryLabel; 20 | UILabel* ObjectsLabel; 21 | UIProgressBar* ProgressBar; 22 | 23 | int lastTick; 24 | 25 | virtual void InitUI(); 26 | }; 27 | 28 | 29 | #endif // __PROGRESS_DIALOG_H__ 30 | -------------------------------------------------------------------------------- /UmodelTool/SettingsDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef __SETTINGS_DIALOG_H__ 2 | #define __SETTINGS_DIALOG_H__ 3 | 4 | #include "UmodelSettings.h" 5 | 6 | class UISettingsDialog : public UIBaseDialog 7 | { 8 | public: 9 | enum OptionsKind 10 | { 11 | OPT_Full, 12 | OPT_Export, 13 | OPT_Save, 14 | }; 15 | 16 | UISettingsDialog(CUmodelSettings& settings, OptionsKind kind = OPT_Full); 17 | 18 | bool Show(); 19 | 20 | static bool ShowExportOptions(CUmodelSettings& settings) 21 | { 22 | if (!settings.bShowExportOptions) 23 | return true; 24 | UISettingsDialog dialog(settings, OPT_Export); 25 | return dialog.Show(); 26 | } 27 | 28 | static bool ShowSavePackagesOptions(CUmodelSettings& settings) 29 | { 30 | if (!settings.bShowSaveOptions) 31 | return true; 32 | UISettingsDialog dialog(settings, OPT_Save); 33 | return dialog.Show(); 34 | } 35 | 36 | protected: 37 | OptionsKind Kind; 38 | CUmodelSettings* OptRef; 39 | CUmodelSettings Opt; 40 | 41 | virtual void InitUI(); 42 | 43 | UIElement& MakeExportOptions(); 44 | UIElement& MakeSavePackagesOptions(); 45 | UIElement& MakeUIOptions(); 46 | }; 47 | 48 | #endif // __SETTINGS_DIALOG_H__ 49 | -------------------------------------------------------------------------------- /UmodelTool/StartupDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef __STARTUP_DIALOG_H__ 2 | #define __STARTUP_DIALOG_H__ 3 | 4 | #include "UmodelSettings.h" 5 | 6 | class UIStartupDialog : public UIBaseDialog 7 | { 8 | public: 9 | UIStartupDialog(CStartupSettings& settings); 10 | 11 | bool Show(); 12 | 13 | protected: 14 | CStartupSettings& Opt; 15 | 16 | UICheckboxGroup* OverrideGameGroup; 17 | UICombobox* OverrideEngineCombo; 18 | UICombobox* OverrideGameCombo; 19 | 20 | void FillGameList(); 21 | 22 | virtual void InitUI(); 23 | }; 24 | 25 | #endif // __STARTUP_DIALOG_H__ 26 | -------------------------------------------------------------------------------- /UmodelTool/UE4AesKeyDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef __UE4_AES_KEY_DIALOG_H__ 2 | #define __UE4_AES_KEY_DIALOG_H__ 3 | 4 | #if UNREAL4 5 | 6 | class UIUE4AesKeyDialog : public UIBaseDialog 7 | { 8 | public: 9 | bool Show(TArray& Values) 10 | { 11 | SetResizeable(); 12 | if (!ShowModal("Please enter AES encryption key", 530, 200)) 13 | return ""; 14 | 15 | if (Value.IsEmpty()) 16 | { 17 | return false; 18 | } 19 | 20 | // Separate multiple AES keys to FString's 21 | const char* Begin = &Value[0]; 22 | int Len = Value.Len() + 1; // include null character for simpler loop below 23 | for (int i = 0; i < Len; i++) 24 | { 25 | const char* s = &Value[i]; 26 | char c = *s; 27 | if (c == '\n' || c == 0) 28 | { 29 | int len = s - Begin; 30 | if (len) 31 | { 32 | FStaticString<256> Code(len, Begin); 33 | Code.TrimStartAndEndInline(); 34 | if (Code.Len()) Values.Add(Code); 35 | } 36 | Begin = s + 1; 37 | } 38 | } 39 | 40 | return true; 41 | } 42 | 43 | void InitUI() 44 | { 45 | (*this) 46 | [ 47 | NewControl(UIGroup, GROUP_NO_BORDER|GROUP_HORIZONTAL_LAYOUT) 48 | .SetWidth(EncodeWidth(1.0f)) 49 | .SetHeight(EncodeWidth(1.0f)) // allow vertical resize of contents 50 | [ 51 | NewControl(UIBitmap) 52 | .SetWidth(48) 53 | .SetHeight(48) 54 | .SetResourceIcon(UIBitmap::BI_Warning) 55 | + NewControl(UISpacer, 8) 56 | +NewControl(UIGroup, GROUP_NO_BORDER) 57 | .SetWidth(EncodeWidth(1.0f)) 58 | [ 59 | NewControl(UILabel, "UE Viewer has found an encrypted UE4 pak file. In order to work correctly").SetAutoSize() 60 | +NewControl(UILabel, "please specify an AES encryption key which is used for this game.").SetAutoSize() 61 | +NewControl(UILabel, "Multiple AES keys could be entered, each key on the new line").SetAutoSize() 62 | +NewControl(UISpacer) 63 | +NewControl(UITextEdit, &Value) 64 | .SetHeight(-1) 65 | .SetMultiline(true) 66 | +NewControl(UISpacer) 67 | +NewControl(UIGroup, GROUP_NO_BORDER|GROUP_HORIZONTAL_LAYOUT) 68 | [ 69 | NewControl(UISpacer, -1) 70 | +NewControl(UIButton, "Ok") 71 | .SetWidth(80) 72 | .SetOK() 73 | +NewControl(UIButton, "Cancel") 74 | .SetWidth(80) 75 | .SetCancel() 76 | ] 77 | ] 78 | ] 79 | ]; 80 | } 81 | 82 | FString Value; 83 | // UIButton* OkButton; 84 | }; 85 | 86 | #endif // UNREAL4 87 | 88 | #endif // __UE4_AES_KEY_DIALOG_H__ 89 | -------------------------------------------------------------------------------- /UmodelTool/UE4VersionDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef __UE4_VERSION_DIALOG_H__ 2 | #define __UE4_VERSION_DIALOG_H__ 3 | 4 | #if UNREAL4 5 | 6 | class UIUE4VersionDialog : public UIBaseDialog 7 | { 8 | public: 9 | int Show(int verMin, int verMax) 10 | { 11 | VersionMin = verMin; 12 | VersionMax = verMax; 13 | 14 | if (!ShowModal("Unreal engine 4 version", -1, -1)) 15 | return -1; 16 | 17 | int selection = SelectVersionCombo->GetSelectionIndex(); 18 | return selection >= 0 ? selection + VersionMin : -1; 19 | } 20 | 21 | void InitUI() 22 | { 23 | (*this) 24 | [ 25 | NewControl(UIGroup, GROUP_NO_BORDER|GROUP_HORIZONTAL_LAYOUT) 26 | .SetWidth(EncodeWidth(1.0f)) 27 | [ 28 | NewControl(UIBitmap) 29 | .SetWidth(48) 30 | .SetHeight(48) 31 | .SetResourceIcon(UIBitmap::BI_Question) 32 | + NewControl(UISpacer, 8) 33 | +NewControl(UIGroup, GROUP_NO_BORDER) 34 | .SetWidth(EncodeWidth(1.0f)) 35 | [ 36 | NewControl(UILabel, "UE Viewer has found an unversioned UE4 package. In order to").SetAutoSize() 37 | +NewControl(UILabel, "work correctly please specify which Unreal engine 4 version").SetAutoSize() 38 | +NewControl(UILabel, "is used for this game.").SetAutoSize() 39 | +NewControl(UISpacer) 40 | +NewControl(UICombobox) 41 | .SetCallback(BIND_MEMBER(&UIUE4VersionDialog::EngineSelected, this)) 42 | // .SetCallback(BIND_LAMBDA([this]() { OkButton->Enable(true); })) -- error in VS2013 43 | .Expose(SelectVersionCombo) 44 | +NewControl(UISpacer) 45 | +NewControl(UIGroup, GROUP_NO_BORDER|GROUP_HORIZONTAL_LAYOUT) 46 | [ 47 | NewControl(UISpacer, -1) 48 | +NewControl(UIButton, "Ok") 49 | .SetWidth(80) 50 | .SetOK() 51 | .Enable(false) 52 | .Expose(OkButton) 53 | +NewControl(UIButton, "Cancel") 54 | .SetWidth(80) 55 | .SetCancel() 56 | ] 57 | ] 58 | ] 59 | ]; 60 | 61 | // Fill versions list 62 | for (int ver = VersionMin; ver <= VersionMax; ver++) 63 | { 64 | char buffer[64]; 65 | appSprintf(ARRAY_ARG(buffer), "Unreal engine 4.%d", ver); 66 | SelectVersionCombo->AddItem(buffer); 67 | } 68 | } 69 | 70 | void EngineSelected() 71 | { 72 | OkButton->Enable(true); 73 | } 74 | 75 | int VersionMin; 76 | int VersionMax; 77 | 78 | UICombobox* SelectVersionCombo; 79 | UIButton* OkButton; 80 | }; 81 | 82 | #endif // UNREAL4 83 | 84 | #endif // __UE4_VERSION_DIALOG_H__ 85 | -------------------------------------------------------------------------------- /UmodelTool/UmodelCommands.h: -------------------------------------------------------------------------------- 1 | #ifndef __UMODEL_COMMANDS_H__ 2 | #define __UMODEL_COMMANDS_H__ 3 | 4 | class UnPackage; 5 | class IProgressCallback; 6 | 7 | // Export all loaded objects. 8 | bool ExportObjects(const TArray *Objects, IProgressCallback* progress = NULL); 9 | 10 | // Export everything from provided package list. 11 | bool ExportPackages(const TArray& Packages, IProgressCallback* Progress = NULL); 12 | 13 | void DisplayPackageStats(const TArray &Packages); 14 | 15 | void SavePackages(const TArray& Packages, IProgressCallback* Progress = NULL); 16 | 17 | #endif // __UMODEL_COMMANDS_H__ 18 | -------------------------------------------------------------------------------- /UmodelTool/res/resource.h: -------------------------------------------------------------------------------- 1 | #define IDC_MAIN_ICON 200 2 | -------------------------------------------------------------------------------- /UmodelTool/res/umodel.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/UmodelTool/res/umodel.ico -------------------------------------------------------------------------------- /UmodelTool/res/umodel.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | wxWindows application 10 | 11 | 12 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /UmodelTool/res/umodel.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "resource.h" 3 | 4 | // Enable themes for GUI elements 5 | // http://www.angelfire.com/hi5/delphizeus/theme_xp.html 6 | #ifndef _WIN64 7 | 1 RT_MANIFEST "umodel.manifest" 8 | #else 9 | 1 RT_MANIFEST "umodel64.manifest" 10 | #endif 11 | 12 | IDC_MAIN_ICON ICON "umodel.ico" 13 | -------------------------------------------------------------------------------- /UmodelTool/res/umodel64.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | wxWindows application 10 | 11 | 12 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /UmodelTool/umodel.project: -------------------------------------------------------------------------------- 1 | # perl highlighting 2 | 3 | R = . 4 | PRJ = umodel 5 | !include common.project 6 | 7 | UMODEL=UmodelTool 8 | 9 | INCLUDES += $UMODEL UI 10 | 11 | !if "$PLATFORM" eq "win32" || "$PLATFORM" eq "win64" 12 | IS_WINDOWS = 1 13 | !else 14 | IS_WINDOWS = 0 15 | !endif 16 | 17 | # Allow GUI for Windows platform 18 | !if "$IS_WINDOWS" eq "1" 19 | DEFINES += HAS_UI=1 20 | !endif 21 | 22 | sources(MAIN) = { 23 | Exporters/*.cpp 24 | Unreal/*.cpp 25 | Unreal/FileSystem/*.cpp 26 | Unreal/GameSpecific/*.cpp 27 | Unreal/Mesh/*.cpp 28 | Unreal/UnrealMaterial/*.cpp 29 | Unreal/UnrealMesh/*.cpp 30 | Unreal/UnrealPackage/*.cpp 31 | Unreal/Wrappers/*.cpp 32 | Viewers/*.cpp 33 | MeshInstance/*.cpp 34 | Core/*.cpp 35 | $UMODEL/*.cpp 36 | !if "$IS_WINDOWS" eq "1" 37 | UI/*.cpp 38 | $UMODEL/res/umodel.rc 39 | !endif 40 | } 41 | 42 | !if !defined(EXE_NAME) 43 | EXE_NAME = $PRJ 44 | !message NO EXE_NAME 45 | !endif 46 | 47 | target(executable, $EXE_NAME, MAIN + COMP_LIBS + UE4_LIBS + IMG_LIBS + NV_LIBS + MOBILE_LIBS, MAIN) 48 | -------------------------------------------------------------------------------- /Unreal/FileSystem/FileSystemUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "Core.h" 2 | #include "UnCore.h" 3 | 4 | 5 | void ValidateMountPoint(FString& MountPoint, const FString& ContextFilename) 6 | { 7 | bool badMountPoint = false; 8 | if (!MountPoint.RemoveFromStart("../../..")) 9 | badMountPoint = true; 10 | if (MountPoint[0] != '/' || ( (MountPoint.Len() > 1) && (MountPoint[1] == '.') )) 11 | badMountPoint = true; 12 | 13 | if (badMountPoint) 14 | { 15 | appPrintf("WARNING: \"%s\" has strange mount point \"%s\", mounting to root\n", *ContextFilename, *MountPoint); 16 | MountPoint = "/"; 17 | } 18 | } 19 | 20 | void CompactFilePath(FString& Path) 21 | { 22 | guard(CompactFilePath); 23 | 24 | if (Path.StartsWith("/Engine/Content")) // -> /Engine 25 | { 26 | Path.RemoveAt(7, 8); 27 | return; 28 | } 29 | if (Path.StartsWith("/Engine/Plugins")) // -> /Plugins 30 | { 31 | Path.RemoveAt(0, 7); 32 | return; 33 | } 34 | 35 | if (Path[0] != '/') 36 | return; 37 | 38 | char* delim = strchr(&Path[1], '/'); 39 | if (!delim) 40 | return; 41 | if (strncmp(delim, "/Content/", 9) != 0) 42 | return; 43 | 44 | int pos = delim - &Path[0]; 45 | if (pos > 4) 46 | { 47 | // /GameName/Content -> /Game 48 | int toRemove = pos + 8 - 5; 49 | Path.RemoveAt(5, toRemove); 50 | memcpy(&Path[1], "Game", 4); 51 | } 52 | 53 | unguard; 54 | } 55 | 56 | int32 StringToCompressionMethod(const char* Name) 57 | { 58 | if (!stricmp(Name, "zlib")) 59 | { 60 | return COMPRESS_ZLIB; 61 | } 62 | else if (!stricmp(Name, "oodle")) 63 | { 64 | return COMPRESS_OODLE; 65 | } 66 | else if (!stricmp(Name, "lz4")) 67 | { 68 | return COMPRESS_LZ4; 69 | } 70 | else if (Name[0]) 71 | { 72 | appPrintf("Warning: unknown compression method name: %s\n", Name); 73 | return COMPRESS_FIND; 74 | } 75 | return 0; 76 | } 77 | 78 | #if UNREAL4 79 | 80 | bool FileRequiresAesKey(bool fatal) 81 | { 82 | if ((GAesKeys.Num() == 0) && !UE4EncryptedPak()) 83 | { 84 | if (fatal) 85 | appErrorNoLog("AES key is required"); 86 | return false; 87 | } 88 | return true; 89 | } 90 | 91 | #endif // UNREAL4 92 | -------------------------------------------------------------------------------- /Unreal/FileSystem/FileSystemUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef __FILE_SYSTEM_UTILS_H__ 2 | #define __FILE_SYSTEM_UTILS_H__ 3 | 4 | void ValidateMountPoint(FString& MountPoint, const FString& ContextFilename); 5 | 6 | void CompactFilePath(FString& Path); 7 | 8 | int32 StringToCompressionMethod(const char* Name); 9 | 10 | bool FileRequiresAesKey(bool fatal = true); 11 | 12 | #endif // __FILE_SYSTEM_UTILS_H__ 13 | -------------------------------------------------------------------------------- /Unreal/FileSystem/GameFileSystem.h: -------------------------------------------------------------------------------- 1 | #ifndef __GAME_FILE_SYSTEM_H__ 2 | #define __GAME_FILE_SYSTEM_H__ 3 | 4 | struct CRegisterFileInfo 5 | { 6 | const char* Filename; 7 | const char* Path; //todo: probably using `FolderIndex`, so 'Path' could be removed? 8 | int64 Size; 9 | uint8 Flags; // CGameFileInfo::GFI_... 10 | int IndexInArchive; 11 | int FolderIndex; 12 | 13 | CRegisterFileInfo() 14 | : Filename(NULL) 15 | , Path(NULL) 16 | , Size(0) 17 | , Flags(CGameFileInfo::GFI_None) 18 | , IndexInArchive(-1) 19 | , FolderIndex(0) 20 | {} 21 | }; 22 | 23 | class FVirtualFileSystem 24 | { 25 | public: 26 | virtual ~FVirtualFileSystem() 27 | {} 28 | 29 | // Attach FArchive which will be used for reading VFS content. This function should scan 30 | // VFS directory. If function failed, it should return false and optionally fill error string. 31 | virtual bool AttachReader(FArchive* reader, FString& error) = 0; 32 | // Open a file from VFS. 33 | virtual FArchive* CreateReader(int index) = 0; 34 | 35 | // Reserve space for 'count' files 36 | void Reserve(int count); 37 | 38 | FORCEINLINE CGameFileInfo* RegisterFile(CRegisterFileInfo& info) 39 | { 40 | assert(info.IndexInArchive >= 0); 41 | return CGameFileInfo::Register(this, info); 42 | } 43 | }; 44 | 45 | int RegisterGameFolder(const char* FolderName); 46 | 47 | #endif // __GAME_FILE_SYSTEM_H__ 48 | -------------------------------------------------------------------------------- /Unreal/GameDatabase.h: -------------------------------------------------------------------------------- 1 | #ifndef __GAME_LIST_H__ 2 | #define __GAME_LIST_H__ 3 | 4 | struct GameInfo 5 | { 6 | const char *Name; 7 | const char *Switch; 8 | int Enum; 9 | }; 10 | 11 | extern const GameInfo GListOfGames[]; 12 | 13 | 14 | const char *GetEngineName(int Game); 15 | void PrintGameList(bool tags = false); 16 | 17 | int FindGameTag(const char *name); 18 | // Reverse operation for FindGameTag() 19 | const char* GetGameTag(int gameEnum); 20 | 21 | 22 | #endif // __GAME_LIST_H__ 23 | -------------------------------------------------------------------------------- /Unreal/GameSpecific/UnUbisoft.h: -------------------------------------------------------------------------------- 1 | #ifndef __UNUBISOFT_H__ 2 | #define __UNUBISOFT_H__ 3 | 4 | 5 | #if LEAD 6 | 7 | 8 | class FLeadUmdFile; 9 | 10 | 11 | FArchive* CreateUMDReader(FArchive *File); 12 | bool ExtractUMDArchive(FArchive *UmdFile, const char *OutDir); 13 | void SaveUMDArchive(FArchive *UmdFile, const char *OutName); 14 | 15 | 16 | #endif // LEAD 17 | 18 | #endif // __UNUBISOFT_H__ 19 | -------------------------------------------------------------------------------- /Unreal/Mesh/StaticMesh.h: -------------------------------------------------------------------------------- 1 | #ifndef __STATIC_MESH_H__ 2 | #define __STATIC_MESH_H__ 3 | 4 | #include "MeshCommon.h" 5 | 6 | /*----------------------------------------------------------------------------- 7 | Local StaticMesh class, encapsulated all UE versions 8 | -----------------------------------------------------------------------------*/ 9 | 10 | struct CStaticMeshVertex : public CMeshVertex 11 | { 12 | // everything is from the CMeshVertex 13 | }; 14 | 15 | 16 | struct CStaticMeshLod : public CBaseMeshLod 17 | { 18 | CStaticMeshVertex *Verts; 19 | 20 | CStaticMeshLod() 21 | : Verts(NULL) 22 | {} 23 | 24 | ~CStaticMeshLod() 25 | { 26 | if (Verts) appFree(Verts); 27 | } 28 | 29 | void BuildNormals() 30 | { 31 | if (HasNormals) return; 32 | BuildNormalsCommon(Verts, sizeof(CStaticMeshVertex), NumVerts, Indices); 33 | HasNormals = true; 34 | } 35 | 36 | void BuildTangents() 37 | { 38 | if (HasTangents) return; 39 | BuildTangentsCommon(Verts, sizeof(CStaticMeshVertex), Indices); 40 | HasTangents = true; 41 | } 42 | 43 | void AllocateVerts(int Count) 44 | { 45 | guard(CStaticMeshLod::AllocateVerts); 46 | assert(Verts == NULL); 47 | Verts = (CStaticMeshVertex*)appMalloc(sizeof(CStaticMeshVertex) * Count, 16); // alignment for SSE 48 | NumVerts = Count; 49 | AllocateUVBuffers(); 50 | unguard; 51 | } 52 | 53 | #if DECLARE_VIEWER_PROPS 54 | DECLARE_STRUCT(CStaticMeshLod) 55 | BEGIN_PROP_TABLE 56 | PROP_ARRAY(Sections, "CMeshSection") 57 | PROP_INT(NumVerts) 58 | VPROP_ARRAY_COUNT(Indices.Indices16, IndexCount) 59 | PROP_INT(NumTexCoords) 60 | END_PROP_TABLE 61 | #endif // DECLARE_VIEWER_PROPS 62 | }; 63 | 64 | 65 | class CStaticMesh 66 | { 67 | public: 68 | UObject *OriginalMesh; //?? make common for all mesh classes 69 | FBox BoundingBox; //?? common 70 | FSphere BoundingSphere; //?? common 71 | TArray Lods; 72 | 73 | CStaticMesh(UObject *Original) 74 | : OriginalMesh(Original) 75 | {} 76 | 77 | void FinalizeMesh() 78 | { 79 | for (int i = 0; i < Lods.Num(); i++) 80 | Lods[i].BuildNormals(); 81 | } 82 | 83 | #if RENDERING 84 | void LockMaterials() 85 | { 86 | for (int i = 0; i < Lods.Num(); i++) 87 | Lods[i].LockMaterials(); 88 | } 89 | 90 | void UnlockMaterials() 91 | { 92 | for (int i = 0; i < Lods.Num(); i++) 93 | Lods[i].UnlockMaterials(); 94 | } 95 | #endif 96 | 97 | #if DECLARE_VIEWER_PROPS 98 | DECLARE_STRUCT(CStaticMesh) 99 | BEGIN_PROP_TABLE 100 | PROP_ARRAY(Lods, "CStaticMeshLod") 101 | VPROP_ARRAY_COUNT(Lods, LodCount) 102 | END_PROP_TABLE 103 | private: 104 | CStaticMesh() // for InternalConstructor() 105 | {} 106 | #endif // DECLARE_VIEWER_PROPS 107 | }; 108 | 109 | 110 | #define REGISTER_STATICMESH_VCLASSES \ 111 | REGISTER_CLASS(CStaticMeshLod) 112 | 113 | 114 | #endif // __STATIC_MESH_H__ 115 | -------------------------------------------------------------------------------- /Unreal/Shaders/BloomBlend.ush: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * This shader blends blurred picture into the frame buffer 3 | *****************************************************************************/ 4 | 5 | // debug: visualize depth buffer in some fog-like manner 6 | //#define SHOW_DEPTH 7 | 8 | uniform sampler2D BlurTex; 9 | uniform sampler2D OrigTex; 10 | uniform sampler2D DepthTex; 11 | 12 | void VertexShaderMain() 13 | { 14 | gl_TexCoord[0] = gl_MultiTexCoord0; 15 | gl_Position = ftransform(); 16 | } 17 | 18 | #define BLOOM_SCALE 4.0 19 | 20 | void PixelShaderMain() 21 | { 22 | vec2 TexCoord = gl_TexCoord[0].st; 23 | vec4 Blur = texture2D(BlurTex, TexCoord); 24 | vec3 Orig = texture2D(OrigTex, TexCoord).rgb; 25 | vec4 c; 26 | // c = vec4(vec3(Blur.a) * BLOOM_SCALE, 1.0); // show Blur.a 27 | // c = vec4(Blur * 1.0 + Orig * 1.0, 1.0); //?? different formula 28 | // c = vec4(Blur * -9.0 + Orig * 10.0, 1.0); // interesting effect (sharp image) ... 29 | // c = vec4(Blur * 0.5 + Orig * 0.5, 1.0); 30 | // c = vec4(Blur + Orig, 1.0); // combine both with weights = 1 31 | c = vec4(Orig + Blur.rgb * Blur.a * BLOOM_SCALE, 1.0); 32 | // c = vec4(Blur * 1.0, 1.0); // blur only 33 | // c = vec4(Orig, 1.0); // unblurred image only 34 | 35 | gl_FragColor = c; 36 | 37 | // copy depth 38 | float f = texture2D(DepthTex, TexCoord).r; 39 | gl_FragDepth = f; 40 | 41 | #ifdef SHOW_DEPTH 42 | f = 2.0 / (1000.0 - f * 1000.0); 43 | gl_FragColor = vec4(f, f, f, 1.0); 44 | #endif 45 | } 46 | -------------------------------------------------------------------------------- /Unreal/Shaders/BloomGather.ush: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * This shader collects HDR data for bloom passes 3 | *****************************************************************************/ 4 | 5 | uniform sampler2D tex; 6 | 7 | void VertexShaderMain() 8 | { 9 | gl_TexCoord[0] = gl_MultiTexCoord0; 10 | gl_Position = ftransform(); 11 | } 12 | 13 | 14 | void PixelShaderMain() 15 | { 16 | vec3 c; 17 | vec2 TexCoord = gl_TexCoord[0].st; 18 | c = texture2D(tex, TexCoord).rgb; 19 | float m = max(c.r, c.g); 20 | m = max(m, c.b); 21 | #if 0 22 | if (m <= 1.0) m = 0.0;//c = vec3(0.0); 23 | c *= 0.5; 24 | #else 25 | m = max(m - 1.5, 0.0); // note: it looks like alpha in FP-tagret is always limited by 1.0, so scale it in "BloomBlend" shader 26 | #endif 27 | gl_FragColor = vec4(c, m); 28 | } 29 | -------------------------------------------------------------------------------- /Unreal/Shaders/BloomPass.ush: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * This shader performs single bloom pass 3 | *****************************************************************************/ 4 | 5 | uniform sampler2D Tex; 6 | uniform vec2 Step; 7 | 8 | void VertexShaderMain() 9 | { 10 | gl_TexCoord[0] = gl_MultiTexCoord0; 11 | gl_Position = ftransform(); 12 | } 13 | 14 | /* 15 | * Using idea from these pages: 16 | * http://prideout.net/bloom/index.php 17 | * http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ 18 | * Single sample (texture2D call) will take 2 texels with different weights: weights are 19 | * controlled by OF# and W# parameters 20 | * 21 | * When OF# is 0.5, 1.5, .... N.5 - neighbour texels are taken with identical weights, 22 | * when OF# is 0.0, 1.0, 2.0 ... N.0 - only single texel is sampled. 23 | */ 24 | 25 | /* 26 | // All points has the same weight 27 | #define W0 1.0 28 | #define W1 2.0 29 | #define W2 2.0 30 | #define W3 2.0 31 | 32 | #define OF1 1.5 33 | #define OF2 3.5 34 | #define OF3 5.5 35 | */ 36 | 37 | // Gauss-like distribution 38 | #define W0 6.0 39 | #define W1 10.8 40 | #define W2 6.4 41 | #define W3 2.2 42 | 43 | #define OF1 1.47 44 | #define OF2 3.35 45 | #define OF3 5.32 46 | 47 | 48 | #define W_SUM W0+2.0*(W1+W2+W3) 49 | 50 | void PixelShaderMain() 51 | { 52 | vec4 c; 53 | vec2 TexCoord = gl_TexCoord[0].st; 54 | c = texture2D(Tex, TexCoord ) * W0; 55 | c += texture2D(Tex, TexCoord - Step * OF1) * W1; 56 | c += texture2D(Tex, TexCoord + Step * OF1) * W1; 57 | c += texture2D(Tex, TexCoord - Step * OF2) * W2; 58 | c += texture2D(Tex, TexCoord + Step * OF2) * W2; 59 | c += texture2D(Tex, TexCoord - Step * OF3) * W3; 60 | c += texture2D(Tex, TexCoord + Step * OF3) * W3; 61 | c *= 1.0 / (W_SUM); //?? ATI bug: cannot put define W_SUM ( ... ) - compiler ignored spaces after W_SUM 62 | 63 | gl_FragColor = c; 64 | } 65 | -------------------------------------------------------------------------------- /Unreal/Shaders/ColorFilter.ush: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * This shader allows to extract specific color channel from texture 3 | *****************************************************************************/ 4 | 5 | uniform sampler2D Tex; 6 | uniform vec4 FilterValue; 7 | uniform vec4 Colorizer; 8 | 9 | void VertexShaderMain() 10 | { 11 | gl_TexCoord[0] = gl_MultiTexCoord0; 12 | gl_Position = ftransform(); 13 | } 14 | 15 | 16 | void PixelShaderMain() 17 | { 18 | vec4 c; 19 | vec2 TexCoord = gl_TexCoord[0].st; 20 | c = texture2D(Tex, TexCoord); 21 | float d = dot(c, FilterValue); 22 | c = vec4(d, d, d, 1.0) * Colorizer; 23 | gl_FragColor = c; 24 | } 25 | -------------------------------------------------------------------------------- /Unreal/TypeConvert.h: -------------------------------------------------------------------------------- 1 | #ifndef __TYPE_CONVERT_H__ 2 | #define __TYPE_CONVERT_H__ 3 | 4 | /*----------------------------------------------------------------------------- 5 | Compatibility between Core and UnCore math types 6 | -----------------------------------------------------------------------------*/ 7 | 8 | struct FMeshUVFloat; 9 | struct CMeshUVFloat; 10 | struct FPackedNormal; 11 | 12 | // Convert Unreal type to Core type (e.g. FVector to CVec3) for cases when 13 | // they have identical memory layout 14 | #define CONVERTER_ONE_DIRECTION(From, To) \ 15 | FORCEINLINE To& CVT(From &V) \ 16 | { \ 17 | return (To&)V; \ 18 | } \ 19 | FORCEINLINE const To& CVT(const From &V) \ 20 | { \ 21 | return (const To&)V; \ 22 | } \ 23 | FORCEINLINE To* CVT(From *V) \ 24 | { \ 25 | return (To*)V; \ 26 | } \ 27 | FORCEINLINE const To* CVT(const From *V) \ 28 | { \ 29 | return (const To*)V; \ 30 | } 31 | 32 | // Convert types in both directions 33 | #define CONVERTER(From, To) \ 34 | CONVERTER_ONE_DIRECTION(From, To) \ 35 | CONVERTER_ONE_DIRECTION(To, From) 36 | 37 | //?? combine CONVERTER(T) with CONVERTER(TArray)? 38 | 39 | CONVERTER(FVector, CVec3 ) 40 | CONVERTER(FQuat, CQuat ) 41 | CONVERTER(FCoords, CCoords ) 42 | CONVERTER(FMeshUVFloat, CMeshUVFloat ) 43 | #if UNREAL3 44 | CONVERTER_ONE_DIRECTION(FVector2D, CMeshUVFloat) 45 | #endif 46 | CONVERTER(TArray, TArray ) 47 | CONVERTER(TArray, TArray ) 48 | CONVERTER(TArray, TArray) 49 | 50 | #undef CONVERTER 51 | 52 | 53 | #if defined(__MESH_COMMON_H__) && defined(__UNMESH_TYPES_H__) //todo: not nice 54 | 55 | FORCEINLINE CPackedNormal CVT(FPackedNormal V) 56 | { 57 | CPackedNormal ret; 58 | ret.Data = V.Data ^ 0x80808080; // offset by 128 59 | return ret; 60 | } 61 | 62 | FORCEINLINE FPackedNormal CVT(CPackedNormal V) 63 | { 64 | FPackedNormal ret; 65 | ret.Data = V.Data ^ 0x80808080; // offset by 128 66 | return ret; 67 | } 68 | 69 | #endif // __MESH_COMMON_H__ 70 | 71 | 72 | // declare Core math as SIMPLE_TYPE for faster arrays support 73 | SIMPLE_TYPE(CVec3, float) 74 | SIMPLE_TYPE(CQuat, float) 75 | SIMPLE_TYPE(CCoords, float) 76 | 77 | 78 | #endif // __TYPE_CONVERT_H__ 79 | -------------------------------------------------------------------------------- /Unreal/UnThirdParty.h: -------------------------------------------------------------------------------- 1 | #ifndef __UNTHIRDPARTY_H__ 2 | #define __UNTHIRDPARTY_H__ 3 | 4 | 5 | #if UNREAL3 6 | 7 | /*----------------------------------------------------------------------------- 8 | SwfMovie (ScaleForm) 9 | -----------------------------------------------------------------------------*/ 10 | 11 | class UGFxRawData : public UObject 12 | { 13 | DECLARE_CLASS(UGFxRawData, UObject); 14 | public: 15 | TArray RawData; 16 | 17 | BEGIN_PROP_TABLE 18 | PROP_ARRAY(RawData, PropType::Byte) 19 | END_PROP_TABLE 20 | }; 21 | 22 | 23 | class USwfMovie : public UGFxRawData 24 | { 25 | DECLARE_CLASS(USwfMovie, UGFxRawData); 26 | }; 27 | 28 | 29 | /*----------------------------------------------------------------------------- 30 | FaceFX 31 | -----------------------------------------------------------------------------*/ 32 | 33 | class UFaceFXAnimSet : public UObject 34 | { 35 | DECLARE_CLASS(UFaceFXAnimSet, UObject); 36 | public: 37 | TArray RawFaceFXAnimSetBytes; 38 | 39 | virtual void Serialize(FArchive &Ar) 40 | { 41 | guard(UFaceFXAnimSet::Serialize); 42 | Super::Serialize(Ar); 43 | Ar << RawFaceFXAnimSetBytes; 44 | // the next is RawFaceFXMiniSessionBytes 45 | DROP_REMAINING_DATA(Ar); 46 | unguard; 47 | } 48 | }; 49 | 50 | 51 | class UFaceFXAsset : public UObject 52 | { 53 | DECLARE_CLASS(UFaceFXAsset, UObject); 54 | public: 55 | TArray RawFaceFXActorBytes; 56 | 57 | virtual void Serialize(FArchive &Ar) 58 | { 59 | guard(UFaceFXAsset::Serialize); 60 | Super::Serialize(Ar); 61 | Ar << RawFaceFXActorBytes; 62 | // the next is RawFaceFXSessionBytes 63 | DROP_REMAINING_DATA(Ar); 64 | unguard; 65 | } 66 | }; 67 | 68 | 69 | // UGFxMovieInfo is DC Universe Online USwfMovie analogue 70 | 71 | #define REGISTER_3RDP_CLASSES \ 72 | REGISTER_CLASS(USwfMovie) \ 73 | REGISTER_CLASS_ALIAS(USwfMovie, UGFxMovieInfo) \ 74 | REGISTER_CLASS(UFaceFXAnimSet) \ 75 | REGISTER_CLASS(UFaceFXAsset) 76 | 77 | 78 | #endif // UNREAL3 79 | 80 | #endif // __UNTHIRDPARTY_H__ 81 | -------------------------------------------------------------------------------- /Unreal/UnrealPackage/PackageUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef __PACKAGE_UTILS_H__ 2 | #define __PACKAGE_UTILS_H__ 3 | 4 | 5 | class UnPackage; 6 | extern TArray GFullyLoadedPackages; 7 | 8 | // Virtual interface which could be used for progress indication. 9 | class IProgressCallback 10 | { 11 | public: 12 | // Stop operating when these functions returns 'false'. 13 | virtual bool Progress(const char* package, int index, int total) 14 | { 15 | return true; 16 | } 17 | virtual bool Tick() 18 | { 19 | return true; 20 | } 21 | }; 22 | 23 | 24 | bool LoadWholePackage(UnPackage* Package, IProgressCallback* progress = NULL); 25 | void ReleaseAllObjects(); 26 | 27 | 28 | // Package scanner 29 | 30 | struct FileInfo 31 | { 32 | int Ver; 33 | int LicVer; 34 | int Count; 35 | char FileName[512]; 36 | }; 37 | 38 | bool ScanPackageVersions(TArray& info, IProgressCallback* progress = NULL); 39 | 40 | bool ScanContent(const TArray& Packages, IProgressCallback* Progress = NULL); 41 | 42 | 43 | // Class statistics 44 | 45 | struct ClassStats 46 | { 47 | const char* Name; 48 | int Count; 49 | 50 | ClassStats() 51 | {} 52 | 53 | ClassStats(const char* name) 54 | : Name(name) 55 | , Count(0) 56 | {} 57 | }; 58 | 59 | void CollectPackageStats(const TArray &Packages, TArray& Stats); 60 | 61 | 62 | #endif // __PACKAGE_UTILS_H__ 63 | -------------------------------------------------------------------------------- /Unreal/Wrappers/TextureNVTT.h: -------------------------------------------------------------------------------- 1 | #ifndef __UNTEXTURENVTT_H__ 2 | #define __UNTEXTURENVTT_H__ 3 | 4 | #include 5 | #include 6 | #undef __FUNC__ // conflicted with our guard macros 7 | 8 | void DecodeDDS(const unsigned char* Data, int USize, int VSize, nv::DDSHeader& header, nv::Image& image); 9 | void WriteDDSHeader(unsigned char* Data, nv::DDSHeader& header); 10 | 11 | #endif // __UNTEXTURENVTT_H__ 12 | -------------------------------------------------------------------------------- /Unreal/Wrappers/TexturePNG.h: -------------------------------------------------------------------------------- 1 | #ifndef __UNTEXTUREPNG_H__ 2 | #define __UNTEXTUREPNG_H__ 3 | 4 | bool UncompressPNG(const unsigned char* CompressedData, int CompressedSize, int Width, int Height, unsigned char* pic, bool bgra); 5 | void CompressPNG(const unsigned char* pic, int Width, int Height, TArray& CompressedData); 6 | 7 | #endif // __UNTEXTUREPNG_H__ 8 | -------------------------------------------------------------------------------- /libs/PowerVR/PVRTDecompress.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | @File PVRTDecompress.h 4 | 5 | @Title PVRTDecompress 6 | 7 | @Version 8 | 9 | @Copyright Copyright (C) Imagination Technologies Limited. 10 | 11 | @Platform ANSI compatible 12 | 13 | @Description PVRTC and ETC Texture Decompression. 14 | 15 | ******************************************************************************/ 16 | 17 | #ifndef _PVRTDECOMPRESS_H_ 18 | #define _PVRTDECOMPRESS_H_ 19 | 20 | /*!*********************************************************************** 21 | @Function PVRTDecompressPVRTC 22 | @Input pCompressedData The PVRTC texture data to decompress 23 | @Input Do2bitMode Signifies whether the data is PVRTC2 or PVRTC4 24 | @Input XDim X dimension of the texture 25 | @Input YDim Y dimension of the texture 26 | @Modified pResultImage The decompressed texture data 27 | @Description Decompresses PVRTC to RGBA 8888 28 | *************************************************************************/ 29 | void PVRTDecompressPVRTC(const void *pCompressedData, 30 | const int Do2bitMode, 31 | const int XDim, 32 | const int YDim, 33 | unsigned char* pResultImage); 34 | 35 | /*!*********************************************************************** 36 | @Function PVRTDecompressETC 37 | @Input pSrcData The ETC texture data to decompress 38 | @Input x X dimension of the texture 39 | @Input y Y dimension of the texture 40 | @Modified pDestData The decompressed texture data 41 | @Input nMode The format of the data 42 | @Returns The number of bytes of ETC data decompressed 43 | @Description Decompresses ETC to RGBA 8888 44 | *************************************************************************/ 45 | int PVRTDecompressETC(const void * const pSrcData, 46 | const unsigned int &x, 47 | const unsigned int &y, 48 | void *pDestData, 49 | const int &nMode); 50 | 51 | 52 | #endif /* _PVRTDECOMPRESS_H_ */ 53 | 54 | /***************************************************************************** 55 | End of file (PVRTBoneBatch.h) 56 | *****************************************************************************/ 57 | 58 | -------------------------------------------------------------------------------- /libs/SDL2/SDL2.project: -------------------------------------------------------------------------------- 1 | # perl highlighting 2 | 3 | !if "$PLATFORM" ne "osx" 4 | STDLIBS += SDL2 # disabled in macOS build 5 | !endif 6 | 7 | !if "$PLATFORM" eq "win32" 8 | INCLUDES += $R/libs/includewin32 9 | LIBRARIES += $R/libs/SDL2/x86 10 | !elif "$PLATFORM" eq "win64" 11 | INCLUDES += $R/libs/includewin32 12 | LIBRARIES += $R/libs/SDL2/x64 13 | !endif 14 | 15 | !if "$COMPILER" eq "VisualC" 16 | # Delay loading of SDL2.dll 17 | LINKFLAGS += -DELAYLOAD:SDL2.dll 18 | STDLIBS += delayimp 19 | # Delay loader helper function 20 | sources(MAIN) = $R/libs/SDL2/SDL2Loader.cpp 21 | !endif 22 | -------------------------------------------------------------------------------- /libs/SDL2/SDL2Loader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // Reference: 5 | // https://docs.microsoft.com/en-us/cpp/build/reference/understanding-the-helper-function 6 | 7 | // Core external functions 8 | void appPrintf(const char*, ...); 9 | void appError(const char*, ...); 10 | 11 | static const char* DllPaths[] = 12 | { 13 | #ifndef _WIN64 14 | "SDL2.dll", 15 | "libs\\SDL2\\x86\\SDL2.dll" 16 | #else 17 | "SDL2_64.dll", 18 | "libs\\SDL2\\x64\\SDL2.dll" 19 | #endif 20 | }; 21 | 22 | static FARPROC WINAPI delayHook(unsigned dliNotify, PDelayLoadInfo pdli) 23 | { 24 | if (dliNotify == dliNotePreLoadLibrary) 25 | { 26 | if (stricmp(pdli->szDll, "SDL2.dll") == 0) 27 | { 28 | // Find SDL2.dll in local folder, then in libs. Use a different file name for Win64 builds. 29 | for (const char* DllName : DllPaths) 30 | { 31 | HANDLE hDll = LoadLibrary(DllName); 32 | if (hDll) 33 | return (FARPROC) hDll; 34 | } 35 | appError("SDL2.dll was not found, terminating..."); 36 | } 37 | else 38 | { 39 | // Actually can simply return NULL, and let CRT to find a DLL itself 40 | appError("Unknown DelayLoad: %s", pdli->szDll); 41 | } 42 | } 43 | 44 | return NULL; 45 | } 46 | 47 | ExternC const PfnDliHook __pfnDliNotifyHook2 = delayHook; 48 | -------------------------------------------------------------------------------- /libs/SDL2/readme.txt: -------------------------------------------------------------------------------- 1 | SDL2main.lib is not needed. 2 | 3 | SDL2 has got rid of SDL_main function. The overrided function just calls SDL_SetMainReady(), which 4 | does nothing than just sets some internal 'SDL_MainIsReady' to 'SDL_TRUE', i.e. no initialization is 5 | needed at all. However, SDL 2.0.5 still overrides 'main' function in headers unless SDL_MAIN_HANDLED 6 | is defined. 7 | 8 | SDL 2.0.5 has bug in console_main command line processing: when application got '-path="A B C"' parameter, 9 | it will be returned to main() as '-path="A', 'B', 'C"' i.e. 3 arguments. SDL 2.0.3 doesn't have this bug. 10 | -------------------------------------------------------------------------------- /libs/SDL2/x64/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/libs/SDL2/x64/SDL2.dll -------------------------------------------------------------------------------- /libs/SDL2/x64/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/libs/SDL2/x64/SDL2.lib -------------------------------------------------------------------------------- /libs/SDL2/x86/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/libs/SDL2/x86/SDL2.dll -------------------------------------------------------------------------------- /libs/SDL2/x86/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/libs/SDL2/x86/SDL2.lib -------------------------------------------------------------------------------- /libs/astc/astc_misc.cpp: -------------------------------------------------------------------------------- 1 | #include "astc_codec_internals.h" 2 | #include 3 | 4 | // TODO: make these as defines in header, so code will became smaller 5 | int rgb_force_use_of_hdr = 0; 6 | int alpha_force_use_of_hdr = 0; 7 | int perform_srgb_transform = 0; 8 | 9 | void astc_codec_internal_error(const char *filename, int linenum) 10 | { 11 | printf("ASTC internal error: File=%s Line=%d\n", filename, linenum); 12 | exit(1); 13 | } 14 | -------------------------------------------------------------------------------- /libs/astc/softfloat.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /** 3 | * This confidential and proprietary software may be used only as 4 | * authorised by a licensing agreement from ARM Limited 5 | * (C) COPYRIGHT 2011-2012 ARM Limited 6 | * ALL RIGHTS RESERVED 7 | * 8 | * The entire notice above must be reproduced on all authorised 9 | * copies and copies may only be made to the extent permitted 10 | * by a licensing agreement from ARM Limited. 11 | * 12 | * @brief Soft IEEE-754 floating point library. 13 | */ 14 | /*----------------------------------------------------------------------------*/ 15 | 16 | #ifndef SOFTFLOAT_H_INCLUDED 17 | 18 | #define SOFTFLOAT_H_INCLUDED 19 | 20 | #if defined __cplusplus 21 | extern "C" 22 | { 23 | #endif 24 | 25 | #if defined __cplusplus && !defined(_MSC_VER) 26 | 27 | /* if compiling as C++, we need to define these macros in order to obtain all the macros in stdint.h . */ 28 | #define __STDC_LIMIT_MACROS 29 | #define __STDC_CONSTANT_MACROS 30 | #include 31 | 32 | #else 33 | 34 | typedef unsigned char uint8_t; 35 | typedef signed char int8_t; 36 | typedef unsigned short uint16_t; 37 | typedef signed short int16_t; 38 | typedef unsigned int uint32_t; 39 | typedef signed int int32_t; 40 | 41 | #endif 42 | 43 | 44 | uint32_t clz32(uint32_t p); 45 | 46 | 47 | /* targets that don't have UINT32_C probably don't have the rest of C99s stdint.h */ 48 | #ifndef UINT32_C 49 | 50 | #define PASTE(a) a 51 | #define UINT64_C(a) PASTE(a##ULL) 52 | #define UINT32_C(a) PASTE(a##U) 53 | #define INT64_C(a) PASTE(a##LL) 54 | #define INT32_C(a) a 55 | 56 | #define PRIX32 "X" 57 | #define PRId32 "d" 58 | #define PRIu32 "u" 59 | #define PRIX64 "LX" 60 | #define PRId64 "Ld" 61 | #define PRIu64 "Lu" 62 | 63 | #endif 64 | 65 | /* sized soft-float types. These are mapped to the sized integer types of C99, instead of C's 66 | floating-point types; this is because the library needs to maintain exact, bit-level control on all 67 | operations on these data types. */ 68 | typedef uint16_t sf16; 69 | typedef uint32_t sf32; 70 | 71 | /* the five rounding modes that IEEE-754r defines */ 72 | typedef enum 73 | { 74 | SF_UP = 0, /* round towards positive infinity */ 75 | SF_DOWN = 1, /* round towards negative infinity */ 76 | SF_TOZERO = 2, /* round towards zero */ 77 | SF_NEARESTEVEN = 3, /* round toward nearest value; if mid-between, round to even value */ 78 | SF_NEARESTAWAY = 4 /* round toward nearest value; if mid-between, round away from zero */ 79 | } roundmode; 80 | 81 | /* narrowing float->float conversions */ 82 | sf16 sf32_to_sf16(sf32, roundmode); 83 | 84 | /* widening float->float conversions */ 85 | sf32 sf16_to_sf32(sf16); 86 | 87 | sf16 float_to_sf16(float, roundmode); 88 | float sf16_to_float(sf16); 89 | 90 | 91 | #if defined __cplusplus 92 | } 93 | #endif 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /libs/detex/bits.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015 Harm Hanemaaijer 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | */ 18 | 19 | #include "detex.h" 20 | #include "bits.h" 21 | 22 | uint32_t detexBlock128ExtractBits(detexBlock128 *block, int nu_bits) { 23 | uint32_t value = 0; 24 | for (int i = 0; i < nu_bits; i++) { 25 | if (block->index < 64) { 26 | int shift = block->index - i; 27 | if (shift < 0) 28 | value |= (block->data0 & ((uint64_t)1 << block->index)) << (- shift); 29 | else 30 | value |= (block->data0 & ((uint64_t)1 << block->index)) >> shift; 31 | } 32 | else { 33 | int shift = ((block->index - 64) - i); 34 | if (shift < 0) 35 | value |= (block->data1 & ((uint64_t)1 << (block->index - 64))) << (- shift); 36 | else 37 | value |= (block->data1 & ((uint64_t)1 << (block->index - 64))) >> shift; 38 | } 39 | block->index++; 40 | } 41 | // if (block->index > 128) 42 | // printf("Block overflow (%d)\n", block->index); 43 | return value; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /libs/detex/bits.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015 Harm Hanemaaijer 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | */ 18 | 19 | /* Data structure used to extract bits from 128-bit bitstring. */ 20 | 21 | typedef struct { 22 | uint64_t data0; 23 | uint64_t data1; 24 | int index; 25 | } detexBlock128; 26 | 27 | uint32_t detexBlock128ExtractBits(detexBlock128 *block, int nu_bits); 28 | 29 | /* Return bitfield from bit0 to bit1 from 64-bit bitstring. */ 30 | static DETEX_INLINE_ONLY uint32_t detexGetBits64(uint64_t data, int bit0, int bit1) { 31 | return (data & (((uint64_t)1 << (bit1 + 1)) - 1)) >> bit0; 32 | } 33 | 34 | /* Return reversed bitfield (bit1 to bit0) from 64-bit bitstring. */ 35 | static DETEX_INLINE_ONLY uint32_t detexGetBits64Reversed(uint64_t data, int bit0, int bit1) { 36 | // Assumes bit0 > bit1. 37 | // Reverse the bits. 38 | uint32_t val = 0; 39 | for (int i = 0; i <= bit0 - bit1; i++) { 40 | int shift_right = bit0 - 2 * i; 41 | if (shift_right >= 0) 42 | val |= (data & ((uint64_t)1 << (bit0 - i))) >> shift_right; 43 | else 44 | val |= (data & ((uint64_t)1 << (bit0 - i))) << (- shift_right); 45 | } 46 | return val; 47 | } 48 | 49 | /* Clear bit0 to bit1 of 64-bit bitstring. */ 50 | static DETEX_INLINE_ONLY uint64_t detexClearBits64(uint64_t data, int bit0, int bit1) { 51 | uint64_t mask = ~(((uint64_t)1 << (bit1 + 1)) - 1); 52 | mask |= ((uint64_t)1 << bit0) - 1; 53 | return data & mask; 54 | } 55 | 56 | /* Set bit0 to bit1 of 64-bit bitstring. */ 57 | static DETEX_INLINE_ONLY uint64_t detexSetBits64(uint64_t data, int bit0, int bit1, uint64_t val) { 58 | uint64_t d = detexClearBits64(data, bit0, bit1); 59 | d |= val << bit0; 60 | return d; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /libs/detex/bptc-tables.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015 Harm Hanemaaijer 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | */ 18 | 19 | extern const uint8_t detex_bptc_table_P2[64 * 16]; 20 | extern const uint8_t detex_bptc_table_P3[64 * 16]; 21 | 22 | extern const uint8_t detex_bptc_table_anchor_index_second_subset[64]; 23 | extern const uint8_t detex_bptc_table_anchor_index_second_subset_of_three[64]; 24 | extern const uint8_t detex_bptc_table_anchor_index_third_subset[64]; 25 | 26 | extern const uint16_t detex_bptc_table_aWeight2[4]; 27 | extern const uint16_t detex_bptc_table_aWeight3[8]; 28 | extern const uint16_t detex_bptc_table_aWeight4[16]; 29 | 30 | -------------------------------------------------------------------------------- /libs/detex/file-info.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015 Harm Hanemaaijer 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | */ 18 | 19 | typedef struct { 20 | uint32_t texture_format; 21 | int ktx_support; 22 | int dds_support; 23 | const char *text1; 24 | const char *text2; 25 | int block_width; // The block width (1 for uncompressed textures). 26 | int block_height; // The block height (1 for uncompressed textures). 27 | int gl_internal_format; 28 | uint32_t gl_format; 29 | uint32_t gl_type; 30 | const char *dx_four_cc; 31 | int dx10_format; 32 | } detexTextureFileInfo; 33 | 34 | // Look-up texture file info for texture format. 35 | const detexTextureFileInfo *detexLookupTextureFormatFileInfo(uint32_t texture_format); 36 | 37 | // Look-up texture file info for texture description. 38 | const detexTextureFileInfo *detexLookupTextureDescription(const char *s); 39 | 40 | // Look-up texture file info for KTX file format based on GL format parameters. 41 | const detexTextureFileInfo *detexLookupKTXFileInfo(int gl_internal_format, int gl_format, int gl_type); 42 | 43 | // Look-up texture file info for DDS file format based on DX format parameters. 44 | const detexTextureFileInfo *detexLookupDDSFileInfo(const char *four_cc, int dx10_format, uint32_t pixel_format_flags, int bitcount, uint32_t red_mask, uint32_t green_mask, uint32_t blue_mask, uint32_t alpha_mask); 45 | 46 | -------------------------------------------------------------------------------- /libs/detex/half-float.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015 Harm Hanemaaijer 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | */ 18 | 19 | void detexConvertHalfFloatToFloat(uint16_t *source_buffer, int n, float *target_buffer); 20 | 21 | void detexConvertFloatToHalfFloat(float *source_buffer, int n, uint16_t *target_buffer); 22 | 23 | void detexConvertNormalizedHalfFloatToUInt16(uint16_t *buffer, int n); 24 | 25 | void detexConvertNormalizedFloatToUInt16(float *source_buffer, int n, uint16_t *target_buffer); 26 | 27 | static DETEX_INLINE_ONLY float detexGetFloatFromHalfFloat(uint16_t hf) { 28 | float result = 0.0f; 29 | detexConvertHalfFloatToFloat(&hf, 1, &result); 30 | return result; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libs/detex/hdr.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015 Harm Hanemaaijer 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | */ 18 | 19 | void detexConvertHDRHalfFloatToUInt16(uint16_t *buffer, int n); 20 | 21 | void detexConvertHDRFloatToFloat(float *buffer, int n); 22 | 23 | -------------------------------------------------------------------------------- /libs/detex/misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015 Harm Hanemaaijer 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | */ 18 | 19 | 20 | void detexSetErrorMessage(const char *format, ...); 21 | 22 | -------------------------------------------------------------------------------- /libs/include/glslang/Include/ResourceLimits.h: -------------------------------------------------------------------------------- 1 | // 2 | //Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 | //All rights reserved. 4 | // 5 | //Redistribution and use in source and binary forms, with or without 6 | //modification, are permitted provided that the following conditions 7 | //are met: 8 | // 9 | // Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // 12 | // Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following 14 | // disclaimer in the documentation and/or other materials provided 15 | // with the distribution. 16 | // 17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 18 | // contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | //"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | //FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | //COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | //INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | //CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | //LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | //POSSIBILITY OF SUCH DAMAGE. 33 | // 34 | 35 | #ifndef _RESOURCE_LIMITS_INCLUDED_ 36 | #define _RESOURCE_LIMITS_INCLUDED_ 37 | 38 | struct TBuiltInResource { 39 | int maxLights; 40 | int maxClipPlanes; 41 | int maxTextureUnits; 42 | int maxTextureCoords; 43 | int maxVertexAttribs; 44 | int maxVertexUniformComponents; 45 | int maxVaryingFloats; 46 | int maxVertexTextureImageUnits; 47 | int maxCombinedTextureImageUnits; 48 | int maxTextureImageUnits; 49 | int maxFragmentUniformComponents; 50 | int maxDrawBuffers; 51 | }; 52 | #endif // _RESOURCE_LIMITS_INCLUDED_ 53 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_clipboard.h 24 | * 25 | * Include file for SDL clipboard handling 26 | */ 27 | 28 | #ifndef SDL_clipboard_h_ 29 | #define SDL_clipboard_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | /** 42 | * \brief Put UTF-8 text into the clipboard 43 | * 44 | * \sa SDL_GetClipboardText() 45 | */ 46 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); 47 | 48 | /** 49 | * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() 50 | * 51 | * \sa SDL_SetClipboardText() 52 | */ 53 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); 54 | 55 | /** 56 | * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty 57 | * 58 | * \sa SDL_GetClipboardText() 59 | */ 60 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); 61 | 62 | 63 | /* Ends C function definitions when using C++ */ 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #include "close_code.h" 68 | 69 | #endif /* SDL_clipboard_h_ */ 70 | 71 | /* vi: set ts=4 sw=4 expandtab: */ 72 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_config_minimal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2017 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_config_minimal_h_ 23 | #define SDL_config_minimal_h_ 24 | #define SDL_config_h_ 25 | 26 | #include "SDL_platform.h" 27 | 28 | /** 29 | * \file SDL_config_minimal.h 30 | * 31 | * This is the minimal configuration that can be used to build SDL. 32 | */ 33 | 34 | #define HAVE_STDARG_H 1 35 | #define HAVE_STDDEF_H 1 36 | 37 | /* Most everything except Visual Studio 2008 and earlier has stdint.h now */ 38 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 39 | /* Here are some reasonable defaults */ 40 | typedef unsigned int size_t; 41 | typedef signed char int8_t; 42 | typedef unsigned char uint8_t; 43 | typedef signed short int16_t; 44 | typedef unsigned short uint16_t; 45 | typedef signed int int32_t; 46 | typedef unsigned int uint32_t; 47 | typedef signed long long int64_t; 48 | typedef unsigned long long uint64_t; 49 | typedef unsigned long uintptr_t; 50 | #else 51 | #define HAVE_STDINT_H 1 52 | #endif /* Visual Studio 2008 */ 53 | 54 | #ifdef __GNUC__ 55 | #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 56 | #endif 57 | 58 | /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ 59 | #define SDL_AUDIO_DRIVER_DUMMY 1 60 | 61 | /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ 62 | #define SDL_JOYSTICK_DISABLED 1 63 | 64 | /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ 65 | #define SDL_HAPTIC_DISABLED 1 66 | 67 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 68 | #define SDL_LOADSO_DISABLED 1 69 | 70 | /* Enable the stub thread support (src/thread/generic/\*.c) */ 71 | #define SDL_THREADS_DISABLED 1 72 | 73 | /* Enable the stub timer support (src/timer/dummy/\*.c) */ 74 | #define SDL_TIMERS_DISABLED 1 75 | 76 | /* Enable the dummy video driver (src/video/dummy/\*.c) */ 77 | #define SDL_VIDEO_DRIVER_DUMMY 1 78 | 79 | /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ 80 | #define SDL_FILESYSTEM_DUMMY 1 81 | 82 | #endif /* SDL_config_minimal_h_ */ 83 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2017 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_error.h 24 | * 25 | * Simple error message routines for SDL. 26 | */ 27 | 28 | #ifndef SDL_error_h_ 29 | #define SDL_error_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Public functions */ 40 | /* SDL_SetError() unconditionally returns -1. */ 41 | extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 42 | extern DECLSPEC const char *SDLCALL SDL_GetError(void); 43 | extern DECLSPEC void SDLCALL SDL_ClearError(void); 44 | 45 | /** 46 | * \name Internal error functions 47 | * 48 | * \internal 49 | * Private error reporting function - used internally. 50 | */ 51 | /* @{ */ 52 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) 53 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) 54 | #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) 55 | typedef enum 56 | { 57 | SDL_ENOMEM, 58 | SDL_EFREAD, 59 | SDL_EFWRITE, 60 | SDL_EFSEEK, 61 | SDL_UNSUPPORTED, 62 | SDL_LASTERROR 63 | } SDL_errorcode; 64 | /* SDL_Error() unconditionally returns -1. */ 65 | extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); 66 | /* @} *//* Internal error functions */ 67 | 68 | /* Ends C function definitions when using C++ */ 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | #include "close_code.h" 73 | 74 | #endif /* SDL_error_h_ */ 75 | 76 | /* vi: set ts=4 sw=4 expandtab: */ 77 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_gesture.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_gesture.h 24 | * 25 | * Include file for SDL gesture event handling. 26 | */ 27 | 28 | #ifndef SDL_gesture_h_ 29 | #define SDL_gesture_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_video.h" 34 | 35 | #include "SDL_touch.h" 36 | 37 | 38 | #include "begin_code.h" 39 | /* Set up for C function definitions, even when using C++ */ 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | typedef Sint64 SDL_GestureID; 45 | 46 | /* Function prototypes */ 47 | 48 | /** 49 | * \brief Begin Recording a gesture on the specified touch, or all touches (-1) 50 | * 51 | * 52 | */ 53 | extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); 54 | 55 | 56 | /** 57 | * \brief Save all currently loaded Dollar Gesture templates 58 | * 59 | * 60 | */ 61 | extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); 62 | 63 | /** 64 | * \brief Save a currently loaded Dollar Gesture template 65 | * 66 | * 67 | */ 68 | extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); 69 | 70 | 71 | /** 72 | * \brief Load Dollar Gesture templates from a file 73 | * 74 | * 75 | */ 76 | extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); 77 | 78 | 79 | /* Ends C function definitions when using C++ */ 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #include "close_code.h" 84 | 85 | #endif /* SDL_gesture_h_ */ 86 | 87 | /* vi: set ts=4 sw=4 expandtab: */ 88 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDLname_h_ 23 | #define SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifndef _MSC_VER 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_power_h_ 23 | #define SDL_power_h_ 24 | 25 | /** 26 | * \file SDL_power.h 27 | * 28 | * Header for the SDL power management routines. 29 | */ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * \brief The basic state for the system's power supply. 41 | */ 42 | typedef enum 43 | { 44 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ 45 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ 46 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ 47 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ 48 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ 49 | } SDL_PowerState; 50 | 51 | 52 | /** 53 | * \brief Get the current power supply details. 54 | * 55 | * \param secs Seconds of battery life left. You can pass a NULL here if 56 | * you don't care. Will return -1 if we can't determine a 57 | * value, or we're not running on a battery. 58 | * 59 | * \param pct Percentage of battery life left, between 0 and 100. You can 60 | * pass a NULL here if you don't care. Will return -1 if we 61 | * can't determine a value, or we're not running on a battery. 62 | * 63 | * \return The state of the battery (if any). 64 | */ 65 | extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); 66 | 67 | /* Ends C function definitions when using C++ */ 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | #include "close_code.h" 72 | 73 | #endif /* SDL_power_h_ */ 74 | 75 | /* vi: set ts=4 sw=4 expandtab: */ 76 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_quit.h 24 | * 25 | * Include file for SDL quit event handling. 26 | */ 27 | 28 | #ifndef SDL_quit_h_ 29 | #define SDL_quit_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /** 35 | * \file SDL_quit.h 36 | * 37 | * An ::SDL_QUIT event is generated when the user tries to close the application 38 | * window. If it is ignored or filtered out, the window will remain open. 39 | * If it is not ignored or filtered, it is queued normally and the window 40 | * is allowed to close. When the window is closed, screen updates will 41 | * complete, but have no effect. 42 | * 43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 44 | * and SIGTERM (system termination request), if handlers do not already 45 | * exist, that generate ::SDL_QUIT events as well. There is no way 46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal 47 | * handler in your application will override the default generation of 48 | * quit events for that signal. 49 | * 50 | * \sa SDL_Quit() 51 | */ 52 | 53 | /* There are no functions directly affecting the quit event */ 54 | 55 | #define SDL_QuitRequested() \ 56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) 57 | 58 | #endif /* SDL_quit_h_ */ 59 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "hg-12952:bc90ce38f1e2" 2 | #define SDL_REVISION_NUMBER 12952 3 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_h_ 31 | #define SDL_test_h_ 32 | 33 | #include "SDL.h" 34 | #include "SDL_test_assert.h" 35 | #include "SDL_test_common.h" 36 | #include "SDL_test_compare.h" 37 | #include "SDL_test_crc32.h" 38 | #include "SDL_test_font.h" 39 | #include "SDL_test_fuzzer.h" 40 | #include "SDL_test_harness.h" 41 | #include "SDL_test_images.h" 42 | #include "SDL_test_log.h" 43 | #include "SDL_test_md5.h" 44 | #include "SDL_test_memory.h" 45 | #include "SDL_test_random.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /* Global definitions */ 54 | 55 | /* 56 | * Note: Maximum size of SDLTest log message is less than SDL's limit 57 | * to ensure we can fit additional information such as the timestamp. 58 | */ 59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_test_compare.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_compare.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines comparison functions (i.e. for surfaces). 33 | 34 | */ 35 | 36 | #ifndef SDL_test_compare_h_ 37 | #define SDL_test_compare_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "SDL_test_images.h" 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * \brief Compares a surface and with reference image data for equality 51 | * 52 | * \param surface Surface used in comparison 53 | * \param referenceSurface Test Surface used in comparison 54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. 55 | * 56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. 57 | */ 58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); 59 | 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_compare_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_test_font.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_font.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_font_h_ 31 | #define SDL_test_font_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | #define FONT_CHARACTER_SIZE 8 42 | 43 | /** 44 | * \brief Draw a string in the currently set font. 45 | * 46 | * \param renderer The renderer to draw on. 47 | * \param x The X coordinate of the upper left corner of the character. 48 | * \param y The Y coordinate of the upper left corner of the character. 49 | * \param c The character to draw. 50 | * 51 | * \returns Returns 0 on success, -1 on failure. 52 | */ 53 | int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c); 54 | 55 | /** 56 | * \brief Draw a string in the currently set font. 57 | * 58 | * \param renderer The renderer to draw on. 59 | * \param x The X coordinate of the upper left corner of the string. 60 | * \param y The Y coordinate of the upper left corner of the string. 61 | * \param s The string to draw. 62 | * 63 | * \returns Returns 0 on success, -1 on failure. 64 | */ 65 | int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s); 66 | 67 | 68 | /** 69 | * \brief Cleanup textures used by font drawing functions. 70 | */ 71 | void SDLTest_CleanupTextDrawing(void); 72 | 73 | /* Ends C function definitions when using C++ */ 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | #include "close_code.h" 78 | 79 | #endif /* SDL_test_font_h_ */ 80 | 81 | /* vi: set ts=4 sw=4 expandtab: */ 82 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_test_images.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_images.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines some images for tests. 33 | 34 | */ 35 | 36 | #ifndef SDL_test_images_h_ 37 | #define SDL_test_images_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "begin_code.h" 42 | /* Set up for C function definitions, even when using C++ */ 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** 48 | *Type for test images. 49 | */ 50 | typedef struct SDLTest_SurfaceImage_s { 51 | int width; 52 | int height; 53 | unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 54 | const char *pixel_data; 55 | } SDLTest_SurfaceImage_t; 56 | 57 | /* Test images */ 58 | SDL_Surface *SDLTest_ImageBlit(void); 59 | SDL_Surface *SDLTest_ImageBlitColor(void); 60 | SDL_Surface *SDLTest_ImageBlitAlpha(void); 61 | SDL_Surface *SDLTest_ImageBlitBlendAdd(void); 62 | SDL_Surface *SDLTest_ImageBlitBlend(void); 63 | SDL_Surface *SDLTest_ImageBlitBlendMod(void); 64 | SDL_Surface *SDLTest_ImageBlitBlendNone(void); 65 | SDL_Surface *SDLTest_ImageBlitBlendAll(void); 66 | SDL_Surface *SDLTest_ImageFace(void); 67 | SDL_Surface *SDLTest_ImagePrimitives(void); 68 | SDL_Surface *SDLTest_ImagePrimitivesBlend(void); 69 | 70 | /* Ends C function definitions when using C++ */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | #include "close_code.h" 75 | 76 | #endif /* SDL_test_images_h_ */ 77 | 78 | /* vi: set ts=4 sw=4 expandtab: */ 79 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_test_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_log.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Wrapper to log in the TEST category 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_log_h_ 37 | #define SDL_test_log_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority. 47 | * 48 | * \param fmt Message to be logged 49 | */ 50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 51 | 52 | /** 53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. 54 | * 55 | * \param fmt Message to be logged 56 | */ 57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 58 | 59 | /* Ends C function definitions when using C++ */ 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #include "close_code.h" 64 | 65 | #endif /* SDL_test_log_h_ */ 66 | 67 | /* vi: set ts=4 sw=4 expandtab: */ 68 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_memory.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_memory_h_ 31 | #define SDL_test_memory_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Start tracking SDL memory allocations 42 | * 43 | * \note This should be called before any other SDL functions for complete tracking coverage 44 | */ 45 | int SDLTest_TrackAllocations(void); 46 | 47 | /** 48 | * \brief Print a log of any outstanding allocations 49 | * 50 | * \note This can be called after SDL_Quit() 51 | */ 52 | void SDLTest_LogAllocations(void); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* SDL_test_memory_h_ */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /libs/includewin32/SDL2/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2019 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #ifndef _begin_code_h 30 | #error close_code.h included without matching begin_code.h 31 | #endif 32 | #undef _begin_code_h 33 | 34 | /* Reset structure packing at previous byte alignment */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #pragma pack(pop) 40 | #endif /* Compiler needs structure packing set */ 41 | -------------------------------------------------------------------------------- /libs/libpng/pngprefix.h: -------------------------------------------------------------------------------- 1 | // Just shut up genmake's error 2 | -------------------------------------------------------------------------------- /libs/libpng/pngusr.h: -------------------------------------------------------------------------------- 1 | // Disable some warnings for Visual C++ 2 | #if _MSC_VER 3 | #pragma warning(disable : 4005) 4 | #endif 5 | -------------------------------------------------------------------------------- /libs/lzo/lzo1x_d1.c: -------------------------------------------------------------------------------- 1 | /* lzo1x_d1.c -- LZO1X decompression 2 | 3 | This file is part of the LZO real-time data compression library. 4 | 5 | Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer 6 | Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer 7 | Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer 8 | Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer 9 | Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer 10 | Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer 11 | Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer 12 | Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer 13 | Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer 14 | Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer 15 | Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer 16 | Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer 17 | Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer 18 | All Rights Reserved. 19 | 20 | The LZO library is free software; you can redistribute it and/or 21 | modify it under the terms of the GNU General Public License as 22 | published by the Free Software Foundation; either version 2 of 23 | the License, or (at your option) any later version. 24 | 25 | The LZO library is distributed in the hope that it will be useful, 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | GNU General Public License for more details. 29 | 30 | You should have received a copy of the GNU General Public License 31 | along with the LZO library; see the file COPYING. 32 | If not, write to the Free Software Foundation, Inc., 33 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 34 | 35 | Markus F.X.J. Oberhumer 36 | 37 | http://www.oberhumer.com/opensource/lzo/ 38 | */ 39 | 40 | 41 | #include "config1x.h" 42 | 43 | #undef LZO_TEST_OVERRUN 44 | #define DO_DECOMPRESS lzo1x_decompress 45 | 46 | #include "lzo1x_d.ch" 47 | -------------------------------------------------------------------------------- /libs/lzo/lzo1x_d2.c: -------------------------------------------------------------------------------- 1 | /* lzo1x_d2.c -- LZO1X decompression with overrun testing 2 | 3 | This file is part of the LZO real-time data compression library. 4 | 5 | Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer 6 | Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer 7 | Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer 8 | Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer 9 | Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer 10 | Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer 11 | Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer 12 | Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer 13 | Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer 14 | Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer 15 | Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer 16 | Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer 17 | Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer 18 | All Rights Reserved. 19 | 20 | The LZO library is free software; you can redistribute it and/or 21 | modify it under the terms of the GNU General Public License as 22 | published by the Free Software Foundation; either version 2 of 23 | the License, or (at your option) any later version. 24 | 25 | The LZO library is distributed in the hope that it will be useful, 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | GNU General Public License for more details. 29 | 30 | You should have received a copy of the GNU General Public License 31 | along with the LZO library; see the file COPYING. 32 | If not, write to the Free Software Foundation, Inc., 33 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 34 | 35 | Markus F.X.J. Oberhumer 36 | 37 | http://www.oberhumer.com/opensource/lzo/ 38 | */ 39 | 40 | 41 | #include "config1x.h" 42 | 43 | #define LZO_TEST_OVERRUN 44 | #define DO_DECOMPRESS lzo1x_decompress_safe 45 | 46 | #include "lzo1x_d.ch" 47 | -------------------------------------------------------------------------------- /libs/lzo/lzo_dll.ch: -------------------------------------------------------------------------------- 1 | /* lzo_dll.ch -- DLL initialization of the LZO library 2 | 3 | This file is part of the LZO real-time data compression library. 4 | 5 | Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer 6 | Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer 7 | Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer 8 | Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer 9 | Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer 10 | Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer 11 | Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer 12 | Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer 13 | Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer 14 | Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer 15 | Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer 16 | Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer 17 | Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer 18 | All Rights Reserved. 19 | 20 | The LZO library is free software; you can redistribute it and/or 21 | modify it under the terms of the GNU General Public License as 22 | published by the Free Software Foundation; either version 2 of 23 | the License, or (at your option) any later version. 24 | 25 | The LZO library is distributed in the hope that it will be useful, 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | GNU General Public License for more details. 29 | 30 | You should have received a copy of the GNU General Public License 31 | along with the LZO library; see the file COPYING. 32 | If not, write to the Free Software Foundation, Inc., 33 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 34 | 35 | Markus F.X.J. Oberhumer 36 | 37 | http://www.oberhumer.com/opensource/lzo/ 38 | */ 39 | 40 | 41 | /*********************************************************************** 42 | // Windows 16 bit + Watcom C + DLL 43 | ************************************************************************/ 44 | 45 | #if (LZO_OS_WIN16 && LZO_CC_WATCOMC) && defined(__SW_BD) 46 | 47 | /* don't pull in - we don't need it */ 48 | #if 0 49 | BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment, 50 | WORD wHeapSize, LPSTR lpszCmdLine ) 51 | #else 52 | int __far __pascal LibMain ( int a, short b, short c, long d ) 53 | #endif 54 | { 55 | LZO_UNUSED(a); LZO_UNUSED(b); LZO_UNUSED(c); LZO_UNUSED(d); 56 | return 1; 57 | } 58 | 59 | #endif 60 | 61 | 62 | /* 63 | vi:ts=4:et 64 | */ 65 | -------------------------------------------------------------------------------- /libs/mspack/lzx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/libs/mspack/lzx.h -------------------------------------------------------------------------------- /libs/nvtt/nvconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CONFIG 2 | #define NV_CONFIG 3 | 4 | //#cmakedefine HAVE_UNISTD_H 5 | #ifndef HAVE_STDARG_H 6 | #define HAVE_STDARG_H 1 7 | #endif 8 | //#cmakedefine HAVE_SIGNAL_H 9 | //#cmakedefine HAVE_EXECINFO_H 10 | #ifndef HAVE_MALLOC_H 11 | #define HAVE_MALLOC_H 12 | #endif 13 | 14 | //#cmakedefine HAVE_PNG 15 | //#cmakedefine HAVE_JPEG 16 | //#cmakedefine HAVE_TIFF 17 | //#cmakedefine HAVE_OPENEXR 18 | 19 | //#cmakedefine HAVE_MAYA 20 | 21 | #if _MSC_VER 22 | #define __restrict //?? empty; check version? 23 | #endif 24 | 25 | #define NV_NO_ASSERT 1 26 | #define UMODEL 1 27 | 28 | #endif // NV_CONFIG 29 | -------------------------------------------------------------------------------- /libs/nvtt/nvcore/DefsGnucDarwin.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | #include // uint8_t, int8_t, ... 6 | 7 | // Function linkage 8 | #define DLL_IMPORT 9 | #if __GNUC__ >= 4 10 | # define DLL_EXPORT __attribute__((visibility("default"))) 11 | # define DLL_EXPORT_CLASS DLL_EXPORT 12 | #else 13 | # define DLL_EXPORT 14 | # define DLL_EXPORT_CLASS 15 | #endif 16 | 17 | // Function calling modes 18 | #if NV_CPU_X86 19 | # define NV_CDECL __attribute__((cdecl)) 20 | # define NV_STDCALL __attribute__((stdcall)) 21 | #else 22 | # define NV_CDECL 23 | # define NV_STDCALL 24 | #endif 25 | 26 | #define NV_FASTCALL __attribute__((fastcall)) 27 | #define NV_FORCEINLINE __attribute__((always_inline)) 28 | #define NV_DEPRECATED __attribute__((deprecated)) 29 | 30 | #if __GNUC__ > 2 31 | #define NV_PURE __attribute__((pure)) 32 | #define NV_CONST __attribute__((const)) 33 | #else 34 | #define NV_PURE 35 | #define NV_CONST 36 | #endif 37 | 38 | // Define __FUNC__ properly. 39 | #if __STDC_VERSION__ < 199901L 40 | # if __GNUC__ >= 2 41 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 42 | # else 43 | # define __FUNC__ "" 44 | # endif 45 | #else 46 | # define __FUNC__ __PRETTY_FUNCTION__ 47 | #endif 48 | 49 | #define restrict __restrict__ 50 | 51 | 52 | // Type definitions 53 | typedef uint8_t uint8; 54 | typedef int8_t int8; 55 | 56 | typedef uint16_t uint16; 57 | typedef int16_t int16; 58 | 59 | typedef uint32_t uint32; 60 | typedef int32_t int32; 61 | 62 | typedef uint64_t uint64; 63 | typedef int64_t int64; 64 | 65 | // Aliases 66 | typedef uint32 uint; 67 | -------------------------------------------------------------------------------- /libs/nvtt/nvcore/DefsGnucLinux.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | #include // uint8_t, int8_t, ... uintptr_t 6 | 7 | // Function linkage 8 | #define DLL_IMPORT 9 | #if __GNUC__ >= 4 10 | # define DLL_EXPORT __attribute__((visibility("default"))) 11 | # define DLL_EXPORT_CLASS DLL_EXPORT 12 | #else 13 | # define DLL_EXPORT 14 | # define DLL_EXPORT_CLASS 15 | #endif 16 | 17 | // Function calling modes 18 | #if NV_CPU_X86 19 | # define NV_CDECL __attribute__((cdecl)) 20 | # define NV_STDCALL __attribute__((stdcall)) 21 | #else 22 | # define NV_CDECL 23 | # define NV_STDCALL 24 | #endif 25 | 26 | #define NV_FASTCALL __attribute__((fastcall)) 27 | #define NV_FORCEINLINE __attribute__((always_inline)) 28 | #define NV_DEPRECATED __attribute__((deprecated)) 29 | 30 | 31 | #if __GNUC__ > 2 32 | #define NV_PURE __attribute__((pure)) 33 | #define NV_CONST __attribute__((const)) 34 | #else 35 | #define NV_PURE 36 | #define NV_CONST 37 | #endif 38 | 39 | // Define __FUNC__ properly. 40 | #if __STDC_VERSION__ < 199901L 41 | # if __GNUC__ >= 2 42 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 43 | # else 44 | # define __FUNC__ "" 45 | # endif 46 | #else 47 | # define __FUNC__ __PRETTY_FUNCTION__ 48 | #endif 49 | 50 | #define restrict __restrict__ 51 | 52 | 53 | // Type definitions 54 | typedef unsigned char uint8; 55 | typedef signed char int8; 56 | 57 | typedef unsigned short uint16; 58 | typedef signed short int16; 59 | 60 | typedef unsigned int uint32; 61 | typedef signed int int32; 62 | 63 | typedef uint64_t uint64; 64 | typedef int64_t int64; 65 | //typedef unsigned long long uint64; 66 | //typedef signed long long int64; 67 | 68 | // Aliases 69 | typedef uint32 uint; 70 | -------------------------------------------------------------------------------- /libs/nvtt/nvcore/DefsGnucWin32.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | // Function linkage 6 | #define DLL_IMPORT __declspec(dllimport) 7 | #define DLL_EXPORT __declspec(dllexport) 8 | #define DLL_EXPORT_CLASS DLL_EXPORT 9 | 10 | // Function calling modes 11 | #if NV_CPU_X86 12 | # define NV_CDECL __attribute__((cdecl)) 13 | # define NV_STDCALL __attribute__((stdcall)) 14 | #else 15 | # define NV_CDECL 16 | # define NV_STDCALL 17 | #endif 18 | 19 | #define NV_FASTCALL __attribute__((fastcall)) 20 | #define NV_FORCEINLINE __attribute__((always_inline)) 21 | #define NV_DEPRECATED __attribute__((deprecated)) 22 | 23 | #if __GNUC__ > 2 24 | #define NV_PURE __attribute__((pure)) 25 | #define NV_CONST __attribute__((const)) 26 | #else 27 | #define NV_PURE 28 | #define NV_CONST 29 | #endif 30 | 31 | // Define __FUNC__ properly. 32 | #if __STDC_VERSION__ < 199901L 33 | # if __GNUC__ >= 2 34 | # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ 35 | # else 36 | # define __FUNC__ "" 37 | # endif 38 | #else 39 | # define __FUNC__ __PRETTY_FUNCTION__ 40 | #endif 41 | 42 | #define restrict __restrict__ 43 | 44 | 45 | // Type definitions 46 | typedef unsigned char uint8; 47 | typedef signed char int8; 48 | 49 | typedef unsigned short uint16; 50 | typedef signed short int16; 51 | 52 | typedef unsigned int uint32; 53 | typedef signed int int32; 54 | 55 | typedef unsigned long long uint64; 56 | typedef signed long long int64; 57 | 58 | // Aliases 59 | typedef uint32 uint; 60 | -------------------------------------------------------------------------------- /libs/nvtt/nvcore/DefsVcWin32.h: -------------------------------------------------------------------------------- 1 | #ifndef NV_CORE_H 2 | #error "Do not include this file directly." 3 | #endif 4 | 5 | // Function linkage 6 | #define DLL_IMPORT __declspec(dllimport) 7 | #define DLL_EXPORT __declspec(dllexport) 8 | #define DLL_EXPORT_CLASS DLL_EXPORT 9 | 10 | // Function calling modes 11 | #define NV_CDECL __cdecl 12 | #define NV_STDCALL __stdcall 13 | #define NV_FASTCALL __fastcall 14 | #define NV_FORCEINLINE __forceinline 15 | #define NV_DEPRECATED 16 | 17 | #define NV_PURE 18 | #define NV_CONST 19 | 20 | // Set standard function names. 21 | #if _MSC_VER < 1900 22 | # define snprintf _snprintf 23 | #endif 24 | #if _MSC_VER < 1500 25 | # define vsnprintf _vsnprintf 26 | #endif 27 | #define vsscanf _vsscanf 28 | #define chdir _chdir 29 | #define getcwd _getcwd 30 | 31 | #if _MSC_VER < 1800 32 | # define va_copy(a, b) a = b 33 | #endif 34 | 35 | #if !defined restrict 36 | #define restrict 37 | #endif 38 | 39 | // Ignore gcc attributes. 40 | #define __attribute__(X) 41 | 42 | #if !defined __FUNC__ 43 | #define __FUNC__ __FUNCTION__ 44 | #endif 45 | 46 | 47 | // Type definitions 48 | typedef unsigned char uint8; 49 | typedef signed char int8; 50 | 51 | typedef unsigned short uint16; 52 | typedef signed short int16; 53 | 54 | typedef unsigned int uint32; 55 | typedef signed int int32; 56 | 57 | typedef unsigned __int64 uint64; 58 | typedef signed __int64 int64; 59 | 60 | // Aliases 61 | typedef uint32 uint; 62 | 63 | 64 | // Unwanted VC++ warnings to disable. 65 | /* 66 | #pragma warning(disable : 4244) // conversion to float, possible loss of data 67 | #pragma warning(disable : 4245) // conversion from 'enum ' to 'unsigned long', signed/unsigned mismatch 68 | #pragma warning(disable : 4100) // unreferenced formal parameter 69 | #pragma warning(disable : 4514) // unreferenced inline function has been removed 70 | #pragma warning(disable : 4710) // inline function not expanded 71 | #pragma warning(disable : 4127) // Conditional expression is constant 72 | #pragma warning(disable : 4305) // truncation from 'const double' to 'float' 73 | #pragma warning(disable : 4505) // unreferenced local function has been removed 74 | 75 | #pragma warning(disable : 4702) // unreachable code in inline expanded function 76 | #pragma warning(disable : 4711) // function selected for automatic inlining 77 | #pragma warning(disable : 4725) // Pentium fdiv bug 78 | 79 | #pragma warning(disable : 4786) // Identifier was truncated and cannot be debugged. 80 | 81 | #pragma warning(disable : 4675) // resolved overload was found by argument-dependent lookup 82 | */ 83 | -------------------------------------------------------------------------------- /libs/nvtt/nvcore/TextWriter.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NVCORE_TEXTWRITER_H 4 | #define NVCORE_TEXTWRITER_H 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace nv 11 | { 12 | 13 | /// Text writer. 14 | class NVCORE_CLASS TextWriter 15 | { 16 | public: 17 | 18 | TextWriter(Stream * s); 19 | 20 | void writeString(const char * str); 21 | void writeString(const char * str, uint len); 22 | void write(const char * format, ...) __attribute__((format (printf, 2, 3))); 23 | void write(const char * format, va_list arg); 24 | 25 | private: 26 | 27 | Stream * s; 28 | 29 | // Temporary string. 30 | StringBuilder str; 31 | 32 | }; 33 | 34 | 35 | inline TextWriter & operator<<( TextWriter & tw, int i) 36 | { 37 | tw.write("%d", i); 38 | return tw; 39 | } 40 | 41 | inline TextWriter & operator<<( TextWriter & tw, uint i) 42 | { 43 | tw.write("%u", i); 44 | return tw; 45 | } 46 | 47 | inline TextWriter & operator<<( TextWriter & tw, float f) 48 | { 49 | tw.write("%f", f); 50 | return tw; 51 | } 52 | 53 | inline TextWriter & operator<<( TextWriter & tw, const char * str) 54 | { 55 | tw.writeString(str); 56 | return tw; 57 | } 58 | 59 | } // nv namespace 60 | 61 | 62 | 63 | 64 | 65 | #endif // NVCORE_TEXTWRITER_H 66 | -------------------------------------------------------------------------------- /libs/nvtt/nvimage/ColorBlock.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_IMAGE_COLORBLOCK_H 4 | #define NV_IMAGE_COLORBLOCK_H 5 | 6 | #include 7 | 8 | namespace nv 9 | { 10 | class Image; 11 | 12 | /// Uncompressed 4x4 color block. 13 | struct ColorBlock 14 | { 15 | ColorBlock(); 16 | ColorBlock(const uint * linearImage); 17 | ColorBlock(const ColorBlock & block); 18 | ColorBlock(const Image * img, uint x, uint y); 19 | 20 | void init(const Image * img, uint x, uint y); 21 | 22 | void swizzleDXT5n(); 23 | void splatX(); 24 | void splatY(); 25 | 26 | bool isSingleColor() const; 27 | uint countUniqueColors() const; 28 | Color32 averageColor() const; 29 | bool hasAlpha() const; 30 | 31 | void diameterRange(Color32 * start, Color32 * end) const; 32 | void luminanceRange(Color32 * start, Color32 * end) const; 33 | void boundsRange(Color32 * start, Color32 * end) const; 34 | void boundsRangeAlpha(Color32 * start, Color32 * end) const; 35 | 36 | void sortColorsByAbsoluteValue(); 37 | 38 | void computeRange(const Vector3 & axis, Color32 * start, Color32 * end) const; 39 | void sortColors(const Vector3 & axis); 40 | 41 | float volume() const; 42 | 43 | // Accessors 44 | const Color32 * colors() const; 45 | 46 | Color32 color(uint i) const; 47 | Color32 & color(uint i); 48 | 49 | Color32 color(uint x, uint y) const; 50 | Color32 & color(uint x, uint y); 51 | 52 | private: 53 | 54 | Color32 m_color[4*4]; 55 | 56 | }; 57 | 58 | 59 | /// Get pointer to block colors. 60 | inline const Color32 * ColorBlock::colors() const 61 | { 62 | return m_color; 63 | } 64 | 65 | /// Get block color. 66 | inline Color32 ColorBlock::color(uint i) const 67 | { 68 | nvDebugCheck(i < 16); 69 | return m_color[i]; 70 | } 71 | 72 | /// Get block color. 73 | inline Color32 & ColorBlock::color(uint i) 74 | { 75 | nvDebugCheck(i < 16); 76 | return m_color[i]; 77 | } 78 | 79 | /// Get block color. 80 | inline Color32 ColorBlock::color(uint x, uint y) const 81 | { 82 | nvDebugCheck(x < 4 && y < 4); 83 | return m_color[y * 4 + x]; 84 | } 85 | 86 | /// Get block color. 87 | inline Color32 & ColorBlock::color(uint x, uint y) 88 | { 89 | nvDebugCheck(x < 4 && y < 4); 90 | return m_color[y * 4 + x]; 91 | } 92 | 93 | } // nv namespace 94 | 95 | #endif // NV_IMAGE_COLORBLOCK_H 96 | -------------------------------------------------------------------------------- /libs/nvtt/nvimage/Image.cpp: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | #if !UMODEL 10 | #include 11 | #endif 12 | 13 | 14 | using namespace nv; 15 | 16 | static_assert(sizeof(Color32) == Image::Color32_Size, "Wrong Color32 size!"); 17 | 18 | Image::Image() : m_width(0), m_height(0), m_format(Format_RGB), m_data(NULL) 19 | { 20 | } 21 | 22 | Image::Image(const Image & img) : m_data(NULL) 23 | { 24 | allocate(img.m_width, img.m_height); 25 | m_format = img.m_format; 26 | memcpy(m_data, img.m_data, sizeof(Color32) * m_width * m_height); 27 | } 28 | 29 | Image::~Image() 30 | { 31 | free(); 32 | } 33 | 34 | const Image & Image::operator=(const Image & img) 35 | { 36 | allocate(img.m_width, img.m_height); 37 | m_format = img.m_format; 38 | memcpy(m_data, img.m_data, sizeof(Color32) * m_width * m_height); 39 | return *this; 40 | } 41 | 42 | 43 | void Image::allocate(uint w, uint h) 44 | { 45 | m_width = w; 46 | m_height = h; 47 | m_data = (Color32 *)realloc(m_data, w * h * sizeof(Color32)); 48 | } 49 | 50 | #if !UMODEL 51 | bool Image::load(const char * name) 52 | { 53 | free(); 54 | 55 | AutoPtr img(ImageIO::load(name)); 56 | if (img == NULL) { 57 | return false; 58 | } 59 | 60 | swap(m_width, img->m_width); 61 | swap(m_height, img->m_height); 62 | swap(m_format, img->m_format); 63 | swap(m_data, img->m_data); 64 | 65 | return true; 66 | } 67 | #endif 68 | 69 | void Image::wrap(void * data, uint w, uint h) 70 | { 71 | free(); 72 | m_data = (Color32 *)data; 73 | m_width = w; 74 | m_height = h; 75 | } 76 | 77 | void Image::unwrap() 78 | { 79 | m_data = NULL; 80 | m_width = 0; 81 | m_height = 0; 82 | } 83 | 84 | 85 | void Image::free() 86 | { 87 | ::free(m_data); 88 | m_data = NULL; 89 | } 90 | 91 | 92 | const Color32 * Image::scanline(uint h) const 93 | { 94 | nvDebugCheck(h < m_height); 95 | return m_data + h * m_width; 96 | } 97 | 98 | Color32 * Image::scanline(uint h) 99 | { 100 | nvDebugCheck(h < m_height); 101 | return m_data + h * m_width; 102 | } 103 | 104 | void Image::setFormat(Image::Format f) 105 | { 106 | m_format = f; 107 | } 108 | 109 | void Image::fill(Color32 c) 110 | { 111 | const uint size = m_width * m_height; 112 | for (uint i = 0; i < size; ++i) 113 | { 114 | m_data[i] = c; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /libs/nvtt/nvimage/Image.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_IMAGE_IMAGE_H 4 | #define NV_IMAGE_IMAGE_H 5 | 6 | #include 7 | #include 8 | 9 | namespace nv 10 | { 11 | class Color32; 12 | 13 | /// 32 bit RGBA image. 14 | class NVIMAGE_CLASS Image 15 | { 16 | public: 17 | 18 | enum { Color32_Size = 4 }; 19 | 20 | enum Format 21 | { 22 | Format_RGB, 23 | Format_ARGB, 24 | }; 25 | 26 | Image(); 27 | Image(const Image & img); 28 | ~Image(); 29 | 30 | const Image & operator=(const Image & img); 31 | 32 | 33 | void allocate(uint w, uint h); 34 | bool load(const char * name); 35 | 36 | void wrap(void * data, uint w, uint h); 37 | void unwrap(); 38 | 39 | NV_FORCEINLINE uint width() const 40 | { 41 | return m_width; 42 | } 43 | NV_FORCEINLINE uint height() const 44 | { 45 | return m_height; 46 | } 47 | 48 | const Color32 * scanline(uint h) const; 49 | Color32 * scanline(uint h); 50 | 51 | NV_FORCEINLINE const Color32 * pixels() const 52 | { 53 | return m_data; 54 | } 55 | NV_FORCEINLINE Color32 * pixels() 56 | { 57 | return m_data; 58 | } 59 | 60 | NV_FORCEINLINE const Color32 & pixel(uint idx) const 61 | { 62 | nvDebugCheck(idx < m_width * m_height); 63 | // Work with undefined Color32 64 | // return m_data[idx]; 65 | return *(Color32*) ((char*)m_data + idx * Color32_Size); 66 | } 67 | NV_FORCEINLINE Color32 & pixel(uint idx) 68 | { 69 | nvDebugCheck(idx < m_width * m_height); 70 | // Work with undefined Color32 71 | // return m_data[idx]; 72 | return *(Color32*) ((char*)m_data + idx * Color32_Size); 73 | } 74 | 75 | const Color32 & pixel(uint x, uint y) const; 76 | Color32 & pixel(uint x, uint y); 77 | 78 | NV_FORCEINLINE Format format() const 79 | { 80 | return m_format; 81 | } 82 | void setFormat(Format f); 83 | 84 | void fill(Color32 c); 85 | 86 | private: 87 | void free(); 88 | 89 | private: 90 | uint m_width; 91 | uint m_height; 92 | Format m_format; 93 | Color32 * m_data; 94 | }; 95 | 96 | 97 | inline const Color32 & Image::pixel(uint x, uint y) const 98 | { 99 | nvDebugCheck(x < width() && y < height()); 100 | return pixel(y * width() + x); 101 | } 102 | 103 | inline Color32 & Image::pixel(uint x, uint y) 104 | { 105 | nvDebugCheck(x < width() && y < height()); 106 | return pixel(y * width() + x); 107 | } 108 | 109 | } // nv namespace 110 | 111 | 112 | #endif // NV_IMAGE_IMAGE_H 113 | -------------------------------------------------------------------------------- /libs/nvtt/nvimage/PixelFormat.h: -------------------------------------------------------------------------------- 1 | // Copyright NVIDIA Corporation 2007 -- Ignacio Castano 2 | // 3 | // Permission is hereby granted, free of charge, to any person 4 | // obtaining a copy of this software and associated documentation 5 | // files (the "Software"), to deal in the Software without 6 | // restriction, including without limitation the rights to use, 7 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following 10 | // conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be 13 | // included in all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | // OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #ifndef NV_IMAGE_PIXELFORMAT_H 25 | #define NV_IMAGE_PIXELFORMAT_H 26 | 27 | #include 28 | 29 | 30 | namespace nv 31 | { 32 | namespace PixelFormat 33 | { 34 | 35 | // Convert component @a c having @a inbits to the returned value having @a outbits. 36 | inline uint convert(uint c, uint inbits, uint outbits) 37 | { 38 | if (inbits == 0) 39 | { 40 | return 0; 41 | } 42 | else if (inbits >= outbits) 43 | { 44 | // truncate 45 | return c >> (inbits - outbits); 46 | } 47 | else 48 | { 49 | // bitexpand 50 | return (c << (outbits - inbits)) | convert(c, inbits, outbits - inbits); 51 | } 52 | } 53 | 54 | // Get pixel component shift and size given its mask. 55 | inline void maskShiftAndSize(uint mask, uint * shift, uint * size) 56 | { 57 | if (!mask) 58 | { 59 | *shift = 0; 60 | *size = 0; 61 | return; 62 | } 63 | 64 | *shift = 0; 65 | while((mask & 1) == 0) { 66 | ++(*shift); 67 | mask >>= 1; 68 | } 69 | 70 | *size = 0; 71 | while((mask & 1) == 1) { 72 | ++(*size); 73 | mask >>= 1; 74 | } 75 | } 76 | 77 | } // PixelFormat namespace 78 | 79 | } // nv namespace 80 | 81 | 82 | #endif // NV_IMAGE_PIXELFORMAT_H 83 | -------------------------------------------------------------------------------- /libs/nvtt/nvimage/nvimage.h: -------------------------------------------------------------------------------- 1 | // This code is in the public domain -- castanyo@yahoo.es 2 | 3 | #ifndef NV_IMAGE_H 4 | #define NV_IMAGE_H 5 | 6 | #include 7 | 8 | // Function linkage 9 | #if NVIMAGE_SHARED 10 | #ifdef NVIMAGE_EXPORTS 11 | #define NVIMAGE_API DLL_EXPORT 12 | #define NVIMAGE_CLASS DLL_EXPORT_CLASS 13 | #else 14 | #define NVIMAGE_API DLL_IMPORT 15 | #define NVIMAGE_CLASS DLL_IMPORT 16 | #endif 17 | #else 18 | #define NVIMAGE_API 19 | #define NVIMAGE_CLASS 20 | #endif 21 | 22 | #endif // NV_IMAGE_H 23 | -------------------------------------------------------------------------------- /libs/nvtt/nvmath/Matrix.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/libs/nvtt/nvmath/Matrix.h -------------------------------------------------------------------------------- /libs/oodle/README.md: -------------------------------------------------------------------------------- 1 | This directory contains SDK for oodle. It could be obtained from the Unreal Engine 4.27 or newer source code repository. 2 | 3 | The directory structure should appear like this: 4 | 5 | ``` 6 | ├── include # header files from oodle SDK 7 | ├── lib # library files from oodle SDK 8 | │ ├── Linux 9 | │ ├── Mac 10 | │ ├── Win32 11 | │ └── Win64 12 | └── README.md # this file 13 | ``` 14 | 15 | You may use symlink to provide the following directories here, or simply copy the required files here. In a case the SDK is 16 | not available for the platform you're working with, the oodle support will be automatically disabled. 17 | -------------------------------------------------------------------------------- /libs/oodle/oodle.project: -------------------------------------------------------------------------------- 1 | # perl highlighting 2 | 3 | OODLE_LIB= 4 | OODLE_LIB_FILE= 5 | OODLE_LIB_PATH= 6 | 7 | !if "$COMPILER" eq "VisualC" 8 | !if "$PLATFORM" eq "win32" 9 | OODLE_LIB_PATH=lib/Win32 10 | OODLE_LIB_FILE=oo2core_win32.lib 11 | !else 12 | OODLE_LIB_PATH=lib/Win64 13 | OODLE_LIB_FILE=oo2core_win64.lib 14 | !endif 15 | !else 16 | !if "$PLATFORM" ne "osx" 17 | # Linux 18 | !if "$PLATFORM" eq "unix64" 19 | OODLE_LIB_PATH=lib/Linux 20 | OODLE_LIB_FILE=liboo2corelinux64.a 21 | !else 22 | # there's no .a file for 32-bit linux 23 | !endif 24 | !else 25 | # MacOS 26 | OODLE_LIB_PATH=lib/Mac 27 | OODLE_LIB_FILE=liboo2coremac64.a 28 | !endif 29 | !endif 30 | 31 | !if "$OODLE_LIB_FILE" ne "" 32 | # Append the library path 33 | OODLE_LIB=$R/libs/oodle/$OODLE_LIB_PATH/$OODLE_LIB_FILE 34 | # Verify if oodle SDK exists here 35 | !if ! -e "$OODLE_LIB" 36 | !message $OODLE_LIB doesn't exist 37 | OODLE_LIB= 38 | !endif 39 | !else 40 | !message Info: the selected platform doesn't have oodle SDK support. 41 | !endif 42 | 43 | !if "$OODLE_LIB" ne "" 44 | DEFINES += HAS_OODLE 45 | LIBINCLUDES += $R/libs/oodle/include 46 | LIBRARIES += $R/libs/oodle/$OODLE_LIB_PATH 47 | STDLIBS += $OODLE_LIB_FILE 48 | !if "$COMPILER" eq "VisualC" 49 | # Ensure compatible CRT will be used when linking with Win32 Oodle static libraries 50 | LINKFLAGS += -NODEFAULTLIB:msvcrt 51 | # Use static CRT for release Windows builds without use of MSVCRT.dll 52 | LIBC = static 53 | !endif 54 | !endif 55 | -------------------------------------------------------------------------------- /libs/rijndael/readme.txt: -------------------------------------------------------------------------------- 1 | The code is taken from http://www.efgh.com/software/rijndael.htm 2 | UE4 uses the same code (just reformatted to comply with UE4 coding standard) 3 | -------------------------------------------------------------------------------- /libs/rijndael/rijndael.h: -------------------------------------------------------------------------------- 1 | #ifndef H__RIJNDAEL 2 | #define H__RIJNDAEL 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | int rijndaelSetupEncrypt(unsigned long *rk, const unsigned char *key, 9 | int keybits); 10 | int rijndaelSetupDecrypt(unsigned long *rk, const unsigned char *key, 11 | int keybits); 12 | void rijndaelEncrypt(const unsigned long *rk, int nrounds, 13 | const unsigned char plaintext[16], unsigned char ciphertext[16]); 14 | void rijndaelDecrypt(const unsigned long *rk, int nrounds, 15 | const unsigned char ciphertext[16], unsigned char plaintext[16]); 16 | 17 | #define KEYLENGTH(keybits) ((keybits)/8) 18 | #define RKLENGTH(keybits) ((keybits)/8+28) 19 | #define NROUNDS(keybits) ((keybits)/32+6) 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif // H__RIJNDAEL 26 | -------------------------------------------------------------------------------- /libs/tracy/TracyClient.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Tracy profiler 3 | // ---------------- 4 | // 5 | // For fast integration, compile and 6 | // link with this source file (and none 7 | // other) in your executable (or in the 8 | // main DLL / shared object on multi-DLL 9 | // projects). 10 | // 11 | 12 | // Define TRACY_ENABLE to enable profiler. 13 | 14 | #include "common/TracySystem.cpp" 15 | 16 | #ifdef TRACY_ENABLE 17 | 18 | #ifdef _MSC_VER 19 | # pragma warning(push, 0) 20 | #endif 21 | 22 | #include "common/tracy_lz4.cpp" 23 | #include "client/TracyProfiler.cpp" 24 | #include "client/TracyCallstack.cpp" 25 | #include "client/TracySysTime.cpp" 26 | #include "client/TracySysTrace.cpp" 27 | #include "common/TracySocket.cpp" 28 | #include "client/tracy_rpmalloc.cpp" 29 | #include "client/TracyDxt1.cpp" 30 | 31 | #if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 3 || TRACY_HAS_CALLSTACK == 4 || TRACY_HAS_CALLSTACK == 6 32 | # include "libbacktrace/alloc.cpp" 33 | # include "libbacktrace/dwarf.cpp" 34 | # include "libbacktrace/fileline.cpp" 35 | # include "libbacktrace/mmapio.cpp" 36 | # include "libbacktrace/posix.cpp" 37 | # include "libbacktrace/sort.cpp" 38 | # include "libbacktrace/state.cpp" 39 | # if TRACY_HAS_CALLSTACK == 4 40 | # include "libbacktrace/macho.cpp" 41 | # else 42 | # include "libbacktrace/elf.cpp" 43 | # endif 44 | #endif 45 | 46 | #ifdef _MSC_VER 47 | # pragma comment(lib, "ws2_32.lib") 48 | # pragma comment(lib, "dbghelp.lib") 49 | # pragma warning(pop) 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /libs/tracy/client/TracyCallstack.h: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYCALLSTACK_H__ 2 | #define __TRACYCALLSTACK_H__ 3 | 4 | #if !defined _WIN32 && !defined __CYGWIN__ 5 | # include 6 | #endif 7 | 8 | #if defined _WIN32 || defined __CYGWIN__ 9 | # define TRACY_HAS_CALLSTACK 1 10 | #elif defined __ANDROID__ 11 | # if !defined __arm__ || __ANDROID_API__ >= 21 12 | # define TRACY_HAS_CALLSTACK 2 13 | # else 14 | # define TRACY_HAS_CALLSTACK 5 15 | # endif 16 | #elif defined __linux 17 | # if defined _GNU_SOURCE && defined __GLIBC__ 18 | # define TRACY_HAS_CALLSTACK 3 19 | # else 20 | # define TRACY_HAS_CALLSTACK 2 21 | # endif 22 | #elif defined __APPLE__ 23 | # define TRACY_HAS_CALLSTACK 4 24 | #elif defined BSD 25 | # define TRACY_HAS_CALLSTACK 6 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /libs/tracy/client/TracyDxt1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYDXT1_HPP__ 2 | #define __TRACYDXT1_HPP__ 3 | 4 | namespace tracy 5 | { 6 | 7 | void CompressImageDxt1( const char* src, char* dst, int w, int h ); 8 | 9 | } 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /libs/tracy/client/TracySysTime.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYSYSTIME_HPP__ 2 | #define __TRACYSYSTIME_HPP__ 3 | 4 | #if defined _WIN32 || defined __CYGWIN__ || defined __linux__ || defined __APPLE__ 5 | # define TRACY_HAS_SYSTIME 6 | #else 7 | # include 8 | #endif 9 | 10 | #ifdef BSD 11 | # define TRACY_HAS_SYSTIME 12 | #endif 13 | 14 | #ifdef TRACY_HAS_SYSTIME 15 | 16 | #include 17 | 18 | namespace tracy 19 | { 20 | 21 | class SysTime 22 | { 23 | public: 24 | SysTime(); 25 | float Get(); 26 | 27 | void ReadTimes(); 28 | 29 | private: 30 | uint64_t idle, used; 31 | }; 32 | 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /libs/tracy/client/TracySysTrace.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYSYSTRACE_HPP__ 2 | #define __TRACYSYSTRACE_HPP__ 3 | 4 | #if !defined TRACY_NO_SYSTEM_TRACING && ( defined _WIN32 || defined __CYGWIN__ || defined __linux__ ) 5 | # define TRACY_HAS_SYSTEM_TRACING 6 | #endif 7 | 8 | #ifdef TRACY_HAS_SYSTEM_TRACING 9 | 10 | #include 11 | 12 | namespace tracy 13 | { 14 | 15 | bool SysTraceStart( int64_t& samplingPeriod ); 16 | void SysTraceStop(); 17 | void SysTraceWorker( void* ptr ); 18 | 19 | void SysTraceSendExternalName( uint64_t thread ); 20 | 21 | } 22 | 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /libs/tracy/client/TracyThread.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYTHREAD_HPP__ 2 | #define __TRACYTHREAD_HPP__ 3 | 4 | #if defined _WIN32 || defined __CYGWIN__ 5 | # include 6 | #else 7 | # include 8 | #endif 9 | 10 | #ifdef TRACY_MANUAL_LIFETIME 11 | # include "tracy_rpmalloc.hpp" 12 | #endif 13 | 14 | namespace tracy 15 | { 16 | 17 | class ThreadExitHandler 18 | { 19 | public: 20 | ~ThreadExitHandler() 21 | { 22 | #ifdef TRACY_MANUAL_LIFETIME 23 | rpmalloc_thread_finalize(); 24 | #endif 25 | } 26 | }; 27 | 28 | #if defined _WIN32 || defined __CYGWIN__ 29 | 30 | class Thread 31 | { 32 | public: 33 | Thread( void(*func)( void* ptr ), void* ptr ) 34 | : m_func( func ) 35 | , m_ptr( ptr ) 36 | , m_hnd( CreateThread( nullptr, 0, Launch, this, 0, nullptr ) ) 37 | {} 38 | 39 | ~Thread() 40 | { 41 | WaitForSingleObject( m_hnd, INFINITE ); 42 | CloseHandle( m_hnd ); 43 | } 44 | 45 | HANDLE Handle() const { return m_hnd; } 46 | 47 | private: 48 | static DWORD WINAPI Launch( void* ptr ) { ((Thread*)ptr)->m_func( ((Thread*)ptr)->m_ptr ); return 0; } 49 | 50 | void(*m_func)( void* ptr ); 51 | void* m_ptr; 52 | HANDLE m_hnd; 53 | }; 54 | 55 | #else 56 | 57 | class Thread 58 | { 59 | public: 60 | Thread( void(*func)( void* ptr ), void* ptr ) 61 | : m_func( func ) 62 | , m_ptr( ptr ) 63 | { 64 | pthread_create( &m_thread, nullptr, Launch, this ); 65 | } 66 | 67 | ~Thread() 68 | { 69 | pthread_join( m_thread, nullptr ); 70 | } 71 | 72 | pthread_t Handle() const { return m_thread; } 73 | 74 | private: 75 | static void* Launch( void* ptr ) { ((Thread*)ptr)->m_func( ((Thread*)ptr)->m_ptr ); return nullptr; } 76 | void(*m_func)( void* ptr ); 77 | void* m_ptr; 78 | pthread_t m_thread; 79 | }; 80 | 81 | #endif 82 | 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /libs/tracy/common/TracyAlign.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYALIGN_HPP__ 2 | #define __TRACYALIGN_HPP__ 3 | 4 | #include 5 | 6 | #include "TracyForceInline.hpp" 7 | 8 | namespace tracy 9 | { 10 | 11 | template 12 | tracy_force_inline T MemRead( const void* ptr ) 13 | { 14 | T val; 15 | memcpy( &val, ptr, sizeof( T ) ); 16 | return val; 17 | } 18 | 19 | template 20 | tracy_force_inline void MemWrite( void* ptr, T val ) 21 | { 22 | memcpy( ptr, &val, sizeof( T ) ); 23 | } 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /libs/tracy/common/TracyAlloc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYALLOC_HPP__ 2 | #define __TRACYALLOC_HPP__ 3 | 4 | #include 5 | 6 | #ifdef TRACY_ENABLE 7 | # include "../client/tracy_rpmalloc.hpp" 8 | #endif 9 | 10 | namespace tracy 11 | { 12 | 13 | static inline void* tracy_malloc( size_t size ) 14 | { 15 | #ifdef TRACY_ENABLE 16 | return rpmalloc( size ); 17 | #else 18 | return malloc( size ); 19 | #endif 20 | } 21 | 22 | static inline void tracy_free( void* ptr ) 23 | { 24 | #ifdef TRACY_ENABLE 25 | rpfree( ptr ); 26 | #else 27 | free( ptr ); 28 | #endif 29 | } 30 | 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /libs/tracy/common/TracyApi.h: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYAPI_H__ 2 | #define __TRACYAPI_H__ 3 | 4 | #if defined _WIN32 || defined __CYGWIN__ 5 | # if defined TRACY_EXPORTS 6 | # define TRACY_API __declspec(dllexport) 7 | # elif defined TRACY_IMPORTS 8 | # define TRACY_API __declspec(dllimport) 9 | # else 10 | # define TRACY_API 11 | # endif 12 | #else 13 | # define TRACY_API __attribute__((visibility("default"))) 14 | #endif 15 | 16 | #endif // __TRACYAPI_H__ 17 | -------------------------------------------------------------------------------- /libs/tracy/common/TracyForceInline.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYFORCEINLINE_HPP__ 2 | #define __TRACYFORCEINLINE_HPP__ 3 | 4 | #if defined(__GNUC__) 5 | # define tracy_force_inline __attribute__((always_inline)) inline 6 | #elif defined(_MSC_VER) 7 | # define tracy_force_inline __forceinline 8 | #else 9 | # define tracy_force_inline inline 10 | #endif 11 | 12 | #if defined(__GNUC__) 13 | # define tracy_no_inline __attribute__((noinline)) 14 | #elif defined(_MSC_VER) 15 | # define tracy_no_inline __declspec(noinline) 16 | #else 17 | # define tracy_no_inline 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /libs/tracy/common/TracyMutex.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYMUTEX_HPP__ 2 | #define __TRACYMUTEX_HPP__ 3 | 4 | #if defined _MSC_VER 5 | 6 | # include 7 | 8 | namespace tracy 9 | { 10 | using TracyMutex = std::shared_mutex; 11 | } 12 | 13 | #else 14 | 15 | #include 16 | 17 | namespace tracy 18 | { 19 | using TracyMutex = std::mutex; 20 | } 21 | 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /libs/tracy/common/TracySystem.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYSYSTEM_HPP__ 2 | #define __TRACYSYSTEM_HPP__ 3 | 4 | #include 5 | 6 | #include "TracyApi.h" 7 | 8 | namespace tracy 9 | { 10 | 11 | namespace detail 12 | { 13 | TRACY_API uint64_t GetThreadHandleImpl(); 14 | } 15 | 16 | #ifdef TRACY_ENABLE 17 | TRACY_API uint64_t GetThreadHandle(); 18 | #else 19 | static inline uint64_t GetThreadHandle() 20 | { 21 | return detail::GetThreadHandleImpl(); 22 | } 23 | #endif 24 | 25 | TRACY_API void SetThreadName( const char* name ); 26 | TRACY_API const char* GetThreadName( uint64_t id ); 27 | 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /libs/tracy/libbacktrace/LICENSE: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2016 Free Software Foundation, Inc. 2 | 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are 5 | # met: 6 | 7 | # (1) Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | 10 | # (2) Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in 12 | # the documentation and/or other materials provided with the 13 | # distribution. 14 | 15 | # (3) The name of the author may not be used to 16 | # endorse or promote products derived from this software without 17 | # specific prior written permission. 18 | 19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 23 | # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 28 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /libs/tracy/libbacktrace/config.h: -------------------------------------------------------------------------------- 1 | #include 2 | #if __WORDSIZE == 64 3 | # define BACKTRACE_ELF_SIZE 64 4 | #else 5 | # define BACKTRACE_ELF_SIZE 32 6 | #endif 7 | 8 | #define HAVE_DLFCN_H 1 9 | #define HAVE_FCNTL 1 10 | #define HAVE_INTTYPES_H 1 11 | #define HAVE_LSTAT 1 12 | #define HAVE_READLINK 1 13 | #define HAVE_DL_ITERATE_PHDR 1 14 | #define HAVE_ATOMIC_FUNCTIONS 1 15 | #define HAVE_DECL_STRNLEN 1 16 | 17 | #ifdef __APPLE__ 18 | # define HAVE_MACH_O_DYLD_H 1 19 | #elif defined BSD 20 | # define HAVE_KERN_PROC 1 21 | # define HAVE_KERN_PROC_ARGS 1 22 | #endif 23 | -------------------------------------------------------------------------------- /libs/tracy/libbacktrace/filenames.hpp: -------------------------------------------------------------------------------- 1 | /* btest.c -- Filename header for libbacktrace library 2 | Copyright (C) 2012-2018 Free Software Foundation, Inc. 3 | Written by Ian Lance Taylor, Google. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | (1) Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | (2) Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the 15 | distribution. 16 | 17 | (3) The name of the author may not be used to 18 | endorse or promote products derived from this software without 19 | specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 25 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. */ 32 | 33 | #ifndef GCC_VERSION 34 | # define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) 35 | #endif 36 | 37 | #if (GCC_VERSION < 2007) 38 | # define __attribute__(x) 39 | #endif 40 | 41 | #ifndef ATTRIBUTE_UNUSED 42 | # define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 43 | #endif 44 | 45 | #if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) 46 | # define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') 47 | # define HAS_DRIVE_SPEC(f) ((f)[0] != '\0' && (f)[1] == ':') 48 | # define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || HAS_DRIVE_SPEC(f)) 49 | #else 50 | # define IS_DIR_SEPARATOR(c) ((c) == '/') 51 | # define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) 52 | #endif 53 | -------------------------------------------------------------------------------- /libs/tracy/libbacktrace/state.cpp: -------------------------------------------------------------------------------- 1 | /* state.c -- Create the backtrace state. 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. 3 | Written by Ian Lance Taylor, Google. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | (1) Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | (2) Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the 15 | distribution. 16 | 17 | (3) The name of the author may not be used to 18 | endorse or promote products derived from this software without 19 | specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 25 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. */ 32 | 33 | #include "config.h" 34 | 35 | #include 36 | #include 37 | 38 | #include "backtrace.hpp" 39 | #include "internal.hpp" 40 | 41 | namespace tracy 42 | { 43 | 44 | /* Create the backtrace state. This will then be passed to all the 45 | other routines. */ 46 | 47 | struct backtrace_state * 48 | backtrace_create_state (const char *filename, int threaded, 49 | backtrace_error_callback error_callback, 50 | void *data) 51 | { 52 | struct backtrace_state init_state; 53 | struct backtrace_state *state; 54 | 55 | #ifndef HAVE_SYNC_FUNCTIONS 56 | if (threaded) 57 | { 58 | error_callback (data, "backtrace library does not support threads", 0); 59 | return NULL; 60 | } 61 | #endif 62 | 63 | memset (&init_state, 0, sizeof init_state); 64 | init_state.filename = filename; 65 | init_state.threaded = threaded; 66 | 67 | state = ((struct backtrace_state *) 68 | backtrace_alloc (&init_state, sizeof *state, error_callback, data)); 69 | if (state == NULL) 70 | return NULL; 71 | *state = init_state; 72 | 73 | return state; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /libs/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /package_lnx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | archive="umodel_linux.tar.gz" 3 | filelist="umodel readme.txt LICENSE.txt" 4 | 5 | for i in $filelist; do 6 | if [ ! -f $i ]; then 7 | echo "ERROR: unable to find \"$i\"" 8 | exit 1 9 | fi 10 | done 11 | 12 | rm -f $archive 13 | tar -cf - $filelist | gzip -f9 > $archive 14 | -------------------------------------------------------------------------------- /package_win32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | archive="umodel_win32.zip" 3 | filelist="umodel.exe umodel_64.exe readme.txt SDL2.dll SDL2_64.dll LICENSE.txt" 4 | 5 | # Build 32 and 64 bit executables 6 | ./build.sh || exit 1 7 | ./build.sh --64 || exit 1 8 | 9 | if grep -q -E "(PRIVATE BUILD)" umodel.exe; then 10 | echo "ERROR: this is a private build" 11 | exit 12 | fi 13 | 14 | if grep -q -E "(DEBUG BUILD)" umodel.exe; then 15 | echo "ERROR: this is a debug build" 16 | exit 17 | fi 18 | 19 | # Copy SDL2.dll locally 20 | cp libs/SDL2/x86/SDL2.dll . 21 | cp libs/SDL2/x64/SDL2.dll ./SDL2_64.dll 22 | 23 | # Verify for presence of all files 24 | for i in $filelist; do 25 | if [ ! -f $i ]; then 26 | echo "ERROR: unable to find \"$i\"" 27 | exit 1 28 | fi 29 | done 30 | 31 | # Create an archive 32 | rm -f $archive 33 | pkzipc -add $archive -level=9 $filelist 34 | 35 | # Remove SDL2.dll files, these are required only for packaging 36 | rm -f SDL2.dll SDL2_64.dll 37 | -------------------------------------------------------------------------------- /t.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd %~dp0 3 | bash test.sh %* 4 | -------------------------------------------------------------------------------- /umodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/umodel -------------------------------------------------------------------------------- /umodel.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gildor2/UEViewer/a0bfb468d42be831b126632fd8a0ae6b3614f981/umodel.exe --------------------------------------------------------------------------------