├── .gitignore ├── .gitmodules ├── .project.kdev4 ├── LICENSE ├── Makefile ├── README.md ├── data ├── linux │ ├── builds-deps.sh │ └── setup-chroot.sh ├── macos │ ├── build-deps.sh │ ├── build.sh │ ├── bundle.py │ └── env.sh ├── mod-app ├── mod-app.desktop ├── mod-app.xml ├── mod-remote ├── mod-remote.desktop └── windows │ ├── README.txt │ ├── build-win32.sh │ ├── build-win64.sh │ ├── create-wineprefixes.sh │ ├── remote.py │ └── unzipfx-remote │ ├── .gitignore │ ├── Makefile.linux │ ├── Makefile.win32 │ ├── README │ ├── consts.h │ ├── crc32.c │ ├── crc32.h │ ├── crypt.c │ ├── crypt.h │ ├── ebcdic.h │ ├── extract.c │ ├── fileio.c │ ├── globals.c │ ├── globals.h │ ├── inflate.c │ ├── inflate.h │ ├── match.c │ ├── process.c │ ├── ttyio.c │ ├── ttyio.h │ ├── ubz2err.c │ ├── unix │ ├── unix.c │ └── unxcfg.h │ ├── unzip.c │ ├── unzip.h │ ├── unzipfx │ ├── appDetails.c │ └── appDetails.h │ ├── unzpriv.h │ ├── unzvers.h │ ├── win32 │ ├── nt.c │ ├── nt.h │ ├── w32cfg.h │ ├── win32.c │ └── win32i64.c │ ├── zip.h │ └── zipinfo.c ├── resources ├── 128x128 │ └── mod.png ├── 16x16 │ ├── application-exit.png │ ├── configure.png │ ├── dialog-information.png │ ├── document-new.png │ ├── document-open.png │ ├── document-save-as.png │ ├── document-save.png │ ├── ingen.png │ ├── media-playback-start.png │ ├── media-playback-stop.png │ ├── mod.png │ ├── network-connect.png │ ├── network-disconnect.png │ ├── system-search.png │ └── view-refresh.png ├── 24x24 │ └── mod.png ├── 256x256 │ └── mod.png ├── 32x32 │ └── mod.png ├── 48x48 │ ├── configure.png │ ├── folder.png │ ├── internet.png │ ├── jack.png │ ├── media-playback-start.png │ ├── mod.png │ └── network-connect.png ├── 64x64 │ └── mod.png ├── 96x96 │ └── mod.png ├── ico │ ├── mod.icns │ ├── mod.ico │ └── mod.rc ├── mod-splash.jpg ├── resources.qrc ├── scalable │ └── mod.svg └── ui │ ├── mod_connect.ui │ ├── mod_host.ui │ └── mod_settings.ui └── source ├── mod-app ├── mod-remote ├── mod_common.py ├── mod_host.py ├── mod_remote.py ├── mod_settings.py ├── modules └── README └── tests ├── lv2bundleinfo.py └── print-pedalboard-list.py /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.exe 3 | *.pyc 4 | *.zip 5 | .DS_Store 6 | .kdev4/ 7 | build/ 8 | 9 | source/mod_config.py 10 | source/resources_rc.py 11 | source/ui_*.py 12 | 13 | data/macos/MOD-*/ 14 | data/windows/MOD-*/ 15 | data/windows/python/ 16 | resources/raw/ 17 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "source/modules/mod-host"] 2 | path = source/modules/mod-host 3 | url = https://github.com/moddevices/mod-host.git 4 | [submodule "source/modules/mod-ui"] 5 | path = source/modules/mod-ui 6 | url = https://github.com/portalmod/mod-ui.git 7 | -------------------------------------------------------------------------------- /.project.kdev4: -------------------------------------------------------------------------------- 1 | [Project] 2 | Manager=KDevGenericManager 3 | Name=mod-app 4 | 5 | [Filters] 6 | Excludes=*/.*,*/*~,*/*.pyc,*/ui_*.py,*/__pycache__/,chroot/,*.a,*.dll,*.dylib,*.exe,*.o 7 | 8 | [Project] 9 | VersionControlSupport=kdevgit 10 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # Makefile for mod-app # 3 | # -------------------- # 4 | # Created by falkTX 5 | # 6 | 7 | # ---------------------------------------------------------------------------------------------------------------------------- 8 | 9 | PREFIX := /usr 10 | DESTDIR := 11 | 12 | # ---------------------------------------------------------------------------------------------------------------------------- 13 | # Set PyQt tools 14 | 15 | PYUIC4 ?= /usr/bin/pyuic4 16 | PYUIC5 ?= /usr/bin/pyuic5 17 | 18 | ifneq (,$(wildcard $(PYUIC4))) 19 | HAVE_PYQT4=true 20 | else 21 | HAVE_PYQT4=false 22 | endif 23 | 24 | ifneq (,$(wildcard $(PYUIC5))) 25 | HAVE_PYQT5=true 26 | else 27 | HAVE_PYQT5=false 28 | endif 29 | 30 | # ifneq ($(HAVE_PYQT4),true) 31 | ifneq ($(HAVE_PYQT5),true) 32 | $(error PyQt5 is not available, please install it) 33 | endif 34 | # endif 35 | 36 | ifeq ($(HAVE_PYQT5),true) 37 | PYUIC ?= pyuic5 38 | PYRCC ?= pyrcc5 39 | else 40 | PYUIC ?= pyuic4 -w 41 | PYRCC ?= pyrcc4 -py3 42 | endif 43 | 44 | # ---------------------------------------------------------------------------------------------------------------------------- 45 | 46 | all: RES UI host utils 47 | 48 | # ---------------------------------------------------------------------------------------------------------------------------- 49 | # Resources 50 | 51 | RES = \ 52 | source/resources_rc.py 53 | 54 | RES: $(RES) 55 | 56 | source/resources_rc.py: resources/resources.qrc resources/*/*.png # resources/*/*.svg 57 | $(PYRCC) $< -o $@ 58 | 59 | bin/resources/%.py: source/%.py 60 | $(LINK) $(CURDIR)/source/$*.py bin/resources/ 61 | 62 | # ---------------------------------------------------------------------------------------------------------------------------- 63 | # UI code 64 | 65 | UIs = \ 66 | source/ui_mod_connect.py \ 67 | source/ui_mod_pedalboard_open.py \ 68 | source/ui_mod_pedalboard_save.py \ 69 | source/ui_mod_host.py \ 70 | source/ui_mod_settings.py 71 | 72 | UI: $(UIs) 73 | 74 | source/ui_%.py: resources/ui/%.ui 75 | $(PYUIC) $< -o $@ 76 | 77 | # ---------------------------------------------------------------------------------------------------------------------------- 78 | # host (mod-host submodule, if present) 79 | 80 | ifneq (,$(wildcard source/modules/mod-host/Makefile)) 81 | host: source/modules/mod-host/mod-host 82 | else 83 | host: 84 | endif 85 | 86 | source/modules/mod-host/mod-host: source/modules/mod-host/src/*.c source/modules/mod-host/src/*.h 87 | $(MAKE) -C source/modules/mod-host 88 | 89 | # ---------------------------------------------------------------------------------------------------------------------------- 90 | # utils (from mod-ui, if present) 91 | 92 | ifneq (,$(wildcard source/modules/mod-ui/utils/Makefile)) 93 | utils: source/modules/mod-ui/utils/libmod_utils.so 94 | else 95 | utils: 96 | endif 97 | 98 | source/modules/mod-ui/utils/libmod_utils.so: source/modules/mod-ui/utils/*.cpp source/modules/mod-ui/utils/*.h 99 | $(MAKE) -C source/modules/mod-ui/utils 100 | 101 | # ---------------------------------------------------------------------------------------------------------------------------- 102 | 103 | clean: 104 | rm -f $(RES) $(UIs) 105 | rm -f *~ source/*~ source/*.pyc source/*_rc.py source/ui_*.py 106 | ifneq (,$(wildcard source/modules/mod-host/Makefile)) 107 | $(MAKE) clean -C source/modules/mod-host 108 | endif 109 | ifneq (,$(wildcard source/modules/mod-ui/utils/Makefile)) 110 | $(MAKE) clean -C source/modules/mod-ui/utils 111 | endif 112 | 113 | # ---------------------------------------------------------------------------------------------------------------------------- 114 | 115 | run: 116 | ./source/mod-app 117 | 118 | # ---------------------------------------------------------------------------------------------------------------------------- 119 | 120 | install: 121 | # Create directories 122 | install -d $(DESTDIR)$(PREFIX)/bin/ 123 | install -d $(DESTDIR)$(PREFIX)/share/applications/ 124 | install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/ 125 | install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/24x24/apps/ 126 | install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32/apps/ 127 | install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/ 128 | install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps/ 129 | install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/96x96/apps/ 130 | install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/ 131 | install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/ 132 | install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/ 133 | install -d $(DESTDIR)$(PREFIX)/share/mime/packages/ 134 | install -d $(DESTDIR)$(PREFIX)/share/mod-app/ 135 | 136 | # Install desktop files 137 | install -m 755 data/*.desktop $(DESTDIR)$(PREFIX)/share/applications/ 138 | 139 | # Install icons, 16x16 140 | install -m 644 resources/16x16/mod.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/ 141 | install -m 644 resources/24x24/mod.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/24x24/apps/ 142 | install -m 644 resources/32x32/mod.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32/apps/ 143 | install -m 644 resources/48x48/mod.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/ 144 | install -m 644 resources/64x64/mod.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps/ 145 | install -m 644 resources/96x96/mod.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/96x96/apps/ 146 | install -m 644 resources/128x128/mod.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/ 147 | install -m 644 resources/256x256/mod.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/ 148 | install -m 644 resources/scalable/mod.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/ 149 | 150 | # Install mime package 151 | install -m 644 data/mod-app.xml $(DESTDIR)$(PREFIX)/share/mime/packages/ 152 | 153 | # Install script files 154 | install -m 755 \ 155 | data/mod-app \ 156 | data/mod-remote \ 157 | $(DESTDIR)$(PREFIX)/bin/ 158 | 159 | # Install python code 160 | install -m 644 \ 161 | source/mod-app \ 162 | source/mod-remote \ 163 | source/*.py \ 164 | $(DESTDIR)$(PREFIX)/share/mod-app/ 165 | 166 | # Adjust PREFIX value in script files 167 | sed -i "s?X-PREFIX-X?$(PREFIX)?" \ 168 | $(DESTDIR)$(PREFIX)/bin/mod-app \ 169 | $(DESTDIR)$(PREFIX)/bin/mod-remote 170 | 171 | # ---------------------------------------------------------------------------------------------------------------------------- 172 | 173 | uninstall: 174 | rm -f $(DESTDIR)$(PREFIX)/bin/mod-app 175 | rm -f $(DESTDIR)$(PREFIX)/bin/mod-remote 176 | rm -f $(DESTDIR)$(PREFIX)/share/applications/mod-app.desktop 177 | rm -f $(DESTDIR)$(PREFIX)/share/applications/mod-remote.desktop 178 | rm -f $(DESTDIR)$(PREFIX)/share/mime/packages/mod-app.xml 179 | rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/mod.png 180 | rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/mod.svg 181 | rm -rf $(DESTDIR)$(PREFIX)/share/mod-app/ 182 | 183 | # ---------------------------------------------------------------------------------------------------------------------------- 184 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | mod-app 2 | ======= 3 | 4 | This is a work-in-progress desktop application of the MOD interface and backend, 5 | natively integrated in the OS (no external web browser needed). 6 | 7 | It requires `mod-host` and `mod-ui`, which you can either have installed system-wide or as part of the git submodules of this repository. 8 | 9 | Under Debian-based Linux distrbutions, you can run this to install all the dependencies: 10 | 11 | ``` 12 | sudo apt-get install jack-capture sndfile-tools liblilv-dev 13 | sudo apt-get install python3-pyqt5 python3-pyqt5.qtsvg python3-pyqt5.qtwebkit pyqt5-dev-tools 14 | sudo apt-get install python3-pil python3-pystache python3-serial python3-tornado 15 | ``` 16 | 17 | After you're done installing the dependencies, simply type: 18 | 19 | ``` 20 | make 21 | ``` 22 | 23 | To generate the necessary resource files to be able to run mod-app (and mod-remote). 24 | If you have git submodules enabled, it will also build `mod-host` and `mod-ui`. 25 | 26 | You can now run mod-app using: 27 | 28 | ``` 29 | make run 30 | ``` 31 | 32 | Binary builds will be available at a later date. 33 | 34 | 35 | mod-remote 36 | ========== 37 | 38 | This is a work-in-progress application that allows you to connect to a remote MOD device. 39 | The only required dependency for it is PyQt. 40 | -------------------------------------------------------------------------------- /data/linux/builds-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ------------------------------------------------------------------------------------ 4 | # function to build everything 5 | 6 | function build_all() { 7 | 8 | echo " 9 | set -e 10 | 11 | export HOME=/root 12 | export LANG=C 13 | unset LC_TIME 14 | 15 | export CC=gcc 16 | export CXX=g++ 17 | 18 | export CFLAGS=\"-O2 -mtune=generic -msse -msse2 -m64 -fPIC -DPIC\" 19 | export CXXFLAGS=\$CFLAGS 20 | export CPPFLAGS= 21 | export LDFLAGS=\"-m64\" 22 | 23 | export PREFIX=/opt/mod-app 24 | export PATH=\$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin 25 | export PKG_CONFIG_PATH=\$PREFIX/lib/pkgconfig 26 | 27 | mkdir -p /src 28 | cd /src 29 | 30 | # ------------------------------------------------------------------------------------ 31 | # pkgconfig 32 | 33 | if [ ! -d pkg-config-0.28 ]; then 34 | curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz 35 | tar -xf pkg-config-0.28.tar.gz 36 | fi 37 | 38 | if [ ! -f pkg-config-0.28/build-done ]; then 39 | cd pkg-config-0.28 40 | ./configure --with-internal-glib --with-pc-path=\$PKG_CONFIG_PATH --prefix=\$PREFIX 41 | make 42 | make install 43 | touch build-done 44 | cd .. 45 | fi 46 | 47 | # ------------------------------------------------------------------------------------ 48 | # lv2 (git) 49 | 50 | if [ ! -d lv2-git ]; then 51 | git clone http://lv2plug.in/git/lv2.git lv2-git 52 | fi 53 | 54 | if [ ! -f lv2-git/build-done ]; then 55 | cd lv2-git 56 | git pull 57 | ./waf clean || true 58 | ./waf configure --prefix=\$PREFIX --copy-headers --no-plugins 59 | ./waf build 60 | ./waf install 61 | touch build-done 62 | cd .. 63 | fi 64 | 65 | # ------------------------------------------------------------------------------------ 66 | # qt5-base 67 | 68 | if [ ! -d qtbase-opensource-src-5.4.1 ]; then 69 | curl -L http://download.qt-project.org/official_releases/qt/5.4/5.4.1/submodules/qtbase-opensource-src-5.4.1.tar.gz -o qtbase-opensource-src-5.4.1.tar.gz 70 | tar -xf qtbase-opensource-src-5.4.1.tar.gz 71 | fi 72 | 73 | if [ ! -f qtbase-opensource-src-5.4.1/build-done ]; then 74 | cd qtbase-opensource-src-5.4.1 75 | patch -p1 -i /fix-qt5-build.patch 76 | ./configure -release -shared -opensource -confirm-license -force-pkg-config \ 77 | -prefix \$PREFIX -plugindir \$PREFIX/lib/qt5/plugins -headerdir \$PREFIX/include/qt5 \ 78 | -reduce-relocations -plugin-sql-sqlite \ 79 | -xcb -opengl desktop -qpa xcb \ 80 | -qt-harfbuzz -qt-freetype -qt-libjpeg -qt-libpng -qt-pcre -qt-sql-sqlite -qt-zlib -qt-xcb -qt-xkbcommon \ 81 | -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -no-avx2 -no-mips_dsp -no-mips_dspr2 \ 82 | -no-cups -no-dbus -no-evdev -no-sm -no-iconv -no-glib -no-icu -no-gif -no-nis -no-openssl -no-pch -no-sql-ibase -no-sql-odbc \ 83 | -no-directfb -no-eglfs -no-qml-debug -no-separate-debug-info -no-rpath \ 84 | -no-compile-examples -nomake examples -nomake tests -make libs -make tools -v 85 | make -j 4 86 | make install 87 | touch build-done 88 | cd .. 89 | fi 90 | 91 | # ------------------------------------------------------------------------------------ 92 | # qt5-multimedia 93 | 94 | if [ ! -d qtmultimedia-opensource-src-5.4.1 ]; then 95 | curl -L http://download.qt-project.org/official_releases/qt/5.4/5.4.1/submodules/qtmultimedia-opensource-src-5.4.1.tar.gz -o qtmultimedia-opensource-src-5.4.1.tar.gz 96 | tar -xf qtmultimedia-opensource-src-5.4.1.tar.gz 97 | fi 98 | 99 | if [ ! -f qtmultimedia-opensource-src-5.4.1/build-done ]; then 100 | cd qtmultimedia-opensource-src-5.4.1 101 | qmake 102 | make -j 4 103 | sudo make install 104 | touch build-done 105 | cd .. 106 | fi 107 | 108 | # ------------------------------------------------------------------------------------ 109 | # qt5-svg 110 | 111 | if [ ! -d qtsvg-opensource-src-5.4.1 ]; then 112 | curl -L http://download.qt-project.org/official_releases/qt/5.4/5.4.1/submodules/qtsvg-opensource-src-5.4.1.tar.gz -o qtsvg-opensource-src-5.4.1.tar.gz 113 | tar -xf qtsvg-opensource-src-5.4.1.tar.gz 114 | fi 115 | 116 | if [ ! -f qtsvg-opensource-src-5.4.1/build-done ]; then 117 | cd qtsvg-opensource-src-5.4.1 118 | qmake 119 | make -j 2 120 | sudo make install 121 | touch build-done 122 | cd .. 123 | fi 124 | 125 | if [ ! -d qtwebkit-opensource-src-5.4.1 ]; then 126 | curl -L http://download.qt-project.org/official_releases/qt/5.4/5.4.1/submodules/qtwebkit-opensource-src-5.4.1.tar.gz -o qtwebkit-opensource-src-5.4.1.tar.gz 127 | tar -xf qtwebkit-opensource-src-5.4.1.tar.gz 128 | fi 129 | 130 | apt-get install ruby flex bison gperf 131 | #if [ ! -f qtwebkit-opensource-src-5.4.1/build-done ]; then 132 | cd qtwebkit-opensource-src-5.4.1 133 | export SQLITE3SRCDIR=/src/qtbase-opensource-src-5.4.1/src/3rdparty/sqlite/ 134 | qmake 135 | make -j 2 136 | sudo make install 137 | touch build-done 138 | unset SQLITE3SRCDIR 139 | cd .. 140 | #fi 141 | 142 | # ------------------------------------------------------------------------------------ 143 | # done 144 | " | sudo tee ./chroot/cmd 145 | 146 | sudo chroot ./chroot /bin/bash /cmd 147 | 148 | } 149 | 150 | # ------------------------------------------------------------------------------------ 151 | # stop on error 152 | 153 | set -e 154 | 155 | # ------------------------------------------------------------------------------------ 156 | # cd to correct path 157 | 158 | if [ -f Makefile ]; then 159 | cd data/linux 160 | fi 161 | 162 | # ------------------------------------------------------------------------------------ 163 | # patch to fix qt5 build 164 | 165 | echo " 166 | --- qtbase5-static-5.4.1.orig/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp 167 | +++ qtbase5-static-5.4.1/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp 168 | @@ -175,9 +175,11 @@ void QXcbConnection::xi2SetupDevices() 169 | case XIKeyClass: 170 | qCDebug(lcQpaXInputDevices) << \" it's a keyboard\"; 171 | break; 172 | +#ifdef XCB_USE_XINPUT22 173 | case XITouchClass: 174 | // will be handled in deviceForId() 175 | break; 176 | +#endif 177 | default: 178 | qCDebug(lcQpaXInputDevices) << \" has class\" << devices[i].classes[c]->type; 179 | break; 180 | " | sudo tee ./chroot/fix-qt5-build.patch 181 | 182 | # ------------------------------------------------------------------------------------ 183 | # build everything 184 | 185 | build_all 186 | 187 | # ------------------------------------------------------------------------------------ 188 | -------------------------------------------------------------------------------- /data/linux/setup-chroot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ------------------------------------------------------------------------------------ 4 | # function to run a command inside the chroot 5 | 6 | function run_chroot_cmd() { 7 | 8 | echo " 9 | export HOME=/root 10 | export LANG=C 11 | unset LC_TIME 12 | $@ 13 | " | sudo tee ./chroot/cmd 14 | 15 | sudo chroot ./chroot /bin/bash /cmd 16 | 17 | } 18 | 19 | # ------------------------------------------------------------------------------------ 20 | # stop on error 21 | 22 | set -e 23 | 24 | # ------------------------------------------------------------------------------------ 25 | # cd to correct path 26 | 27 | if [ -f Makefile ]; then 28 | cd data/linux 29 | fi 30 | 31 | # ------------------------------------------------------------------------------------ 32 | # check if already set up 33 | 34 | if [ -f ./chroot/chroot-done ]; then 35 | echo \ 36 | " 37 | chroot is already set up. 38 | Delete $(pwd)/chroot/chroot-done to start over. 39 | " 40 | exit 0 41 | else 42 | if [ -x chroot ]; then 43 | sudo mv chroot chroot_delete 44 | fi 45 | sudo rm -rf ./chroot_delete || true 46 | fi 47 | 48 | # ------------------------------------------------------------------------------------ 49 | # create the chroot 50 | 51 | sudo debootstrap --arch=amd64 lucid ./chroot http://archive.ubuntu.com/ubuntu/ 52 | 53 | # ------------------------------------------------------------------------------------ 54 | # enable network access 55 | 56 | sudo rm -f ./chroot/etc/hosts 57 | sudo rm -f ./chroot/etc/resolv.conf 58 | sudo cp /etc/resolv.conf /etc/hosts ./chroot/etc/ 59 | 60 | # ------------------------------------------------------------------------------------ 61 | # mount basic chroot points 62 | 63 | run_chroot_cmd mount -t devpts none /dev/pts 64 | run_chroot_cmd mount -t proc none /proc 65 | run_chroot_cmd mount -t sysfs none /sys 66 | 67 | # ------------------------------------------------------------------------------------ 68 | # fix upstart 69 | 70 | run_chroot_cmd dpkg-divert --local --rename --add /sbin/initctl 71 | run_chroot_cmd ln -s /bin/true /sbin/initctl 72 | run_chroot_cmd touch /etc/init.d/systemd-logind 73 | run_chroot_cmd touch /etc/init.d/modemmanager 74 | 75 | # ------------------------------------------------------------------------------------ 76 | # proper lucid repos + backports 77 | 78 | echo " 79 | deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse 80 | deb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse 81 | deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse 82 | deb http://security.ubuntu.com/ubuntu lucid-security main restricted universe multiverse 83 | " | sudo tee ./chroot/etc/apt/sources.list 84 | 85 | # ------------------------------------------------------------------------------------ 86 | # enable repo from which we'll install kxstudio-repos package 87 | 88 | mkdir -p ./chroot/etc/apt/sources.list.d 89 | echo "deb http://ppa.launchpad.net/kxstudio-debian/kxstudio/ubuntu lucid main" | sudo tee ./chroot/etc/apt/sources.list.d/kxstudio-repos-tmp.list 90 | 91 | # ------------------------------------------------------------------------------------ 92 | # enable kxstudio-repos 93 | 94 | run_chroot_cmd apt-get update 95 | run_chroot_cmd apt-get install kxstudio-repos kxstudio-repos-backports -y --force-yes 96 | 97 | # ------------------------------------------------------------------------------------ 98 | # enable toolchain 99 | 100 | echo "deb http://ppa.launchpad.net/kxstudio-debian/toolchain/ubuntu lucid main" | sudo tee -a ./chroot/etc/apt/sources.list.d/kxstudio-debian.list 101 | 102 | # ------------------------------------------------------------------------------------ 103 | # cleanup 104 | 105 | sudo rm ./chroot/etc/apt/sources.list.d/kxstudio-repos-tmp.list 106 | 107 | # ------------------------------------------------------------------------------------ 108 | # install updates 109 | 110 | run_chroot_cmd apt-get update 111 | run_chroot_cmd apt-get dist-upgrade -y 112 | 113 | # ------------------------------------------------------------------------------------ 114 | # now finally install all needed tools 115 | 116 | run_chroot_cmd apt-get install -y autotools-dev build-essential cmake premake git-core subversion 117 | run_chroot_cmd apt-get install -y libasound2-dev libjack-dev/lucid libjack0/lucid ladspa-sdk lv2-dev 118 | run_chroot_cmd apt-get install -y libosmesa6-dev libgl1-mesa-dev libglu1-mesa-dev 119 | run_chroot_cmd apt-get install -y libxinerama-dev libxi-dev libxrender-dev libxcomposite-dev libxcursor-dev 120 | run_chroot_cmd apt-get install -y libx11-dev libx11-xcb-dev xvfb 121 | run_chroot_cmd apt-get install -y libcups2-dev libdbus-1-dev 122 | run_chroot_cmd apt-get install -y libfontconfig1-dev libfreetype6-dev 123 | run_chroot_cmd apt-get install -y libglib2.0-dev libgtk2.0-dev 124 | run_chroot_cmd apt-get install -y ruby flex bison gperf 125 | 126 | # ------------------------------------------------------------------------------------ 127 | # done 128 | 129 | sudo touch ./chroot/chroot-done 130 | 131 | # ------------------------------------------------------------------------------------ 132 | -------------------------------------------------------------------------------- /data/macos/build-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ------------------------------------------------------------------------------------ 4 | # stop on error 5 | 6 | set -e 7 | 8 | # ------------------------------------------------------------------------------------ 9 | # check for needed binaries 10 | 11 | # TODO, check for binaries like /opt/local/bin/7z 12 | 13 | # ------------------------------------------------------------------------------------ 14 | # cd to correct path 15 | 16 | if [ -f Makefile ]; then 17 | cd data/macos 18 | fi 19 | 20 | # ------------------------------------------------------------------------------------ 21 | # setup for base libs 22 | 23 | export CC=gcc 24 | export CXX=g++ 25 | 26 | export CFLAGS="-O2 -mtune=generic -msse -msse2 -m64 -fPIC -DPIC" 27 | export CXXFLAGS=$CFLAGS 28 | export CPPFLAGS= 29 | export LDFLAGS="-m64" 30 | 31 | export PREFIX=/opt/mod-app 32 | export PATH=$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin 33 | export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig 34 | 35 | # ------------------------------------------------------------------------------------ 36 | # pkgconfig 37 | 38 | if [ ! -d pkg-config-0.28 ]; then 39 | curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz 40 | tar -xf pkg-config-0.28.tar.gz 41 | fi 42 | 43 | if [ ! -f pkg-config-0.28/build-done ]; then 44 | cd pkg-config-0.28 45 | ./configure --enable-indirect-deps --with-internal-glib --with-pc-path=$PKG_CONFIG_PATH --prefix=$PREFIX 46 | make 47 | sudo make install 48 | touch build-done 49 | cd .. 50 | fi 51 | 52 | # ------------------------------------------------------------------------------------ 53 | # lv2 (git) 54 | 55 | if [ ! -d lv2-git ]; then 56 | git clone http://lv2plug.in/git/lv2.git lv2-git 57 | fi 58 | 59 | if [ ! -f lv2-git/build-done ]; then 60 | cd lv2-git 61 | git pull 62 | ./waf clean || true 63 | ./waf configure --prefix=$PREFIX --copy-headers --no-plugins 64 | ./waf build 65 | sudo ./waf install 66 | touch build-done 67 | cd .. 68 | fi 69 | 70 | # ------------------------------------------------------------------------------------ 71 | # setup for advanced libs 72 | 73 | export CC=clang 74 | export CXX=clang 75 | 76 | export QMAKESPEC=macx-clang 77 | 78 | # ------------------------------------------------------------------------------------ 79 | # qt5-base 80 | 81 | if [ ! -d qtbase-opensource-src-5.4.1 ]; then 82 | curl -L http://download.qt-project.org/official_releases/qt/5.4/5.4.1/submodules/qtbase-opensource-src-5.4.1.tar.gz -o qtbase-opensource-src-5.4.1.tar.gz 83 | tar -xf qtbase-opensource-src-5.4.1.tar.gz 84 | fi 85 | 86 | if [ ! -f qtbase-opensource-src-5.4.1/build-done ]; then 87 | cd qtbase-opensource-src-5.4.1 88 | ./configure -release -shared -opensource -confirm-license -force-pkg-config -platform macx-clang -framework \ 89 | -prefix $PREFIX -plugindir $PREFIX/lib/qt5/plugins -headerdir $PREFIX/include/qt5 \ 90 | -qt-freetype -qt-libjpeg -qt-libpng -qt-pcre -qt-sql-sqlite -qt-zlib -opengl desktop -qpa cocoa \ 91 | -no-directfb -no-eglfs -no-kms -no-linuxfb -no-mtdev -no-xcb -no-xcb-xlib \ 92 | -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -no-avx2 -no-mips_dsp -no-mips_dspr2 \ 93 | -no-cups -no-dbus -no-evdev -no-fontconfig -no-harfbuzz -no-iconv -no-icu -no-gif -no-glib -no-nis -no-openssl -no-pch -no-sql-ibase -no-sql-odbc \ 94 | -no-audio-backend -no-qml-debug -no-separate-debug-info \ 95 | -no-compile-examples -nomake examples -nomake tests -make libs -make tools 96 | make -j 4 97 | sudo make install 98 | touch build-done 99 | cd .. 100 | fi 101 | 102 | # ------------------------------------------------------------------------------------ 103 | # qt5-multimedia 104 | 105 | ignore2() 106 | { 107 | 108 | if [ ! -d qtmultimedia-opensource-src-5.4.1 ]; then 109 | curl -L http://download.qt-project.org/official_releases/qt/5.4/5.4.1/submodules/qtmultimedia-opensource-src-5.4.1.tar.gz -o qtmultimedia-opensource-src-5.4.1.tar.gz 110 | tar -xf qtmultimedia-opensource-src-5.4.1.tar.gz 111 | fi 112 | 113 | if [ ! -f qtmultimedia-opensource-src-5.4.1/build-done ]; then 114 | cd qtmultimedia-opensource-src-5.4.1 115 | qmake 116 | make -j 4 117 | sudo make install 118 | touch build-done 119 | cd .. 120 | fi 121 | 122 | } 123 | 124 | # ------------------------------------------------------------------------------------ 125 | # qt5-webkit 126 | 127 | ignore3() 128 | { 129 | 130 | if [ ! -d qtwebkit-opensource-src-5.4.1 ]; then 131 | curl -L http://download.qt-project.org/official_releases/qt/5.4/5.4.1/submodules/qtwebkit-opensource-src-5.4.1.tar.gz -o qtwebkit-opensource-src-5.4.1.tar.gz 132 | tar -xf qtwebkit-opensource-src-5.4.1.tar.gz 133 | fi 134 | 135 | if [ ! -f qtwebkit-opensource-src-5.4.1/build-done ]; then 136 | cd qtwebkit-opensource-src-5.4.1 137 | qmake 138 | make -j 2 139 | sudo make install 140 | touch build-done 141 | cd .. 142 | fi 143 | 144 | } 145 | 146 | # ------------------------------------------------------------------------------------ 147 | # python 148 | 149 | if [ ! -d Python-3.4.3 ]; then 150 | curl -O https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz 151 | tar -xf Python-3.4.3.tgz 152 | fi 153 | 154 | if [ ! -f Python-3.4.3/build-done ]; then 155 | cd Python-3.4.3 156 | ./configure --prefix=$PREFIX 157 | make 158 | sudo make install 159 | touch build-done 160 | cd .. 161 | fi 162 | 163 | exit 0 164 | 165 | # ------------------------------------------------------------------------------------ 166 | # sip 167 | 168 | if [ ! -d sip-4.16.7 ]; then 169 | curl -L http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.7/sip-4.16.7.tar.gz -o sip-4.16.7.tar.gz 170 | tar -xf sip-4.16.7.tar.gz 171 | fi 172 | 173 | if [ ! -f sip-4.16.7/build-done ]; then 174 | cd sip-4.16.7 175 | python3 configure.py 176 | make 177 | sudo make install 178 | touch build-done 179 | cd .. 180 | fi 181 | -------------------------------------------------------------------------------- /data/macos/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | JOBS="-j 2" 6 | 7 | if [ ! -f Makefile ]; then 8 | cd ../.. 9 | fi 10 | 11 | export MACOS="true" 12 | export CXFREEZE="/opt/carla/bin/cxfreeze --include-modules=re,sip,subprocess,inspect" 13 | export DEFAULT_QT=5 14 | export PATH=/opt/carla/bin:/opt/carla64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin 15 | export PYTHONPATH=`pwd`/source 16 | export PYUIC5=/opt/carla/bin/pyuic5 17 | 18 | ############################################################################################## 19 | # Build Mac App 20 | 21 | make clean 22 | make 23 | 24 | rm -rf ./build/ 25 | 26 | cp ./source/mod-app ./source/MOD-App.pyw 27 | cp ./source/mod-remote ./source/MOD-Remote.pyw 28 | # env SCRIPT_NAME=MOD-App python3 ./data/macos/bundle.py bdist_mac --bundle-name=MOD-App 29 | env SCRIPT_NAME=MOD-Remote python3 ./data/macos/bundle.py bdist_mac --bundle-name=MOD-Remote 30 | rm ./source/*.pyw 31 | 32 | ############################################################################################## 33 | # Enable HiDPI mode 34 | 35 | sed -i -e 's|icon.icns|icon.icns\'$'\n NSHighResolutionCapable |' build/MOD-Remote.app/Contents/Info.plist 36 | 37 | ############################################################################################## 38 | -------------------------------------------------------------------------------- /data/macos/bundle.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # ------------------------------------------------------------------------------------------------------------ 5 | # Imports (cx_Freeze) 6 | 7 | from cx_Freeze import setup, Executable 8 | from os import getenv 9 | 10 | # ------------------------------------------------------------------------------------------------------------ 11 | # Imports (Custom Stuff) 12 | 13 | from mod_common import config 14 | 15 | # ------------------------------------------------------------------------------------------------------------ 16 | 17 | options = { 18 | "packages": ["PyQt5.QtNetwork", "PyQt5.QtPrintSupport", "PyQt5.QtWebKit"], 19 | "includes": ["re", "sip", "subprocess", "inspect"], 20 | "create_shared_zip": False, 21 | "append_script_to_exe": True, 22 | "optimize": True, 23 | "compressed": True 24 | } 25 | 26 | boptions = { 27 | "iconfile": "./resources/ico/mod.icns" 28 | } 29 | 30 | setup(name = "MOD-Remote", 31 | version = config['version'], 32 | description = "MOD Remote", 33 | options = {"build_exe": options, "bdist_mac": boptions}, 34 | executables = [Executable("./source/%s.pyw" % getenv("SCRIPT_NAME"))]) 35 | 36 | # ------------------------------------------------------------------------------------------------------------ 37 | -------------------------------------------------------------------------------- /data/macos/env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############################################################################################## 4 | # MacOS X default environment for Carla, adjusted for MOD-App/Remote 5 | 6 | export MACOS="true" 7 | 8 | export PATH=/opt/carla/bin:/opt/carla64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin 9 | export PKG_CONFIG_PATH=/opt/carla/lib/pkgconfig:/opt/carla64/lib/pkgconfig 10 | 11 | export DEFAULT_QT=5 12 | export PYUIC5=/opt/carla/bin/pyuic5 13 | -------------------------------------------------------------------------------- /data/mod-app: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f /usr/bin/python3 ]; then 4 | PYTHON=/usr/bin/python3 5 | else 6 | PYTHON=python 7 | fi 8 | 9 | INSTALL_PREFIX="X-PREFIX-X" 10 | exec $PYTHON "$INSTALL_PREFIX"/share/mod-app/mod-app "$@" 11 | -------------------------------------------------------------------------------- /data/mod-app.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=MOD-App 3 | GenericName=MOD Application 4 | Comment=Desktop application for the MOD host and UI server 5 | Exec=mod-app %u 6 | Icon=mod 7 | Terminal=false 8 | Type=Application 9 | Categories=AudioVideo;AudioEditing;Qt; 10 | MimeType=application/x-mod-app-project; 11 | Version=1.0 12 | -------------------------------------------------------------------------------- /data/mod-app.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Carla project 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /data/mod-remote: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f /usr/bin/python3 ]; then 4 | PYTHON=/usr/bin/python3 5 | else 6 | PYTHON=python 7 | fi 8 | 9 | INSTALL_PREFIX="X-PREFIX-X" 10 | exec $PYTHON "$INSTALL_PREFIX"/share/mod-app/mod-remote "$@" 11 | -------------------------------------------------------------------------------- /data/mod-remote.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=MOD-Remote 3 | GenericName=MOD Remote 4 | Comment=Application for connecting to a remote MOD device 5 | Exec=mod-remote %u 6 | Icon=mod 7 | Terminal=false 8 | Type=Application 9 | Categories=AudioVideo;AudioEditing;Qt; 10 | Version=1.0 11 | -------------------------------------------------------------------------------- /data/windows/README.txt: -------------------------------------------------------------------------------- 1 | # --- README for MOD-App/Remote for Windows --- 2 | 3 | MOD-Remote is an application that allows you to connect to a remote MOD device. 4 | 5 | For more information, bug reports and feature requests visit the MOD-App GitHub project page at https://github.com/moddevices/mod-app 6 | -------------------------------------------------------------------------------- /data/windows/build-win32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION="0.0.1" 4 | 5 | set -e 6 | 7 | MINGW=i686-w64-mingw32 8 | MINGW_PATH=/opt/mingw32 9 | 10 | JOBS="-j 2" 11 | 12 | if [ ! -f Makefile ]; then 13 | cd ../.. 14 | fi 15 | 16 | export WIN32=true 17 | 18 | export PATH=$MINGW_PATH/bin:$MINGW_PATH/$MINGW/bin:$PATH 19 | export CC=$MINGW-gcc 20 | export CXX=$MINGW-g++ 21 | export WINDRES=$MINGW-windres 22 | 23 | unset CFLAGS 24 | unset CXXFLAGS 25 | unset CPPFLAGS 26 | unset LDFLAGS 27 | 28 | export WINEARCH=win32 29 | export WINEPREFIX=~/.winepy3_x86 30 | export PYTHON_EXE="wine C:\\\\Python34\\\\python.exe" 31 | 32 | export CXFREEZE="$PYTHON_EXE C:\\\\Python34\\\\Scripts\\\\cxfreeze" 33 | export PYUIC="$PYTHON_EXE -m PyQt5.uic.pyuic" 34 | export PYRCC="wine C:\\\\Python34\\\\Lib\\\\site-packages\\\\PyQt5\\\\pyrcc5.exe" 35 | 36 | export DEFAULT_QT=5 37 | 38 | make clean 39 | make $JOBS 40 | 41 | export PYTHONPATH=`pwd`/source 42 | 43 | rm -f ./data/windows/MOD-*.exe 44 | rm -rf ./data/windows/MOD-Remote 45 | rm -rf ./data/windows/MOD-Remote-win* 46 | cp ./source/mod-app ./source/mod-app.pyw 47 | cp ./source/mod-remote ./source/mod-remote.pyw 48 | # $PYTHON_EXE ./data/windows/app.py build_exe 49 | $PYTHON_EXE ./data/windows/remote.py build_exe 50 | rm -f ./source/*.pyw 51 | 52 | cd data/windows/ 53 | 54 | cp $WINEPREFIX/drive_c/Python34/python34.dll MOD-Remote/ 55 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/*eay32.dll MOD-Remote/ 56 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/icu*.dll MOD-Remote/ 57 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/libEGL.dll MOD-Remote/ 58 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/libGLESv2.dll MOD-Remote/ 59 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Core.dll MOD-Remote/ 60 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Gui.dll MOD-Remote/ 61 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Multimedia.dll MOD-Remote/ 62 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5MultimediaWidgets.dll MOD-Remote/ 63 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Network.dll MOD-Remote/ 64 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5OpenGL.dll MOD-Remote/ 65 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5PrintSupport.dll MOD-Remote/ 66 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Positioning.dll MOD-Remote/ 67 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Qml.dll MOD-Remote/ 68 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Quick.dll MOD-Remote/ 69 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Sensors.dll MOD-Remote/ 70 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Sql.dll MOD-Remote/ 71 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Svg.dll MOD-Remote/ 72 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5WebChannel.dll MOD-Remote/ 73 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5WebKit.dll MOD-Remote/ 74 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5WebKitWidgets.dll MOD-Remote/ 75 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Widgets.dll MOD-Remote/ 76 | 77 | # Build unzipfx 78 | make -C unzipfx-remote -f Makefile.win32 clean 79 | make -C unzipfx-remote -f Makefile.win32 80 | 81 | # Create zip of MOD-Remote 82 | rm -f MOD-Remote.zip 83 | zip -r -9 MOD-Remote.zip MOD-Remote 84 | 85 | # Create static build 86 | rm -f MOD-Remote.exe 87 | cat unzipfx-remote/unzipfx2cat.exe MOD-Remote.zip > MOD-Remote.exe 88 | chmod +x MOD-Remote.exe 89 | 90 | # Cleanup 91 | rm -f MOD-Remote.zip 92 | 93 | # Create release zip 94 | rm -rf MOD-Remote-win32 95 | mkdir MOD-Remote-win32 96 | mkdir MOD-Remote-win32/vcredist 97 | cp MOD-Remote.exe README.txt MOD-Remote-win32 98 | cp ~/.cache/winetricks/vcrun2010/vcredist_x86.exe MOD-Remote-win32/vcredist 99 | zip -r -9 MOD-Remote_"$VERSION"_win32.zip MOD-Remote-win32 100 | 101 | cd ../.. 102 | 103 | # Testing: 104 | echo "export WINEPREFIX=~/.winepy3_x86" 105 | echo "$PYTHON_EXE ./source/mod-remote" 106 | -------------------------------------------------------------------------------- /data/windows/build-win64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION="0.0.1" 4 | 5 | set -e 6 | 7 | MINGW=x86_64-w64-mingw32 8 | MINGW_PATH=/opt/mingw64 9 | 10 | JOBS="-j 2" 11 | 12 | if [ ! -f Makefile ]; then 13 | cd ../.. 14 | fi 15 | 16 | export WIN32=true 17 | export WIN64=true 18 | 19 | export PATH=$MINGW_PATH/bin:$MINGW_PATH/$MINGW/bin:$PATH 20 | export CC=$MINGW-gcc 21 | export CXX=$MINGW-g++ 22 | export WINDRES=$MINGW-windres 23 | 24 | unset CFLAGS 25 | unset CXXFLAGS 26 | unset CPPFLAGS 27 | unset LDFLAGS 28 | 29 | export WINEARCH=win64 30 | export WINEPREFIX=~/.winepy3_x64 31 | export PYTHON_EXE="wine C:\\\\Python34\\\\python.exe" 32 | 33 | export CXFREEZE="$PYTHON_EXE C:\\\\Python34\\\\Scripts\\\\cxfreeze" 34 | export PYUIC="$PYTHON_EXE -m PyQt5.uic.pyuic" 35 | export PYRCC="wine C:\\\\Python34\\\\Lib\\\\site-packages\\\\PyQt5\\\\pyrcc5.exe" 36 | 37 | export DEFAULT_QT=5 38 | 39 | make clean 40 | make $JOBS 41 | 42 | export PYTHONPATH=`pwd`/source 43 | 44 | rm -f ./data/windows/MOD-*.exe 45 | rm -rf ./data/windows/MOD-Remote 46 | rm -rf ./data/windows/MOD-Remote-win* 47 | cp ./source/mod-app ./source/mod-app.pyw 48 | cp ./source/mod-remote ./source/mod-remote.pyw 49 | # $PYTHON_EXE ./data/windows/app.py build_exe 50 | $PYTHON_EXE ./data/windows/remote.py build_exe 51 | rm -f ./source/*.pyw 52 | 53 | cd data/windows/ 54 | 55 | cp $WINEPREFIX/drive_c/Python34/python34.dll MOD-Remote/ 56 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/*eay32.dll MOD-Remote/ 57 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/icu*.dll MOD-Remote/ 58 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/libEGL.dll MOD-Remote/ 59 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/libGLESv2.dll MOD-Remote/ 60 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Core.dll MOD-Remote/ 61 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Gui.dll MOD-Remote/ 62 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Multimedia.dll MOD-Remote/ 63 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5MultimediaWidgets.dll MOD-Remote/ 64 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Network.dll MOD-Remote/ 65 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5OpenGL.dll MOD-Remote/ 66 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5PrintSupport.dll MOD-Remote/ 67 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Positioning.dll MOD-Remote/ 68 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Qml.dll MOD-Remote/ 69 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Quick.dll MOD-Remote/ 70 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Sensors.dll MOD-Remote/ 71 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Sql.dll MOD-Remote/ 72 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Svg.dll MOD-Remote/ 73 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5WebChannel.dll MOD-Remote/ 74 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5WebKit.dll MOD-Remote/ 75 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5WebKitWidgets.dll MOD-Remote/ 76 | cp $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt5/Qt5Widgets.dll MOD-Remote/ 77 | 78 | # Build unzipfx 79 | make -C unzipfx-remote -f Makefile.win32 clean 80 | make -C unzipfx-remote -f Makefile.win32 81 | 82 | # Create zip of MOD-Remote 83 | rm -f MOD-Remote.zip 84 | zip -r -9 MOD-Remote.zip MOD-Remote 85 | 86 | # Create static build 87 | rm -f MOD-Remote.exe 88 | cat unzipfx-remote/unzipfx2cat.exe MOD-Remote.zip > MOD-Remote.exe 89 | chmod +x MOD-Remote.exe 90 | 91 | # Cleanup 92 | rm -f MOD-Remote.zip 93 | 94 | # Create release zip 95 | rm -rf MOD-Remote-win64 96 | mkdir MOD-Remote-win64 97 | mkdir MOD-Remote-win64/vcredist 98 | cp MOD-Remote.exe README.txt MOD-Remote-win64 99 | cp ~/.cache/winetricks/vcrun2010/vcredist_x64.exe MOD-Remote-win64/vcredist 100 | zip -r -9 MOD-Remote_"$VERSION"_win64.zip MOD-Remote-win64 101 | 102 | cd ../.. 103 | 104 | # Testing: 105 | echo "export WINEPREFIX=~/.winepy3_x64" 106 | echo "$PYTHON_EXE ./source/mod-remote" 107 | -------------------------------------------------------------------------------- /data/windows/create-wineprefixes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ ! -f Makefile ]; then 6 | cd ../.. 7 | fi 8 | 9 | rm -rf ~/.winepy3 10 | rm -rf ~/.winepy3_x86 11 | rm -rf ~/.winepy3_x64 12 | rm -rf data/windows/python 13 | 14 | mkdir data/windows/python 15 | 16 | export WINEARCH=win32 17 | export WINEPREFIX=~/.winepy3_x86 18 | wineboot 19 | winetricks vcrun2010 20 | winetricks corefonts 21 | winetricks fontsmooth=rgb 22 | 23 | cd data/windows/python 24 | msiexec /i python-3.4.3.msi /qn 25 | wine cx_Freeze-4.3.4.win32-py3.4.exe 26 | wine PyQt5-5.4.1-gpl-Py3.4-Qt5.4.1-x32.exe 27 | cd ../../.. 28 | 29 | export WINEARCH=win64 30 | export WINEPREFIX=~/.winepy3_x64 31 | wineboot 32 | winetricks vcrun2010 33 | winetricks corefonts 34 | winetricks fontsmooth=rgb 35 | 36 | cd data/windows/python 37 | msiexec /i python-3.4.3.amd64.msi /qn 38 | wine cx_Freeze-4.3.4.win-amd64-py3.4.exe 39 | wine PyQt5-5.4.1-gpl-Py3.4-Qt5.4.1-x64.exe 40 | cd ../../.. 41 | -------------------------------------------------------------------------------- /data/windows/remote.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # ------------------------------------------------------------------------------------------------------------ 5 | # Imports (cx_Freeze) 6 | 7 | from cx_Freeze import setup, Executable 8 | 9 | # ------------------------------------------------------------------------------------------------------------ 10 | # Imports (Custom Stuff) 11 | 12 | from mod_common import config 13 | 14 | # ------------------------------------------------------------------------------------------------------------ 15 | 16 | options = { 17 | "icon": ".\\resources\\ico\\mod.ico", 18 | "packages": ["PyQt5.QtNetwork", "PyQt5.QtPrintSupport", "PyQt5.QtWebKit"], 19 | "includes": ["re", "sip", "subprocess", "inspect"], 20 | "build_exe": ".\\data\\windows\\MOD-Remote\\", 21 | "create_shared_zip": False, 22 | "append_script_to_exe": True, 23 | "optimize": True, 24 | "compressed": True 25 | } 26 | 27 | setup(name = "MOD-Remote", 28 | version = config['version'], 29 | description = "MOD Remote", 30 | options = {"build_exe": options}, 31 | executables = [Executable(".\\source\\mod-remote.pyw", base="Win32GUI")]) 32 | 33 | # ------------------------------------------------------------------------------------------------------------ 34 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *~ 3 | *.o 4 | *.exe 5 | *.zip 6 | 7 | unzipfx2cat 8 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/Makefile.linux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/Makefile -f 2 | 3 | CC ?= gcc 4 | 5 | BUILD_FLAGS = -DSFX -DLINUX -I. -I.. $(CFLAGS) -O2 6 | BUILD_FLAGS += -DLARGE_FILE_SUPPORT -DUNICODE_SUPPORT -DUNICODE_WCHAR -DUTF8_MAYBE_NATIVE 7 | BUILD_FLAGS += -DNO_LCHMOD -DHAVE_DIRENT_H -DHAVE_TERMIOS_H -D_MBCS 8 | 9 | LINK_FLAGS = -static $(LDFLAGS) 10 | 11 | OBJ = crc32.o crypt.o extract.o fileio.o globals.o inflate.o match.o process.o ttyio.o ubz2err.o unzip.o zipinfo.o 12 | OBJ += unix/unix.o 13 | OBJ += unzipfx/appDetails.o 14 | 15 | # ----------------------------- 16 | 17 | all: unzipfx2cat 18 | 19 | unzipfx2cat: $(OBJ) 20 | $(CC) $^ $(LINK_FLAGS) -o $@ 21 | 22 | clean: 23 | rm -f *~ $(OBJ) 24 | 25 | # ----------------------------- 26 | 27 | .c.o: 28 | $(CC) $< $(BUILD_FLAGS) -c -o $@ 29 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/Makefile.win32: -------------------------------------------------------------------------------- 1 | #!/usr/bin/Makefile -f 2 | 3 | CC ?= gcc 4 | WINDRES ?= windres 5 | 6 | BUILD_FLAGS = -DSFX -DWIN32 -DWINDOWS -DFORCE_UNIX_OVER_WIN32 -I. -I.. $(CFLAGS) -O2 7 | BUILD_FLAGS += -DLARGE_FILE_SUPPORT -DUNICODE_SUPPORT -DUNICODE_WCHAR -DUTF8_MAYBE_NATIVE 8 | BUILD_FLAGS += -DNO_LCHMOD -DHAVE_DIRENT_H -DHAVE_TERMIOS_H -D_MBCS 9 | 10 | LINK_FLAGS = -static -mwindows -lkernel32 -lshell32 $(LDFLAGS) 11 | 12 | OBJ = crc32.o crypt.o extract.o fileio.o globals.o inflate.o match.o process.o ttyio.o ubz2err.o unzip.o zipinfo.o 13 | OBJ += win32/nt.o win32/win32.o win32/win32i64.o 14 | OBJ += unzipfx/appDetails.o 15 | OBJ += icon.o 16 | 17 | # ----------------------------- 18 | 19 | all: unzipfx2cat.exe 20 | 21 | unzipfx2cat.exe: $(OBJ) 22 | $(CC) $^ $(LINK_FLAGS) -o $@ 23 | 24 | icon.o: ../../../resources/ico/mod.rc 25 | $(WINDRES) -i $< -o $@ -O coff 26 | 27 | clean: 28 | rm -f *~ $(OBJ) 29 | 30 | # ----------------------------- 31 | 32 | .c.o: 33 | $(CC) $< $(BUILD_FLAGS) -c -o $@ 34 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/README: -------------------------------------------------------------------------------- 1 | This is a special build of unzip's unzipfx tool, modified to allow full application bundles. 2 | You get a static linked binary that extracts your files into a temporary location, then executes the main program (defined by you). 3 | 4 | Currently working under Linux only, but should be fairly easy to get it into other OSes (unzip itself is already available in many, including Windows, MacOS, Linux and BeOS). 5 | 6 | 7 | To get a static unzipfx application, you do: 8 | 1 - create a zip file of your application bundle, with a single parent/root directory (this directory and the main app-name must match) 9 | 2 - edit unzipfx/appDetails.h and set SFX_APP_MININAME as the directory name set in step 1 10 | 3 - compile this tool using the appropriate makefile (eg: make -f Makefile.linux). That will give you 'unzipfx2cat' binary 11 | 4 - concatenate your zip file over the 'unzipfx2cat' binary (eg: cat unzipfx2cat myapp.zip > myapp) 12 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/consts.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2001 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2000-Apr-09 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /*--------------------------------------------------------------------------- 10 | 11 | consts.h 12 | 13 | This file contains global, initialized variables that never change. It is 14 | included by unzip.c and windll/windll.c. 15 | 16 | ---------------------------------------------------------------------------*/ 17 | 18 | 19 | /* And'ing with mask_bits[n] masks the lower n bits */ 20 | ZCONST unsigned near mask_bits[17] = { 21 | 0x0000, 22 | 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 23 | 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff 24 | }; 25 | 26 | ZCONST char Far VersionDate[] = UZ_VERSION_DATE; /* now defined in unzvers.h */ 27 | 28 | #ifndef SFX 29 | ZCONST char Far EndSigMsg[] = 30 | "\nnote: didn't find end-of-central-dir signature at end of central dir.\n"; 31 | #endif 32 | 33 | ZCONST char Far CentSigMsg[] = 34 | "error: expected central file header signature not found (file #%lu).\n"; 35 | ZCONST char Far SeekMsg[] = 36 | "error [%s]: attempt to seek before beginning of zipfile\n%s"; 37 | ZCONST char Far FilenameNotMatched[] = "caution: filename not matched: %s\n"; 38 | ZCONST char Far ExclFilenameNotMatched[] = 39 | "caution: excluded filename not matched: %s\n"; 40 | 41 | #ifdef VMS 42 | ZCONST char Far ReportMsg[] = "\ 43 | (please check that you have transferred or created the zipfile in the\n\ 44 | appropriate BINARY mode--this includes ftp, Kermit, AND unzip'd zipfiles)\n"; 45 | #else 46 | ZCONST char Far ReportMsg[] = "\ 47 | (please check that you have transferred or created the zipfile in the\n\ 48 | appropriate BINARY mode and that you have compiled UnZip properly)\n"; 49 | #endif 50 | 51 | #ifndef SFX 52 | ZCONST char Far Zipnfo[] = "zipinfo"; 53 | ZCONST char Far CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n"; 54 | #endif 55 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2008 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2000-Apr-09 or later 5 | (the contents of which are also included in zip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /* crc32.h -- compute the CRC-32 of a data stream 10 | * Copyright (C) 1995 Mark Adler 11 | * For conditions of distribution and use, see copyright notice in zlib.h 12 | */ 13 | 14 | #ifndef __crc32_h 15 | #define __crc32_h /* identifies this source module */ 16 | 17 | /* This header should be read AFTER zip.h resp. unzip.h 18 | * (the latter with UNZIP_INTERNAL defined...). 19 | */ 20 | 21 | #ifndef OF 22 | # define OF(a) a 23 | #endif 24 | #ifndef ZCONST 25 | # define ZCONST const 26 | #endif 27 | 28 | #ifdef DYNALLOC_CRCTAB 29 | void free_crc_table OF((void)); 30 | #endif 31 | #ifndef USE_ZLIB 32 | ZCONST ulg near *get_crc_table OF((void)); 33 | #endif 34 | #if (defined(USE_ZLIB) || defined(CRC_TABLE_ONLY)) 35 | # ifdef IZ_CRC_BE_OPTIMIZ 36 | # undef IZ_CRC_BE_OPTIMIZ 37 | # endif 38 | #else /* !(USE_ZLIB || CRC_TABLE_ONLY) */ 39 | ulg crc32 OF((ulg crc, ZCONST uch *buf, extent len)); 40 | #endif /* ?(USE_ZLIB || CRC_TABLE_ONLY) */ 41 | 42 | #ifndef CRC_32_TAB 43 | # define CRC_32_TAB crc_32_tab 44 | #endif 45 | 46 | #ifdef CRC32 47 | # undef CRC32 48 | #endif 49 | #ifdef IZ_CRC_BE_OPTIMIZ 50 | # define CRC32UPD(c, crctab) (crctab[((c) >> 24)] ^ ((c) << 8)) 51 | # define CRC32(c, b, crctab) (crctab[(((int)(c) >> 24) ^ (b))] ^ ((c) << 8)) 52 | # define REV_BE(w) (((w)>>24)+(((w)>>8)&0xff00)+ \ 53 | (((w)&0xff00)<<8)+(((w)&0xff)<<24)) 54 | #else 55 | # define CRC32UPD(c, crctab) (crctab[((int)(c)) & 0xff] ^ ((c) >> 8)) 56 | # define CRC32(c, b, crctab) (crctab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8)) 57 | # define REV_BE(w) w 58 | #endif 59 | 60 | #endif /* !__crc32_h */ 61 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/crypt.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2007 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2005-Feb-10 or later 5 | (the contents of which are also included in (un)zip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /* 10 | crypt.h (full version) by Info-ZIP. Last revised: [see CR_VERSION_DATE] 11 | 12 | The main encryption/decryption source code for Info-Zip software was 13 | originally written in Europe. To the best of our knowledge, it can 14 | be freely distributed in both source and object forms from any country, 15 | including the USA under License Exception TSU of the U.S. Export 16 | Administration Regulations (section 740.13(e)) of 6 June 2002. 17 | 18 | NOTE on copyright history: 19 | Previous versions of this source package (up to version 2.8) were 20 | not copyrighted and put in the public domain. If you cannot comply 21 | with the Info-Zip LICENSE, you may want to look for one of those 22 | public domain versions. 23 | */ 24 | 25 | #ifndef __crypt_h /* don't include more than once */ 26 | #define __crypt_h 27 | 28 | #ifdef CRYPT 29 | # undef CRYPT 30 | #endif 31 | /* 32 | Logic of selecting "full crypt" code: 33 | a) default behaviour: 34 | - dummy crypt code when compiling UnZipSFX stub, to minimize size 35 | - full crypt code when used to compile Zip, UnZip and fUnZip 36 | b) USE_CRYPT defined: 37 | - always full crypt code 38 | c) NO_CRYPT defined: 39 | - never full crypt code 40 | NO_CRYPT takes precedence over USE_CRYPT 41 | */ 42 | #if defined(NO_CRYPT) 43 | # define CRYPT 0 /* dummy version */ 44 | #else 45 | #if defined(USE_CRYPT) 46 | # define CRYPT 1 /* full version */ 47 | #else 48 | #if !defined(SFX) 49 | # define CRYPT 1 /* full version for zip and main unzip */ 50 | #else 51 | # define CRYPT 0 /* dummy version for unzip sfx */ 52 | #endif 53 | #endif /* ?USE_CRYPT */ 54 | #endif /* ?NO_CRYPT */ 55 | 56 | #if CRYPT 57 | /* full version */ 58 | 59 | #ifdef CR_BETA 60 | # undef CR_BETA /* this is not a beta release */ 61 | #endif 62 | 63 | #define CR_MAJORVER 2 64 | #define CR_MINORVER 11 65 | #ifdef CR_BETA 66 | # define CR_BETA_VER "c BETA" 67 | # define CR_VERSION_DATE "05 Jan 2007" /* last real code change */ 68 | #else 69 | # define CR_BETA_VER "" 70 | # define CR_VERSION_DATE "05 Jan 2007" /* last public release date */ 71 | # define CR_RELEASE 72 | #endif 73 | 74 | #ifndef __G /* UnZip only, for now (DLL stuff) */ 75 | # define __G 76 | # define __G__ 77 | # define __GDEF 78 | # define __GPRO void 79 | # define __GPRO__ 80 | #endif 81 | 82 | #if defined(MSDOS) || defined(OS2) || defined(WIN32) 83 | # ifndef DOS_OS2_W32 84 | # define DOS_OS2_W32 85 | # endif 86 | #endif 87 | 88 | #if defined(DOS_OS2_W32) || defined(__human68k__) 89 | # ifndef DOS_H68_OS2_W32 90 | # define DOS_H68_OS2_W32 91 | # endif 92 | #endif 93 | 94 | #if defined(VM_CMS) || defined(MVS) 95 | # ifndef CMS_MVS 96 | # define CMS_MVS 97 | # endif 98 | #endif 99 | 100 | /* To allow combining of Zip and UnZip static libraries in a single binary, 101 | * the Zip and UnZip versions of the crypt core functions have to be named 102 | * differently. 103 | */ 104 | #ifdef ZIP 105 | # ifdef REALLY_SHORT_SYMS 106 | # define decrypt_byte zdcrby 107 | # else 108 | # define decrypt_byte zp_decrypt_byte 109 | # endif 110 | # define update_keys zp_update_keys 111 | # define init_keys zp_init_keys 112 | #else /* !ZIP */ 113 | # ifdef REALLY_SHORT_SYMS 114 | # define decrypt_byte dcrbyt 115 | # endif 116 | #endif /* ?ZIP */ 117 | 118 | #define IZ_PWLEN 80 /* input buffer size for reading encryption key */ 119 | #ifndef PWLEN /* for compatibility with previous zcrypt release... */ 120 | # define PWLEN IZ_PWLEN 121 | #endif 122 | #define RAND_HEAD_LEN 12 /* length of encryption random header */ 123 | 124 | /* the crc_32_tab array has to be provided externally for the crypt calculus */ 125 | 126 | /* encode byte c, using temp t. Warning: c must not have side effects. */ 127 | #define zencode(c,t) (t=decrypt_byte(__G), update_keys(c), t^(c)) 128 | 129 | /* decode byte c in place */ 130 | #define zdecode(c) update_keys(__G__ c ^= decrypt_byte(__G)) 131 | 132 | int decrypt_byte OF((__GPRO)); 133 | int update_keys OF((__GPRO__ int c)); 134 | void init_keys OF((__GPRO__ ZCONST char *passwd)); 135 | 136 | #ifdef ZIP 137 | void crypthead OF((ZCONST char *, ulg, FILE *)); 138 | # ifdef UTIL 139 | int zipcloak OF((struct zlist far *, FILE *, FILE *, ZCONST char *)); 140 | int zipbare OF((struct zlist far *, FILE *, FILE *, ZCONST char *)); 141 | # else 142 | unsigned zfwrite OF((zvoid *, extent, extent, FILE *)); 143 | extern char *key; 144 | # endif 145 | #endif /* ZIP */ 146 | 147 | #if (defined(UNZIP) && !defined(FUNZIP)) 148 | int decrypt OF((__GPRO__ ZCONST char *passwrd)); 149 | #endif 150 | 151 | #ifdef FUNZIP 152 | extern int encrypted; 153 | # ifdef NEXTBYTE 154 | # undef NEXTBYTE 155 | # endif 156 | # define NEXTBYTE \ 157 | (encrypted? update_keys(__G__ getc(G.in)^decrypt_byte(__G)) : getc(G.in)) 158 | #endif /* FUNZIP */ 159 | 160 | #else /* !CRYPT */ 161 | /* dummy version */ 162 | 163 | #define zencode 164 | #define zdecode 165 | 166 | #define zfwrite fwrite 167 | 168 | #endif /* ?CRYPT */ 169 | #endif /* !__crypt_h */ 170 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2008 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2000-Apr-09 or later 5 | (the contents of which are also included in zip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /*--------------------------------------------------------------------------- 10 | 11 | ebcdic.h 12 | 13 | The CECP 1047 (Extended de-facto EBCDIC) <-> ISO 8859-1 conversion tables, 14 | from ftp://aix1.segi.ulg.ac.be/pub/docs/iso8859/iso8859.networking 15 | 16 | NOTES: 17 | (OS/390 port 12/97) 18 | These table no longer represent the standard mappings (for example in the 19 | OS/390 iconv utility). In order to follow current standards I remapped 20 | ebcdic x0a to ascii x15 and 21 | ebcdic x85 to ascii x25 (and vice-versa) 22 | Without these changes, newlines in auto-convert text files appeared 23 | as literal \045. 24 | I'm not sure what effect this remap would have on the MVS and CMS ports, so 25 | I ifdef'd these changes. Hopefully these ifdef's can be removed when the 26 | MVS/CMS folks test the new mappings. 27 | 28 | Christian Spieler , 27-Apr-1998 29 | The problem mentioned by Paul von Behren was already observed previously 30 | on VM/CMS, during the preparation of the CMS&MVS port of UnZip 5.20 in 31 | 1996. At that point, the ebcdic tables were not changed since they seemed 32 | to be an adopted standard (to my knowledge, these tables are still used 33 | as presented in mainfraime KERMIT). Instead, the "end-of-line" conversion 34 | feature of Zip's and UnZip's "text-translation" mode was used to force 35 | correct mappings between ASCII and EBCDIC newline markers. 36 | Before interchanging the ASCII mappings of the EBCDIC control characters 37 | "NL" 0x25 and "LF" 0x15 according to the OS/390 setting, we have to 38 | make sure that EBCDIC 0x15 is never used as line termination. 39 | 40 | ---------------------------------------------------------------------------*/ 41 | 42 | #ifndef __ebcdic_h /* prevent multiple inclusions */ 43 | #define __ebcdic_h 44 | 45 | 46 | #ifndef ZCONST 47 | # define ZCONST const 48 | #endif 49 | 50 | #ifdef EBCDIC 51 | #ifndef MTS /* MTS uses a slightly "special" EBCDIC code page */ 52 | 53 | ZCONST uch ebcdic[] = { 54 | 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, /* 00 - 07 */ 55 | #ifdef OS390 56 | 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */ 57 | #else 58 | 0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */ 59 | #endif 60 | 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, /* 10 - 17 */ 61 | 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */ 62 | 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, /* 20 - 27 */ 63 | 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, /* 28 - 2F */ 64 | 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* 30 - 37 */ 65 | 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, /* 38 - 3F */ 66 | 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 40 - 47 */ 67 | 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, /* 48 - 4F */ 68 | 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, /* 50 - 57 */ 69 | 0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D, /* 58 - 5F */ 70 | 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60 - 67 */ 71 | 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* 68 - 6F */ 72 | 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, /* 70 - 77 */ 73 | 0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07, /* 78 - 7F */ 74 | #ifdef OS390 75 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17, /* 80 - 87 */ 76 | #else 77 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17, /* 80 - 87 */ 78 | #endif 79 | 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x09, 0x0A, 0x1B, /* 88 - 8F */ 80 | 0x30, 0x31, 0x1A, 0x33, 0x34, 0x35, 0x36, 0x08, /* 90 - 97 */ 81 | 0x38, 0x39, 0x3A, 0x3B, 0x04, 0x14, 0x3E, 0xFF, /* 98 - 9F */ 82 | 0x41, 0xAA, 0x4A, 0xB1, 0x9F, 0xB2, 0x6A, 0xB5, /* A0 - A7 */ 83 | 0xBB, 0xB4, 0x9A, 0x8A, 0xB0, 0xCA, 0xAF, 0xBC, /* A8 - AF */ 84 | 0x90, 0x8F, 0xEA, 0xFA, 0xBE, 0xA0, 0xB6, 0xB3, /* B0 - B7 */ 85 | 0x9D, 0xDA, 0x9B, 0x8B, 0xB7, 0xB8, 0xB9, 0xAB, /* B8 - BF */ 86 | 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9E, 0x68, /* C0 - C7 */ 87 | 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* C8 - CF */ 88 | 0xAC, 0x69, 0xED, 0xEE, 0xEB, 0xEF, 0xEC, 0xBF, /* D0 - D7 */ 89 | 0x80, 0xFD, 0xFE, 0xFB, 0xFC, 0xBA, 0xAE, 0x59, /* D8 - DF */ 90 | 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9C, 0x48, /* E0 - E7 */ 91 | 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* E8 - EF */ 92 | 0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, /* F0 - F7 */ 93 | 0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF /* F8 - FF */ 94 | }; 95 | 96 | #if (defined(ZIP) || CRYPT) 97 | ZCONST uch ascii[] = { 98 | 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, /* 00 - 07 */ 99 | 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */ 100 | #ifdef OS390 101 | 0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, /* 10 - 17 */ 102 | #else 103 | 0x10, 0x11, 0x12, 0x13, 0x9D, 0x85, 0x08, 0x87, /* 10 - 17 */ 104 | #endif 105 | 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */ 106 | #ifdef OS390 107 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, /* 20 - 27 */ 108 | #else 109 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x0A, 0x17, 0x1B, /* 20 - 27 */ 110 | #endif 111 | 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, /* 28 - 2F */ 112 | 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30 - 37 */ 113 | 0x98, 0x99, 0x9A, 0x9B, 0x14, 0x15, 0x9E, 0x1A, /* 38 - 3F */ 114 | 0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, /* 40 - 47 */ 115 | 0xE7, 0xF1, 0xA2, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, /* 48 - 4F */ 116 | 0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, /* 50 - 57 */ 117 | 0xEC, 0xDF, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E, /* 58 - 5F */ 118 | 0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, /* 60 - 67 */ 119 | 0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, /* 68 - 6F */ 120 | 0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, /* 70 - 77 */ 121 | 0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, /* 78 - 7F */ 122 | 0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80 - 87 */ 123 | 0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1, /* 88 - 8F */ 124 | 0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, /* 90 - 97 */ 125 | 0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4, /* 98 - 9F */ 126 | 0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* A0 - A7 */ 127 | 0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0x5B, 0xDE, 0xAE, /* A8 - AF */ 128 | 0xAC, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, /* B0 - B7 */ 129 | 0xBD, 0xBE, 0xDD, 0xA8, 0xAF, 0x5D, 0xB4, 0xD7, /* B8 - BF */ 130 | 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* C0 - C7 */ 131 | 0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5, /* C8 - CF */ 132 | 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, /* D0 - D7 */ 133 | 0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF, /* D8 - DF */ 134 | 0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* E0 - E7 */ 135 | 0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5, /* E8 - EF */ 136 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* F0 - F7 */ 137 | 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F /* F8 - FF */ 138 | }; 139 | #endif /* ZIP || CRYPT */ 140 | 141 | #else /* MTS */ 142 | 143 | /* 144 | * This is the MTS ASCII->EBCDIC translation table. It provides a 1-1 145 | * translation from ISO 8859/1 8-bit ASCII to IBM Code Page 37 EBCDIC. 146 | */ 147 | 148 | ZCONST uch ebcdic[] = { 149 | 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, /* 00 - 07 */ 150 | 0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */ 151 | 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, /* 10 - 17 */ 152 | 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */ 153 | 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, /* 20 - 27 */ 154 | 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, /* 28 - 2F */ 155 | 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* 30 - 37 */ 156 | 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, /* 38 - 3F */ 157 | 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 40 - 47 */ 158 | 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, /* 48 - 4F */ 159 | 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, /* 50 - 57 */ 160 | 0xE7, 0xE8, 0xE9, 0xBA, 0xE0, 0xBB, 0xB0, 0x6D, /* 58 - 5F */ 161 | 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60 - 67 */ 162 | 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* 68 - 6F */ 163 | 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, /* 70 - 77 */ 164 | 0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07, /* 78 - 7F */ 165 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17, /* 80 - 87 */ 166 | 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x09, 0x0A, 0x1B, /* 88 - 8F */ 167 | 0x30, 0x31, 0x1A, 0x33, 0x34, 0x35, 0x36, 0x08, /* 90 - 97 */ 168 | 0x38, 0x39, 0x3A, 0x3B, 0x04, 0x14, 0x3E, 0xFF, /* 98 - 9F */ 169 | 0x41, 0xAA, 0x4A, 0xB1, 0x9F, 0xB2, 0x6A, 0xB5, /* A0 - A7 */ 170 | 0xBD, 0xB4, 0x9A, 0x8A, 0x5F, 0xCA, 0xAF, 0xBC, /* A8 - AF */ 171 | 0x90, 0x8F, 0xEA, 0xFA, 0xBE, 0xA0, 0xB6, 0xB3, /* B0 - B7 */ 172 | 0x9D, 0xDA, 0x9B, 0x8B, 0xB7, 0xB8, 0xB9, 0xAB, /* B8 - BF */ 173 | 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9E, 0x68, /* C0 - C7 */ 174 | 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* C8 - CF */ 175 | 0xAC, 0x69, 0xED, 0xEE, 0xEB, 0xEF, 0xEC, 0xBF, /* D0 - D7 */ 176 | 0x80, 0xFD, 0xFE, 0xFB, 0xFC, 0xAD, 0xAE, 0x59, /* D8 - DF */ 177 | 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9C, 0x48, /* E0 - E7 */ 178 | 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* E8 - EF */ 179 | 0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, /* F0 - F7 */ 180 | 0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF /* F8 - FF */ 181 | }; 182 | 183 | #if (defined(ZIP) || CRYPT) 184 | ZCONST uch ascii[] = { 185 | 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, /* 00 - 07 */ 186 | 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */ 187 | 0x10, 0x11, 0x12, 0x13, 0x9D, 0x85, 0x08, 0x87, /* 10 - 17 */ 188 | 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */ 189 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x0A, 0x17, 0x1B, /* 20 - 27 */ 190 | 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, /* 28 - 2F */ 191 | 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30 - 37 */ 192 | 0x98, 0x99, 0x9A, 0x9B, 0x14, 0x15, 0x9E, 0x1A, /* 38 - 3F */ 193 | 0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, /* 40 - 47 */ 194 | 0xE7, 0xF1, 0xA2, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, /* 48 - 4F */ 195 | 0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, /* 50 - 57 */ 196 | 0xEC, 0xDF, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAC, /* 58 - 5F */ 197 | 0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, /* 60 - 67 */ 198 | 0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, /* 68 - 6F */ 199 | 0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, /* 70 - 77 */ 200 | 0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, /* 78 - 7F */ 201 | 0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80 - 87 */ 202 | 0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1, /* 88 - 8F */ 203 | 0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, /* 90 - 97 */ 204 | 0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4, /* 98 - 9F */ 205 | 0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* A0 - A7 */ 206 | 0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0xDD, 0xDE, 0xAE, /* A8 - AF */ 207 | 0x5E, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, /* B0 - B7 */ 208 | 0xBD, 0xBE, 0x5B, 0x5D, 0xAF, 0xA8, 0xB4, 0xD7, /* B8 - BF */ 209 | 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* C0 - C7 */ 210 | 0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5, /* C8 - CF */ 211 | 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, /* D0 - D7 */ 212 | 0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF, /* D8 - DF */ 213 | 0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* E0 - E7 */ 214 | 0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5, /* E8 - EF */ 215 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* F0 - F7 */ 216 | 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F /* F8 - FF */ 217 | }; 218 | #endif /* ZIP || CRYPT */ 219 | 220 | #endif /* ?MTS */ 221 | #endif /* EBCDIC */ 222 | 223 | /*--------------------------------------------------------------------------- 224 | 225 | The following conversion tables translate between IBM PC CP 850 226 | (OEM codepage) and the "Western Europe & America" Windows codepage 1252. 227 | The Windows codepage 1252 contains the ISO 8859-1 "Latin 1" codepage, 228 | with some additional printable characters in the range (0x80 - 0x9F), 229 | that is reserved to control codes in the ISO 8859-1 character table. 230 | 231 | The ISO <--> OEM conversion tables were constructed with the help 232 | of the WIN32 (Win16?) API's OemToAnsi() and AnsiToOem() conversion 233 | functions and have been checked against the CP850 and LATIN1 tables 234 | provided in the MS-Kermit 3.14 distribution. 235 | 236 | ---------------------------------------------------------------------------*/ 237 | 238 | #ifdef IZ_ISO2OEM_ARRAY 239 | ZCONST uch Far iso2oem_850[] = { 240 | 0x3F, 0x3F, 0x27, 0x9F, 0x22, 0x2E, 0xC5, 0xCE, /* 80 - 87 */ 241 | 0x5E, 0x25, 0x53, 0x3C, 0x4F, 0x3F, 0x3F, 0x3F, /* 88 - 8F */ 242 | 0x3F, 0x27, 0x27, 0x22, 0x22, 0x07, 0x2D, 0x2D, /* 90 - 97 */ 243 | 0x7E, 0x54, 0x73, 0x3E, 0x6F, 0x3F, 0x3F, 0x59, /* 98 - 9F */ 244 | 0xFF, 0xAD, 0xBD, 0x9C, 0xCF, 0xBE, 0xDD, 0xF5, /* A0 - A7 */ 245 | 0xF9, 0xB8, 0xA6, 0xAE, 0xAA, 0xF0, 0xA9, 0xEE, /* A8 - AF */ 246 | 0xF8, 0xF1, 0xFD, 0xFC, 0xEF, 0xE6, 0xF4, 0xFA, /* B0 - B7 */ 247 | 0xF7, 0xFB, 0xA7, 0xAF, 0xAC, 0xAB, 0xF3, 0xA8, /* B8 - BF */ 248 | 0xB7, 0xB5, 0xB6, 0xC7, 0x8E, 0x8F, 0x92, 0x80, /* C0 - C7 */ 249 | 0xD4, 0x90, 0xD2, 0xD3, 0xDE, 0xD6, 0xD7, 0xD8, /* C8 - CF */ 250 | 0xD1, 0xA5, 0xE3, 0xE0, 0xE2, 0xE5, 0x99, 0x9E, /* D0 - D7 */ 251 | 0x9D, 0xEB, 0xE9, 0xEA, 0x9A, 0xED, 0xE8, 0xE1, /* D8 - DF */ 252 | 0x85, 0xA0, 0x83, 0xC6, 0x84, 0x86, 0x91, 0x87, /* E0 - E7 */ 253 | 0x8A, 0x82, 0x88, 0x89, 0x8D, 0xA1, 0x8C, 0x8B, /* E8 - EF */ 254 | 0xD0, 0xA4, 0x95, 0xA2, 0x93, 0xE4, 0x94, 0xF6, /* F0 - F7 */ 255 | 0x9B, 0x97, 0xA3, 0x96, 0x81, 0xEC, 0xE7, 0x98 /* F8 - FF */ 256 | }; 257 | #endif /* IZ_ISO2OEM_ARRAY */ 258 | 259 | #ifdef IZ_OEM2ISO_ARRAY 260 | ZCONST uch Far oem2iso_850[] = { 261 | 0xC7, 0xFC, 0xE9, 0xE2, 0xE4, 0xE0, 0xE5, 0xE7, /* 80 - 87 */ 262 | 0xEA, 0xEB, 0xE8, 0xEF, 0xEE, 0xEC, 0xC4, 0xC5, /* 88 - 8F */ 263 | 0xC9, 0xE6, 0xC6, 0xF4, 0xF6, 0xF2, 0xFB, 0xF9, /* 90 - 97 */ 264 | 0xFF, 0xD6, 0xDC, 0xF8, 0xA3, 0xD8, 0xD7, 0x83, /* 98 - 9F */ 265 | 0xE1, 0xED, 0xF3, 0xFA, 0xF1, 0xD1, 0xAA, 0xBA, /* A0 - A7 */ 266 | 0xBF, 0xAE, 0xAC, 0xBD, 0xBC, 0xA1, 0xAB, 0xBB, /* A8 - AF */ 267 | 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xC1, 0xC2, 0xC0, /* B0 - B7 */ 268 | 0xA9, 0xA6, 0xA6, 0x2B, 0x2B, 0xA2, 0xA5, 0x2B, /* B8 - BF */ 269 | 0x2B, 0x2D, 0x2D, 0x2B, 0x2D, 0x2B, 0xE3, 0xC3, /* C0 - C7 */ 270 | 0x2B, 0x2B, 0x2D, 0x2D, 0xA6, 0x2D, 0x2B, 0xA4, /* C8 - CF */ 271 | 0xF0, 0xD0, 0xCA, 0xCB, 0xC8, 0x69, 0xCD, 0xCE, /* D0 - D7 */ 272 | 0xCF, 0x2B, 0x2B, 0xA6, 0x5F, 0xA6, 0xCC, 0xAF, /* D8 - DF */ 273 | 0xD3, 0xDF, 0xD4, 0xD2, 0xF5, 0xD5, 0xB5, 0xFE, /* E0 - E7 */ 274 | 0xDE, 0xDA, 0xDB, 0xD9, 0xFD, 0xDD, 0xAF, 0xB4, /* E8 - EF */ 275 | 0xAD, 0xB1, 0x3D, 0xBE, 0xB6, 0xA7, 0xF7, 0xB8, /* F0 - F7 */ 276 | 0xB0, 0xA8, 0xB7, 0xB9, 0xB3, 0xB2, 0xA6, 0xA0 /* F8 - FF */ 277 | }; 278 | #endif /* IZ_OEM2ISO_ARRAY */ 279 | 280 | /* The following pointers to the OEM<-->ISO translation tables are used 281 | by the translation code portions. They may get initialized at program 282 | startup to point to the matching static translation tables, or to NULL 283 | to disable OEM-ISO translation. 284 | The compile-time initialization used here provides the backward compatible 285 | setting, as can be found in UnZip 5.52 and earlier. 286 | In case this mechanism will ever get used on a multithreading system that 287 | allows different codepage setups for concurrently running threads, these 288 | pointers should get moved into UnZip's thread-safe global data structure. 289 | */ 290 | #ifdef IZ_ISO2OEM_ARRAY 291 | ZCONST uch Far *iso2oem = iso2oem_850; /* backward compatibility default */ 292 | #endif /* IZ_ISO2OEM_ARRAY */ 293 | #ifdef IZ_OEM2ISO_ARRAY 294 | ZCONST uch Far *oem2iso = oem2iso_850; /* backward compatibility default */ 295 | #endif /* IZ_OEM2ISO_ARRAY */ 296 | 297 | #if defined(THEOS) || defined(THEOS_SUPPORT) 298 | # include "theos/charconv.h" 299 | #endif 300 | 301 | #endif /* __ebcdic_h */ 302 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/globals.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2007 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2003-May-08 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /*--------------------------------------------------------------------------- 10 | 11 | globals.c 12 | 13 | Routines to allocate and initialize globals, with or without threads. 14 | 15 | Contents: registerGlobalPointer() 16 | deregisterGlobalPointer() 17 | getGlobalPointer() 18 | globalsCtor() 19 | 20 | ---------------------------------------------------------------------------*/ 21 | 22 | 23 | #define UNZIP_INTERNAL 24 | #include "unzip.h" 25 | 26 | #ifndef FUNZIP 27 | /* initialization of sigs is completed at runtime so unzip(sfx) executable 28 | * won't look like a zipfile 29 | */ 30 | char central_hdr_sig[4] = {0, 0, 0x01, 0x02}; 31 | char local_hdr_sig[4] = {0, 0, 0x03, 0x04}; 32 | char end_central_sig[4] = {0, 0, 0x05, 0x06}; 33 | char end_central64_sig[4] = {0, 0, 0x06, 0x06}; 34 | char end_centloc64_sig[4] = {0, 0, 0x06, 0x07}; 35 | /* extern char extd_local_sig[4] = {0, 0, 0x07, 0x08}; NOT USED YET */ 36 | 37 | ZCONST char *fnames[2] = {"*", NULL}; /* default filenames vector */ 38 | #endif 39 | 40 | 41 | #ifndef REENTRANT 42 | Uz_Globs G; 43 | #else /* REENTRANT */ 44 | 45 | # ifndef USETHREADID 46 | Uz_Globs *GG; 47 | # else /* USETHREADID */ 48 | # define THREADID_ENTRIES 0x40 49 | 50 | int lastScan; 51 | Uz_Globs *threadPtrTable[THREADID_ENTRIES]; 52 | ulg threadIdTable [THREADID_ENTRIES] = { 53 | 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 54 | 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* Make sure there are */ 55 | 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* THREADID_ENTRIES 0s */ 56 | 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 57 | }; 58 | 59 | static ZCONST char Far TooManyThreads[] = 60 | "error: more than %d simultaneous threads.\n\ 61 | Some threads are probably not calling DESTROYTHREAD()\n"; 62 | static ZCONST char Far EntryNotFound[] = 63 | "error: couldn't find global pointer in table.\n\ 64 | Maybe somebody accidentally called DESTROYTHREAD() twice.\n"; 65 | static ZCONST char Far GlobalPointerMismatch[] = 66 | "error: global pointer in table does not match pointer passed as\ 67 | parameter\n"; 68 | 69 | static void registerGlobalPointer OF((__GPRO)); 70 | 71 | 72 | 73 | static void registerGlobalPointer(__G) 74 | __GDEF 75 | { 76 | int scan=0; 77 | ulg tid = GetThreadId(); 78 | 79 | while (threadIdTable[scan] && scan < THREADID_ENTRIES) 80 | scan++; 81 | 82 | if (scan == THREADID_ENTRIES) { 83 | ZCONST char *tooMany = LoadFarString(TooManyThreads); 84 | Info(slide, 0x421, ((char *)slide, tooMany, THREADID_ENTRIES)); 85 | free(pG); 86 | EXIT(PK_MEM); /* essentially memory error before we've started */ 87 | } 88 | 89 | threadIdTable [scan] = tid; 90 | threadPtrTable[scan] = pG; 91 | lastScan = scan; 92 | } 93 | 94 | 95 | 96 | void deregisterGlobalPointer(__G) 97 | __GDEF 98 | { 99 | int scan=0; 100 | ulg tid = GetThreadId(); 101 | 102 | 103 | while (threadIdTable[scan] != tid && scan < THREADID_ENTRIES) 104 | scan++; 105 | 106 | /*--------------------------------------------------------------------------- 107 | There are two things we can do if we can't find the entry: ignore it or 108 | scream. The most likely reason for it not to be here is the user calling 109 | this routine twice. Since this could cause BIG problems if any globals 110 | are accessed after the first call, we'd better scream. 111 | ---------------------------------------------------------------------------*/ 112 | 113 | if (scan == THREADID_ENTRIES || threadPtrTable[scan] != pG) { 114 | ZCONST char *noEntry; 115 | if (scan == THREADID_ENTRIES) 116 | noEntry = LoadFarString(EntryNotFound); 117 | else 118 | noEntry = LoadFarString(GlobalPointerMismatch); 119 | Info(slide, 0x421, ((char *)slide, noEntry)); 120 | EXIT(PK_WARN); /* programming error, but after we're all done */ 121 | } 122 | 123 | threadIdTable [scan] = 0; 124 | lastScan = scan; 125 | free(threadPtrTable[scan]); 126 | } 127 | 128 | 129 | 130 | Uz_Globs *getGlobalPointer() 131 | { 132 | int scan=0; 133 | ulg tid = GetThreadId(); 134 | 135 | while (threadIdTable[scan] != tid && scan < THREADID_ENTRIES) 136 | scan++; 137 | 138 | /*--------------------------------------------------------------------------- 139 | There are two things we can do if we can't find the entry: ignore it or 140 | scream. The most likely reason for it not to be here is the user calling 141 | this routine twice. Since this could cause BIG problems if any globals 142 | are accessed after the first call, we'd better scream. 143 | ---------------------------------------------------------------------------*/ 144 | 145 | if (scan == THREADID_ENTRIES) { 146 | ZCONST char *noEntry = LoadFarString(EntryNotFound); 147 | fprintf(stderr, noEntry); /* can't use Info w/o a global pointer */ 148 | EXIT(PK_ERR); /* programming error while still working */ 149 | } 150 | 151 | return threadPtrTable[scan]; 152 | } 153 | 154 | # endif /* ?USETHREADID */ 155 | #endif /* ?REENTRANT */ 156 | 157 | 158 | 159 | Uz_Globs *globalsCtor() 160 | { 161 | #ifdef REENTRANT 162 | Uz_Globs *pG = (Uz_Globs *)malloc(sizeof(Uz_Globs)); 163 | 164 | if (!pG) 165 | return (Uz_Globs *)NULL; 166 | #endif /* REENTRANT */ 167 | 168 | /* for REENTRANT version, G is defined as (*pG) */ 169 | 170 | memzero(&G, sizeof(Uz_Globs)); 171 | 172 | #ifndef FUNZIP 173 | #ifdef CMS_MVS 174 | uO.aflag=1; 175 | uO.C_flag=1; 176 | #endif 177 | #ifdef TANDEM 178 | uO.aflag=1; /* default to '-a' auto create Text Files as type 101 */ 179 | #endif 180 | #ifdef VMS 181 | # if (!defined(NO_TIMESTAMPS)) 182 | uO.D_flag=1; /* default to '-D', no restoration of dir timestamps */ 183 | # endif 184 | #endif 185 | 186 | uO.lflag=(-1); 187 | G.wildzipfn = ""; 188 | G.pfnames = (char **)fnames; 189 | G.pxnames = (char **)&fnames[1]; 190 | G.pInfo = G.info; 191 | G.sol = TRUE; /* at start of line */ 192 | 193 | G.message = UzpMessagePrnt; 194 | G.input = UzpInput; /* not used by anyone at the moment... */ 195 | #if defined(WINDLL) || defined(MACOS) 196 | G.mpause = NULL; /* has scrollbars: no need for pausing */ 197 | #else 198 | G.mpause = UzpMorePause; 199 | #endif 200 | G.decr_passwd = UzpPassword; 201 | #endif /* !FUNZIP */ 202 | 203 | #if (!defined(DOS_FLX_H68_NLM_OS2_W32) && !defined(AMIGA) && !defined(RISCOS)) 204 | #if (!defined(MACOS) && !defined(ATARI) && !defined(VMS)) 205 | G.echofd = -1; 206 | #endif /* !(MACOS || ATARI || VMS) */ 207 | #endif /* !(DOS_FLX_H68_NLM_OS2_W32 || AMIGA || RISCOS) */ 208 | 209 | #ifdef SYSTEM_SPECIFIC_CTOR 210 | SYSTEM_SPECIFIC_CTOR(__G); 211 | #endif 212 | 213 | #ifdef REENTRANT 214 | #ifdef USETHREADID 215 | registerGlobalPointer(__G); 216 | #else 217 | GG = &G; 218 | #endif /* ?USETHREADID */ 219 | #endif /* REENTRANT */ 220 | 221 | return &G; 222 | } 223 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/globals.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2009 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2009-Jan-02 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /*--------------------------------------------------------------------------- 10 | 11 | globals.h 12 | 13 | There is usually no need to include this file since unzip.h includes it. 14 | 15 | This header file is used by all of the UnZip source files. It contains 16 | a struct definition that is used to "house" all of the global variables. 17 | This is done to allow for multithreaded environments (OS/2, NT, Win95, 18 | Unix) to call UnZip through an API without a semaphore. REENTRANT should 19 | be defined for all platforms that require this. 20 | 21 | GLOBAL CONSTRUCTOR AND DESTRUCTOR (API WRITERS READ THIS!!!) 22 | ------------------------------------------------------------ 23 | 24 | No, it's not C++, but it's as close as we can get with K&R. 25 | 26 | The main() of each process that uses these globals must include the 27 | CONSTRUCTGLOBALS; statement. This will malloc enough memory for the 28 | structure and initialize any variables that require it. This must 29 | also be done by any API function that jumps into the middle of the 30 | code. 31 | 32 | The DESTROYGLOBALS(); statement should be inserted before EVERY "EXIT(n)". 33 | Naturally, it also needs to be put before any API returns as well. 34 | In fact, it's much more important in API functions since the process 35 | will NOT end, and therefore the memory WON'T automatically be freed 36 | by the operating system. 37 | 38 | USING VARIABLES FROM THE STRUCTURE 39 | ---------------------------------- 40 | 41 | All global variables must now be prefixed with `G.' which is either a 42 | global struct (in which case it should be the only global variable) or 43 | a macro for the value of a local pointer variable that is passed from 44 | function to function. Yes, this is a pain. But it's the only way to 45 | allow full reentrancy. 46 | 47 | ADDING VARIABLES TO THE STRUCTURE 48 | --------------------------------- 49 | 50 | If you make the inclusion of any variables conditional, be sure to only 51 | check macros that are GUARANTEED to be included in every module. 52 | For instance, newzip and pwdarg are needed only if CRYPT is TRUE, 53 | but this is defined after unzip.h has been read. If you are not careful, 54 | some modules will expect your variable to be part of this struct while 55 | others won't. This will cause BIG problems. (Inexplicable crashes at 56 | strange times, car fires, etc.) When in doubt, always include it! 57 | 58 | Note also that UnZipSFX needs a few variables that UnZip doesn't. However, 59 | it also includes some object files from UnZip. If we were to conditionally 60 | include the extra variables that UnZipSFX needs, the object files from 61 | UnZip would not mesh with the UnZipSFX object files. Result: we just 62 | include the UnZipSFX variables every time. (It's only an extra 4 bytes 63 | so who cares!) 64 | 65 | ADDING FUNCTIONS 66 | ---------------- 67 | 68 | To support this new global struct, all functions must now conditionally 69 | pass the globals pointer (pG) to each other. This is supported by 5 macros: 70 | __GPRO, __GPRO__, __G, __G__ and __GDEF. A function that needs no other 71 | parameters would look like this: 72 | 73 | int extract_or_test_files(__G) 74 | __GDEF 75 | { 76 | ... stuff ... 77 | } 78 | 79 | A function with other parameters would look like: 80 | 81 | int memextract(__G__ tgt, tgtsize, src, srcsize) 82 | __GDEF 83 | uch *tgt, *src; 84 | ulg tgtsize, srcsize; 85 | { 86 | ... stuff ... 87 | } 88 | 89 | In the Function Prototypes section of unzpriv.h, you should use __GPRO and 90 | __GPRO__ instead: 91 | 92 | int uz_opts OF((__GPRO__ int *pargc, char ***pargv)); 93 | int process_zipfiles OF((__GPRO)); 94 | 95 | Note that there is NO comma after __G__ or __GPRO__ and no semi-colon after 96 | __GDEF. I wish there was another way but I don't think there is. 97 | 98 | 99 | TESTING THE CODE 100 | ----------------- 101 | 102 | Whether your platform requires reentrancy or not, you should always try 103 | building with REENTRANT defined if any functions have been added. It is 104 | pretty easy to forget a __G__ or a __GDEF and this mistake will only show 105 | up if REENTRANT is defined. All platforms should run with REENTRANT 106 | defined. Platforms that can't take advantage of it will just be paying 107 | a performance penalty needlessly. 108 | 109 | SIGNAL MADNESS 110 | -------------- 111 | 112 | This whole pointer passing scheme falls apart when it comes to SIGNALs. 113 | I handle this situation 2 ways right now. If you define USETHREADID, 114 | UnZip will include a 64-entry table. Each entry can hold a global 115 | pointer and thread ID for one thread. This should allow up to 64 116 | threads to access UnZip simultaneously. Calling DESTROYGLOBALS() 117 | will free the global struct and zero the table entry. If somebody 118 | forgets to call DESTROYGLOBALS(), this table will eventually fill up 119 | and UnZip will exit with an error message. A good way to test your 120 | code to make sure you didn't forget a DESTROYGLOBALS() is to change 121 | THREADID_ENTRIES to 3 or 4 in globals.c, making the table real small. 122 | Then make a small test program that calls your API a dozen times. 123 | 124 | Those platforms that don't have threads still need to be able to compile 125 | with REENTRANT defined to test and see if new code is correctly written 126 | to work either way. For these platforms, I simply keep a global pointer 127 | called GG that points to the Globals structure. Good enough for testing. 128 | 129 | I believe that NT has thread level storage. This could probably be used 130 | to store a global pointer for the sake of the signal handler more cleanly 131 | than my table approach. 132 | 133 | ---------------------------------------------------------------------------*/ 134 | 135 | #ifndef __globals_h 136 | #define __globals_h 137 | 138 | #ifdef USE_ZLIB 139 | # include "zlib.h" 140 | # ifdef zlib_version /* This name is used internally in unzip */ 141 | # undef zlib_version /* and must not be defined as a macro. */ 142 | # endif 143 | #endif 144 | 145 | #ifdef USE_BZIP2 146 | # include "bzlib.h" 147 | #endif 148 | 149 | 150 | /*************/ 151 | /* Globals */ 152 | /*************/ 153 | 154 | typedef struct Globals { 155 | #ifdef DLL 156 | zvoid *callerglobs; /* pointer to structure of pass-through global vars */ 157 | #endif 158 | 159 | /* command options of general use */ 160 | UzpOpts UzO; /* command options of general use */ 161 | 162 | #ifndef FUNZIP 163 | /* command options specific to the high level command line interface */ 164 | #ifdef MORE 165 | int M_flag; /* -M: built-in "more" function */ 166 | #endif 167 | 168 | /* internal flags and general globals */ 169 | #ifdef MORE 170 | int height; /* check for SIGWINCH, etc., eventually... */ 171 | int lines; /* count of lines displayed on current screen */ 172 | # if (defined(SCREENWIDTH) && defined(SCREENLWRAP)) 173 | int width; 174 | int chars; /* count of screen characters in current line */ 175 | # endif 176 | #endif /* MORE */ 177 | #if (defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME)) 178 | int tz_is_valid; /* indicates that timezone info can be used */ 179 | #endif 180 | int noargs; /* did true command line have *any* arguments? */ 181 | unsigned filespecs; /* number of real file specifications to be matched */ 182 | unsigned xfilespecs; /* number of excluded filespecs to be matched */ 183 | int process_all_files; 184 | int overwrite_mode; /* 0 - query, 1 - always, 2 - never */ 185 | int create_dirs; /* used by main(), mapname(), checkdir() */ 186 | int extract_flag; 187 | int newzip; /* reset in extract.c; used in crypt.c */ 188 | zoff_t real_ecrec_offset; 189 | zoff_t expect_ecrec_offset; 190 | zoff_t csize; /* used by decompr. (NEXTBYTE): must be signed */ 191 | zoff_t used_csize; /* used by extract_or_test_member(), explode() */ 192 | 193 | #ifdef DLL 194 | int fValidate; /* true if only validating an archive */ 195 | int filenotfound; 196 | int redirect_data; /* redirect data to memory buffer */ 197 | int redirect_text; /* redirect text output to buffer */ 198 | # ifndef NO_SLIDE_REDIR 199 | int redirect_slide; /* redirect decompression area to mem buffer */ 200 | # if (defined(USE_DEFLATE64) && defined(INT_16BIT)) 201 | ulg _wsize; /* size of sliding window exceeds "unsigned" range */ 202 | # else 203 | unsigned _wsize; /* sliding window size can be hold in unsigned */ 204 | # endif 205 | # endif 206 | ulg redirect_size; /* size of redirected output buffer */ 207 | uch *redirect_buffer; /* pointer to head of allocated buffer */ 208 | uch *redirect_pointer; /* pointer past end of written data */ 209 | # ifndef NO_SLIDE_REDIR 210 | uch *redirect_sldptr; /* head of decompression slide buffer */ 211 | # endif 212 | # ifdef OS2DLL 213 | cbList(processExternally); /* call-back list */ 214 | # endif 215 | #endif /* DLL */ 216 | 217 | char **pfnames; 218 | char **pxnames; 219 | char sig[4]; 220 | char answerbuf[10]; 221 | min_info info[DIR_BLKSIZ]; 222 | min_info *pInfo; 223 | #endif /* !FUNZIP */ 224 | union work area; /* see unzpriv.h for definition of work */ 225 | 226 | #if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB)) 227 | ZCONST ulg near *crc_32_tab; 228 | #else 229 | ZCONST ulg Far *crc_32_tab; 230 | #endif 231 | ulg crc32val; /* CRC shift reg. (was static in funzip) */ 232 | 233 | #ifdef FUNZIP 234 | FILE *in; /* file descriptor of compressed stream */ 235 | #endif 236 | uch *inbuf; /* input buffer (any size is OK) */ 237 | uch *inptr; /* pointer into input buffer */ 238 | int incnt; 239 | 240 | #ifndef FUNZIP 241 | ulg bitbuf; 242 | int bits_left; /* unreduce and unshrink only */ 243 | int zipeof; 244 | char *argv0; /* used for NT and EXE_EXTENSION */ 245 | char *wildzipfn; 246 | char *zipfn; /* GRR: WINDLL: must nuke any malloc'd zipfn... */ 247 | #ifdef USE_STRM_INPUT 248 | FILE *zipfd; /* zipfile file descriptor */ 249 | #else 250 | int zipfd; /* zipfile file handle */ 251 | #endif 252 | zoff_t ziplen; 253 | zoff_t cur_zipfile_bufstart; /* extract_or_test, readbuf, ReadByte */ 254 | zoff_t extra_bytes; /* used in unzip.c, misc.c */ 255 | uch *extra_field; /* Unix, VMS, Mac, OS/2, Acorn, ... */ 256 | uch *hold; 257 | 258 | local_file_hdr lrec; /* used in unzip.c, extract.c */ 259 | cdir_file_hdr crec; /* used in unzip.c, extract.c, misc.c */ 260 | ecdir_rec ecrec; /* used in unzip.c, extract.c */ 261 | z_stat statbuf; /* used by main, mapname, check_for_newer */ 262 | 263 | int mem_mode; 264 | uch *outbufptr; /* extract.c static */ 265 | ulg outsize; /* extract.c static */ 266 | int reported_backslash; /* extract.c static */ 267 | int disk_full; 268 | int newfile; 269 | 270 | int didCRlast; /* fileio static */ 271 | ulg numlines; /* fileio static: number of lines printed */ 272 | int sol; /* fileio static: at start of line */ 273 | int no_ecrec; /* process static */ 274 | #ifdef SYMLINKS 275 | int symlnk; 276 | slinkentry *slink_head; /* pointer to head of symlinks list */ 277 | slinkentry *slink_last; /* pointer to last entry in symlinks list */ 278 | #endif 279 | #ifdef NOVELL_BUG_FAILSAFE 280 | int dne; /* true if stat() says file doesn't exist */ 281 | #endif 282 | 283 | FILE *outfile; 284 | uch *outbuf; 285 | uch *realbuf; 286 | 287 | #ifndef VMS /* if SMALL_MEM, outbuf2 is initialized in */ 288 | uch *outbuf2; /* process_zipfiles() (never changes); */ 289 | #endif /* else malloc'd ONLY if unshrink and -a */ 290 | #endif /* !FUNZIP */ 291 | uch *outptr; 292 | ulg outcnt; /* number of chars stored in outbuf */ 293 | #ifndef FUNZIP 294 | char filename[FILNAMSIZ]; /* also used by NT for temporary SFX path */ 295 | #ifdef UNICODE_SUPPORT 296 | char *filename_full; /* the full path so Unicode checks work */ 297 | extent fnfull_bufsize; /* size of allocated filename buffer */ 298 | int unicode_escape_all; 299 | int unicode_mismatch; 300 | #ifdef UTF8_MAYBE_NATIVE 301 | int native_is_utf8; /* bool, TRUE => native charset == UTF-8 */ 302 | #endif 303 | 304 | int unipath_version; /* version of Unicode field */ 305 | ulg unipath_checksum; /* Unicode field checksum */ 306 | char *unipath_filename; /* UTF-8 path */ 307 | #endif /* UNICODE_SUPPORT */ 308 | 309 | #ifdef CMS_MVS 310 | char *tempfn; /* temp file used; erase on close */ 311 | #endif 312 | 313 | char *key; /* crypt static: decryption password or NULL */ 314 | int nopwd; /* crypt static */ 315 | #endif /* !FUNZIP */ 316 | z_uint4 keys[3]; /* crypt static: keys defining pseudo-random sequence */ 317 | 318 | #if (!defined(DOS_FLX_H68_NLM_OS2_W32) && !defined(AMIGA) && !defined(RISCOS)) 319 | #if (!defined(MACOS) && !defined(ATARI) && !defined(VMS)) 320 | int echofd; /* ttyio static: file descriptor whose echo is off */ 321 | #endif /* !(MACOS || ATARI || VMS) */ 322 | #endif /* !(DOS_FLX_H68_NLM_OS2_W32 || AMIGA || RISCOS) */ 323 | 324 | unsigned hufts; /* track memory usage */ 325 | 326 | #ifdef USE_ZLIB 327 | int inflInit; /* inflate static: zlib inflate() initialized */ 328 | z_stream dstrm; /* inflate global: decompression stream */ 329 | #else 330 | struct huft *fixed_tl; /* inflate static */ 331 | struct huft *fixed_td; /* inflate static */ 332 | unsigned fixed_bl, fixed_bd; /* inflate static */ 333 | #ifdef USE_DEFLATE64 334 | struct huft *fixed_tl64; /* inflate static */ 335 | struct huft *fixed_td64; /* inflate static */ 336 | unsigned fixed_bl64, fixed_bd64; /* inflate static */ 337 | struct huft *fixed_tl32; /* inflate static */ 338 | struct huft *fixed_td32; /* inflate static */ 339 | unsigned fixed_bl32, fixed_bd32; /* inflate static */ 340 | ZCONST ush *cplens; /* inflate static */ 341 | ZCONST uch *cplext; /* inflate static */ 342 | ZCONST uch *cpdext; /* inflate static */ 343 | #endif 344 | unsigned wp; /* inflate static: current position in slide */ 345 | ulg bb; /* inflate static: bit buffer */ 346 | unsigned bk; /* inflate static: bits count in bit buffer */ 347 | #endif /* ?USE_ZLIB */ 348 | 349 | #ifndef FUNZIP 350 | /* cylindric buffer space for formatting zoff_t values (fileio static) */ 351 | char fzofft_buf[FZOFFT_NUM][FZOFFT_LEN]; 352 | int fzofft_index; 353 | 354 | #ifdef SMALL_MEM 355 | char rgchBigBuffer[512]; 356 | char rgchSmallBuffer[96]; 357 | char rgchSmallBuffer2[160]; /* boosted to 160 for local3[] in unzip.c */ 358 | #endif 359 | 360 | MsgFn *message; 361 | InputFn *input; 362 | PauseFn *mpause; 363 | PasswdFn *decr_passwd; 364 | StatCBFn *statreportcb; 365 | #ifdef WINDLL 366 | LPUSERFUNCTIONS lpUserFunctions; 367 | #endif 368 | 369 | int incnt_leftover; /* so improved NEXTBYTE does not waste input */ 370 | uch *inptr_leftover; 371 | 372 | #ifdef VMS_TEXT_CONV 373 | unsigned VMS_line_length; /* so native VMS variable-length text files */ 374 | int VMS_line_state; /* are readable on other platforms */ 375 | int VMS_line_pad; 376 | #endif 377 | 378 | #if (defined(SFX) && defined(CHEAP_SFX_AUTORUN)) 379 | char autorun_command[FILNAMSIZ]; 380 | #endif 381 | #endif /* !FUNZIP */ 382 | 383 | #ifdef SYSTEM_SPECIFIC_GLOBALS 384 | SYSTEM_SPECIFIC_GLOBALS 385 | #endif 386 | 387 | } Uz_Globs; /* end of struct Globals */ 388 | 389 | 390 | /***************************************************************************/ 391 | 392 | 393 | #define CRC_32_TAB G.crc_32_tab 394 | 395 | 396 | Uz_Globs *globalsCtor OF((void)); 397 | 398 | /* pseudo constant sigs; they are initialized at runtime so unzip executable 399 | * won't look like a zipfile 400 | */ 401 | extern char local_hdr_sig[4]; 402 | extern char central_hdr_sig[4]; 403 | extern char end_central_sig[4]; 404 | extern char end_central32_sig[4]; 405 | extern char end_central64_sig[4]; 406 | extern char end_centloc64_sig[4]; 407 | /* extern char extd_local_sig[4]; NOT USED YET */ 408 | 409 | #ifdef REENTRANT 410 | # define G (*(Uz_Globs *)pG) 411 | # define __G pG 412 | # define __G__ pG, 413 | # define __GPRO Uz_Globs *pG 414 | # define __GPRO__ Uz_Globs *pG, 415 | # define __GDEF Uz_Globs *pG; 416 | # ifdef USETHREADID 417 | extern int lastScan; 418 | void deregisterGlobalPointer OF((__GPRO)); 419 | Uz_Globs *getGlobalPointer OF((void)); 420 | # define GETGLOBALS() Uz_Globs *pG = getGlobalPointer() 421 | # define DESTROYGLOBALS() do {free_G_buffers(pG); \ 422 | deregisterGlobalPointer(pG);} while (0) 423 | # else 424 | extern Uz_Globs *GG; 425 | # define GETGLOBALS() Uz_Globs *pG = GG 426 | # define DESTROYGLOBALS() do {free_G_buffers(pG); free(pG);} while (0) 427 | # endif /* ?USETHREADID */ 428 | # define CONSTRUCTGLOBALS() Uz_Globs *pG = globalsCtor() 429 | #else /* !REENTRANT */ 430 | extern Uz_Globs G; 431 | # define __G 432 | # define __G__ 433 | # define __GPRO void 434 | # define __GPRO__ 435 | # define __GDEF 436 | # define GETGLOBALS() 437 | # define CONSTRUCTGLOBALS() globalsCtor() 438 | # define DESTROYGLOBALS() 439 | #endif /* ?REENTRANT */ 440 | 441 | #define uO G.UzO 442 | 443 | #endif /* __globals_h */ 444 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/inflate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2000 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2000-Apr-09 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /* inflate.h for UnZip -- by Mark Adler 10 | version c14f, 23 November 1995 */ 11 | 12 | 13 | /* Copyright history: 14 | - Starting with UnZip 5.41 of 16-April-2000, this source file 15 | is covered by the Info-Zip LICENSE cited above. 16 | - Prior versions of this source file, found in UnZip source packages 17 | up to UnZip 5.40, were put in the public domain. 18 | The original copyright note by Mark Adler was: 19 | "You can do whatever you like with this source file, 20 | though I would prefer that if you modify it and 21 | redistribute it that you include comments to that effect 22 | with your name and the date. Thank you." 23 | 24 | History: 25 | vers date who what 26 | ---- --------- -------------- ------------------------------------ 27 | c14 12 Mar 93 M. Adler made inflate.c standalone with the 28 | introduction of inflate.h. 29 | c14d 28 Aug 93 G. Roelofs replaced flush/FlushOutput with new version 30 | c14e 29 Sep 93 G. Roelofs moved everything into unzip.h; added crypt.h 31 | c14f 23 Nov 95 G. Roelofs added UNZIP_INTERNAL to accommodate newly 32 | split unzip.h 33 | */ 34 | 35 | #define UNZIP_INTERNAL 36 | #include "unzip.h" /* provides slide[], typedefs and macros */ 37 | #ifdef FUNZIP 38 | # include "crypt.h" /* provides NEXTBYTE macro for crypt version of funzip */ 39 | #endif 40 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/match.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2005 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2000-Apr-09 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /*--------------------------------------------------------------------------- 10 | 11 | match.c 12 | 13 | The match() routine recursively compares a string to a "pattern" (regular 14 | expression), returning TRUE if a match is found or FALSE if not. This 15 | version is specifically for use with unzip.c: as did the previous match() 16 | routines from SEA and J. Kercheval, it leaves the case (upper, lower, or 17 | mixed) of the string alone, but converts any uppercase characters in the 18 | pattern to lowercase if indicated by the global var pInfo->lcflag (which 19 | is to say, string is assumed to have been converted to lowercase already, 20 | if such was necessary). 21 | 22 | GRR: reversed order of text, pattern in matche() (now same as match()); 23 | added ignore_case/ic flags, Case() macro. 24 | 25 | PaulK: replaced matche() with recmatch() from Zip, modified to have an 26 | ignore_case argument; replaced test frame with simpler one. 27 | 28 | --------------------------------------------------------------------------- 29 | 30 | Copyright on recmatch() from Zip's util.c (although recmatch() was almost 31 | certainly written by Mark Adler...ask me how I can tell :-) ): 32 | 33 | Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly, 34 | Kai Uwe Rommel and Igor Mandrichenko. 35 | 36 | Permission is granted to any individual or institution to use, copy, 37 | or redistribute this software so long as all of the original files are 38 | included unmodified, that it is not sold for profit, and that this copy- 39 | right notice is retained. 40 | 41 | --------------------------------------------------------------------------- 42 | 43 | Match the pattern (wildcard) against the string (fixed): 44 | 45 | match(string, pattern, ignore_case, sepc); 46 | 47 | returns TRUE if string matches pattern, FALSE otherwise. In the pattern: 48 | 49 | `*' matches any sequence of characters (zero or more) 50 | `?' matches any single character 51 | [SET] matches any character in the specified set, 52 | [!SET] or [^SET] matches any character not in the specified set. 53 | 54 | A set is composed of characters or ranges; a range looks like ``character 55 | hyphen character'' (as in 0-9 or A-Z). [0-9a-zA-Z_] is the minimal set of 56 | characters allowed in the [..] pattern construct. Other characters are 57 | allowed (i.e., 8-bit characters) if your system will support them. 58 | 59 | To suppress the special syntactic significance of any of ``[]*?!^-\'', in- 60 | side or outside a [..] construct, and match the character exactly, precede 61 | it with a ``\'' (backslash). 62 | 63 | Note that "*.*" and "*." are treated specially under MS-DOS if DOSWILD is 64 | defined. See the DOSWILD section below for an explanation. Note also 65 | that with VMSWILD defined, '%' is used instead of '?', and sets (ranges) 66 | are delimited by () instead of []. 67 | 68 | ---------------------------------------------------------------------------*/ 69 | 70 | 71 | #define __MATCH_C /* identifies this source module */ 72 | 73 | /* define ToLower() in here (for Unix, define ToLower to be macro (using 74 | * isupper()); otherwise just use tolower() */ 75 | #define UNZIP_INTERNAL 76 | #include "unzip.h" 77 | 78 | #ifndef THEOS /* the Theos port defines its own variant of match() */ 79 | 80 | #if 0 /* this is not useful until it matches Amiga names insensitively */ 81 | #ifdef AMIGA /* some other platforms might also want to use this */ 82 | # define ANSI_CHARSET /* MOVE INTO UNZIP.H EVENTUALLY */ 83 | #endif 84 | #endif /* 0 */ 85 | 86 | #ifdef ANSI_CHARSET 87 | # ifdef ToLower 88 | # undef ToLower 89 | # endif 90 | /* uppercase letters are values 41 thru 5A, C0 thru D6, and D8 thru DE */ 91 | # define IsUpper(c) (c>=0xC0 ? c<=0xDE && c!=0xD7 : c>=0x41 && c<=0x5A) 92 | # define ToLower(c) (IsUpper((uch) c) ? (unsigned) c | 0x20 : (unsigned) c) 93 | #endif 94 | #define Case(x) (ic? ToLower(x) : (x)) 95 | 96 | #ifdef VMSWILD 97 | # define WILDCHAR '%' 98 | # define BEG_RANGE '(' 99 | # define END_RANGE ')' 100 | #else 101 | # define WILDCHAR '?' 102 | # define BEG_RANGE '[' 103 | # define END_RANGE ']' 104 | #endif 105 | 106 | #if 0 /* GRR: add this to unzip.h someday... */ 107 | #if !(defined(MSDOS) && defined(DOSWILD)) 108 | #ifdef WILD_STOP_AT_DIR 109 | #define match(s,p,ic,sc) (recmatch((ZCONST uch *)p,(ZCONST uch *)s,ic,sc) == 1) 110 | #else 111 | #define match(s,p,ic) (recmatch((ZCONST uch *)p,(ZCONST uch *)s,ic) == 1) 112 | #endif 113 | int recmatch OF((ZCONST uch *pattern, ZCONST uch *string, 114 | int ignore_case __WDLPRO)); 115 | #endif 116 | #endif /* 0 */ 117 | static int recmatch OF((ZCONST uch *pattern, ZCONST uch *string, 118 | int ignore_case __WDLPRO)); 119 | static char *isshexp OF((ZCONST char *p)); 120 | static int namecmp OF((ZCONST char *s1, ZCONST char *s2)); 121 | 122 | 123 | /* match() is a shell to recmatch() to return only Boolean values. */ 124 | 125 | int match(string, pattern, ignore_case __WDL) 126 | ZCONST char *string, *pattern; 127 | int ignore_case; 128 | __WDLDEF 129 | { 130 | #if (defined(MSDOS) && defined(DOSWILD)) 131 | char *dospattern; 132 | int j = strlen(pattern); 133 | 134 | /*--------------------------------------------------------------------------- 135 | Optional MS-DOS preprocessing section: compare last three chars of the 136 | wildcard to "*.*" and translate to "*" if found; else compare the last 137 | two characters to "*." and, if found, scan the non-wild string for dots. 138 | If in the latter case a dot is found, return failure; else translate the 139 | "*." to "*". In either case, continue with the normal (Unix-like) match 140 | procedure after translation. (If not enough memory, default to normal 141 | match.) This causes "a*.*" and "a*." to behave as MS-DOS users expect. 142 | ---------------------------------------------------------------------------*/ 143 | 144 | if ((dospattern = (char *)malloc(j+1)) != NULL) { 145 | strcpy(dospattern, pattern); 146 | if (!strcmp(dospattern+j-3, "*.*")) { 147 | dospattern[j-2] = '\0'; /* nuke the ".*" */ 148 | } else if (!strcmp(dospattern+j-2, "*.")) { 149 | char *p = MBSCHR(string, '.'); 150 | 151 | if (p) { /* found a dot: match fails */ 152 | free(dospattern); 153 | return 0; 154 | } 155 | dospattern[j-1] = '\0'; /* nuke the end "." */ 156 | } 157 | j = recmatch((uch *)dospattern, (uch *)string, ignore_case __WDL); 158 | free(dospattern); 159 | return j == 1; 160 | } else 161 | #endif /* MSDOS && DOSWILD */ 162 | return recmatch((uch *)pattern, (uch *)string, ignore_case __WDL) == 1; 163 | } 164 | 165 | 166 | 167 | static int recmatch(p, s, ic __WDL) 168 | ZCONST uch *p; /* sh pattern to match */ 169 | ZCONST uch *s; /* string to which to match it */ 170 | int ic; /* true for case insensitivity */ 171 | __WDLDEF /* directory sepchar for WildStopAtDir mode, or 0 */ 172 | /* Recursively compare the sh pattern p with the string s and return 1 if 173 | * they match, and 0 or 2 if they don't or if there is a syntax error in the 174 | * pattern. This routine recurses on itself no more deeply than the number 175 | * of characters in the pattern. */ 176 | { 177 | unsigned int c; /* pattern char or start of range in [-] loop */ 178 | 179 | /* Get first character, the pattern for new recmatch calls follows */ 180 | c = *p; INCSTR(p); 181 | 182 | /* If that was the end of the pattern, match if string empty too */ 183 | if (c == 0) 184 | return *s == 0; 185 | 186 | /* '?' (or '%') matches any character (but not an empty string). */ 187 | if (c == WILDCHAR) 188 | #ifdef WILD_STOP_AT_DIR 189 | /* If uO.W_flag is non-zero, it won't match '/' */ 190 | return (*s && (!sepc || *s != (uch)sepc)) 191 | ? recmatch(p, s + CLEN(s), ic, sepc) : 0; 192 | #else 193 | return *s ? recmatch(p, s + CLEN(s), ic) : 0; 194 | #endif 195 | 196 | /* '*' matches any number of characters, including zero */ 197 | #ifdef AMIGA 198 | if (c == '#' && *p == '?') /* "#?" is Amiga-ese for "*" */ 199 | c = '*', p++; 200 | #endif /* AMIGA */ 201 | if (c == '*') { 202 | #ifdef WILD_STOP_AT_DIR 203 | if (sepc) { 204 | /* check for single "*" or double "**" */ 205 | # ifdef AMIGA 206 | if ((c = p[0]) == '#' && p[1] == '?') /* "#?" is Amiga-ese for "*" */ 207 | c = '*', p++; 208 | if (c != '*') { 209 | # else /* !AMIGA */ 210 | if (*p != '*') { 211 | # endif /* ?AMIGA */ 212 | /* single "*": this doesn't match the dirsep character */ 213 | for (; *s && *s != (uch)sepc; INCSTR(s)) 214 | if ((c = recmatch(p, s, ic, sepc)) != 0) 215 | return (int)c; 216 | /* end of pattern: matched if at end of string, else continue */ 217 | if (*p == '\0') 218 | return (*s == 0); 219 | /* continue to match if at sepc in pattern, else give up */ 220 | return (*p == (uch)sepc || (*p == '\\' && p[1] == (uch)sepc)) 221 | ? recmatch(p, s, ic, sepc) : 2; 222 | } 223 | /* "**": this matches slashes */ 224 | ++p; /* move p behind the second '*' */ 225 | /* and continue with the non-W_flag code variant */ 226 | } 227 | #endif /* WILD_STOP_AT_DIR */ 228 | if (*p == 0) 229 | return 1; 230 | if (isshexp((ZCONST char *)p) == NULL) { 231 | /* Optimization for rest of pattern being a literal string: 232 | * If there are no other shell expression chars in the rest 233 | * of the pattern behind the multi-char wildcard, then just 234 | * compare the literal string tail. 235 | */ 236 | ZCONST uch *srest; 237 | 238 | srest = s + (strlen((ZCONST char *)s) - strlen((ZCONST char *)p)); 239 | if (srest - s < 0) 240 | /* remaining literal string from pattern is longer than rest 241 | * of test string, there can't be a match 242 | */ 243 | return 0; 244 | else 245 | /* compare the remaining literal pattern string with the last 246 | * bytes of the test string to check for a match 247 | */ 248 | #ifdef _MBCS 249 | { 250 | ZCONST uch *q = s; 251 | 252 | /* MBCS-aware code must not scan backwards into a string from 253 | * the end. 254 | * So, we have to move forward by character from our well-known 255 | * character position s in the test string until we have 256 | * advanced to the srest position. 257 | */ 258 | while (q < srest) 259 | INCSTR(q); 260 | /* In case the byte *srest is a trailing byte of a multibyte 261 | * character in the test string s, we have actually advanced 262 | * past the position (srest). 263 | * For this case, the match has failed! 264 | */ 265 | if (q != srest) 266 | return 0; 267 | return ((ic 268 | ? namecmp((ZCONST char *)p, (ZCONST char *)q) 269 | : strcmp((ZCONST char *)p, (ZCONST char *)q) 270 | ) == 0); 271 | } 272 | #else /* !_MBCS */ 273 | return ((ic 274 | ? namecmp((ZCONST char *)p, (ZCONST char *)srest) 275 | : strcmp((ZCONST char *)p, (ZCONST char *)srest) 276 | ) == 0); 277 | #endif /* ?_MBCS */ 278 | } else { 279 | /* pattern contains more wildcards, continue with recursion... */ 280 | for (; *s; INCSTR(s)) 281 | if ((c = recmatch(p, s, ic __WDL)) != 0) 282 | return (int)c; 283 | return 2; /* 2 means give up--match will return false */ 284 | } 285 | } 286 | 287 | /* Parse and process the list of characters and ranges in brackets */ 288 | if (c == BEG_RANGE) { 289 | int e; /* flag true if next char to be taken literally */ 290 | ZCONST uch *q; /* pointer to end of [-] group */ 291 | int r; /* flag true to match anything but the range */ 292 | 293 | if (*s == 0) /* need a character to match */ 294 | return 0; 295 | p += (r = (*p == '!' || *p == '^')); /* see if reverse */ 296 | for (q = p, e = 0; *q; INCSTR(q)) /* find closing bracket */ 297 | if (e) 298 | e = 0; 299 | else 300 | if (*q == '\\') /* GRR: change to ^ for MS-DOS, OS/2? */ 301 | e = 1; 302 | else if (*q == END_RANGE) 303 | break; 304 | if (*q != END_RANGE) /* nothing matches if bad syntax */ 305 | return 0; 306 | for (c = 0, e = (*p == '-'); p < q; INCSTR(p)) { 307 | /* go through the list */ 308 | if (!e && *p == '\\') /* set escape flag if \ */ 309 | e = 1; 310 | else if (!e && *p == '-') /* set start of range if - */ 311 | c = *(p-1); 312 | else { 313 | unsigned int cc = Case(*s); 314 | 315 | if (*(p+1) != '-') 316 | for (c = c ? c : *p; c <= *p; c++) /* compare range */ 317 | if ((unsigned)Case(c) == cc) /* typecast for MSC bug */ 318 | return r ? 0 : recmatch(q + 1, s + 1, ic __WDL); 319 | c = e = 0; /* clear range, escape flags */ 320 | } 321 | } 322 | return r ? recmatch(q + CLEN(q), s + CLEN(s), ic __WDL) : 0; 323 | /* bracket match failed */ 324 | } 325 | 326 | /* if escape ('\\'), just compare next character */ 327 | if (c == '\\' && (c = *p++) == 0) /* if \ at end, then syntax error */ 328 | return 0; 329 | 330 | /* just a character--compare it */ 331 | #ifdef QDOS 332 | return QMatch(Case((uch)c), Case(*s)) ? 333 | recmatch(p, s + CLEN(s), ic __WDL) : 0; 334 | #else 335 | return Case((uch)c) == Case(*s) ? 336 | recmatch(p, s + CLEN(s), ic __WDL) : 0; 337 | #endif 338 | 339 | } /* end function recmatch() */ 340 | 341 | 342 | 343 | static char *isshexp(p) 344 | ZCONST char *p; 345 | /* If p is a sh expression, a pointer to the first special character is 346 | returned. Otherwise, NULL is returned. */ 347 | { 348 | for (; *p; INCSTR(p)) 349 | if (*p == '\\' && *(p+1)) 350 | p++; 351 | else if (*p == WILDCHAR || *p == '*' || *p == BEG_RANGE) 352 | return (char *)p; 353 | return NULL; 354 | } /* end function isshexp() */ 355 | 356 | 357 | 358 | static int namecmp(s1, s2) 359 | ZCONST char *s1, *s2; 360 | { 361 | int d; 362 | 363 | for (;;) { 364 | d = (int)ToLower((uch)*s1) 365 | - (int)ToLower((uch)*s2); 366 | 367 | if (d || *s1 == 0 || *s2 == 0) 368 | return d; 369 | 370 | s1++; 371 | s2++; 372 | } 373 | } /* end function namecmp() */ 374 | 375 | #endif /* !THEOS */ 376 | 377 | 378 | 379 | 380 | int iswild(p) /* originally only used for stat()-bug workaround in */ 381 | ZCONST char *p; /* VAX C, Turbo/Borland C, Watcom C, Atari MiNT libs; */ 382 | { /* now used in process_zipfiles() as well */ 383 | for (; *p; INCSTR(p)) 384 | if (*p == '\\' && *(p+1)) 385 | ++p; 386 | #ifdef THEOS 387 | else if (*p == '?' || *p == '*' || *p=='#'|| *p == '@') 388 | #else /* !THEOS */ 389 | #ifdef VMS 390 | else if (*p == '%' || *p == '*') 391 | #else /* !VMS */ 392 | #ifdef AMIGA 393 | else if (*p == '?' || *p == '*' || (*p=='#' && p[1]=='?') || *p == '[') 394 | #else /* !AMIGA */ 395 | else if (*p == '?' || *p == '*' || *p == '[') 396 | #endif /* ?AMIGA */ 397 | #endif /* ?VMS */ 398 | #endif /* ?THEOS */ 399 | #ifdef QDOS 400 | return (int)p; 401 | #else 402 | return TRUE; 403 | #endif 404 | 405 | return FALSE; 406 | 407 | } /* end function iswild() */ 408 | 409 | 410 | 411 | 412 | 413 | #ifdef TEST_MATCH 414 | 415 | #define put(s) {fputs(s,stdout); fflush(stdout);} 416 | #ifdef main 417 | # undef main 418 | #endif 419 | 420 | int main(int argc, char **argv) 421 | { 422 | char pat[256], str[256]; 423 | 424 | for (;;) { 425 | put("Pattern (return to exit): "); 426 | gets(pat); 427 | if (!pat[0]) 428 | break; 429 | for (;;) { 430 | put("String (return for new pattern): "); 431 | gets(str); 432 | if (!str[0]) 433 | break; 434 | printf("Case sensitive: %s insensitive: %s\n", 435 | match(str, pat, 0) ? "YES" : "NO", 436 | match(str, pat, 1) ? "YES" : "NO"); 437 | } 438 | } 439 | EXIT(0); 440 | } 441 | 442 | #endif /* TEST_MATCH */ 443 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/ttyio.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2004 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2000-Apr-09 or later 5 | (the contents of which are also included in zip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /* 10 | ttyio.h 11 | */ 12 | 13 | #ifndef __ttyio_h /* don't include more than once */ 14 | #define __ttyio_h 15 | 16 | #ifndef __crypt_h 17 | # include "crypt.h" /* ensure that encryption header file has been seen */ 18 | #endif 19 | 20 | #if (CRYPT || (defined(UNZIP) && !defined(FUNZIP))) 21 | /* 22 | * Non-echo keyboard/console input support is needed and enabled. 23 | */ 24 | 25 | #ifndef __G /* UnZip only, for now (DLL stuff) */ 26 | # define __G 27 | # define __G__ 28 | # define __GDEF 29 | # define __GPRO void 30 | # define __GPRO__ 31 | #endif 32 | 33 | #ifndef ZCONST /* UnZip only (until have configure script like Zip) */ 34 | # define ZCONST const 35 | #endif 36 | 37 | #if (defined(MSDOS) || defined(OS2) || defined(WIN32)) 38 | # ifndef DOS_OS2_W32 39 | # define DOS_OS2_W32 40 | # endif 41 | #endif 42 | 43 | #if (defined(DOS_OS2_W32) || defined(__human68k__)) 44 | # ifndef DOS_H68_OS2_W32 45 | # define DOS_H68_OS2_W32 46 | # endif 47 | #endif 48 | 49 | #if (defined(DOS_OS2_W32) || defined(FLEXOS)) 50 | # ifndef DOS_FLX_OS2_W32 51 | # define DOS_FLX_OS2_W32 52 | # endif 53 | #endif 54 | 55 | #if (defined(DOS_H68_OS2_W32) || defined(FLEXOS)) 56 | # ifndef DOS_FLX_H68_OS2_W32 57 | # define DOS_FLX_H68_OS2_W32 58 | # endif 59 | #endif 60 | 61 | #if (defined(__ATHEOS__) || defined(__BEOS__) || defined(UNIX)) 62 | # ifndef ATH_BEO_UNX 63 | # define ATH_BEO_UNX 64 | # endif 65 | #endif 66 | 67 | #if (defined(VM_CMS) || defined(MVS)) 68 | # ifndef CMS_MVS 69 | # define CMS_MVS 70 | # endif 71 | #endif 72 | 73 | 74 | /* Function prototypes */ 75 | 76 | /* The following systems supply a `non-echo' character input function "getch()" 77 | * (or an alias) and do not need the echoff() / echon() function pair. 78 | */ 79 | #ifdef AMIGA 80 | # define echoff(f) 81 | # define echon() 82 | # define getch() Agetch() 83 | # define HAVE_WORKING_GETCH 84 | #endif /* AMIGA */ 85 | 86 | #ifdef ATARI 87 | # define echoff(f) 88 | # define echon() 89 | # include 90 | # define getch() (Cnecin() & 0x000000ff) 91 | # define HAVE_WORKING_GETCH 92 | #endif 93 | 94 | #ifdef MACOS 95 | # define echoff(f) 96 | # define echon() 97 | # define getch() macgetch() 98 | # define HAVE_WORKING_GETCH 99 | #endif 100 | 101 | #ifdef NLM 102 | # define echoff(f) 103 | # define echon() 104 | # define HAVE_WORKING_GETCH 105 | #endif 106 | 107 | #ifdef QDOS 108 | # define echoff(f) 109 | # define echon() 110 | # define HAVE_WORKING_GETCH 111 | #endif 112 | 113 | #ifdef RISCOS 114 | # define echoff(f) 115 | # define echon() 116 | # define getch() SWI_OS_ReadC() 117 | # define HAVE_WORKING_GETCH 118 | #endif 119 | 120 | #ifdef DOS_H68_OS2_W32 121 | # define echoff(f) 122 | # define echon() 123 | # ifdef WIN32 124 | # ifndef getch 125 | # define getch() getch_win32() 126 | # endif 127 | # else /* !WIN32 */ 128 | # ifdef __EMX__ 129 | # ifndef getch 130 | # define getch() _read_kbd(0, 1, 0) 131 | # endif 132 | # else /* !__EMX__ */ 133 | # ifdef __GO32__ 134 | # include 135 | # define getch() getkey() 136 | # else /* !__GO32__ */ 137 | # include 138 | # endif /* ?__GO32__ */ 139 | # endif /* ?__EMX__ */ 140 | # endif /* ?WIN32 */ 141 | # define HAVE_WORKING_GETCH 142 | #endif /* DOS_H68_OS2_W32 */ 143 | 144 | #ifdef FLEXOS 145 | # define echoff(f) 146 | # define echon() 147 | # define getch() getchar() /* not correct, but may not be on a console */ 148 | # define HAVE_WORKING_GETCH 149 | #endif 150 | 151 | /* For VM/CMS and MVS, we do not (yet) have any support to switch terminal 152 | * input echo on and off. The following "fake" definitions allow inclusion 153 | * of crypt support and UnZip's "pause prompting" features, but without 154 | * any echo suppression. 155 | */ 156 | #ifdef CMS_MVS 157 | # define echoff(f) 158 | # define echon() 159 | #endif 160 | 161 | #ifdef TANDEM 162 | # define echoff(f) 163 | # define echon() 164 | # define getch() zgetch() /* defined in TANDEMC */ 165 | # define HAVE_WORKING_GETCH 166 | #endif 167 | 168 | /* The THEOS C runtime library supplies the function conmask() to toggle 169 | * terminal input echo on (conmask("e")) and off (conmask("n")). But, 170 | * since THEOS C RTL also contains a working non-echo getch() function, 171 | * the echo toggles are not needed. 172 | */ 173 | #ifdef THEOS 174 | # define echoff(f) 175 | # define echon() 176 | # define HAVE_WORKING_GETCH 177 | #endif 178 | 179 | /* VMS has a single echo() function in ttyio.c to toggle terminal 180 | * input echo on and off. 181 | */ 182 | #ifdef VMS 183 | # define echoff(f) echo(0) 184 | # define echon() echo(1) 185 | # define getch() tt_getch() 186 | # define FGETCH(f) tt_getch() 187 | int echo OF((int)); 188 | int tt_getch OF((void)); 189 | #endif 190 | 191 | /* For all other systems, ttyio.c supplies the two functions Echoff() and 192 | * Echon() for suppressing and (re)enabling console input echo. 193 | */ 194 | #ifndef echoff 195 | # define echoff(f) Echoff(__G__ f) 196 | # define echon() Echon(__G) 197 | void Echoff OF((__GPRO__ int f)); 198 | void Echon OF((__GPRO)); 199 | #endif 200 | 201 | /* this stuff is used by MORE and also now by the ctrl-S code; fileio.c only */ 202 | #if (defined(UNZIP) && !defined(FUNZIP)) 203 | # ifdef HAVE_WORKING_GETCH 204 | # define FGETCH(f) getch() 205 | # endif 206 | # ifndef FGETCH 207 | /* default for all systems where no getch()-like function is available */ 208 | int zgetch OF((__GPRO__ int f)); 209 | # define FGETCH(f) zgetch(__G__ f) 210 | # endif 211 | #endif /* UNZIP && !FUNZIP */ 212 | 213 | #if (CRYPT && !defined(WINDLL)) 214 | char *getp OF((__GPRO__ ZCONST char *m, char *p, int n)); 215 | #endif 216 | 217 | #else /* !(CRYPT || (UNZIP && !FUNZIP)) */ 218 | 219 | /* 220 | * No need for non-echo keyboard/console input; provide dummy definitions. 221 | */ 222 | #define echoff(f) 223 | #define echon() 224 | 225 | #endif /* ?(CRYPT || (UNZIP && !FUNZIP)) */ 226 | 227 | #endif /* !__ttyio_h */ 228 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/ubz2err.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2008 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2007-Mar-04 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /*--------------------------------------------------------------------------- 10 | 11 | ubz2err.c 12 | 13 | This file contains the "fatal error" callback routine required by the 14 | "minimal" (silent, non-stdio) setup of the bzip2 compression library. 15 | 16 | The fatal bzip2 error bail-out routine is provided in a separate code 17 | module, so that it can be easily overridden when the UnZip package is 18 | used as a static link library. One example is the WinDLL static library 19 | usage for building a monolythic binary of the Windows application "WiZ" 20 | that supports bzip2 both in compression and decompression operations. 21 | 22 | Contains: bz_internal_error() (USE_BZIP2 only) 23 | 24 | ---------------------------------------------------------------------------*/ 25 | 26 | 27 | #define __UBZ2ERR_C /* identifies this source module */ 28 | #define UNZIP_INTERNAL 29 | #include "unzip.h" 30 | #ifdef WINDLL 31 | # ifdef POCKET_UNZIP 32 | # include "wince/intrface.h" 33 | # else 34 | # include "windll/windll.h" 35 | # endif 36 | #endif 37 | 38 | #ifdef USE_BZIP2 39 | 40 | /**********************************/ 41 | /* Function bz_internal_error() */ 42 | /**********************************/ 43 | 44 | /* Call-back function for the bzip2 decompression code (compiled with 45 | * BZ_NO_STDIO), required to handle fatal internal bug-type errors of 46 | * the bzip2 library. 47 | */ 48 | void bz_internal_error(bzerrcode) 49 | int bzerrcode; 50 | { 51 | GETGLOBALS(); 52 | 53 | Info(slide, 0x421, ((char *)slide, 54 | "error: internal fatal libbzip2 error number %d\n", bzerrcode)); 55 | #ifdef WINDLL 56 | longjmp(dll_error_return, 1); 57 | #else 58 | DESTROYGLOBALS(); 59 | EXIT(PK_BADERR); 60 | #endif 61 | } /* end function bz_internal_error() */ 62 | 63 | #endif /* USE_BZIP2 */ 64 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/unix/unxcfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2009 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2009-Jan-02 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /*--------------------------------------------------------------------------- 10 | Unix specific configuration section: 11 | ---------------------------------------------------------------------------*/ 12 | 13 | #ifndef __unxcfg_h 14 | #define __unxcfg_h 15 | 16 | 17 | /* LARGE FILE SUPPORT - 10/6/04 EG */ 18 | /* This needs to be set before the includes so they set the right sizes */ 19 | 20 | #if (defined(NO_LARGE_FILE_SUPPORT) && defined(LARGE_FILE_SUPPORT)) 21 | # undef LARGE_FILE_SUPPORT 22 | #endif 23 | 24 | /* Automatically set ZIP64_SUPPORT if LFS */ 25 | #ifdef LARGE_FILE_SUPPORT 26 | # if (!defined(NO_ZIP64_SUPPORT) && !defined(ZIP64_SUPPORT)) 27 | # define ZIP64_SUPPORT 28 | # endif 29 | #endif 30 | 31 | /* NO_ZIP64_SUPPORT takes preceedence over ZIP64_SUPPORT */ 32 | #if defined(NO_ZIP64_SUPPORT) && defined(ZIP64_SUPPORT) 33 | # undef ZIP64_SUPPORT 34 | #endif 35 | 36 | #ifdef LARGE_FILE_SUPPORT 37 | /* 64-bit Large File Support */ 38 | 39 | /* The following Large File Summit (LFS) defines turn on large file support 40 | on Linux (probably 2.4 or later kernel) and many other unixen */ 41 | 42 | /* These have to be before any include that sets types so the large file 43 | versions of the types are set in the includes */ 44 | 45 | # define _LARGEFILE_SOURCE /* some OSes need this for fseeko */ 46 | # define _LARGEFILE64_SOURCE 47 | # define _FILE_OFFSET_BITS 64 /* select default interface as 64 bit */ 48 | # define _LARGE_FILES /* some OSes need this for 64-bit off_t */ 49 | # define __USE_LARGEFILE64 50 | #endif /* LARGE_FILE_SUPPORT */ 51 | 52 | 53 | #include /* off_t, time_t, dev_t, ... */ 54 | #include 55 | 56 | #ifdef NO_OFF_T 57 | typedef long zoff_t; 58 | #else 59 | typedef off_t zoff_t; 60 | #endif 61 | #define ZOFF_T_DEFINED 62 | typedef struct stat z_stat; 63 | #define Z_STAT_DEFINED 64 | 65 | #ifndef COHERENT 66 | # include /* O_BINARY for open() w/o CR/LF translation */ 67 | #else /* COHERENT */ 68 | # ifdef _I386 69 | # include /* Coherent 4.0.x, Mark Williams C */ 70 | # else 71 | # include /* Coherent 3.10, Mark Williams C */ 72 | # endif 73 | # define SHORT_SYMS 74 | # ifndef __COHERENT__ /* Coherent 4.2 has tzset() */ 75 | # define tzset settz 76 | # endif 77 | #endif /* ?COHERENT */ 78 | 79 | #ifndef NO_PARAM_H 80 | # ifdef NGROUPS_MAX 81 | # undef NGROUPS_MAX /* SCO bug: defined again in */ 82 | # endif 83 | # ifdef BSD 84 | # define TEMP_BSD /* may be defined again in */ 85 | # undef BSD 86 | # endif 87 | # include /* conflict with , some systems? */ 88 | # ifdef TEMP_BSD 89 | # undef TEMP_BSD 90 | # ifndef BSD 91 | # define BSD 92 | # endif 93 | # endif 94 | #endif /* !NO_PARAM_H */ 95 | 96 | #ifdef __osf__ 97 | # define DIRENT 98 | # ifdef BSD 99 | # undef BSD 100 | # endif 101 | #endif /* __osf__ */ 102 | 103 | #ifdef __CYGWIN__ 104 | # include 105 | # define DIRENT 106 | # define HAVE_TERMIOS_H 107 | # ifndef timezone 108 | # define timezone _timezone 109 | # endif 110 | #endif 111 | 112 | #ifdef BSD 113 | # include 114 | # include 115 | # if (defined(_AIX) || defined(__GLIBC__) || defined(__GNU__)) 116 | # include 117 | # endif 118 | #else 119 | # include 120 | struct tm *gmtime(), *localtime(); 121 | #endif 122 | 123 | #if (defined(BSD4_4) || (defined(SYSV) && defined(MODERN))) 124 | # include /* this includes utime.h on SGIs */ 125 | # if (defined(BSD4_4) || defined(linux) || defined(__GLIBC__)) 126 | # include 127 | # define GOT_UTIMBUF 128 | # endif 129 | # if (!defined(GOT_UTIMBUF) && (defined(__hpux) || defined(__SUNPRO_C))) 130 | # include 131 | # define GOT_UTIMBUF 132 | # endif 133 | # if (!defined(GOT_UTIMBUF) && defined(__GNU__)) 134 | # include 135 | # define GOT_UTIMBUF 136 | # endif 137 | #endif 138 | #if (defined(__DGUX__) && !defined(GOT_UTIMBUF)) 139 | /* DG/UX requires this because of a non-standard struct utimebuf */ 140 | # include 141 | # define GOT_UTIMBUF 142 | #endif 143 | 144 | #if (defined(V7) || defined(pyr_bsd)) 145 | # define strchr index 146 | # define strrchr rindex 147 | #endif 148 | #ifdef V7 149 | # define O_RDONLY 0 150 | # define O_WRONLY 1 151 | # define O_RDWR 2 152 | #endif 153 | 154 | #if defined(NO_UNICODE_SUPPORT) && defined(UNICODE_SUPPORT) 155 | /* disable Unicode (UTF-8) support when requested */ 156 | # undef UNICODE_SUPPORT 157 | #endif 158 | 159 | #if (defined(_MBCS) && defined(NO_MBCS)) 160 | /* disable MBCS support when requested */ 161 | # undef _MBCS 162 | #endif 163 | 164 | #if (!defined(NO_SETLOCALE) && !defined(_MBCS)) 165 | # if (!defined(UNICODE_SUPPORT) || !defined(UTF8_MAYBE_NATIVE)) 166 | /* enable setlocale here, unless this happens later for UTF-8 and/or 167 | * MBCS support */ 168 | # include 169 | # ifndef SETLOCALE 170 | # define SETLOCALE(category, locale) setlocale(category, locale) 171 | # endif 172 | # endif 173 | #endif 174 | #ifndef NO_SETLOCALE 175 | # if (!defined(NO_WORKING_ISPRINT) && !defined(HAVE_WORKING_ISPRINT)) 176 | /* enable "enhanced" unprintable chars detection in fnfilter() */ 177 | # define HAVE_WORKING_ISPRINT 178 | # endif 179 | #endif 180 | 181 | #ifdef MINIX 182 | # include 183 | #endif 184 | #if (!defined(HAVE_STRNICMP) & !defined(NO_STRNICMP)) 185 | # define NO_STRNICMP 186 | #endif 187 | #ifndef DATE_FORMAT 188 | # define DATE_FORMAT DF_MDY /* GRR: customize with locale.h somehow? */ 189 | #endif 190 | #define lenEOL 1 191 | #ifdef EBCDIC 192 | # define PutNativeEOL *q++ = '\n'; 193 | #else 194 | # define PutNativeEOL *q++ = native(LF); 195 | #endif 196 | #define SCREENSIZE(ttrows, ttcols) screensize(ttrows, ttcols) 197 | #define SCREENWIDTH 80 198 | #define SCREENLWRAP 1 199 | #define USE_EF_UT_TIME 200 | #if (!defined(NO_LCHOWN) || !defined(NO_LCHMOD)) 201 | # define SET_SYMLINK_ATTRIBS 202 | #endif 203 | #ifdef MTS 204 | # ifdef SET_DIR_ATTRIB 205 | # undef SET_DIR_ATTRIB 206 | # endif 207 | #else /* !MTS */ 208 | # define SET_DIR_ATTRIB 209 | # if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP)) /* GRR 970513 */ 210 | # define TIMESTAMP 211 | # endif 212 | # define RESTORE_UIDGID 213 | #endif /* ?MTS */ 214 | 215 | /* Static variables that we have to add to Uz_Globs: */ 216 | #define SYSTEM_SPECIFIC_GLOBALS \ 217 | int created_dir, renamed_fullpath;\ 218 | char *rootpath, *buildpath, *end;\ 219 | ZCONST char *wildname;\ 220 | char *dirname, matchname[FILNAMSIZ];\ 221 | int rootlen, have_dirname, dirnamelen, notfirstcall;\ 222 | zvoid *wild_dir; 223 | 224 | /* created_dir, and renamed_fullpath are used by both mapname() and */ 225 | /* checkdir(). */ 226 | /* rootlen, rootpath, buildpath and end are used by checkdir(). */ 227 | /* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */ 228 | /* and notfirstcall are used by do_wild(). */ 229 | 230 | #endif /* !__unxcfg_h */ 231 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/unzipfx/appDetails.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #ifdef WIN32 6 | # include 7 | #endif 8 | 9 | #include "appDetails.h" 10 | 11 | #define CMD_BUF_LEN 1024 12 | 13 | static int sfx_app_argc = 0; 14 | static char** sfx_app_argv = NULL; 15 | static char sfx_tmp_path[512] = { 0 }; 16 | 17 | void sfx_app_set_args(int argc, char** argv) 18 | { 19 | sfx_app_argc = argc; 20 | sfx_app_argv = argv; 21 | } 22 | 23 | int sfx_app_autorun_now() 24 | { 25 | int i, cmdBufLen = 0; 26 | char cmdBuf[CMD_BUF_LEN]; 27 | 28 | #ifdef WIN32 29 | strcpy(cmdBuf, sfx_get_tmp_path(1)); 30 | strcat(cmdBuf, SFX_AUTORUN_CMD); 31 | #else 32 | strcpy(cmdBuf, "cd "); 33 | strcat(cmdBuf, sfx_get_tmp_path(1)); 34 | strcat(cmdBuf, "; "); 35 | strcat(cmdBuf, SFX_AUTORUN_CMD); 36 | #endif 37 | 38 | cmdBufLen = strlen(cmdBuf); 39 | 40 | for (i=0; i < sfx_app_argc; i++) 41 | { 42 | if (! sfx_app_argv[i]) 43 | continue; 44 | 45 | cmdBufLen += strlen(sfx_app_argv[i]) + 1; 46 | if (cmdBufLen >= CMD_BUF_LEN-1) 47 | break; 48 | 49 | strcat(cmdBuf, " "); 50 | strcat(cmdBuf, sfx_app_argv[i]); 51 | } 52 | 53 | #ifdef WIN32 54 | ShellExecute(NULL, "open", cmdBuf, NULL, NULL, SW_SHOWNORMAL); 55 | return 0; 56 | #else 57 | return system(cmdBuf); 58 | #endif 59 | } 60 | 61 | char* sfx_get_tmp_path(int withAppName) 62 | { 63 | #ifdef WIN32 64 | { 65 | GetTempPathA(512 - strlen(SFX_APP_MININAME), sfx_tmp_path); 66 | 67 | if (withAppName == 1) 68 | strcat(sfx_tmp_path, SFX_APP_MININAME); 69 | } 70 | #else 71 | { 72 | char* tmp = getenv("TMP"); 73 | 74 | if (tmp) 75 | strcpy(sfx_tmp_path, tmp); 76 | else 77 | strcpy(sfx_tmp_path, "/tmp"); 78 | 79 | if (withAppName == 1) 80 | strcat(sfx_tmp_path, "/" SFX_APP_MININAME); 81 | } 82 | #endif 83 | 84 | return sfx_tmp_path; 85 | } 86 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/unzipfx/appDetails.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __APP_DETAILS_H__ 3 | #define __APP_DETAILS_H__ 4 | 5 | #define SFX_APP_VERSION "1.0.0" 6 | #define SFX_APP_BANNER "MOD-Remote self-contained executable " SFX_APP_VERSION ", based on UnZipSFX." 7 | 8 | #ifndef SFX_APP_MININAME 9 | # define SFX_APP_MININAME "MOD-Remote" 10 | #endif 11 | 12 | #ifdef WIN32 13 | # define SFX_AUTORUN_CMD "\\" SFX_APP_MININAME ".exe" 14 | #else 15 | # define SFX_AUTORUN_CMD "./" SFX_APP_MININAME 16 | #endif 17 | 18 | void sfx_app_set_args(int argc, char** argv); 19 | int sfx_app_autorun_now(); 20 | char* sfx_get_tmp_path(int withAppName); 21 | 22 | #endif // __APP_DETAILS_H__ 23 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/unzvers.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2009 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2009-Jan-02 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /* 10 | unzvers.h (for UnZip) by Info-ZIP. 11 | */ 12 | 13 | #ifndef __unzvers_h /* don't include more than once */ 14 | #define __unzvers_h 15 | 16 | #ifdef BETA 17 | # undef BETA /* undefine BETA for public releases */ 18 | #endif 19 | 20 | #ifdef BETA 21 | # define UZ_BETALEVEL "h03 BETA" 22 | # define UZ_VERSION_DATE "17 Apr 09" /* internal beta version */ 23 | #else 24 | # define UZ_BETALEVEL "" 25 | # define UZ_VERSION_DATE "20 April 2009" /* official release version */ 26 | # define RELEASE 27 | #endif 28 | 29 | #define UZ_MAJORVER 6 /* UnZip */ 30 | #define UZ_MINORVER 0 31 | 32 | #define ZI_MAJORVER 3 /* ZipInfo */ 33 | #define ZI_MINORVER 0 34 | 35 | #define UZ_PATCHLEVEL 0 36 | 37 | #define UZ_VER_STRING "6.0" /* keep in sync with Version numbers! */ 38 | 39 | #ifndef IZ_COMPANY_NAME /* might be already defined... */ 40 | # define IZ_COMPANY_NAME "Info-ZIP" 41 | #endif 42 | 43 | /* these are obsolete but remain for backward compatibility: */ 44 | #if (defined(OS2) || defined(__OS2__)) 45 | # define D2_MAJORVER UZ_MAJORVER /* DLL for OS/2 */ 46 | # define D2_MINORVER UZ_MINORVER 47 | # define D2_PATCHLEVEL UZ_PATCHLEVEL 48 | #endif 49 | 50 | #define DW_MAJORVER UZ_MAJORVER /* DLL for MS Windows */ 51 | #define DW_MINORVER UZ_MINORVER 52 | #define DW_PATCHLEVEL UZ_PATCHLEVEL 53 | 54 | #define WIN_VERSION_DATE UZ_VERSION_DATE 55 | 56 | #define UNZ_DLL_VERSION UZ_VER_STRING 57 | 58 | /* The following version constants specify the UnZip version that introduced 59 | * the most recent incompatible change (means: change that breaks backward 60 | * compatibility) of a DLL/Library binary API definition. 61 | * 62 | * Currently, UnZip supports three distinct DLL/Library APIs, which each 63 | * carry their own "compatibility level": 64 | * a) The "generic" (console-mode oriented) API has been used on UNIX, 65 | * for example. This API provides a "callable" interface similar to the 66 | * interactive command line of the normal program executables. 67 | * b) The OS/2-only API provides (additional) functions specially tailored 68 | * for interfacing with the REXX shell. 69 | * c) The Win32 DLL API with a pure binary interface which can be used to 70 | * build GUI mode as well as Console mode applications. 71 | * 72 | * Whenever a change that breaks backward compatibility gets applied to 73 | * any of the DLL/Library APIs, the corresponding compatibility level should 74 | * be synchronized with the current UnZip version numbers. 75 | */ 76 | /* generic DLL API minimum compatible version*/ 77 | #define UZ_GENAPI_COMP_MAJOR 6 78 | #define UZ_GENAPI_COMP_MINOR 0 79 | #define UZ_GENAPI_COMP_REVIS 0 80 | /* os2dll API minimum compatible version*/ 81 | #define UZ_OS2API_COMP_MAJOR 6 82 | #define UZ_OS2API_COMP_MINOR 0 83 | #define UZ_OS2API_COMP_REVIS 0 84 | /* windll API minimum compatible version*/ 85 | #define UZ_WINAPI_COMP_MAJOR 6 86 | #define UZ_WINAPI_COMP_MINOR 0 87 | #define UZ_WINAPI_COMP_REVIS 0 88 | 89 | #endif /* !__unzvers_h */ 90 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/win32/nt.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2007 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2000-Apr-09 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /* 10 | 11 | Copyright (c) 1996 Scott Field (dedicated to Info-Zip group) 12 | 13 | Module Name: 14 | 15 | nt.c 16 | 17 | Abstract: 18 | 19 | This module implements WinNT security descriptor operations for the 20 | Win32 Info-ZIP project. Operation such as setting file security, 21 | using/querying local and remote privileges, and queuing of operations 22 | is performed here. The contents of this module are only relevant 23 | when the code is running on Windows NT, and the target volume supports 24 | persistent Acl storage. 25 | 26 | User privileges that allow accessing certain privileged aspects of the 27 | security descriptor (such as the Sacl) are only used if the user specified 28 | to do so. 29 | 30 | Author: 31 | 32 | Scott Field (sfield@microsoft.com) 33 | 34 | Last revised: 18 Jan 97 35 | 36 | */ 37 | 38 | #define WIN32_LEAN_AND_MEAN 39 | #define UNZIP_INTERNAL 40 | #include "../unzip.h" 41 | #include 42 | #ifdef __RSXNT__ 43 | # include "../win32/rsxntwin.h" 44 | #endif 45 | #include "../win32/nt.h" 46 | 47 | 48 | #ifdef NTSD_EAS /* This file is only needed for NTSD handling */ 49 | 50 | /* Borland C++ does not define FILE_SHARE_DELETE. Others also? */ 51 | #ifndef FILE_SHARE_DELETE 52 | # define FILE_SHARE_DELETE 0x00000004 53 | #endif 54 | 55 | /* This macro definition is missing in old versions of MS' winbase.h. */ 56 | #ifndef InterlockedExchangePointer 57 | # define InterlockedExchangePointer(Target, Value) \ 58 | (PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value)) 59 | #endif 60 | 61 | 62 | /* private prototypes */ 63 | 64 | static BOOL Initialize(VOID); 65 | static VOID GetRemotePrivilegesSet(CHAR *FileName, PDWORD dwRemotePrivileges); 66 | static VOID InitLocalPrivileges(VOID); 67 | 68 | 69 | volatile BOOL bInitialized = FALSE; /* module level stuff initialized? */ 70 | HANDLE hInitMutex = NULL; /* prevent multiple initialization */ 71 | 72 | BOOL g_bRestorePrivilege = FALSE; /* for local set file security override */ 73 | BOOL g_bSaclPrivilege = FALSE; /* for local set sacl operations, only when 74 | restore privilege not present */ 75 | 76 | /* our single cached volume capabilities structure that describes the last 77 | volume root we encountered. A single entry like this works well in the 78 | zip/unzip scenario for a number of reasons: 79 | 1. typically one extraction path during unzip. 80 | 2. typically process one volume at a time during zip, and then move 81 | on to the next. 82 | 3. no cleanup code required and no memory leaks. 83 | 4. simple code. 84 | 85 | This approach should be reworked to a linked list approach if we expect to 86 | be called by many threads which are processing a variety of input/output 87 | volumes, since lock contention and stale data may become a bottleneck. */ 88 | 89 | VOLUMECAPS g_VolumeCaps; 90 | CRITICAL_SECTION VolumeCapsLock; 91 | 92 | 93 | static BOOL Initialize(VOID) 94 | { 95 | HANDLE hMutex; 96 | HANDLE hOldMutex; 97 | 98 | if (bInitialized) return TRUE; 99 | 100 | hMutex = CreateMutex(NULL, TRUE, NULL); 101 | if(hMutex == NULL) return FALSE; 102 | 103 | hOldMutex = (HANDLE)InterlockedExchangePointer((void *)&hInitMutex, 104 | hMutex); 105 | 106 | if (hOldMutex != NULL) { 107 | /* somebody setup the mutex already */ 108 | InterlockedExchangePointer((void *)&hInitMutex, 109 | hOldMutex); 110 | 111 | CloseHandle(hMutex); /* close new, un-needed mutex */ 112 | 113 | /* wait for initialization to complete and return status */ 114 | WaitForSingleObject(hOldMutex, INFINITE); 115 | ReleaseMutex(hOldMutex); 116 | 117 | return bInitialized; 118 | } 119 | 120 | if (!bInitialized) { 121 | /* initialize module level resources */ 122 | 123 | InitializeCriticalSection( &VolumeCapsLock ); 124 | memset(&g_VolumeCaps, 0, sizeof(VOLUMECAPS)); 125 | 126 | InitLocalPrivileges(); 127 | 128 | bInitialized = TRUE; 129 | } 130 | 131 | InterlockedExchangePointer((void *)&hInitMutex, 132 | NULL); 133 | 134 | ReleaseMutex(hMutex); /* release correct mutex */ 135 | 136 | CloseHandle(hMutex); /* free the no longer needed handle resource */ 137 | 138 | return TRUE; 139 | } 140 | 141 | 142 | BOOL ValidateSecurity(uch *securitydata) 143 | { 144 | PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR)securitydata; 145 | PACL pAcl; 146 | PSID pSid; 147 | BOOL bAclPresent; 148 | BOOL bDefaulted; 149 | 150 | if(!IsWinNT()) return TRUE; /* don't do anything if not on WinNT */ 151 | 152 | if(!IsValidSecurityDescriptor(sd)) return FALSE; 153 | 154 | /* verify Dacl integrity */ 155 | 156 | if(!GetSecurityDescriptorDacl(sd, &bAclPresent, &pAcl, &bDefaulted)) 157 | return FALSE; 158 | 159 | if(bAclPresent && pAcl!=NULL) { 160 | if(!IsValidAcl(pAcl)) return FALSE; 161 | } 162 | 163 | /* verify Sacl integrity */ 164 | 165 | if(!GetSecurityDescriptorSacl(sd, &bAclPresent, &pAcl, &bDefaulted)) 166 | return FALSE; 167 | 168 | if(bAclPresent && pAcl!=NULL) { 169 | if(!IsValidAcl(pAcl)) return FALSE; 170 | } 171 | 172 | /* verify owner integrity */ 173 | 174 | if(!GetSecurityDescriptorOwner(sd, &pSid, &bDefaulted)) 175 | return FALSE; 176 | 177 | if(pSid != NULL) { 178 | if(!IsValidSid(pSid)) return FALSE; 179 | } 180 | 181 | /* verify group integrity */ 182 | 183 | if(!GetSecurityDescriptorGroup(sd, &pSid, &bDefaulted)) 184 | return FALSE; 185 | 186 | if(pSid != NULL) { 187 | if(!IsValidSid(pSid)) return FALSE; 188 | } 189 | 190 | return TRUE; 191 | } 192 | 193 | static VOID GetRemotePrivilegesSet(char *FileName, PDWORD dwRemotePrivileges) 194 | { 195 | HANDLE hFile; 196 | 197 | *dwRemotePrivileges = 0; 198 | 199 | /* see if we have the SeRestorePrivilege */ 200 | 201 | hFile = CreateFileA( 202 | FileName, 203 | ACCESS_SYSTEM_SECURITY | WRITE_DAC | WRITE_OWNER | READ_CONTROL, 204 | FILE_SHARE_READ | FILE_SHARE_DELETE, /* no sd updating allowed here */ 205 | NULL, 206 | OPEN_EXISTING, 207 | FILE_FLAG_BACKUP_SEMANTICS, 208 | NULL 209 | ); 210 | 211 | if(hFile != INVALID_HANDLE_VALUE) { 212 | /* no remote way to determine SeRestorePrivilege -- just try a 213 | read/write to simulate it */ 214 | SECURITY_INFORMATION si = DACL_SECURITY_INFORMATION | 215 | SACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION | 216 | GROUP_SECURITY_INFORMATION; 217 | PSECURITY_DESCRIPTOR sd; 218 | DWORD cbBuf = 0; 219 | 220 | GetKernelObjectSecurity(hFile, si, NULL, cbBuf, &cbBuf); 221 | 222 | if(ERROR_INSUFFICIENT_BUFFER == GetLastError()) { 223 | if((sd = HeapAlloc(GetProcessHeap(), 0, cbBuf)) != NULL) { 224 | if(GetKernelObjectSecurity(hFile, si, sd, cbBuf, &cbBuf)) { 225 | if(SetKernelObjectSecurity(hFile, si, sd)) 226 | *dwRemotePrivileges |= OVERRIDE_RESTORE; 227 | } 228 | HeapFree(GetProcessHeap(), 0, sd); 229 | } 230 | } 231 | 232 | CloseHandle(hFile); 233 | } else { 234 | 235 | /* see if we have the SeSecurityPrivilege */ 236 | /* note we don't need this if we have SeRestorePrivilege */ 237 | 238 | hFile = CreateFileA( 239 | FileName, 240 | ACCESS_SYSTEM_SECURITY, 241 | FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, /* max */ 242 | NULL, 243 | OPEN_EXISTING, 244 | 0, 245 | NULL 246 | ); 247 | 248 | if(hFile != INVALID_HANDLE_VALUE) { 249 | CloseHandle(hFile); 250 | *dwRemotePrivileges |= OVERRIDE_SACL; 251 | } 252 | } 253 | } 254 | 255 | 256 | BOOL GetVolumeCaps( 257 | char *rootpath, /* filepath, or NULL */ 258 | char *name, /* filename associated with rootpath */ 259 | PVOLUMECAPS VolumeCaps /* result structure describing capabilities */ 260 | ) 261 | { 262 | char TempRootPath[MAX_PATH + 1]; 263 | DWORD cchTempRootPath = 0; 264 | BOOL bSuccess = TRUE; /* assume success until told otherwise */ 265 | 266 | if(!bInitialized) if(!Initialize()) return FALSE; 267 | 268 | /* process the input path to produce a consistent path suitable for 269 | compare operations and also suitable for certain picky Win32 API 270 | that don't like forward slashes */ 271 | 272 | if(rootpath != NULL && rootpath[0] != '\0') { 273 | DWORD i; 274 | 275 | cchTempRootPath = lstrlenA(rootpath); 276 | if(cchTempRootPath > MAX_PATH) return FALSE; 277 | 278 | /* copy input, converting forward slashes to back slashes as we go */ 279 | 280 | for(i = 0 ; i <= cchTempRootPath ; i++) { 281 | if(rootpath[i] == '/') TempRootPath[i] = '\\'; 282 | else TempRootPath[i] = rootpath[i]; 283 | } 284 | 285 | /* check for UNC and Null terminate or append trailing \ as 286 | appropriate */ 287 | 288 | /* possible valid UNCs we are passed follow: 289 | \\machine\foo\bar (path is \\machine\foo\) 290 | \\machine\foo (path is \\machine\foo\) 291 | \\machine\foo\ 292 | \\.\c$\ (FIXFIX: Win32API doesn't like this - GetComputerName()) 293 | LATERLATER: handling mounted DFS drives in the future will require 294 | slightly different logic which isn't available today. 295 | This is required because directories can point at 296 | different servers which have differing capabilities. 297 | */ 298 | 299 | if(TempRootPath[0] == '\\' && TempRootPath[1] == '\\') { 300 | DWORD slash = 0; 301 | 302 | for(i = 2 ; i < cchTempRootPath ; i++) { 303 | if(TempRootPath[i] == '\\') { 304 | slash++; 305 | 306 | if(slash == 2) { 307 | i++; 308 | TempRootPath[i] = '\0'; 309 | cchTempRootPath = i; 310 | break; 311 | } 312 | } 313 | } 314 | 315 | /* if there was only one slash found, just tack another onto the 316 | end */ 317 | 318 | if(slash == 1 && TempRootPath[cchTempRootPath] != '\\') { 319 | TempRootPath[cchTempRootPath] = TempRootPath[0]; /* '\\' */ 320 | TempRootPath[cchTempRootPath+1] = '\0'; 321 | cchTempRootPath++; 322 | } 323 | 324 | } else { 325 | 326 | if(TempRootPath[1] == ':') { 327 | 328 | /* drive letter specified, truncate to root */ 329 | TempRootPath[2] = '\\'; 330 | TempRootPath[3] = '\0'; 331 | cchTempRootPath = 3; 332 | } else { 333 | 334 | /* must be file on current drive */ 335 | TempRootPath[0] = '\0'; 336 | cchTempRootPath = 0; 337 | } 338 | 339 | } 340 | 341 | } /* if path != NULL */ 342 | 343 | /* grab lock protecting cached entry */ 344 | EnterCriticalSection( &VolumeCapsLock ); 345 | 346 | if(!g_VolumeCaps.bValid || 347 | lstrcmpiA(g_VolumeCaps.RootPath, TempRootPath) != 0) 348 | { 349 | 350 | /* no match found, build up new entry */ 351 | 352 | DWORD dwFileSystemFlags; 353 | DWORD dwRemotePrivileges = 0; 354 | BOOL bRemote = FALSE; 355 | 356 | /* release lock during expensive operations */ 357 | LeaveCriticalSection( &VolumeCapsLock ); 358 | 359 | bSuccess = GetVolumeInformationA( 360 | (TempRootPath[0] == '\0') ? NULL : TempRootPath, 361 | NULL, 0, 362 | NULL, NULL, 363 | &dwFileSystemFlags, 364 | NULL, 0); 365 | 366 | 367 | /* only if target volume supports Acls, and we were told to use 368 | privileges do we need to go out and test for the remote case */ 369 | 370 | if(bSuccess && (dwFileSystemFlags & FS_PERSISTENT_ACLS) && 371 | VolumeCaps->bUsePrivileges) 372 | { 373 | if(GetDriveTypeA( (TempRootPath[0] == '\0') ? NULL : TempRootPath ) 374 | == DRIVE_REMOTE) 375 | { 376 | bRemote = TRUE; 377 | 378 | /* make a determination about our remote capabilities */ 379 | 380 | GetRemotePrivilegesSet(name, &dwRemotePrivileges); 381 | } 382 | } 383 | 384 | /* always take the lock again, since we release it below */ 385 | EnterCriticalSection( &VolumeCapsLock ); 386 | 387 | /* replace the existing data if successful */ 388 | if(bSuccess) { 389 | 390 | lstrcpynA(g_VolumeCaps.RootPath, TempRootPath, cchTempRootPath+1); 391 | g_VolumeCaps.dwFileSystemFlags = dwFileSystemFlags; 392 | g_VolumeCaps.bRemote = bRemote; 393 | g_VolumeCaps.dwRemotePrivileges = dwRemotePrivileges; 394 | g_VolumeCaps.bValid = TRUE; 395 | } 396 | } 397 | 398 | if(bSuccess) { 399 | /* copy input elements */ 400 | g_VolumeCaps.bUsePrivileges = VolumeCaps->bUsePrivileges; 401 | g_VolumeCaps.dwFileAttributes = VolumeCaps->dwFileAttributes; 402 | 403 | /* give caller results */ 404 | memcpy(VolumeCaps, &g_VolumeCaps, sizeof(VOLUMECAPS)); 405 | } else { 406 | g_VolumeCaps.bValid = FALSE; 407 | } 408 | 409 | LeaveCriticalSection( &VolumeCapsLock ); /* release lock */ 410 | 411 | return bSuccess; 412 | } 413 | 414 | 415 | BOOL SecuritySet(char *resource, PVOLUMECAPS VolumeCaps, uch *securitydata) 416 | { 417 | HANDLE hFile; 418 | DWORD dwDesiredAccess = 0; 419 | DWORD dwFlags = 0; 420 | PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR)securitydata; 421 | SECURITY_DESCRIPTOR_CONTROL sdc; 422 | SECURITY_INFORMATION RequestedInfo = 0; 423 | DWORD dwRev; 424 | BOOL bRestorePrivilege = FALSE; 425 | BOOL bSaclPrivilege = FALSE; 426 | BOOL bSuccess; 427 | 428 | if(!bInitialized) if(!Initialize()) return FALSE; 429 | 430 | /* defer directory processing */ 431 | 432 | if(VolumeCaps->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { 433 | /* opening a directory requires FILE_FLAG_BACKUP_SEMANTICS */ 434 | dwFlags |= FILE_FLAG_BACKUP_SEMANTICS; 435 | } 436 | 437 | /* evaluate the input security descriptor and act accordingly */ 438 | 439 | if(!IsValidSecurityDescriptor(sd)) 440 | return FALSE; 441 | 442 | if(!GetSecurityDescriptorControl(sd, &sdc, &dwRev)) 443 | return FALSE; 444 | 445 | /* setup privilege usage based on if told we can use privileges, and if so, 446 | what privileges we have */ 447 | 448 | if(VolumeCaps->bUsePrivileges) { 449 | if(VolumeCaps->bRemote) { 450 | /* use remotely determined privileges */ 451 | if(VolumeCaps->dwRemotePrivileges & OVERRIDE_RESTORE) 452 | bRestorePrivilege = TRUE; 453 | 454 | if(VolumeCaps->dwRemotePrivileges & OVERRIDE_SACL) 455 | bSaclPrivilege = TRUE; 456 | 457 | } else { 458 | /* use local privileges */ 459 | bRestorePrivilege = g_bRestorePrivilege; 460 | bSaclPrivilege = g_bSaclPrivilege; 461 | } 462 | } 463 | 464 | 465 | /* if a Dacl is present write Dacl out */ 466 | /* if we have SeRestorePrivilege, write owner and group info out */ 467 | 468 | if(sdc & SE_DACL_PRESENT) { 469 | dwDesiredAccess |= WRITE_DAC; 470 | RequestedInfo |= DACL_SECURITY_INFORMATION; 471 | 472 | if(bRestorePrivilege) { 473 | dwDesiredAccess |= WRITE_OWNER; 474 | RequestedInfo |= (OWNER_SECURITY_INFORMATION | 475 | GROUP_SECURITY_INFORMATION); 476 | } 477 | } 478 | 479 | /* if a Sacl is present and we have either SeRestorePrivilege or 480 | SeSystemSecurityPrivilege try to write Sacl out */ 481 | 482 | if((sdc & SE_SACL_PRESENT) && (bRestorePrivilege || bSaclPrivilege)) { 483 | dwDesiredAccess |= ACCESS_SYSTEM_SECURITY; 484 | RequestedInfo |= SACL_SECURITY_INFORMATION; 485 | } 486 | 487 | if(RequestedInfo == 0) /* nothing to do */ 488 | return FALSE; 489 | 490 | if(bRestorePrivilege) 491 | dwFlags |= FILE_FLAG_BACKUP_SEMANTICS; 492 | 493 | hFile = CreateFileA( 494 | resource, 495 | dwDesiredAccess, 496 | FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,/* max sharing */ 497 | NULL, 498 | OPEN_EXISTING, 499 | dwFlags, 500 | NULL 501 | ); 502 | 503 | if(hFile == INVALID_HANDLE_VALUE) 504 | return FALSE; 505 | 506 | bSuccess = SetKernelObjectSecurity(hFile, RequestedInfo, sd); 507 | 508 | CloseHandle(hFile); 509 | 510 | return bSuccess; 511 | } 512 | 513 | static VOID InitLocalPrivileges(VOID) 514 | { 515 | HANDLE hToken; 516 | TOKEN_PRIVILEGES tp; 517 | 518 | /* try to enable some interesting privileges that give us the ability 519 | to get some security information that we normally cannot. 520 | 521 | note that enabling privileges is only relevant on the local machine; 522 | when accessing files that are on a remote machine, any privileges 523 | that are present on the remote machine get enabled by default. */ 524 | 525 | if(!OpenProcessToken(GetCurrentProcess(), 526 | TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &hToken)) 527 | return; 528 | 529 | tp.PrivilegeCount = 1; 530 | tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; 531 | 532 | if(LookupPrivilegeValue(NULL, SE_RESTORE_NAME, &tp.Privileges[0].Luid)) { 533 | 534 | /* try to enable SeRestorePrivilege; if this succeeds, we can write 535 | all aspects of the security descriptor */ 536 | 537 | if(AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL) && 538 | GetLastError() == ERROR_SUCCESS) g_bRestorePrivilege = TRUE; 539 | 540 | } 541 | 542 | /* try to enable SeSystemSecurityPrivilege, if SeRestorePrivilege not 543 | present; if this succeeds, we can write the Sacl */ 544 | 545 | if(!g_bRestorePrivilege && 546 | LookupPrivilegeValue(NULL, SE_SECURITY_NAME, &tp.Privileges[0].Luid)) { 547 | 548 | if(AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL) && 549 | GetLastError() == ERROR_SUCCESS) g_bSaclPrivilege = TRUE; 550 | } 551 | 552 | CloseHandle(hToken); 553 | } 554 | #endif /* NTSD_EAS */ 555 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/win32/nt.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2005 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2000-Apr-09 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /* nt.h: central header for EF_NTSD "SD" extra field */ 10 | 11 | #ifndef _NT_H 12 | #define _NT_H 13 | 14 | #define NTSD_BUFFERSIZE (1024) /* threshold to cause malloc() */ 15 | #define OVERRIDE_BACKUP 1 /* we have SeBackupPrivilege on remote */ 16 | #define OVERRIDE_RESTORE 2 /* we have SeRestorePrivilege on remote */ 17 | #define OVERRIDE_SACL 4 /* we have SeSystemSecurityPrivilege on remote */ 18 | 19 | typedef struct { 20 | BOOL bValid; /* are our contents valid? */ 21 | BOOL bUsePrivileges; /* use privilege overrides? */ 22 | DWORD dwFileSystemFlags; /* describes target file system */ 23 | BOOL bRemote; /* is volume remote? */ 24 | DWORD dwRemotePrivileges; /* relevant only on remote volumes */ 25 | DWORD dwFileAttributes; 26 | char RootPath[MAX_PATH+1]; /* path to network / filesystem */ 27 | } VOLUMECAPS, *PVOLUMECAPS, *LPVOLUMECAPS; 28 | 29 | BOOL SecuritySet(char *resource, PVOLUMECAPS VolumeCaps, uch *securitydata); 30 | BOOL GetVolumeCaps(char *rootpath, char *name, PVOLUMECAPS VolumeCaps); 31 | BOOL ValidateSecurity(uch *securitydata); 32 | 33 | #endif /* _NT_H */ 34 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/win32/win32i64.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2009 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2009-Jan-02 or later 5 | (the contents of which are also included in zip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /*--------------------------------------------------------------------------- 10 | 11 | win32/win32i64.c - UnZip 6 12 | 13 | 64-bit filesize support for WIN32 Zip and UnZip. 14 | ---------------------------------------------------------------------------*/ 15 | 16 | #include "../zip.h" 17 | 18 | /* --------------------------------------------------- */ 19 | /* Large File Support 20 | * 21 | * Initial functions by E. Gordon and R. Nausedat 22 | * 9/10/2003 23 | * 24 | * These implement 64-bit file support for Windows. The 25 | * defines and headers are in win32/osdep.h. 26 | * 27 | * These moved from win32.c by Mike White to avoid conflicts 28 | * in WiZ of same name functions in UnZip and Zip libraries. 29 | * 9/25/04 EG 30 | */ 31 | 32 | #if defined(LARGE_FILE_SUPPORT) && !defined(__CYGWIN__) 33 | # ifdef USE_STRM_INPUT 34 | 35 | # ifndef zftello 36 | /* 64-bit buffered ftello 37 | * 38 | * Win32 does not provide a 64-bit buffered 39 | * ftell (in the published api anyway) so below provides 40 | * hopefully close version. 41 | * We have not gotten _telli64 to work with buffered 42 | * streams. Below cheats by using fgetpos improperly and 43 | * may not work on other ports. 44 | */ 45 | 46 | zoff_t zftello(stream) 47 | FILE *stream; 48 | { 49 | fpos_t fpos = 0; 50 | 51 | if (fgetpos(stream, &fpos) != 0) { 52 | return -1L; 53 | } else { 54 | return fpos; 55 | } 56 | } 57 | # endif /* ndef zftello */ 58 | 59 | 60 | # ifndef zfseeko 61 | /* 64-bit buffered fseeko 62 | * 63 | * Win32 does not provide a 64-bit buffered 64 | * fseeko, so use _lseeki64 and fflush. Note 65 | * that SEEK_CUR can lose track of location 66 | * if fflush is done between the last buffered 67 | * io and this call. 68 | */ 69 | 70 | int zfseeko(stream, offset, origin) 71 | FILE *stream; 72 | zoff_t offset; 73 | int origin; 74 | { 75 | 76 | /* fseek() or its replacements are supposed to clear the eof status 77 | of the stream. fflush() and _lseeki64() do not touch the stream's 78 | eof flag, so we have to do it manually. */ 79 | #if ((defined(_MSC_VER) && (_MSC_VER >= 1200)) || \ 80 | (defined(__MINGW32__) && defined(__MSVCRT_VERSION__))) 81 | /* For the MSC environment (VS 6 or higher), and for recent releases of 82 | the MinGW environment, we "know" the internals of the FILE structure. 83 | So, we can clear just the EOF bit of the status flag. */ 84 | stream->_flag &= ~_IOEOF; 85 | #else 86 | /* Unfortunately, there is no standard "cleareof()" function, so we have 87 | to use clearerr(). This has the unwanted side effect of clearing the 88 | ferror() state as well. */ 89 | clearerr(stream); 90 | #endif 91 | 92 | if (origin == SEEK_CUR) { 93 | /* instead of synching up lseek easier just to figure and 94 | use an absolute offset */ 95 | offset += zftello(stream); 96 | origin = SEEK_SET; 97 | } 98 | fflush(stream); 99 | if (_lseeki64(fileno(stream), offset, origin) == (zoff_t)-1L) { 100 | return -1; 101 | } else { 102 | return 0; 103 | } 104 | } 105 | # endif /* ndef fseeko */ 106 | # endif /* USE_STRM_INPUT */ 107 | #endif /* Win32 LARGE_FILE_SUPPORT */ 108 | 109 | #if 0 110 | FILE* zfopen(filename, mode) 111 | const char *filename; 112 | const char *mode; 113 | { 114 | FILE* fTemp; 115 | 116 | fTemp = fopen(filename, mode); 117 | if( fTemp == NULL ) 118 | return NULL; 119 | 120 | /* sorry, could not make VC60 and its rtl work properly without setting the 121 | * file buffer to NULL. the problem seems to be _telli64 which seems to 122 | * return the max stream position, comments are welcome 123 | */ 124 | setbuf(fTemp, NULL); 125 | 126 | return fTemp; 127 | } 128 | #endif 129 | /* --------------------------------------------------- */ 130 | -------------------------------------------------------------------------------- /data/windows/unzipfx-remote/zip.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990-2005 Info-ZIP. All rights reserved. 3 | 4 | See the accompanying file LICENSE, version 2003-May-08 or later 5 | (the contents of which are also included in unzip.h) for terms of use. 6 | If, for some reason, all these files are missing, the Info-ZIP license 7 | also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 8 | */ 9 | /* This is a dummy zip.h to allow the source files shared with Zip 10 | (crypt.c, crc32.c, ttyio.c, win32/win32i64.c) to compile for UnZip. 11 | (In case you are looking for the Info-ZIP license, please follow 12 | the pointers above.) */ 13 | 14 | #ifndef __zip_h /* don't include more than once */ 15 | #define __zip_h 16 | 17 | #define UNZIP_INTERNAL 18 | #include "unzip.h" 19 | 20 | #define local static 21 | 22 | #define ZE_MEM PK_MEM 23 | #define ziperr(c, h) return 24 | 25 | #endif /* !__zip_h */ 26 | -------------------------------------------------------------------------------- /resources/128x128/mod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/128x128/mod.png -------------------------------------------------------------------------------- /resources/16x16/application-exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/application-exit.png -------------------------------------------------------------------------------- /resources/16x16/configure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/configure.png -------------------------------------------------------------------------------- /resources/16x16/dialog-information.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/dialog-information.png -------------------------------------------------------------------------------- /resources/16x16/document-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/document-new.png -------------------------------------------------------------------------------- /resources/16x16/document-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/document-open.png -------------------------------------------------------------------------------- /resources/16x16/document-save-as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/document-save-as.png -------------------------------------------------------------------------------- /resources/16x16/document-save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/document-save.png -------------------------------------------------------------------------------- /resources/16x16/ingen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/ingen.png -------------------------------------------------------------------------------- /resources/16x16/media-playback-start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/media-playback-start.png -------------------------------------------------------------------------------- /resources/16x16/media-playback-stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/media-playback-stop.png -------------------------------------------------------------------------------- /resources/16x16/mod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/mod.png -------------------------------------------------------------------------------- /resources/16x16/network-connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/network-connect.png -------------------------------------------------------------------------------- /resources/16x16/network-disconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/network-disconnect.png -------------------------------------------------------------------------------- /resources/16x16/system-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/system-search.png -------------------------------------------------------------------------------- /resources/16x16/view-refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/16x16/view-refresh.png -------------------------------------------------------------------------------- /resources/24x24/mod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/24x24/mod.png -------------------------------------------------------------------------------- /resources/256x256/mod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/256x256/mod.png -------------------------------------------------------------------------------- /resources/32x32/mod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/32x32/mod.png -------------------------------------------------------------------------------- /resources/48x48/configure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/48x48/configure.png -------------------------------------------------------------------------------- /resources/48x48/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/48x48/folder.png -------------------------------------------------------------------------------- /resources/48x48/internet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/48x48/internet.png -------------------------------------------------------------------------------- /resources/48x48/jack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/48x48/jack.png -------------------------------------------------------------------------------- /resources/48x48/media-playback-start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/48x48/media-playback-start.png -------------------------------------------------------------------------------- /resources/48x48/mod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/48x48/mod.png -------------------------------------------------------------------------------- /resources/48x48/network-connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/48x48/network-connect.png -------------------------------------------------------------------------------- /resources/64x64/mod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/64x64/mod.png -------------------------------------------------------------------------------- /resources/96x96/mod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/96x96/mod.png -------------------------------------------------------------------------------- /resources/ico/mod.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/ico/mod.icns -------------------------------------------------------------------------------- /resources/ico/mod.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/ico/mod.ico -------------------------------------------------------------------------------- /resources/ico/mod.rc: -------------------------------------------------------------------------------- 1 | id ICON "mod.ico" 2 | -------------------------------------------------------------------------------- /resources/mod-splash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mod-audio/mod-app-legacy/53184a7427cad1929dcd086abbef71f2d1df6161/resources/mod-splash.jpg -------------------------------------------------------------------------------- /resources/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16x16/application-exit.png 4 | 16x16/configure.png 5 | 16x16/dialog-information.png 6 | 16x16/document-new.png 7 | 16x16/document-open.png 8 | 16x16/document-save.png 9 | 16x16/document-save-as.png 10 | 16x16/ingen.png 11 | 16x16/media-playback-start.png 12 | 16x16/media-playback-stop.png 13 | 16x16/network-connect.png 14 | 16x16/network-disconnect.png 15 | 16x16/system-search.png 16 | 16x16/view-refresh.png 17 | 18 | 48x48/configure.png 19 | 48x48/folder.png 20 | 48x48/internet.png 21 | 48x48/jack.png 22 | 48x48/media-playback-start.png 23 | 48x48/network-connect.png 24 | 48x48/mod.png 25 | 26 | scalable/mod.svg 27 | 28 | mod-splash.jpg 29 | 30 | 31 | -------------------------------------------------------------------------------- /resources/scalable/mod.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 9 | 30 | 35 | 36 | -------------------------------------------------------------------------------- /resources/ui/mod_connect.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ConnectDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 503 10 | 138 11 | 12 | 13 | 14 | Connect 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Connection Type: 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Bluetooth 31 | 32 | 33 | 34 | 35 | Local Network 36 | 37 | 38 | 39 | 40 | USB Network 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Qt::Horizontal 49 | 50 | 51 | 52 | 40 53 | 20 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 0 64 | 65 | 66 | 67 | 68 | 69 | 70 | Qt::Horizontal 71 | 72 | 73 | QSizePolicy::Fixed 74 | 75 | 76 | 77 | 30 78 | 20 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | Device Number: 87 | 88 | 89 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 90 | 91 | 92 | 93 | 94 | 95 | 96 | 1 97 | 98 | 99 | 253 100 | 101 | 102 | 103 | 104 | 105 | 106 | Qt::Horizontal 107 | 108 | 109 | QSizePolicy::Fixed 110 | 111 | 112 | 113 | 30 114 | 20 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | Qt::Horizontal 123 | 124 | 125 | 126 | 40 127 | 20 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | Qt::Horizontal 140 | 141 | 142 | QSizePolicy::Fixed 143 | 144 | 145 | 146 | 30 147 | 20 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | Qt::Horizontal 156 | 157 | 158 | QSizePolicy::Fixed 159 | 160 | 161 | 162 | 30 163 | 20 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | IP: 172 | 173 | 174 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 175 | 176 | 177 | 178 | 179 | 180 | 181 | Qt::Horizontal 182 | 183 | 184 | QSizePolicy::Fixed 185 | 186 | 187 | 188 | 30 189 | 20 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 7000 198 | 199 | 200 | 19999 201 | 202 | 203 | 8888 204 | 205 | 206 | 207 | 208 | 209 | 210 | Port: 211 | 212 | 213 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 214 | 215 | 216 | 217 | 218 | 219 | 220 | Qt::Horizontal 221 | 222 | 223 | QSizePolicy::Fixed 224 | 225 | 226 | 227 | 30 228 | 20 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | Qt::Horizontal 237 | 238 | 239 | 240 | 40 241 | 20 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 127.0.0.1 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | Qt::Horizontal 261 | 262 | 263 | QSizePolicy::Fixed 264 | 265 | 266 | 267 | 30 268 | 20 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | IP: 277 | 278 | 279 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 280 | 281 | 282 | 283 | 284 | 285 | 286 | 192.168.51.1 287 | 288 | 289 | 290 | 291 | 292 | 293 | Qt::Horizontal 294 | 295 | 296 | QSizePolicy::Fixed 297 | 298 | 299 | 300 | 30 301 | 20 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | Qt::Horizontal 315 | 316 | 317 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | buttonBox 327 | accepted() 328 | ConnectDialog 329 | accept() 330 | 331 | 332 | 248 333 | 254 334 | 335 | 336 | 157 337 | 274 338 | 339 | 340 | 341 | 342 | buttonBox 343 | rejected() 344 | ConnectDialog 345 | reject() 346 | 347 | 348 | 316 349 | 260 350 | 351 | 352 | 286 353 | 274 354 | 355 | 356 | 357 | 358 | comboBox 359 | currentIndexChanged(int) 360 | stackedWidget 361 | setCurrentIndex(int) 362 | 363 | 364 | 152 365 | 18 366 | 367 | 368 | 251 369 | 68 370 | 371 | 372 | 373 | 374 | 375 | -------------------------------------------------------------------------------- /source/mod-app: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # MOD-App 5 | # Copyright (C) 2014-2015 Filipe Coelho 6 | # 7 | # This program is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 3 of 10 | # the License, or any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # For a full copy of the GNU General Public License see the LICENSE file. 18 | 19 | # ------------------------------------------------------------------------------------------------------------ 20 | # Imports (Custom) 21 | 22 | from mod_host import * 23 | 24 | # ------------------------------------------------------------------------------------------------------------ 25 | # Imports (Global) 26 | 27 | if using_Qt4: 28 | from PyQt4.QtCore import Qt 29 | from PyQt4.QtGui import QApplication, QColor, QMessageBox, QPalette 30 | from PyQt4.QtWebKit import qWebKitMajorVersion 31 | else: 32 | from PyQt5.QtCore import Qt 33 | from PyQt5.QtGui import QColor, QPalette 34 | from PyQt5.QtWebKit import qWebKitMajorVersion 35 | from PyQt5.QtWidgets import QApplication, QMessageBox 36 | 37 | # ------------------------------------------------------------------------------------------------------------ 38 | # Import Signal 39 | 40 | from signal import signal, SIGINT, SIGTERM 41 | 42 | try: 43 | from signal import SIGUSR1 44 | haveSIGUSR1 = True 45 | except: 46 | haveSIGUSR1 = False 47 | 48 | # ------------------------------------------------------------------------------------------------------------ 49 | # Global gui object 50 | 51 | global gui 52 | gui = None 53 | 54 | # ------------------------------------------------------------------------------------------------------------ 55 | # Signal handler 56 | 57 | def signalHandler(sig, frame): 58 | global gui 59 | if gui is None: 60 | return 61 | 62 | if sig in (SIGINT, SIGTERM): 63 | gui.SIGTERM.emit() 64 | elif haveSIGUSR1 and sig == SIGUSR1: 65 | gui.SIGUSR1.emit() 66 | 67 | def setUpSignals(): 68 | signal(SIGINT, signalHandler) 69 | signal(SIGTERM, signalHandler) 70 | 71 | if not haveSIGUSR1: 72 | return 73 | 74 | signal(SIGUSR1, signalHandler) 75 | 76 | # ------------------------------------------------------------------------------------------------------------ 77 | # Main 78 | 79 | if __name__ == '__main__': 80 | # -------------------------------------------------------------------------------------------------------- 81 | # App initialization 82 | 83 | QApplication.addLibraryPath(CWD) 84 | 85 | app = QApplication(sys.argv) 86 | app.setApplicationName("MOD-App") 87 | app.setApplicationVersion(config["version"]) 88 | app.setOrganizationName("MOD") 89 | app.setWindowIcon(QIcon(":/scalable/mod.svg")) 90 | 91 | if MACOS: 92 | app.setAttribute(Qt.AA_DontShowIconsInMenus) 93 | 94 | if using_Qt4 or qWebKitMajorVersion() < 538: 95 | QMessageBox.warning(None, 96 | "MOD-App Alert", # app.translate("HostWindow", ), #app.translate("HostWindow", 97 | """ 98 | The WebKit included in your distribution's PyQt5 package is too old!
99 | You might experience graphical issues in MOD-App. 100 | """, 101 | QMessageBox.Ok) 102 | 103 | pedalboardToLoad = "" 104 | 105 | # -------------------------------------------------------------------------------------------------------- 106 | # Set-up custom signal handling 107 | 108 | setUpSignals() 109 | 110 | # -------------------------------------------------------------------------------------------------------- 111 | # Check arguments 112 | 113 | if len(sys.argv) > 1: 114 | arg = sys.argv[-1] 115 | 116 | if os.path.exists(arg): 117 | pedalboardToLoad = arg 118 | 119 | # -------------------------------------------------------------------------------------------------------- 120 | # Create GUI 121 | 122 | gui = HostWindow() 123 | 124 | if pedalboardToLoad: 125 | gui.openPedalboardLater(pedalboardToLoad) 126 | 127 | # -------------------------------------------------------------------------------------------------------- 128 | # Show GUI 129 | 130 | gui.show() 131 | 132 | # -------------------------------------------------------------------------------------------------------- 133 | # App-Loop 134 | 135 | sys.exit(app.exec_()) 136 | 137 | # ------------------------------------------------------------------------------------------------------------ 138 | -------------------------------------------------------------------------------- /source/mod-remote: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # MOD-App 5 | # Copyright (C) 2014-2015 Filipe Coelho 6 | # 7 | # This program is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 3 of 10 | # the License, or any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # For a full copy of the GNU General Public License see the LICENSE file. 18 | 19 | # ------------------------------------------------------------------------------------------------------------ 20 | # Imports (Custom) 21 | 22 | from mod_remote import * 23 | 24 | # ------------------------------------------------------------------------------------------------------------ 25 | # Imports (Global) 26 | 27 | from PyQt5.QtCore import Qt 28 | from PyQt5.QtWebKit import qWebKitMajorVersion 29 | from PyQt5.QtWidgets import QApplication, QMessageBox 30 | 31 | # ------------------------------------------------------------------------------------------------------------ 32 | # Import Signal 33 | 34 | from signal import signal, SIGINT, SIGTERM 35 | 36 | # ------------------------------------------------------------------------------------------------------------ 37 | # Global gui object 38 | 39 | global gui 40 | gui = None 41 | 42 | # ------------------------------------------------------------------------------------------------------------ 43 | # Signal handler 44 | 45 | def signalHandler(sig, frame): 46 | global gui 47 | if gui is None: 48 | return 49 | 50 | if sig in (SIGINT, SIGTERM): 51 | gui.SIGTERM.emit() 52 | 53 | def setUpSignals(): 54 | signal(SIGINT, signalHandler) 55 | signal(SIGTERM, signalHandler) 56 | 57 | # ------------------------------------------------------------------------------------------------------------ 58 | # Main 59 | 60 | if __name__ == '__main__': 61 | # -------------------------------------------------------------------------------------------------------- 62 | # App initialization 63 | 64 | QApplication.addLibraryPath(CWD) 65 | 66 | # Needed for local wine build 67 | if WINDOWS and CWD.endswith("source") and os.getenv("CXFREEZE") is None: 68 | QApplication.addLibraryPath("C:\\Python34\\Lib\\site-packages\\PyQt5\\plugins") 69 | 70 | app = QApplication(sys.argv) 71 | app.setApplicationName("MOD-Remote") 72 | app.setApplicationVersion(config["version"]) 73 | app.setOrganizationName("MOD") 74 | app.setWindowIcon(QIcon(":/scalable/mod.svg")) 75 | 76 | if MACOS: 77 | app.setAttribute(Qt.AA_DontShowIconsInMenus) 78 | 79 | if qWebKitMajorVersion() < 538: 80 | QMessageBox.warning(None, 81 | "MOD-Remote Alert", # app.translate("HostWindow", ), #app.translate("HostWindow", 82 | """ 83 | The WebKit included in your distribution's PyQt5 package is too old!
84 | You might experience graphical issues in MOD-Remote. 85 | """, 86 | QMessageBox.Ok) 87 | 88 | # -------------------------------------------------------------------------------------------------------- 89 | # Set-up custom signal handling 90 | 91 | setUpSignals() 92 | 93 | # -------------------------------------------------------------------------------------------------------- 94 | # Create GUI 95 | 96 | gui = RemoteWindow() 97 | 98 | # -------------------------------------------------------------------------------------------------------- 99 | # Show GUI 100 | 101 | gui.show() 102 | 103 | # -------------------------------------------------------------------------------------------------------- 104 | # App-Loop 105 | 106 | sys.exit(app.exec_()) 107 | 108 | # ------------------------------------------------------------------------------------------------------------ 109 | -------------------------------------------------------------------------------- /source/mod_common.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # MOD-App 5 | # Copyright (C) 2014-2015 Filipe Coelho 6 | # 7 | # This program is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 3 of 10 | # the License, or any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # For a full copy of the GNU General Public License see the LICENSE file. 18 | 19 | # ------------------------------------------------------------------------------------------------------------ 20 | # Generate a random port number between 9000 and 18000 21 | 22 | from random import random 23 | 24 | _PORT = str(8998 + int(random()*9000)) 25 | using_Qt4 = False 26 | 27 | # ------------------------------------------------------------------------------------------------------------ 28 | # Mod-App Configuration 29 | 30 | config = { 31 | # Address used for the webserver 32 | "addr": "http://127.0.0.1:%s" % _PORT, 33 | # Port used for the webserver 34 | "port": _PORT, 35 | # MOD-App version 36 | "version": "0.0.1" 37 | } 38 | 39 | del _PORT 40 | 41 | # ------------------------------------------------------------------------------------------------------------ 42 | # Imports (Global) 43 | 44 | import os 45 | import sys 46 | 47 | if using_Qt4: 48 | from PyQt4.QtCore import QDir, QSettings 49 | else: 50 | from PyQt5.QtCore import QDir, QSettings 51 | 52 | # ------------------------------------------------------------------------------------------------------------ 53 | # Set CWD 54 | 55 | CWD = sys.path[0] 56 | 57 | if not CWD: 58 | CWD = os.path.dirname(sys.argv[0]) 59 | 60 | # make it work with cxfreeze 61 | if os.path.isfile(CWD): 62 | CWD = os.path.dirname(CWD) 63 | 64 | # ------------------------------------------------------------------------------------------------------------ 65 | # Set Platform 66 | 67 | if sys.platform == "darwin": 68 | LINUX = False 69 | MACOS = True 70 | WINDOWS = False 71 | elif "linux" in sys.platform: 72 | LINUX = True 73 | MACOS = False 74 | WINDOWS = False 75 | elif sys.platform in ("win32", "win64", "cygwin"): 76 | LINUX = False 77 | MACOS = False 78 | WINDOWS = True 79 | else: 80 | LINUX = False 81 | MACOS = False 82 | WINDOWS = False 83 | 84 | # ------------------------------------------------------------------------------------------------------------ 85 | # Use custom modules if available 86 | 87 | if os.path.exists(os.path.join(CWD, "modules", "mod-ui", "html", "index.html")): 88 | print("NOTE: Using custom mod-ui module") 89 | sys.path = [os.path.join(CWD, "modules", "mod-ui")] + sys.path 90 | USING_CUSTOM_MOD_UI = True 91 | else: 92 | USING_CUSTOM_MOD_UI = False 93 | 94 | # ------------------------------------------------------------------------------------------------------------ 95 | # Set up environment for the webserver 96 | 97 | if USING_CUSTOM_MOD_UI: 98 | ROOT = os.path.join(CWD, "modules", "mod-ui") 99 | else: 100 | ROOT = "/usr/share/mod" 101 | 102 | DATA_DIR = os.path.expanduser("~/.local/share/mod-data/") 103 | 104 | os.environ['MOD_DEV_HMI'] = "1" 105 | os.environ['MOD_DEV_HOST'] = "0" 106 | os.environ['MOD_DEV_ENVIRONMENT'] = "0" 107 | os.environ['MOD_LOG'] = "0" 108 | 109 | os.environ['MOD_DATA_DIR'] = DATA_DIR 110 | os.environ['MOD_PLUGIN_LIBRARY_DIR'] = os.path.join(DATA_DIR, "lib") 111 | os.environ['MOD_KEY_PATH'] = os.path.join(DATA_DIR, "keys") 112 | os.environ['MOD_CLOUD_PUB'] = os.path.join(ROOT, "keys", "cloud_key.pub") 113 | os.environ['MOD_HTML_DIR'] = os.path.join(ROOT, "html") 114 | 115 | os.environ['MOD_DEVICE_WEBSERVER_PORT'] = config["port"] 116 | 117 | # ------------------------------------------------------------------------------------------------------------ 118 | # Settings keys 119 | 120 | # Main 121 | MOD_KEY_MAIN_PROJECT_FOLDER = "Main/ProjectFolder" # str 122 | MOD_KEY_MAIN_REFRESH_INTERVAL = "Main/RefreshInterval" # int 123 | 124 | # Host 125 | MOD_KEY_HOST_VERBOSE = "Host/Verbose" # bool 126 | MOD_KEY_HOST_PATH = "Host/Path2" # str 127 | 128 | # WebView 129 | MOD_KEY_WEBVIEW_INSPECTOR = "WebView/Inspector" # bool 130 | MOD_KEY_WEBVIEW_VERBOSE = "WebView/Verbose" # bool 131 | MOD_KEY_WEBVIEW_SHOW_INSPECTOR = "WebView/ShowInspector" # bool 132 | 133 | # ------------------------------------------------------------------------------------------------------------ 134 | # Settings defaults 135 | 136 | # Main 137 | MOD_DEFAULT_MAIN_REFRESH_INTERVAL = 30 138 | MOD_DEFAULT_MAIN_PROJECT_FOLDER = QDir.toNativeSeparators(QDir.homePath()) 139 | 140 | # Host 141 | MOD_DEFAULT_HOST_VERBOSE = False 142 | MOD_DEFAULT_HOST_PATH = os.path.join(os.path.dirname(__file__), "modules", "mod-host", "mod-host") 143 | 144 | if not os.path.exists(MOD_DEFAULT_HOST_PATH): 145 | MOD_DEFAULT_HOST_PATH = "/usr/bin/mod-host" 146 | 147 | # WebView 148 | MOD_DEFAULT_WEBVIEW_INSPECTOR = False 149 | MOD_DEFAULT_WEBVIEW_VERBOSE = False 150 | MOD_DEFAULT_WEBVIEW_SHOW_INSPECTOR = False 151 | 152 | # ------------------------------------------------------------------------------------------------------------ 153 | # Set initial settings 154 | 155 | def setInitialSettings(): 156 | qsettings = QSettings("MOD", "MOD-App") 157 | webviewVerbose = qsettings.value(MOD_KEY_WEBVIEW_VERBOSE, MOD_DEFAULT_WEBVIEW_VERBOSE, type=bool) 158 | del qsettings 159 | 160 | os.environ['MOD_LOG'] = "1" if webviewVerbose else "0" 161 | 162 | from mod import settings 163 | settings.LOG = webviewVerbose 164 | 165 | # cleanup 166 | del webviewVerbose 167 | 168 | # ------------------------------------------------------------------------------------------------------------ 169 | -------------------------------------------------------------------------------- /source/mod_settings.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # MOD-App 5 | # Copyright (C) 2014-2020 Filipe Coelho 6 | # 7 | # This program is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 3 of 10 | # the License, or any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # For a full copy of the GNU General Public License see the LICENSE file. 18 | 19 | # ------------------------------------------------------------------------------------------------------------ 20 | # Imports (Custom) 21 | 22 | from mod_common import * 23 | 24 | # ------------------------------------------------------------------------------------------------------------ 25 | # Imports (Global) 26 | 27 | if using_Qt4: 28 | from PyQt4.QtCore import pyqtSlot 29 | from PyQt4.QtGui import QFontMetrics, QIcon 30 | from PyQt4.QtGui import QDialog, QDialogButtonBox, QFileDialog, QMessageBox 31 | else: 32 | from PyQt5.QtCore import pyqtSlot 33 | from PyQt5.QtGui import QFontMetrics, QIcon 34 | from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFileDialog, QMessageBox 35 | 36 | # ------------------------------------------------------------------------------------------------------------ 37 | # Imports (UI) 38 | 39 | from ui_mod_settings import Ui_SettingsWindow 40 | 41 | # ------------------------------------------------------------------------------------------------------------ 42 | # Settings Dialog 43 | 44 | class SettingsWindow(QDialog): 45 | # Tab indexes 46 | TAB_INDEX_MAIN = 0 47 | TAB_INDEX_HOST = 1 48 | TAB_INDEX_WEBVIEW = 2 49 | 50 | # -------------------------------------------------------------------------------------------------------- 51 | 52 | def __init__(self, parent, isApp): 53 | QDialog.__init__(self, parent) 54 | self.ui = Ui_SettingsWindow() 55 | self.ui.setupUi(self) 56 | 57 | # ---------------------------------------------------------------------------------------------------- 58 | # Set up GUI 59 | 60 | self.ui.lw_page.setFixedWidth(48 + 6*4 + QFontMetrics(self.ui.lw_page.font()).width(" WebView ")) 61 | 62 | if not isApp: 63 | self.ui.lw_page.hideRow(self.TAB_INDEX_MAIN) 64 | self.ui.lw_page.hideRow(self.TAB_INDEX_HOST) 65 | self.ui.cb_webview_verbose.setEnabled(False) 66 | self.ui.cb_webview_verbose.setVisible(False) 67 | 68 | # ---------------------------------------------------------------------------------------------------- 69 | # Load Settings 70 | 71 | self.loadSettings() 72 | 73 | # ---------------------------------------------------------------------------------------------------- 74 | # Set-up connections 75 | 76 | self.accepted.connect(self.slot_saveSettings) 77 | self.ui.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.slot_resetSettings) 78 | 79 | self.ui.tb_main_proj_folder_open.clicked.connect(self.slot_getAndSetProjectPath) 80 | self.ui.tb_host_path.clicked.connect(self.slot_getAndSetIngenPath) 81 | 82 | # ---------------------------------------------------------------------------------------------------- 83 | # Post-connect setup 84 | 85 | self.ui.lw_page.setCurrentCell(self.TAB_INDEX_MAIN if isApp else self.TAB_INDEX_WEBVIEW, 0) 86 | 87 | # -------------------------------------------------------------------------------------------------------- 88 | 89 | def loadSettings(self): 90 | settings = QSettings() 91 | 92 | # ---------------------------------------------------------------------------------------------------- 93 | # Main 94 | 95 | self.ui.le_main_proj_folder.setText(settings.value(MOD_KEY_MAIN_PROJECT_FOLDER, MOD_DEFAULT_MAIN_PROJECT_FOLDER, type=str)) 96 | self.ui.sb_main_refresh_interval.setValue(settings.value(MOD_KEY_MAIN_REFRESH_INTERVAL, MOD_DEFAULT_MAIN_REFRESH_INTERVAL, type=int)) 97 | 98 | # ---------------------------------------------------------------------------------------------------- 99 | # Host 100 | 101 | self.ui.cb_host_verbose.setChecked(settings.value(MOD_KEY_HOST_VERBOSE, MOD_DEFAULT_HOST_VERBOSE, type=bool)) 102 | 103 | hostPath = settings.value(MOD_KEY_HOST_PATH, MOD_DEFAULT_HOST_PATH, type=str) 104 | if hostPath.endswith("ingen"): 105 | hostPath = MOD_DEFAULT_HOST_PATH 106 | self.ui.le_host_path.setText(hostPath) 107 | 108 | # ---------------------------------------------------------------------------------------------------- 109 | # WebView 110 | 111 | self.ui.cb_webview_inspector.setChecked(settings.value(MOD_KEY_WEBVIEW_INSPECTOR, MOD_DEFAULT_WEBVIEW_INSPECTOR, type=bool)) 112 | self.ui.cb_webview_verbose.setChecked(settings.value(MOD_KEY_WEBVIEW_VERBOSE, MOD_DEFAULT_WEBVIEW_VERBOSE, type=bool)) 113 | self.ui.cb_webview_show_inspector.setChecked(settings.value(MOD_KEY_WEBVIEW_SHOW_INSPECTOR, MOD_DEFAULT_WEBVIEW_SHOW_INSPECTOR, type=bool)) 114 | self.ui.cb_webview_show_inspector.setEnabled(self.ui.cb_webview_inspector.isChecked()) 115 | 116 | # -------------------------------------------------------------------------------------------------------- 117 | 118 | @pyqtSlot() 119 | def slot_saveSettings(self): 120 | settings = QSettings() 121 | 122 | # ---------------------------------------------------------------------------------------------------- 123 | # Main 124 | 125 | settings.setValue(MOD_KEY_MAIN_PROJECT_FOLDER, self.ui.le_main_proj_folder.text()) 126 | settings.setValue(MOD_KEY_MAIN_REFRESH_INTERVAL, self.ui.sb_main_refresh_interval.value()) 127 | 128 | # ---------------------------------------------------------------------------------------------------- 129 | # Host 130 | 131 | settings.setValue(MOD_KEY_HOST_VERBOSE, self.ui.cb_host_verbose.isChecked()) 132 | settings.setValue(MOD_KEY_HOST_PATH, self.ui.le_host_path.text()) 133 | 134 | # ---------------------------------------------------------------------------------------------------- 135 | # WebView 136 | 137 | settings.setValue(MOD_KEY_WEBVIEW_INSPECTOR, self.ui.cb_webview_inspector.isChecked()) 138 | settings.setValue(MOD_KEY_WEBVIEW_VERBOSE, self.ui.cb_webview_verbose.isChecked()) 139 | settings.setValue(MOD_KEY_WEBVIEW_SHOW_INSPECTOR, self.ui.cb_webview_show_inspector.isChecked()) 140 | 141 | # -------------------------------------------------------------------------------------------------------- 142 | 143 | @pyqtSlot() 144 | def slot_resetSettings(self): 145 | # ---------------------------------------------------------------------------------------------------- 146 | # Main 147 | 148 | if self.ui.lw_page.currentRow() == self.TAB_INDEX_MAIN: 149 | self.ui.le_main_proj_folder.setText(MOD_DEFAULT_MAIN_PROJECT_FOLDER) 150 | self.ui.sb_main_refresh_interval.setValue(MOD_DEFAULT_MAIN_REFRESH_INTERVAL) 151 | 152 | # ---------------------------------------------------------------------------------------------------- 153 | # Host 154 | 155 | elif self.ui.lw_page.currentRow() == self.TAB_INDEX_HOST: 156 | self.ui.cb_host_verbose.setChecked(MOD_DEFAULT_HOST_VERBOSE) 157 | self.ui.le_host_path.setText(MOD_DEFAULT_HOST_PATH) 158 | 159 | # ---------------------------------------------------------------------------------------------------- 160 | # WebView 161 | 162 | elif self.ui.lw_page.currentRow() == self.TAB_INDEX_WEBVIEW: 163 | self.ui.cb_webview_inspector.setChecked(MOD_DEFAULT_WEBVIEW_INSPECTOR) 164 | self.ui.cb_webview_verbose.setChecked(MOD_DEFAULT_WEBVIEW_VERBOSE) 165 | self.ui.cb_webview_show_inspector.setChecked(MOD_DEFAULT_WEBVIEW_SHOW_INSPECTOR) 166 | 167 | # -------------------------------------------------------------------------------------------------------- 168 | 169 | @pyqtSlot() 170 | def slot_getAndSetProjectPath(self): 171 | newPath = QFileDialog.getExistingDirectory(self, self.tr("Set Default Project Path"), self.ui.le_main_proj_folder.text(), QFileDialog.ShowDirsOnly) 172 | if not newPath: 173 | return 174 | 175 | if not os.path.isdir(newPath): 176 | return QMessageBox.critical(self, self.tr("Error"), "Path must be a valid directory") 177 | 178 | self.ui.le_main_proj_folder.setText(newPath) 179 | 180 | @pyqtSlot() 181 | def slot_getAndSetIngenPath(self): 182 | path, ok = QFileDialog.getOpenFileName(self, self.tr("Set Path to ingen"), self.ui.le_host_path.text()) 183 | 184 | if not ok: 185 | return 186 | if not path: 187 | return 188 | if not os.path.isfile(path): 189 | return QMessageBox.critical(self, self.tr("Error"), "Path to ingen must be a valid filename") 190 | 191 | self.ui.le_host_path.setText(path) 192 | 193 | # -------------------------------------------------------------------------------------------------------- 194 | 195 | def done(self, r): 196 | QDialog.done(self, r) 197 | self.close() 198 | 199 | # ------------------------------------------------------------------------------------------------------------ 200 | # Main (for testing Settings UI) 201 | 202 | if __name__ == '__main__': 203 | # -------------------------------------------------------------------------------------------------------- 204 | # App initialization 205 | 206 | if False: 207 | from PyQt4.QtGui import QApplication 208 | else: 209 | from PyQt5.QtWidgets import QApplication 210 | 211 | app = QApplication(sys.argv) 212 | app.setApplicationName("MOD-Settings") 213 | app.setApplicationVersion(config["version"]) 214 | app.setOrganizationName("MOD") 215 | app.setWindowIcon(QIcon(":/48x48/mod.png")) 216 | 217 | # -------------------------------------------------------------------------------------------------------- 218 | # Create GUI 219 | 220 | gui = SettingsWindow() 221 | 222 | # -------------------------------------------------------------------------------------------------------- 223 | # Show GUI 224 | 225 | gui.show() 226 | 227 | # -------------------------------------------------------------------------------------------------------- 228 | # App-Loop 229 | 230 | sys.exit(app.exec_()) 231 | 232 | # ------------------------------------------------------------------------------------------------------------ 233 | -------------------------------------------------------------------------------- /source/modules/README: -------------------------------------------------------------------------------- 1 | Put mod-ui here if you want a custom non-system-installed version to work with mod-app 2 | -------------------------------------------------------------------------------- /source/tests/lv2bundleinfo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # Simple script to get information from an lv2 bundle 5 | 6 | import os, lilv 7 | 8 | # Get info from an lv2 bundle 9 | # @a bundle is a string, consisting of a directory in the filesystem (absolute pathname). 10 | def get_info_from_lv2_bundle(bundle): 11 | # lilv wants the last character as the separator 12 | if not bundle.endswith(os.sep): 13 | bundle += os.sep 14 | 15 | # Create our own unique lilv world 16 | # We'll load a single bundle and get all plugins from it 17 | world = lilv.World() 18 | 19 | # this is needed when loading specific bundles instead of load_all 20 | # (these functions are not exposed via World yet) 21 | lilv.lilv_world_load_specifications(world.me) 22 | lilv.lilv_world_load_plugin_classes(world.me) 23 | 24 | # convert bundle string into a lilv node 25 | bundlenode = lilv.lilv_new_file_uri(world.me, None, bundle) 26 | 27 | # load the bundle 28 | world.load_bundle(bundlenode) 29 | 30 | # free bundlenode, no longer needed 31 | lilv.lilv_node_free(bundlenode) 32 | 33 | # get all plugins in the bundle 34 | plugins = world.get_all_plugins() 35 | 36 | # make sure the bundle includes 1 and only 1 plugin (the pedalboard) 37 | if plugins.size() != 1: 38 | raise Exception('get_info_from_lv2_bundle(%s) - bundle has 0 or > 1 plugin'.format(bundle)) 39 | 40 | # no indexing in python-lilv yet, just get the first item 41 | plugin = None 42 | for p in plugins: 43 | plugin = p 44 | break 45 | 46 | if plugin is None: 47 | raise Exception('get_info_from_lv2_bundle(%s) - failed to get plugin, you are using an old lilv!'.format(bundle)) 48 | 49 | # handy class to get lilv nodes from. copied from lv2.py in mod-ui 50 | class NS(object): 51 | def __init__(self, base): 52 | self.base = base 53 | self._cache = {} 54 | 55 | def __getattr__(self, attr): 56 | if attr not in self._cache: 57 | self._cache[attr] = lilv.Node(world.new_uri(self.base+attr)) 58 | return self._cache[attr] 59 | 60 | # define the needed stuff 61 | NS_lv2core = NS('http://lv2plug.in/ns/lv2core#') 62 | NS_lv2core_proto = NS_lv2core.prototype 63 | 64 | NS_modgui = NS('http://moddevices.com/ns/modgui#') 65 | NS_modgui_thumb = NS_modgui.thumbnail 66 | 67 | NS_ingen = NS('http://drobilla.net/ns/ingen#') 68 | NS_ingen_block = NS_ingen.block 69 | NS_ingen_prototype = NS_ingen.prototype 70 | 71 | # check if the plugin has modgui:thumnail, if not it's probably not a real pedalboard 72 | thumbnail_check = plugin.get_value(NS_modgui_thumb).get_first() 73 | 74 | if thumbnail_check.me is None: 75 | raise Exception('get_info_from_lv2_bundle(%s) - plugin has no modgui:thumbnail'.format(bundle)) 76 | 77 | # let's get all the info now 78 | ingenplugins = [] 79 | 80 | info = { 81 | 'name': plugin.get_name().as_string(), 82 | #'author': plugin.get_author_name().as_string() or '', # Might be empty 83 | #'uri': plugin.get_uri().as_string(), 84 | 'thumbnail': os.path.basename(thumbnail_check.as_string()), 85 | 'plugins': [] # we save this info later 86 | } 87 | 88 | blocks = plugin.get_value(NS_ingen_block) 89 | 90 | it = blocks.begin() 91 | while not blocks.is_end(it): 92 | block = blocks.get(it) 93 | it = blocks.next(it) 94 | 95 | if block.me is None: 96 | continue 97 | 98 | protouri1 = lilv.lilv_world_get(world.me, block.me, NS_lv2core_proto.me, None) 99 | protouri2 = lilv.lilv_world_get(world.me, block.me, NS_ingen_prototype.me, None) 100 | 101 | if protouri1 is not None: 102 | ingenplugins.append(lilv.lilv_node_as_uri(protouri1)) 103 | elif protouri2 is not None: 104 | ingenplugins.append(lilv.lilv_node_as_uri(protouri2)) 105 | 106 | info['plugins'] = ingenplugins 107 | 108 | return info 109 | 110 | # Test via command line 111 | if __name__ == '__main__': 112 | import sys 113 | 114 | if len(sys.argv) == 1: 115 | print("usage %s /path/to/bundle" % sys.argv[0]) 116 | sys.exit(0) 117 | 118 | print(get_info_from_lv2_bundle(sys.argv[1])) 119 | -------------------------------------------------------------------------------- /source/tests/print-pedalboard-list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import os 5 | import sys 6 | 7 | CWD = sys.path[0] 8 | 9 | if not CWD: 10 | CWD = os.path.dirname(sys.argv[0]) 11 | 12 | # make it work with cxfreeze 13 | if os.path.isfile(CWD): 14 | CWD = os.path.dirname(CWD) 15 | 16 | sys.path = [os.path.join(CWD, "..", "modules", "mod-ui")] + sys.path 17 | 18 | from mod.lv2 import * 19 | 20 | for x in get_pedalboards(): 21 | print(x, "\n") 22 | --------------------------------------------------------------------------------